Appendix E. Bluetooth Low Energy Primer
E.1 GAP ROLES: PERIPHERAL AND CENTRAL
When two Bluetooth Low Energy (BLE) devices want to be connected, one device must be in Central role and the other in Peripheral role. The Peripheral device advertises to show its connectable status, while the Central device scans service advertisements, and if needed, initiates a connection to the Peripheral device. Once connected, either end of the connection can choose to bond. Once bonded, all security related keys are saved and security process are waived when reconnecting. Bonded peripheral device can only perform direct advertise and therefore unable to connect to a device other than its bonded peer.
E.2 GATT SERVICE: CLIENT AND SERVER
Similar to Bluetooth Classic, BLE uses the concept of profiles to ensure interoperability between different devices. As illustrated in Figure E-1, BLE profiles are a collection of services. All BLE services are built on top of the Generic Attribute Profile (GATT) where GATT defines accessibility of attributes called characteristics. The main functionality of the BLE profiles is built around the characteristics. For those devices that maintain the value of characteristics in a service, that device is the Server of the service. On the other hand, devices that acquire data from their peer are called Clients.
Each service and its characteristics can be identified by their Universally Unique Identifier (UUID). The UUID can be a short form (16-bit) or long form (128-bit). As specified by Bluetooth Core Specifications, all Bluetooth SIG adopted (public) services and characteristics have short UUIDs (16-bit), while user defined private UUIDs are in long form (128-bit). For the details of Bluetooth SIG adopted services and characteristics, please refer to https://developer.bluetooth.org/gatt/profiles/Pages/ProfilesHome.aspx.
The accessibility of each characteristic is defined by an 8-bit characteristic property in bitmap format, as shown in Table E-1.
Property | Bitmap Value | Description |
---|---|---|
Extended Property(1) | 0x80 | Additional property available |
Authenticated Write(1) | 0x40 | Write characteristic with authentication from Client to Server |
Indicate | 0x20 | Indicate value of characteristic with acknowledgment from Server to Client |
Notify | 0x10 | Notify value of characteristic without acknowledgment from Server to Client |
Write | 0x08 | Write value of characteristic with acknowledgment from Client to Server |
Write without response | 0x04 | Write value of characteristic without acknowledgment from Client to Server |
Read | 0x02 | Read value of characteristic. Value is sent from Server to Client |
Broadcast(1) | 0x01 | Broadcast value of characteristic |
Note (1): These features will be supported in future firmware releases
As shown in Figure E-1, the GATT client can access the characteristics in the GATT server in the Peripheral device. When connected, the GATT client reads the GATT server service and characteristic UUIDs. The characteristic values can be accessed by the GATT client using Write, Read, Indication and Notifications.
Write-REQ enables the GATT client to update characteristic values on the Peripheral's GATT server. The write requests can be performed using RN4870 CHW and CUW commands. Refer to Section 4.6 “Accessing GATT Service Using UART Commands And SmartDiscover App” for more information on GATT characteristic access commands.
Write-CMD performs an unacknowledged write from a GATT client to the GATT server. This is allowed for the Transparent UART Write procedure on the RN4870 when the SR,0100 command is used.
A GATT client sends Read-REQ to read a characteristic value on the Peripheral's GATT server. The read requests can be performed using RN4870 CHR and CUR commands.
Notifications and Indications are unsolicited updates sent from the GATT server to the GATT client. The GATT client must enable the Notification and Indication on a characteristic to receive the updates. On the RN4870 module, this is done by using the CUW or CHW command to write a non-zero value to the Notification Characteristic. When the RN4870 in Client mode receives a notification, the %WC,hhhh,ddddddd% message is returned on UART in Command mode.