This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Are notifications always sent before disconnecting?

Hi,

In our code we would like to respond to a write with a notification and then disconnect. So we first we call sd_ble_gatts_rw_authorize_reply to reply to the write, then sd_ble_gatts_hvx for the notification and then sd_ble_gap_disconnect. Now I was wondering if the write response and the notification are always sent before the disconnection occurs, or do I have to wait for BLE_EVT_TX_COMPLETE (for 2 packets) to know for sure that they are sent?

Regards,

Thiemo van Engelen

  • If you are bonding you should not restore the state of the CCCD's until you have actually encrypted again. If you haven't bonded you have to wait for the peer to enable notifications, i.e. you cannot restore the old state. Still even if you wait for the encryption to start again, some users have reported that Android ignores the first few notifications, unfortunately there is not much that can be done except waiting for some time until you start transmitting...

Related