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.
Tool/software:
According to the Bluetooth spec, the CCC needs to be reset on each new connection:
Client Characteristic Configuration (CCC):
The CCC is a descriptor (UUID: 0x2902) that controls whether notifications or indications for a given characteristic are enabled. It is specific to a connection between a central (e.g., smartphone or host device) and a peripheral (e.g., BLE sensor).
BLE Connections Are Stateless:
In Bluetooth Low Energy (BLE), each connection is treated as independent. When a connection is lost or re-established, all state information related to that connection, including CCC configurations, is lost.
Requirement to Re-enable Notifications:
After a connection is re-established, the central must again write to the CCC descriptor to enable notifications/indications. This ensures that notifications are only sent with the central’s explicit consent for the current connection session.
Practical Implication:
It seems that behavior has not been implemented as per spec. I'm using SimpleLink 7.40.0.77. When I establish a connection and enable notifications, then disconnect and re-connect, the notifications are still enabled. I had a look in the provided example code and it would seem it would need a call to GATTServApp_InitCharCfg for each CCC in each service for each new connection, but in your examples this will only ever be called once at startup. I am missing something?
Hi,
The CCC settings are only non-persistent if two devices connect that are not bonded. If a pair of devices connect, bond, change the CCCD, and disconnect, then on reconnect the CCCD settings should persist. This is mentioned in the following section of the Bluetooth LE specification:
Best Regards,
Jan
Thanks for your answer, I have missed that in the BT spec.
This behavior is creating me some issues though, is there an easy way to disable it, so the bond manager does not enable CCC again on next connection?
Hi,
Unfortunately, this is part of the BLE specification so deviating from it technically breaks the spec. That said, if you are not planning to certify your device as a Bluetooth product then you may be able to modify this behavior provided you control both sides of the connection.I would suggest taking a look at the gapbondmgr.c file to try to remove this functionality.
Best Regards,
Jan