How to handle the data even BLE is disconnected?

Hi,

I am using ble_app_uart for my development, in that I have buffer size of 2kB which will store all the incoming data and the data will be processed and send over NUS service. But some times BLE (peripheral) is getting disconnected from the central device and some data is getting lost. So I want to change my code so that data should not be lost even after disconnection and once again after the connection establishment data can be sent to central device.

Suggest me to do this....

  • This can probably be done in several ways. The safest way is probably to calculate a CRC over multiple packets to check that they have been transmitted, using a control channel to acknowledge this. Something similar to what we are doing in our DFU example.

    You could also keep track of the BLE_GATTS_EVT_HVN_TX_COMPLETE event which is generated when a Handle Value Notification transmission complete. Note that several notifications can be confirmed in the same event, so check the count field in the tx_complete field.