The Bluetooth GATT (Generic Attribute Profile) governs communication between BLE devices via a dedicated connection.
For GATT documentation, see https://www.bluetooth.org:
- Bluetooth Core Standard version 4, Vol 3, Parts F and G
When two BLE devices interact, one acts as a Peripheral, offering GATT Services, and the other acts as a Central, consuming Services. Services are defined in the GATT as collections of characteristics and relationships to other services.
The BGX device typically acts as the Peripheral (GATT server) and a BLE mobile device such as a phone or pad acts as the Central (GATT client). The BGX device can also act as Central.
A BLE Peripheral can connect to only one Central. A BGX device Central is restricted to connect to only one Peripheral.
General BLE issues are discussed in Introduction to BLE below.
The BGX device offers a Streaming Service - provides remote command mode and data streaming.
Introduction to BLE
This section introduces a few terms necessary for later discussion. These terms have a specific meaning in the BLE context.
BLE devices operate in two broad classifications: Central and Peripheral.
- Central - A Central typically uses the information served by a Peripheral, like a client in the client/server communication model.
- Peripheral - A Peripheral typically supplies data required by other devices, like a server in the client/server communication model.
Peripherals offer Services, which consist of Characteristics. Services and Characteristics are distinguished by universally unique identifiers, or UUIDs.
- Service - A collection of data
- Characteristic - An item of data within a service
- UUID - the universal unique identifier of a service or characteristic. All BGX UUIDs are 128 bit (16 octets).
Peripherals advertise, by broadcasting some services and characteristics. This allows them to be discovered by Centrals.
- Advertising - Broadcasting by a Peripheral of a subset of the available Services and Characteristics. See BLE Advertising
- Discovery - Scanning by a Central for advertising Peripherals and identifying them by their advertised Services and Characteristics.
After discovering a Peripheral of interest, a Central requests a connection to the Peripheral. After connecting, the Central can discover the Peripheral's Services, and within those Services the Peripheral's Characteristics. The Central can read the value of Characteristics, subscribe to the value of Characteristics, and in some cases write the value of the Characteristic back to the Peripheral.
To subscribe to a Characteristic, the BLE mechanism is to register for notification when that Characteristic is changed, and provide a callback to be called on each notification. Typically the callback reads the Characteristic value and takes any action required.
- Subscription - Registering for notification when the value of a Characteristic is changed.
- Notification - An event such as a change to the value of a Characteristic registered for notification.
- Callback - A function or procedure invoked in response to an event, such as a notification.
Connecting to a Peripheral
The general procedure for using a Central to interact with a Peripheral is as follows:
- Start the Central.
- Scan for Peripheral's advertising services.
- After finding the desired Peripheral, stop scanning.
- Request a connection to the Peripheral.
- Discover its Services.
- After finding a desired Service, discover its Characteristics
- For desired Characteristics, perform the desired read, subscribe and write operations.
The implementation of these procedural steps depends on the Central platform.
Xpress Streaming Service
In a BGX device, the following capabilities are available:
- remote command mode: the Central can connect to a BGX device via BLE, and place it in remote command mode. This allows a Central to use the full range of control and monitoring available.
- streaming: The Central can place the BGX module in STREAM mode, and send and receive streams of data to and from the device.
Additional commands and variables for managing streaming and the remote command interface are listed below:
- bu i - initial bus mode
- bu s c - bus serial control
- bu s s - bus breakout sequence
- sy r e - remote enabled
Xpress Streaming Service Characteristics
Xpress Streaming Service defines a GATT profile consisting of a Xpress Streaming Service and three Characteristics, Rx, Tx and Mode.
A BGX device advertises the Xpress Streaming Service on start up according to the advertising variables:
A BGX device can be identified by its
SERVICE_BGXSS_UUID. To interact
with a BGX device as a Peripheral, use the Xpress Streaming Service.
The Rx (receive) and Tx (transmit) Characteristics are named from the point of view of the Peripheral BGX device.
To send a string to be received by the Peripheral serial interface, write to the Rx Characteristic.
To read a string transmitted from the Peripheral serial interface, enable Notifications or Indications from the Tx Characteristic then wait for subsequent Notification or Indication Events to occur.
For a BGX device, the serial interface Service and Characteristics are as follows:
|Service or Characteristic||Abbr||UUID||Values|
|Rx||Data sent to BGX serial interface|
|Tx||Data received from BGX serial interface|
The Abbr column in the table defines abbreviations used in this documentation only.
Using Xpress Streaming Service From Another Device
Silicon Labs provides libraries and frameworks for using the BGX Xpress Streaming Service from Android or iOS mobile devices.
For more information, see BGXpress Host Software