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

Disconnect too late detected

Hi,

we are using a sensor which streams out buffered data to an ios or android app. If we face a disconnection the data gets buffered and send when reconnected.

But the issue is that the smart device detects the disconnection quiet early while the sensor still thinks it is connected and still acknowledges the sending via NUS.

Since these packages are acknowlegded but not received by the App the data is lost.

It takes several 100 miliseconds until the sensor detects a disconnection. Is there something I am missing. During normal sending the return value 

NRF_ERROR_RESOURCES just indicates fine when the package was successfully transferred but short before the disconnect it fails.

Best regards,

Constantin

Parents
  • Hi Constantin,

    Have you checked what the disconnect reason is in the BLE_GAP_EVT_DISCONNECTED event? I.e., if it's BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION (0x13) or BLE_HCI_CONNECTION_TIMEOUT (0x08). You may get the BLE_HCI_CONNECTION_TIMEOUT if the phone terminates the link without sending the disconnect command. 

    NRF_ERROR_RESOURCES just indicates fine when the package was successfully transferred but short before the disconnect it fails.

     NRF_ERROR_RESOURCES means that the tx output buffer inside the Softdevice is full. To see when packets are sent on the air, you should monitor the BLE_GATTS_EVT_HVN_TX_COMPLETE event, see MSC: GATTS Handle Value Notification 

    Best regards,

    Vidar

Reply
  • Hi Constantin,

    Have you checked what the disconnect reason is in the BLE_GAP_EVT_DISCONNECTED event? I.e., if it's BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION (0x13) or BLE_HCI_CONNECTION_TIMEOUT (0x08). You may get the BLE_HCI_CONNECTION_TIMEOUT if the phone terminates the link without sending the disconnect command. 

    NRF_ERROR_RESOURCES just indicates fine when the package was successfully transferred but short before the disconnect it fails.

     NRF_ERROR_RESOURCES means that the tx output buffer inside the Softdevice is full. To see when packets are sent on the air, you should monitor the BLE_GATTS_EVT_HVN_TX_COMPLETE event, see MSC: GATTS Handle Value Notification 

    Best regards,

    Vidar

Children
No Data
Related