9.1 Definition of Characteristic Access Commands
When creating a connection with two Bluetooth Low Energy devices, one device plays the central role and the other plays a peripheral role. The peripheral device advertises to show its connectable status, whereas, the central device scans service advertisements, and if required, initiates a connection to the peripheral device.
After establishing the connection, both peers can initiate bonding. Related security keys are saved in PDS after successful bonding. Use these keys on the next connection to reduce the time elapsed on the security procedure.
- Discovering
- Reading
- Writing
- Notifying
- Indicating characteristics
A service definition contains a service declaration and includes definitions and characteristic definitions. All include definitions, and characteristic definitions contained within the service definition are considered to be part of the service.
The GATT profile specifies the structure in which profile data is exchanged. This structure defines basic elements, such as services and characteristics, used in a profile. All of the elements are contained by attributes. Attributes used in the attribute protocol are containers that carry this profile data.
The top level of the hierarchy is a profile. A profile is composed of one or more service necessary to fulfill a use case. A service is composed of characteristics. Each characteristic contains a value and contains optional information about the value. The service and characteristic and the components of the characteristic (in other words, value and descriptors) contain the profile data and are all stored in attributes on the server.
The user can identify each service and its characteristics by its UUID. The UUID takes either a 16-bit short form or a 128-bit long form. As specified in the Bluetooth core specifications, all Bluetooth SIG-adopted public services and characteristics have short UUIDs, whereas, the user-defined private UUIDs are in long form. For details for the Bluetooth SIG-adopted services and characteristics, refer to www.bluetooth.com/specifications/specs/.
The following table provides details about the accessibility of each characteristic, defined by an 8-bit characteristic property in bitmap format.
Property |
Bitmap |
Description |
---|---|---|
Extended Property(1) |
0b10000000 |
Additional property available |
Authenticated Write(1) |
0b01000000 |
Write characteristic with authentication from client to server |
Indicate |
0b00100000 |
Indicate value of characteristic with acknowledgment from server to client |
Notify |
0b00010000 |
Notify value of characteristic without acknowledgment from server to client |
Write |
0b00001000 |
Write value of characteristic with acknowledgment from client to server |
Write without response |
0b00000100 |
Write value of characteristic without acknowledgment from client to server |
Read |
0b00000010 |
Read value of characteristic. Send the value from server to client |
Broadcast(1) | 0b00000001 | Broadcast value of characteristic |
Note:
|
The following figure illustrates the GATT Service in the RNBD451 module. The GATT client can access the characteristics via ATT protocol in the GATT Server in the peripheral device. After establishing the connection, the client reads the GATT server service and characteristic UUIDs. The GATT client can access the characteristic values by using Write, Read, Indication and Notifications.
Write-REQ enables the client to update characteristic values on the peripheral’s GATT
server. Perform the write requests by using the RNBD451
CHW
commands. For more details on the GATT characteristic access
commands, refer to 5.4.3 GATT Operation on Server Role and 5.4.4 GATT Operation on Client Role.
A Write-CMD message performs an unacknowledged write from a client to the server.
A client sends Read-REQ to read a characteristic value on the peripheral’s GATT server.
Perform the read requests by using the RNBD451
CHR
commands.
CHW
command to write a non-zero value to the CCCD. When the RNBD451 module GATT client role receives a
notification, the %WC,hhhh,ddddddd%
message is returned on UART in
Command mode.