<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Identification of peripheral devices connected to central</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/76942/identification-of-peripheral-devices-connected-to-central</link><description>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</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 01 Jul 2021 12:50:20 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/76942/identification-of-peripheral-devices-connected-to-central" /><item><title>RE: Identification of peripheral devices connected to central</title><link>https://devzone.nordicsemi.com/thread/318224?ContentTypeID=1</link><pubDate>Thu, 01 Jul 2021 12:50:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:13b6b8f7-5314-4fd0-b44b-a966438fe77d</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;You only get the peer address on the connected event. But then you can store a map of conn_handle and address yourself if you need to keep that mapping later.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Identification of peripheral devices connected to central</title><link>https://devzone.nordicsemi.com/thread/318198?ContentTypeID=1</link><pubDate>Thu, 01 Jul 2021 12:16:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1079a478-0f8d-43bc-aff7-b57822278b53</guid><dc:creator>sne_333</dc:creator><description>&lt;p&gt;Thank you so much...&lt;/p&gt;
&lt;p&gt;Ok so if I use &amp;quot;ble_evt_t const *p_ble_evt;&amp;quot; and &amp;quot;p_gap_evt-&amp;gt;conn_handle&amp;quot; on other event handler, I will get the same handle number as well as the peer address right?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Identification of peripheral devices connected to central</title><link>https://devzone.nordicsemi.com/thread/318151?ContentTypeID=1</link><pubDate>Thu, 01 Jul 2021 10:49:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:456583b8-ca54-4d90-832c-78f85e4841b9</guid><dc:creator>Einar Thorsrud</dc:creator><description>[quote user="snehal_2789"]If i get a connection from&amp;nbsp;&lt;span&gt;BLE_GAP_EVT_CONNECTED and later I get data from a particular event in a different handle,then how to identify device&lt;/span&gt;[/quote]
&lt;p&gt;You &lt;strong&gt;always&lt;/strong&gt; get a connect handle with every event. You do not get all information with every event, though. So if you for instance need to map conn_handle to address later, you need to keep track of that.&lt;/p&gt;
[quote user="snehal_2789"]At that time i wont be having the same conn_handle I guess.[/quote]
&lt;p&gt;The conn handle is valid for the duration of the connection. And when the connection is established again, you know the address.&lt;/p&gt;
&lt;p&gt;Note that if the peer is a phone or something that use privacy, then you cannot map addresses over time, as it changes regularly. In that case, you will need to bond with the device in order to recognize it (using the IRK. This is handled for you by the peer manager library in that case, though.,&lt;/p&gt;
[quote user="snehal_2789"]My problem is I am getting event in a different handle and inside that I want to identify from which device i got the data.[/quote]
&lt;p&gt;That is exactly why all connection related events have the conn_handle. That is what you should use here.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Identification of peripheral devices connected to central</title><link>https://devzone.nordicsemi.com/thread/318149?ContentTypeID=1</link><pubDate>Thu, 01 Jul 2021 10:41:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a19e9309-209d-4b0e-b55a-fcbd0d547578</guid><dc:creator>sne_333</dc:creator><description>&lt;p&gt;If i get a connection from&amp;nbsp;&lt;span&gt;BLE_GAP_EVT_CONNECTED and later I get data from a particular event in a different handle,then how to identify device. At that time i wont be having the same conn_handle I guess.?? My problem is I am getting event in a different handle and inside that I want to identify from which device i got the data.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Identification of peripheral devices connected to central</title><link>https://devzone.nordicsemi.com/thread/318109?ContentTypeID=1</link><pubDate>Thu, 01 Jul 2021 08:00:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f284f535-90a6-4a1f-a2c0-69a66d4476c3</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;What do you mean by device ID? The only IDs you have is the connection handle, which is just a number without meaning, and with the&amp;nbsp;BLE_GAP_EVT_CONNECTED event you get the peer&amp;#39;s BLE address.&lt;/p&gt;
&lt;p&gt;(There is a concept of device ID in nRF devices, but that is not related to BLE, and is just a random number written into FICR during production in the two&amp;nbsp;DEVICEID registers).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Identification of peripheral devices connected to central</title><link>https://devzone.nordicsemi.com/thread/318097?ContentTypeID=1</link><pubDate>Thu, 01 Jul 2021 06:59:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2e7cd093-732d-4c28-9a37-c3ae618ee8d9</guid><dc:creator>sne_333</dc:creator><description>&lt;p&gt;Thank you so much. Also what is device ID of a peripheral and how is it represented?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Identification of peripheral devices connected to central</title><link>https://devzone.nordicsemi.com/thread/317972?ContentTypeID=1</link><pubDate>Wed, 30 Jun 2021 12:32:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:14cc3713-7621-4cfc-bfa8-a788c94b281d</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;If it disconnects and connects again it will get a new connection handle. If you need to map it to a specific peer address you can do that by checking the address when it connects, and keep a map of conn_handle and address.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Identification of peripheral devices connected to central</title><link>https://devzone.nordicsemi.com/thread/317954?ContentTypeID=1</link><pubDate>Wed, 30 Jun 2021 12:05:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f7876c11-bd7e-4b89-8083-3a885191dd03</guid><dc:creator>sne_333</dc:creator><description>&lt;p&gt;Thank you Einar.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;so for 1st connection..conn_handle will be 1, 2nd connection conn_handle will be 2 and so on... lets say device 2 acquired conn_handle 2. what if conn_handle 2 disconnects in between?? when device 2 tries to reconnect again, it will acquire new conn_handle or it will connect with conn_handle 2? There is no need to check for peer address??&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Identification of peripheral devices connected to central</title><link>https://devzone.nordicsemi.com/thread/317952?ContentTypeID=1</link><pubDate>Wed, 30 Jun 2021 11:51:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d68d2bf8-c415-4e66-ad7c-78bce13e4450</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You are on to it. The key is the connection handle (&lt;code&gt;conn_handle&lt;/code&gt;). 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.&lt;/p&gt;
&lt;p&gt;This starts when the connection is established and you get the&amp;nbsp;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.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>