English
Language : 

AN91162 Datasheet, PDF (39/43 Pages) Ramtron International Corporation – Creating a BLE Custom Profile
Creating a BLE Custom Profile
Appendix
A1: Send Notifications
In addition to reading and writing from a characteristic, another important access that is commonly required is notifications.
Using notifications, a GATT server can send new data to a GATT client without having the GATT client continuously poll for it.
Every characteristic that supports notifications has an associated descriptor, called Client Characteristic Configuration
Descriptor (CCCD). The GATT client enables and disables notifications on the GATT server by writing to this CCCD. Until the
GATT client has enabled notifications on the GATT server, the GATT server cannot send data through notifications.
To allow the notification access to a custom characteristic and send the data to GATT client device, follow these steps in your
project. Similar steps are valid for Indicate support:
1. In the BLE Component configuration window, select the characteristic on which notifications are to be enabled. Select the
checkbox against Notify as shown in Figure 51. The Client Characteristic Configuration Descriptor is automatically added
in the attribute list, below the characteristic. Click OK.
Figure 51. Select Notify Access in Component
2. To enable notifications on the GATT server, the GATT client will write a value of 0x0001 to the CCCD. When
‘CYBLE_EVT_GATTS_WRITE_REQ’ event occurs, do following things:
a. Check whether the Write request is for CCCD’s attribute handle
b. If yes, then check if the value sent only has either of the lowest two bits set and no other bits are set. These
bits are the only allowed values that can be sent as part of write request on CCCD.
c. If yes, then record the CCCD value in the GATT server.
d. Send a write response or error response back to client, depending on whether the CCCD write was
successful or not.
case CYBLE_EVT_GATTS_WRITE_REQ:
wrReqParam = (CYBLE_GATTS_WRITE_REQ_PARAM_T *) eventParam;
/* Check if the returned handle is matching to CCCD attribute */
www.cypress.com
Document No. 001-91162 Rev. *A
39