The Silicon Labs BGX device provides a bridge between Bluetooth Low Energy (BLE) and Serial communication.
More...
|
enum
|
com.silabs.bgxcommander.BGX_CONNECTION_STATUS
|
|
This enum is the Connection Status of the
BGXpressService
instance.
|
|
enum
|
com.silabs.bgxcommander.OTA_Status
|
|
This is the OTA status that can be used to drive a user interface as part of the OTA_STATUS_MESSAGE.
|
|
class
|
com.silabs.bgxcommander.BGXpressService
|
|
An intent service which is used to control and communicate with a BGX device.
More...
|
|
The Silicon Labs BGX device provides a bridge between Bluetooth Low Energy (BLE) and Serial communication.
BGXpressService
is an Android Intent Service which makes it easier to write an Android app which interacts with BGX. It supports discovery of BGX devices, connecting and disconnecting, setting and detecting changes to the bus mode of the BGX, sending and receiving serial data, and OTA (Over The Air) Firmware Updates of the BGX accessed through the Silicon Labs DMS (Device Management Service).
◆
com::silabs::bgxcommander::BGXpressService
class com::silabs::bgxcommander::BGXpressService
|
An intent service which is used to control and communicate with a BGX device.
Inherits IntentService.
◆
BGXpressService()
com.silabs.bgxcommander.BGXpressService.BGXpressService
|
(
|
|
)
|
|
|
inline
|
◆
onCreate()
void com.silabs.bgxcommander.BGXpressService.onCreate
|
(
|
|
)
|
|
|
inline
|
◆
onDestroy()
void com.silabs.bgxcommander.BGXpressService.onDestroy
|
(
|
|
)
|
|
|
inline
|
◆
startActionStartScan()
static void com.silabs.bgxcommander.BGXpressService.startActionStartScan
|
(
|
Context
|
context
|
)
|
|
|
inline
static
|
Starts this service to perform action Start Scan.
If the service is already performing a task this action will be queued.
-
See also
-
IntentService
◆
startActionStopScan()
static void com.silabs.bgxcommander.BGXpressService.startActionStopScan
|
(
|
Context
|
context
|
)
|
|
|
inline
static
|
Starts this service to perform action Stop Scan.
If the service is already performing a task this action will be queued.
-
See also
-
IntentService
◆
startActionBGXConnect()
static void com.silabs.bgxcommander.BGXpressService.startActionBGXConnect
|
(
|
Context
|
context,
|
|
|
String
|
deviceAddress
|
|
)
|
|
|
|
inline
static
|
startActionBGXConnect
Attempt to connect to the specified device.
-
Parameters
-
context
|
|
deviceAddress
|
the Bluetooth address of the device to which you wish to connect.
|
◆
startActionBGXCancelConnect()
static void com.silabs.bgxcommander.BGXpressService.startActionBGXCancelConnect
|
(
|
Context
|
context
|
)
|
|
|
inline
static
|
startActionBGXCancelConnect
Attempt to cancel an in-progress connection operation.
-
Parameters
-
◆
clearCancelFlag()
static void com.silabs.bgxcommander.BGXpressService.clearCancelFlag
|
(
|
|
)
|
|
|
inline
static
|
clearCancelFlag
Call this before initiating a connection in order to clear the connection cancel flag.
To Do: maybe we can clear this a better way (such as when the user calls connect?)
◆
getBGXDeviceInfo()
static void com.silabs.bgxcommander.BGXpressService.getBGXDeviceInfo
|
(
|
Context
|
context
|
)
|
|
|
inline
static
|
getBGXDeviceInfo
Starts an operation to get the device info which is the part id and the device uuid.
-
Parameters
-
◆
onHandleIntent()
void com.silabs.bgxcommander.BGXpressService.onHandleIntent
|
(
|
Intent
|
intent
|
)
|
|
|
inline
protected
|
◆
ACTION_START_SCAN
final String com.silabs.bgxcommander.BGXpressService.ACTION_START_SCAN
|
|
static
|
◆
ACTION_STOP_SCAN
final String com.silabs.bgxcommander.BGXpressService.ACTION_STOP_SCAN
|
|
static
|
◆
ACTION_BGX_CONNECT
final String com.silabs.bgxcommander.BGXpressService.ACTION_BGX_CONNECT
|
|
static
|
This is sent to cause the
BGXpressService
to connect to a BGX.
Extras:
DeviceAddress - String - The bluetooth address of the device to which to connect.
There is no need to directly send this. You can call
startActionBGXConnect()
using the device address instead.
◆
ACTION_BGX_DISCONNECT
final String com.silabs.bgxcommander.BGXpressService.ACTION_BGX_DISCONNECT
|
|
static
|
This is sent to cause the
BGXpressService
to disconnect from a connected BGX.
TODO: Add a static method for this to send the intent.
◆
ACTION_BGX_CANCEL_CONNECTION
final String com.silabs.bgxcommander.BGXpressService.ACTION_BGX_CANCEL_CONNECTION
|
|
static
|
◆
ACTION_READ_BUS_MODE
final String com.silabs.bgxcommander.BGXpressService.ACTION_READ_BUS_MODE
|
|
static
|
Reads the bus mode.
When the read operation completes, a broadcast intent will be sent with the action BGX_MODE_STATE_CHANGE.
◆
ACTION_WRITE_BUS_MODE
final String com.silabs.bgxcommander.BGXpressService.ACTION_WRITE_BUS_MODE
|
|
static
|
Writes the bus mode.
The service will not send a notification to indicate that it succeeded at this time.
Extras: busmode - int - one of the values from
BusMode
: STREAM_MODE, LOCAL_COMMAND_MODE, or REMOTE_COMMAND_MODE.
◆
ACTION_WRITE_SERIAL_DATA
final String com.silabs.bgxcommander.BGXpressService.ACTION_WRITE_SERIAL_DATA
|
|
static
|
Writes data to the BGX.
value - String - the data to be written.
◆
ACTION_BGX_GET_INFO
final String com.silabs.bgxcommander.BGXpressService.ACTION_BGX_GET_INFO
|
|
static
|
This request causes the
BGXpressService
to read the device uuid and determine the part id.
The result is sent out as a broadcast intent BGX_DEVICE_INFO with the following extras: bgx-device-uuid - A string containing the device uuid. bgx-part-id - An enum value from
BGXPartID
.
◆
ACTION_DMS_GET_VERSIONS
final String com.silabs.bgxcommander.BGXpressService.ACTION_DMS_GET_VERSIONS
|
|
static
|
Gets the firmware versions available from DMS.
Extras: bgx-part-id -
BGXPartID
- one of the following values: BGX13S or BGX13P
◆
ACTION_DMS_REQUEST_VERSION
final String com.silabs.bgxcommander.BGXpressService.ACTION_DMS_REQUEST_VERSION
|
|
static
|
This request causes the specified DMS version to be loaded onto the phone.
When finished, the broadcast intent DMS_VERSION_LOADED is sent.
Extras: bgx-part-id -
BGXPartID
- one of the following values: BGX13S or BGX13P dms-version - String - the DMS version number you want to retrieve.
TO DO: Handle fail cases (e.g. specify a version number that doesn't exist as right now the calling app gets no reply.)
◆
ACTION_OTA_WITH_IMAGE
final String com.silabs.bgxcommander.BGXpressService.ACTION_OTA_WITH_IMAGE
|
|
static
|
image_path - String - path to the image file.
You could get this from a DMS_VERSION_LOADED broadcast intent.
◆
ACTION_OTA_CANCEL
final String com.silabs.bgxcommander.BGXpressService.ACTION_OTA_CANCEL
|
|
static
|
Attempts to cancel an OTA operation in progress.
If the cancellation is successful you will get an OTA_STATUS_MESSAGE where the ota_status is UserCanceled
◆
BGX_CONNECTION_STATUS_CHANGE
final String com.silabs.bgxcommander.BGXpressService.BGX_CONNECTION_STATUS_CHANGE
|
|
static
|
Extras: bgx-connection-status - a value from the BGX_CONNECTION_STATUS enum which is the new status.
device - a BluetoothDevice (not present for DISCONNECTED).
◆
BGX_MODE_STATE_CHANGE
final String com.silabs.bgxcommander.BGXpressService.BGX_MODE_STATE_CHANGE
|
|
static
|
Broadcast Intent which indicates a state change in the bgxss mode.
Extras: busmode - int - one of the values from
BusMode
: STREAM_MODE, LOCAL_COMMAND_MODE, or REMOTE_COMMAND_MODE.
◆
BGX_DATA_RECEIVED
final String com.silabs.bgxcommander.BGXpressService.BGX_DATA_RECEIVED
|
|
static
|
Extras: data - String - contains the data that was received from the BGX.
◆
BGX_SCAN_MODE_CHANGE
final String com.silabs.bgxcommander.BGXpressService.BGX_SCAN_MODE_CHANGE
|
|
static
|
This change is sent when scanning begins or ends.
It has one extra.
isscanning - boolean - indicates whether scanning is happening.
◆
BGX_SCAN_DEVICE_DISCOVERED
final String com.silabs.bgxcommander.BGXpressService.BGX_SCAN_DEVICE_DISCOVERED
|
|
static
|
This is sent as a broadcast intent when a BGX device is discovered during scanning.
◆
DMS_VERSION_LOADED
final String com.silabs.bgxcommander.BGXpressService.DMS_VERSION_LOADED
|
|
static
|
Notification that a specific version has been loaded and is attached to the intent as "file_path".
file_path - string of the path to the file containing the version.
◆
OTA_STATUS_MESSAGE
final String com.silabs.bgxcommander.BGXpressService.OTA_STATUS_MESSAGE
|
|
static
|
This contains the following extras: ota_failed : boolean.
True means it failed. Use false as the default. ota_status : OTA_Status enum. Tells the current status of the ota. Use Invalid as the default. bytes_sent : int - number of bytes transfered in the firmware image. Not always present.
◆
BGX_DEVICE_INFO
final String com.silabs.bgxcommander.BGXpressService.BGX_DEVICE_INFO
|
|
static
|
This is sent when connection state becomes connected for the device.
param: bgx-device-uuid - a String param: bgx-part-id - a
BGXPartID
◆
DMS_VERSIONS_AVAILABLE
final String com.silabs.bgxcommander.BGXpressService.DMS_VERSIONS_AVAILABLE
|
|
static
|
Broadcast intent sent when the list of versions is retrieved from DMS.
Extras: versions-available-json - String - Contains JSON response from DMS with the list of firmware versions available.