<?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>How to map a gap event to a physical device?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/27371/how-to-map-a-gap-event-to-a-physical-device</link><description>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&amp;#39;m wrong, but connection handles are created after a connection is established</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 18 Nov 2017 08:50:09 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/27371/how-to-map-a-gap-event-to-a-physical-device" /><item><title>RE: How to map a gap event to a physical device?</title><link>https://devzone.nordicsemi.com/thread/108102?ContentTypeID=1</link><pubDate>Sat, 18 Nov 2017 08:50:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a381688b-7b05-43ce-8730-a7dd3cf8b04c</guid><dc:creator>MichaelNordicUser</dc:creator><description>&lt;p&gt;Thank you. If the disconnect event provides the handle of the disconnected device, than my problem is solved. Indeed, I am using the multi connect example from the SDK. Thanks again.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to map a gap event to a physical device?</title><link>https://devzone.nordicsemi.com/thread/108100?ContentTypeID=1</link><pubDate>Sat, 18 Nov 2017 08:46:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c45d12d-aa61-412b-a0e4-97d29f279316</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;No I said nothing of the sort. Every BLE event has a connection handle as you sboulder know from the code you’ve  been writing. I said the event structure for the disconnect event only has a reason  field.&lt;/p&gt;
&lt;p&gt;At this point you need to sit down and read the documentation properly because you’re just guessing your way through. Read the message sequence charts and look at the event types and corresponding structures until you understand the flow.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to map a gap event to a physical device?</title><link>https://devzone.nordicsemi.com/thread/108101?ContentTypeID=1</link><pubDate>Sat, 18 Nov 2017 08:33:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:54122d7c-cffa-4a93-94db-75b556fa4232</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;You can get which connection handle generated &lt;code&gt;BLE_GAP_EVT_DISCONNECTED&lt;/code&gt;, see how it is treated in &lt;code&gt;examples\ble_central\ble_app_multilink_central\main.c&lt;/code&gt; SDK example. Actually search always for examples (by full-text search in *.c and/or *.h file) in SDK prior to asking;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to map a gap event to a physical device?</title><link>https://devzone.nordicsemi.com/thread/108099?ContentTypeID=1</link><pubDate>Sat, 18 Nov 2017 07:52:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:987445c9-3f03-4dab-a6cd-3a3fc22429b0</guid><dc:creator>MichaelNordicUser</dc:creator><description>&lt;p&gt;This is bad news. Are you saying that the disconnect event doesn&amp;#39;t event contain the handle of the terminated connection? So there is no way to know which device is disconnected if I have multiple devices which can disconnect randomly?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to map a gap event to a physical device?</title><link>https://devzone.nordicsemi.com/thread/108098?ContentTypeID=1</link><pubDate>Sat, 18 Nov 2017 07:32:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a9592870-d905-4d19-bab0-ae98e5eb5624</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;There is no peer address in the disconnect event. All the structure for that event (BLE_GAP_EVT_DISCONNECTED -&amp;gt; ble_gap_evt_disconnected_t) has is a reason code.&lt;/p&gt;
&lt;p&gt;There is however a peer address in the connection event (BLD_GAP_EVT_CONNECTED -&amp;gt; ble_gap_evt_connected_t).&lt;/p&gt;
&lt;p&gt;And all of this doesn&amp;#39;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.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to map a gap event to a physical device?</title><link>https://devzone.nordicsemi.com/thread/108097?ContentTypeID=1</link><pubDate>Sat, 18 Nov 2017 07:24:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:005da230-8af2-4574-9d7b-3becf5a27d6c</guid><dc:creator>MichaelNordicUser</dc:creator><description>&lt;p&gt;Yes, in theory information like the peer address will be returned along with the connection handle in the connection event. Therefore, in theory I should know the peer address the connection handle is associated with. However, I have looked at the peer address, and the bytes of the address array are all zero which are non-random numbers.... The caveat is that I have only looked at the peer address in the disconnection event. It&amp;#39;s possible that the peer address is non-zero in the connection event, but I can&amp;#39;t confirm this because I am not in the office. I still find it odd that the peer address is all zero bytes in the disconnection event. I use the same function to print the peer address in the advertisement packet that I use to print the peer address in the disconnect event, so I am confident that my code for printing the peer address is correct.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to map a gap event to a physical device?</title><link>https://devzone.nordicsemi.com/thread/108096?ContentTypeID=1</link><pubDate>Sat, 18 Nov 2017 07:10:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e463c1c7-a3cf-4861-a294-10201114b5f1</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;of course you know - it was YOU who as central initiated the connection and YOU said whom you want to connect to. Since you can only have one connection procedure going on at the same time, you know when you get the connection it was the one you initiated.&lt;/p&gt;
&lt;p&gt;Apart from that the peer address is in the connection event so you have multiple ways to do this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to map a gap event to a physical device?</title><link>https://devzone.nordicsemi.com/thread/108095?ContentTypeID=1</link><pubDate>Sat, 18 Nov 2017 06:54:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:73d910c0-fe5e-4cfc-a8a8-be396b201c52</guid><dc:creator>MichaelNordicUser</dc:creator><description>&lt;p&gt;That&amp;#39;s the problem. I don&amp;#39;t know everything all the way through. I don&amp;#39;t have the connection handle until after the connection is established. If I look at the ble event data structure in the ble event call-back, there is a connection handle, but here is no other data. The handle is just a number. I don&amp;#39;t know if this number is a handle on my tablet, my phone, or an NRF chip. When the soft device connect method is called, all information on advertising device is lost.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to map a gap event to a physical device?</title><link>https://devzone.nordicsemi.com/thread/108094?ContentTypeID=1</link><pubDate>Sat, 18 Nov 2017 05:10:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bb93b86c-c9bb-4616-818c-79513957f751</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;I don&amp;#39;t see the problem. If you are checking advertisements you are the central. You then choose which device to connect when you connect. The result of that connection is the connection handle. So since you initiated the entire procedure you know everything all the way through.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to map a gap event to a physical device?</title><link>https://devzone.nordicsemi.com/thread/108093?ContentTypeID=1</link><pubDate>Sat, 18 Nov 2017 05:03:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:431dbb48-d654-40b5-b99a-d42fd1b3c69a</guid><dc:creator>MichaelNordicUser</dc:creator><description>&lt;p&gt;That&amp;#39;s a great suggestion. The central can query the peripheral for it&amp;#39;s device name. However, I still don&amp;#39;t see a way to map an identifier in the advertisement data to the connection handle which would be more efficient.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to map a gap event to a physical device?</title><link>https://devzone.nordicsemi.com/thread/108092?ContentTypeID=1</link><pubDate>Sat, 18 Nov 2017 04:56:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7e8253b1-2b01-4f69-9b02-9f7d5e779575</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;you can map the mac address beforehand and see who connects to you. Or since the device name is a required GAP characteristic you can get it from the device after connection. Many ways to do this&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>