<?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>Directed Advertising Peripheral</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/26123/directed-advertising-peripheral</link><description>Hi 
 I have a Nordic nRF51 as a Peripheral.
I have it open advertising until it connects for the first time to an Android handset. 
 When a connection is made it stays in directed mode advertising so that no other devices can connect in the future</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 13 Jan 2022 08:29:51 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/26123/directed-advertising-peripheral" /><item><title>RE: Directed Advertising Peripheral</title><link>https://devzone.nordicsemi.com/thread/347527?ContentTypeID=1</link><pubDate>Thu, 13 Jan 2022 08:29:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:247dafd7-8496-4d58-bb25-bf24c5f1c0cb</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Loal,&amp;nbsp;&lt;br /&gt;I&amp;#39;m not an expert with the Audio SDK so I can&amp;#39;t really give you the exact answer. I would suggest to create a new case.&amp;nbsp;&lt;br /&gt;If the Audio stack use the same mechanism as normal BLE then it shouldn&amp;#39;t be a problem change the whitelist or change the directed advertising to point to a single central and switch between when them.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Directed Advertising Peripheral</title><link>https://devzone.nordicsemi.com/thread/347482?ContentTypeID=1</link><pubDate>Thu, 13 Jan 2022 03:57:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a868e1eb-dce7-44bd-90eb-342e782a41aa</guid><dc:creator>Loai</dc:creator><description>&lt;p&gt;Hello Hung Bui,&lt;/p&gt;
&lt;p&gt;I hope you are still part of the network. I noticed that you were discussing this topic couple of years ago which is somehow related to my issue.&lt;/p&gt;
&lt;p&gt;I am using nrf5340 Audio DK, and I would like to implement this Whitelist on the peripheral (headset) device to only connect to a specific central (gateway). I actually have 2 centrals so using the whitelisting, I would like to shift the connection between them when the user presses a button for example, so I thought that whitelisting can help the headset to connect with the device specified. Would you mind to guide mw on how I can do that or maybe show me an example I can refer to?&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Directed Advertising Peripheral</title><link>https://devzone.nordicsemi.com/thread/102948?ContentTypeID=1</link><pubDate>Tue, 24 Oct 2017 12:14:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e45acea1-d948-4901-a2a7-f799eae531a6</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Luke,&lt;/p&gt;
&lt;p&gt;Sorry that I didn&amp;#39;t check you are using S130. Advertising with privacy is not support on S130.&lt;/p&gt;
&lt;p&gt;In your case, I would suggest doing whitelisting. Whitelisting meaning you advertise in open, discoverable mode but only the central device that has been bonded with your can connect. The peripheral will discard the connect request from other central.&lt;/p&gt;
&lt;p&gt;Usually, what we do in our mouse and keyboard reference design is to advertise in directed advertising for a short period of time (few hundred milliseconds) before switching to normal advertising with whitelist. This is to take advantage of the high duty cycle adv interval directed advertising can have (3.5ms) to connect quickly. But this mode consume high power consumption so it should only be used short period of time.&lt;/p&gt;
&lt;p&gt;You can refer to our ble_app_mouse and keyboard example in the SDK to see how we do whitelisting.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Directed Advertising Peripheral</title><link>https://devzone.nordicsemi.com/thread/102947?ContentTypeID=1</link><pubDate>Tue, 24 Oct 2017 10:26:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b94a8fff-f286-4a40-9474-4ce15a53484a</guid><dc:creator>Luke Richards</dc:creator><description>&lt;p&gt;Just looked and sd_ble_gap_device_identities_set() is only available in S132 which is for nRF52.
I am using a nRF51, so this solution is not suitable.
Please advise of other possibilities, as I am urgently trying to resolve this in my company
Luke&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Directed Advertising Peripheral</title><link>https://devzone.nordicsemi.com/thread/102946?ContentTypeID=1</link><pubDate>Mon, 23 Oct 2017 13:21:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:edaa3d8e-9ebf-4b6e-bdbb-bfcd294b69e6</guid><dc:creator>Luke Richards</dc:creator><description>&lt;p&gt;Are you referring to this code, as I cannot find a function in the nordic API for sd_ble_gap_device_identities_set()&lt;/p&gt;
&lt;p&gt;Also the irk in the example I assume needs to be a genuine irk not 0x00 to 0x0F.
Where do I capture this irk?&lt;/p&gt;
&lt;p&gt;ret_code_t err_code;&lt;/p&gt;
&lt;p&gt;const ble_gap_id_key_t m_peer1 =
{
.id_info =
{
.irk = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F},
}
};&lt;/p&gt;
&lt;p&gt;const ble_gap_id_key_t * m_identities[] = {&amp;amp;m_peer1};&lt;/p&gt;
&lt;p&gt;err_code = sd_ble_gap_device_identities_set(m_identities, NULL, 1);
APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p&gt;ble_gap_addr_t gap_addr =
{
.addr_id_peer = 0,
};&lt;/p&gt;
&lt;p&gt;ble_gap_adv_params_t adv_params;&lt;/p&gt;
&lt;p&gt;memset(&amp;amp;adv_params, 0, sizeof(adv_params));
adv_params.type        = BLE_GAP_ADV_TYPE_ADV_DIRECT_IND;
adv_params.p_peer_addr = &amp;amp;gap_addr;&lt;/p&gt;
&lt;p&gt;err_code = sd_ble_gap_adv_start(&amp;amp;adv_params);
APP_ERROR_CHECK(err_code);&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Directed Advertising Peripheral</title><link>https://devzone.nordicsemi.com/thread/102949?ContentTypeID=1</link><pubDate>Mon, 23 Oct 2017 12:48:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ecf910e6-cf96-481c-a9da-2ffc575e54d4</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Yes, it&amp;#39;s the resolvable address so it will change the address but usually will keep the IRK to generate the addresses. You need to follow what I described above. Do bonding and get the IRK from the keys exchange. Then follow the example that I quoted.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Directed Advertising Peripheral</title><link>https://devzone.nordicsemi.com/thread/102945?ContentTypeID=1</link><pubDate>Mon, 23 Oct 2017 09:20:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:843a6a6b-c2c8-4715-8fd8-eab012f6c31d</guid><dc:creator>Luke Richards</dc:creator><description>&lt;p&gt;Thanks for the response.&lt;/p&gt;
&lt;p&gt;On connecting event (BLE_GAP_EVT_CONNECTED), when I query:
ble_evt-&amp;gt;evt.gap_evt.params.connected.peer_addr&lt;/p&gt;
&lt;p&gt;The address type is BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE&lt;/p&gt;
&lt;p&gt;My question is, how will this direct advertising get to the handset since the Android handset is changing its address after a reboot.&lt;/p&gt;
&lt;p&gt;Luke&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Directed Advertising Peripheral</title><link>https://devzone.nordicsemi.com/thread/102944?ContentTypeID=1</link><pubDate>Mon, 23 Oct 2017 09:12:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3c5a8bd7-7d05-40c4-83a7-2c5031f6404e</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Luke,&lt;/p&gt;
&lt;p&gt;You need to check what kind of address the Android phone has. If it&amp;#39;s using random static address, I don&amp;#39;t think there is anyway we can guess the new address to do correct directed advertising.
If the phone has Resolvable Random Address, meaning there is a same IRK to generate the address. Then you need to exchange IRK and then do directed advertising with IRK.
You can have a look at &lt;a href="https://devzone.nordicsemi.com/question/107812/directed-advertising-with-pre-shared-irk/"&gt;this example&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Note that even you do directed advertising, other central device can still be able to connect to your device, there is nothing to stop them to do that. On the phone this function may be disable, but with a customized central or rooted phone, it should be possible.&lt;/p&gt;
&lt;p&gt;And easier way to reconnect a device previously bonded is to use whitelist, either on central or on peripheral.&lt;/p&gt;
&lt;p&gt;If you use whitelist on peripheral, you also need the IRK to detect the previously bonded phone.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>