cancel
Showing results for 
Search instead for 
Did you mean: 

Programattically Enable/Disable Characteristic Notification

kumaichi
Senior

I have two custom STM32WB55 boards that I initially started with the P2P_Client/Server projects.  I have the two devices communicating with each other.  Once the communication is established, the notification characteristic is enabled from the P2P_Client, and data starts flowing from the server to the client.  Next step is to try and disable/enable the notification programmatically from the P2P_Client.  I see in the p2p_client_app.c file, there is an event handler for, APP_BLE_ENABLE_NOTIFICATION_DESC and APP_BLE_DISABLE_NOTIFICATION_DESC.

Can anyone point me to the correct process for either setting the status somehow so that the event handler is utilized or what is the recommended process for enabling/disabling a notification programmatically from the P2P_Client?

Kindest regards.

1 ACCEPTED SOLUTION

Accepted Solutions
STTwo-32
ST Employee

Hello @kumaichi 

To Enable/Disable notifications, you can use the aci_gatt_write_char_desc function on the context of update_Service() in p2p_Client_app.c. This will set the Client Characteristic Configuration Descriptor (CCCD) of the "Notify" Service to enabled or disabled. 

For more details, you can have a look at the p2p_Client_app.c file of the ST Client node example.

Best Regards.

STTwo-32

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

1 REPLY 1
STTwo-32
ST Employee

Hello @kumaichi 

To Enable/Disable notifications, you can use the aci_gatt_write_char_desc function on the context of update_Service() in p2p_Client_app.c. This will set the Client Characteristic Configuration Descriptor (CCCD) of the "Notify" Service to enabled or disabled. 

For more details, you can have a look at the p2p_Client_app.c file of the ST Client node example.

Best Regards.

STTwo-32

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Announcement

We’re moving the ST Community to a new platform to give you a better and more reliable community experience.