This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Notifications from SimpleBLEPeripheral to SimpleBLECentral (CC2640)

Other Parts Discussed in Thread: CC2640

Hi,

I'm trying to enable notifications between SimpleBLEPeripheral and SimpleBLECentral for CHAR1, and I'm confused on a few things.

1. Do notifications need to be enabled from the server, client, or both sides? I want to enable notifications on connecting, so I tried placing some code in SimpleBLEPeripheral_stateChangeCB under GAPROLE_CONNECTED:

uint16_t connHandle[1];
GAPRole_GetParameter(GAPROLE_CONNHANDLE, connHandle);
GATTServApp_WriteCharCfg(connHandle[0], simpleProfileChar1Config, GATT_CLIENT_CFG_NOTIFY);

However, calling ReadCharCfg still gives 0x0.

2. How can I handle notification messages on the client side? Do I need to add a (pMsg->method == ATT_HANDLE_VALUE_NOTI) condition under SimpleBLECentral_processGATTMsg?

Thanks,

Michael

  • Hello Michael,
    1. You are correct. For a characteristic value to be sent as a notification the GATT Client (central/Master in this case) has to enable it by writing
    to the specific characteristic configuration attribute ( write "01:00" to the characteristic configuration handle).

    It is possible however to send notification directly by calling GATT_Notification (without using attributes). There is an example on how to do this in the CC2640_BLE_Throughput example code found here: processors.wiki.ti.com/.../CC2640_BLE_Throughput

    2. Correct. Then you can retrieve the handle, length and payload from the attHandleValueNoti_t struct (pMsg->msg.handleValueNoti......)