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

How to map a gap event to a physical device?

What unique information can I use to know which physical device disconnected for example? Say I have a MAC address or a name encoded into the advertising packet. Correct me if I'm wrong, but connection handles are created after a connection is established. So how can I map a mac address or name to a connection handle?

Parents
  • There is no peer address in the disconnect event. All the structure for that event (BLE_GAP_EVT_DISCONNECTED -> ble_gap_evt_disconnected_t) has is a reason code.

    There is however a peer address in the connection event (BLD_GAP_EVT_CONNECTED -> ble_gap_evt_connected_t).

    And all of this doesn't matter anyway since you can only as central get a connection event for the thing you asked the softdevice to connect to so if you knew what it was before you asked to connect, you know what is it when you get the connection callback and you can associate that handle with it.

Reply
  • There is no peer address in the disconnect event. All the structure for that event (BLE_GAP_EVT_DISCONNECTED -> ble_gap_evt_disconnected_t) has is a reason code.

    There is however a peer address in the connection event (BLD_GAP_EVT_CONNECTED -> ble_gap_evt_connected_t).

    And all of this doesn't matter anyway since you can only as central get a connection event for the thing you asked the softdevice to connect to so if you knew what it was before you asked to connect, you know what is it when you get the connection callback and you can associate that handle with it.

Children
No Data
Related