<?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>Identify Device Based on Advertising Data</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/8944/identify-device-based-on-advertising-data</link><description>I am connecting to two identical devices, but one is configured as device &amp;#39;A&amp;#39; and the other is device &amp;#39;B&amp;#39;. I am currently advertising whether the device is configured as A or B, and am able to connect to them selectively, but I&amp;#39;m not sure how to associate</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 02 Sep 2015 00:40:48 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/8944/identify-device-based-on-advertising-data" /><item><title>RE: Identify Device Based on Advertising Data</title><link>https://devzone.nordicsemi.com/thread/32920?ContentTypeID=1</link><pubDate>Wed, 02 Sep 2015 00:40:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:94c38c0c-3419-478c-918c-e24f97baa279</guid><dc:creator>danbujak</dc:creator><description>&lt;p&gt;I just realized that I need to also identify which device was bonded with under device_manager_event_handler(). Can you let me know what parameter I can correlate here? Currently I&amp;#39;m storing p_ble_evt-&amp;gt;evt.gap_evt.conn_handle on connection but it doesn&amp;#39;t match the p_event-&amp;gt;event_param.p_gap_param-&amp;gt;conn_handle I have at bonding.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Identify Device Based on Advertising Data</title><link>https://devzone.nordicsemi.com/thread/32919?ContentTypeID=1</link><pubDate>Wed, 02 Sep 2015 00:17:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3101c77d-07cf-44bb-9e7e-73c66d825846</guid><dc:creator>danbujak</dc:creator><description>&lt;p&gt;Thanks, I was checking the address in the device_manager_event_handler() for the connection event, but I&amp;#39;m looking under on_ble_evt() now.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Identify Device Based on Advertising Data</title><link>https://devzone.nordicsemi.com/thread/32918?ContentTypeID=1</link><pubDate>Fri, 28 Aug 2015 16:12:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a2398460-0557-4923-8831-107457adb621</guid><dc:creator>danbujak</dc:creator><description>&lt;p&gt;Where should I be identifying the peer address? I tried doing what I describe in my edit above, but like I say, the addresses do not match in the last byte.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Identify Device Based on Advertising Data</title><link>https://devzone.nordicsemi.com/thread/32917?ContentTypeID=1</link><pubDate>Fri, 28 Aug 2015 08:55:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ab742980-80d9-4fa5-adc2-37f64534708a</guid><dc:creator>Anders Strand</dc:creator><description>&lt;p&gt;Hey!&lt;/p&gt;
&lt;p&gt;I would create a data struct for each device with the following info:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Peer Adress&lt;/li&gt;
&lt;li&gt;Peer Configuration (A or B)&lt;/li&gt;
&lt;li&gt;Connection Handle&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;When reading the advertisement report and deciding to connect, save the peer address along with the configuration.
When the connection event happens. Find the correct device data struct, and fill inn the connection handle.
When the disconnect (or other events) happen, use the connection handle to identify the device, and check the corresponding configuration.&lt;/p&gt;
&lt;p&gt;EDIT: If the addresses of the two devices are identical for some reason, you can add a custom read only characteristic to your service which describes the configuration.&lt;/p&gt;
&lt;p&gt;EDIT2, finding the addresses:
This is where you should find the address in the two events:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;        case BLE_GAP_EVT_CONNECTED:
			adress = p_ble_evt-&amp;gt;evt.gap_evt.params.connected.peer_addr;
			break;
		case BLE_GAP_EVT_ADV_REPORT:
			adress = p_ble_evt-&amp;gt;evt.gap_evt.params.adv_report.peer_addr;
			break
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>