Disconnection request from peripheral device.

Hi Everyone,

sdk : nrf Connect v1.7.0

ide : VS code

I was trying out central_hr sample on nrf52840 dk. I have simulated hrs server in nrf Connect mobile application. So basically our dk is Central and nrf Connect app is peripheral here.

Suppose I have disconnected in nrf Connect app,after central made a connection, I couldn't see any callback related to disconnection on central side.

This isn't the case with peripheral_hr sample in nrf52dk. 

My question is ...

1.How the Central device knows if the peripheral is still in connection?

2.Can we disconnect from peripheral side in a ble connection?

3.Suppose I have both functionalities central and peripheral running parallely in a nrf52 chip, how to handle connection and disconnection from two independent roles?

Parents
  • Just to be clear. You want to trigger the disconnect on the peripheral side, is that so? That is indeed possible as well. You can check out the Connection Management API that the Zephyr Bluetooth stack uses to manage connections and disconnections for both roles. Here you see that the bt_conn_disconnect call can be called to disconnect from a remote device. Both the central and peripheral can use this call.

    Best regards,

    Simon

  • Hi Simon,

    Thanks for clearing my doubt. 

    We include some connection timeout timer before creating a connection. 

    /** Default LE connection parameters:
     * Connection Interval: 30-50 ms
     * Latency: 0
     * Timeout: 4 s
     */
    #define BT_LE_CONN_PARAM_DEFAULT BT_LE_CONN_PARAM(BT_GAP_INIT_CONN_INT_MIN, \
     BT_GAP_INIT_CONN_INT_MAX, \
     0, 400)Code

    After a timeout the bluetooth stack should trigger a callback isn't it, then why it's not triggering....I'm still getting used to rtos and Nordic, I couldn't debug it myself. I request you once to try with any development board and let me know if it happens the same with you.

    I thought of adding the timer myself and monitor the connection, then what's the point in giving a timeout before a connection.

Reply
  • Hi Simon,

    Thanks for clearing my doubt. 

    We include some connection timeout timer before creating a connection. 

    /** Default LE connection parameters:
     * Connection Interval: 30-50 ms
     * Latency: 0
     * Timeout: 4 s
     */
    #define BT_LE_CONN_PARAM_DEFAULT BT_LE_CONN_PARAM(BT_GAP_INIT_CONN_INT_MIN, \
     BT_GAP_INIT_CONN_INT_MAX, \
     0, 400)Code

    After a timeout the bluetooth stack should trigger a callback isn't it, then why it's not triggering....I'm still getting used to rtos and Nordic, I couldn't debug it myself. I request you once to try with any development board and let me know if it happens the same with you.

    I thought of adding the timer myself and monitor the connection, then what's the point in giving a timeout before a connection.

Children
No Data
Related