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

When should the peripheral device should disconnect itself?

I'm trying to understand what is meant in section 5 of the BLE on Android primer:  "The peripheral device should disconnect itself when it gets disconnected by the client."

In the reference project: ble_app_uart_s130_pca10028, I understand that I can disconnect with sd_ble_gap_disconnect, but I'm not sure on which condition this should be done.  on_ble_evt, in the case of BLE_GAP_EVT_DISCONNECTED, seems like a redundant call.  Does anyone know what they mean by that last bit?

Parents
  • I think a better description would be: "The peripheral device will disconnect itself when it gets disconnected by the client."

    Because the softdevice will generate a BLE_GAP_EVT_DISCONNECTED event to inform the link is disconnected. There is no further action required by the application, since the link is closed, typically the peripheral can now go to sleep after the BLE_GAP_EVT_DISCONNECTED event, until user press a button and start advertising again.

    The sd_ble_gap_disconnect() can be used for the peripheral to disconnect the link for instance if battery is low or the user is turning OFF the peripheral.

Reply
  • I think a better description would be: "The peripheral device will disconnect itself when it gets disconnected by the client."

    Because the softdevice will generate a BLE_GAP_EVT_DISCONNECTED event to inform the link is disconnected. There is no further action required by the application, since the link is closed, typically the peripheral can now go to sleep after the BLE_GAP_EVT_DISCONNECTED event, until user press a button and start advertising again.

    The sd_ble_gap_disconnect() can be used for the peripheral to disconnect the link for instance if battery is low or the user is turning OFF the peripheral.

Children
No Data
Related