<?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>BLE connection handle value scope</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/28143/ble-connection-handle-value-scope</link><description>I would like to use connection handle value as index to an array which store some per connection specific data. Some questions about connection handle: 
 
 
 is connection handle value allocated by SD continuous? 
 
 
 Suppose 6 connections has</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 14 Dec 2017 16:09:10 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/28143/ble-connection-handle-value-scope" /><item><title>RE: BLE connection handle value scope</title><link>https://devzone.nordicsemi.com/thread/111113?ContentTypeID=1</link><pubDate>Thu, 14 Dec 2017 16:09:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3b725576-eb7c-45c3-ac4c-60e51a870a55</guid><dc:creator>rolandash</dc:creator><description>&lt;p&gt;Thanks Martin.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE connection handle value scope</title><link>https://devzone.nordicsemi.com/thread/111112?ContentTypeID=1</link><pubDate>Thu, 14 Dec 2017 16:02:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:103cccce-a6a5-429c-b9a4-84eb86899490</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Yes, they will be unique.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE connection handle value scope</title><link>https://devzone.nordicsemi.com/thread/111111?ContentTypeID=1</link><pubDate>Wed, 13 Dec 2017 16:08:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8c363105-4605-4840-98df-1810bcecf0e7</guid><dc:creator>rolandash</dc:creator><description>&lt;p&gt;thanks for the advice Martin.&lt;/p&gt;
&lt;p&gt;another related question to confirm is in case of mixed existence of peripheral links and central links, will each connection handle value still unique ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE connection handle value scope</title><link>https://devzone.nordicsemi.com/thread/111114?ContentTypeID=1</link><pubDate>Wed, 13 Dec 2017 13:11:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac1dabb7-f57a-477d-bbc0-47584d23491e</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;I don&amp;#39;t think there are any ways around sacrificing some CPU cycles on this one.&lt;/p&gt;
&lt;p&gt;I suppose one obvious way to distinguish device A and device B when they connect is to check their respective addresses. Maybe you can add a reference to each device in an array and then associate connection handles with their respective device. Then, on each BLE event referencing a connection handle, you can iterate through the array of devices and check their connection handle?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE connection handle value scope</title><link>https://devzone.nordicsemi.com/thread/111109?ContentTypeID=1</link><pubDate>Mon, 11 Dec 2017 16:46:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d379b130-ac2b-407f-8fef-42457da41aaa</guid><dc:creator>rolandash</dc:creator><description>&lt;p&gt;Martin,
Probably i did not describe the question clearly. The root issue behind it is when there are multiple peer devices connecting at the same time to the same service/characteristic, I need to distinguish the data from different devices, so i can handle them differently, say, forward to different buffer for further processing.&lt;/p&gt;
&lt;p&gt;Using conn handle indexing seems OK except it has to go through a lookup table given it is not continuous which may consume some CPU cycles, when there is more connection number.&lt;/p&gt;
&lt;p&gt;So in this case i am not sure if bonding will help as in service write event seems no bonding information available help faster device indexing.&lt;/p&gt;
&lt;p&gt;Is there any better way to do this?&lt;/p&gt;
&lt;p&gt;thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE connection handle value scope</title><link>https://devzone.nordicsemi.com/thread/111110?ContentTypeID=1</link><pubDate>Mon, 11 Dec 2017 13:14:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:94e1f083-82a4-4d9c-8ab1-f2e324ab9a27</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;I&amp;#39;m not sure if I understand. Why would you have to pre-bond? Can&amp;#39;t you bond the devices the first time they connect?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE connection handle value scope</title><link>https://devzone.nordicsemi.com/thread/111108?ContentTypeID=1</link><pubDate>Tue, 05 Dec 2017 07:59:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c6c69326-8b0c-4852-ba9b-8527fef8ab3d</guid><dc:creator>rolandash</dc:creator><description>&lt;p&gt;thanks for the detailed answer.
As in my use cases, the devices at the other end is random and un-predicate-able, so i can not pre-bond any devices.
Is there any other better way to do this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE connection handle value scope</title><link>https://devzone.nordicsemi.com/thread/111107?ContentTypeID=1</link><pubDate>Mon, 04 Dec 2017 12:12:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e9dffeeb-40a5-4ea2-a503-e234c25a4a2c</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have heard this idea before, but there are some pitfalls:&lt;/p&gt;
&lt;p&gt;Q1: Not necessarily. It is continuous as long as no devices disconnects. I.e. the first device will get handle 0, device number 2 gets handle 1, and so on. But if the first device disconnects, then device number 3 might get handle 0 again. Furthermore, due to the supervision timeout mechanism, it might in some cases take some time before the Softdevice detects that a device has lost its connection. And if the same device then tries to reconnect quickly (before the supervision timeout occurs) it might get assigned a new connection handle. Hence, it is actually possible that the same device has two connection handles at the same time, although only until the supervision timeout occurs.&lt;/p&gt;
&lt;p&gt;Q2: Yes, the Softdevice will reuse connection handles, and a particular device will not necessarily get the same connection handle value on every connection.&lt;/p&gt;
&lt;p&gt;Another solution to individually identify connected devices is to bond all your devices. Or you can use other information like e.g MAC addresses.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>