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

Detect link loss with peripheral

Hello, I am trying out my pca10028 board, with s110 and my updated ble_app_uart expample. I am trying to detect a link loss: board advertises as peripheral connects with android device.

After they connect bluetooth is being turned off in the android. In this situation disconnection was detected immediately.

Next procedure was to turn off the android device while in connection. In keil debugger I saw that connection event happens only ~30 seconds after. As I read the questions in the thread I came across answers that firmware detects it automatically and leads to BLE_GAP_EVT_DISCONNECTEDevent. I am lost at this point. Should I implement link-loss service in my code? Is it set by the the master device? How to reduce this time? How to detect link loss in peripheral?

I have tried to explain the situation in a non highly detailed way. If there is lack of infomartion, please let me know. Thank you.

Parents
  • Hi

    The time it takes to recognize a link loss is set by the connection supervising timeout period, which is the time it takes before a BLE devices gives up on the link if no packets are received.

    This time is set up as a part of the connection parameters, and you can try to reduce this parameter to make your device more responsive on a link loss. You just have to make sure it's not too small, or the link will not be very stable (it should be at least 6 times your connection interval).

    If you want an even quicker response on a link loss you could have the phone send some data at a regular interval, and take some action in the peripheral if no data is received for a certain amount of time, but this would require the app to be running continuously on the phone.

    Best regards
    Torbjørn

  • I doubt the link loss service would help you. The link loss service is simply waiting for the disconnect event to occur, and in your case the problem is that the disconnect event doesn't happen soon enough.

    Do you have access to the Nordic sniffer?
    If you do you should be able to check how long it takes for the phone to properly disconnect the link. Most likely the issue is that the Android phone keeps the connection running in the background.

Reply
  • I doubt the link loss service would help you. The link loss service is simply waiting for the disconnect event to occur, and in your case the problem is that the disconnect event doesn't happen soon enough.

    Do you have access to the Nordic sniffer?
    If you do you should be able to check how long it takes for the phone to properly disconnect the link. Most likely the issue is that the Android phone keeps the connection running in the background.

Children
No Data
Related