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

Identification of peripheral devices connected to central

Hello Everyone. 

                       I am a newbie in NRF52840 development. I have one NRF52840 device as a central device and many peripherals are getting connected to it (Max 6). Lets say 6 peripherals are connected to one central. I am not understanding how to identify the different peripheral devices on central side. There is p_gap_evt->conn_handle and &p_gap_evt->params.adv_report.peer_addr but I am not understanding how to use this to identify events from different peripherals??? Can anyone please help me on this? 

Parents
  • Hi,

    You are on to it. The key is the connection handle (conn_handle). Any event you get that relates to a specific connection, or any API function that operate on a specific connection, includes this handle. So if you are a central connected to 6 peripherals all will have unique connection handles.

    This starts when the connection is established and you get the BLE_GAP_EVT_CONNECTED. With that, you get a conn_handle which has a value. Say that value is 1. Then whenever you get another event where the conn_handle is 1, you know it is for the same peer device (peripheral in this case as you are making a central). If the conn_handle is 2 instead, you know it is for a different connection.

Reply
  • Hi,

    You are on to it. The key is the connection handle (conn_handle). Any event you get that relates to a specific connection, or any API function that operate on a specific connection, includes this handle. So if you are a central connected to 6 peripherals all will have unique connection handles.

    This starts when the connection is established and you get the BLE_GAP_EVT_CONNECTED. With that, you get a conn_handle which has a value. Say that value is 1. Then whenever you get another event where the conn_handle is 1, you know it is for the same peer device (peripheral in this case as you are making a central). If the conn_handle is 2 instead, you know it is for a different connection.

Children
Related