How can I detect if subscription to a notification has been made on my peripheral in Zephyrf?
How can I detect if subscription to a notification has been made on my peripheral in Zephyrf?
The callback function gets called.
Hi,
In order to detect if a central has subscribed to notifications on the Zephyr-based peripheral, you can use a CCCD callback to see when the client enables notifications. So, you can add a CCC descriptor with a callback when you define your GATT service. That way, whenever the client writes the CCCD, the callback is called. You also should check if the client is subscribed before sending. You can use bt_gatt_is_subscribed() to check if that connection has actually enabled notifications when you want to send a notification.
Best Regards,
Samruddhi
Hi Samruddihi,
Thank you.