<?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 apply whitelist during advertisement?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/76321/how-to-apply-whitelist-during-advertisement</link><description>Hi, 
 
 I am trying to apply a whitelist during advertisement on my peripheral device. Only one central should be whitelisted at a time. The whitelist is empty on initial boot up. I am using BLE_GAP_ADV_FP_FILTER_CONNREQ , but I always get NRF_ERROR_INVALID_PARAM</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 17 Jun 2021 11:45:46 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/76321/how-to-apply-whitelist-during-advertisement" /><item><title>RE: How to apply advertisement whitelist during advertisement?</title><link>https://devzone.nordicsemi.com/thread/315849?ContentTypeID=1</link><pubDate>Thu, 17 Jun 2021 11:45:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de1efe9b-7874-407a-9f96-97e0d25126cc</guid><dc:creator>Robin</dc:creator><description>&lt;p&gt;&lt;em&gt;SDK&amp;gt;15&lt;/em&gt; uses the &lt;em&gt;ble_dvertising.c/.h&lt;/em&gt; to manage advertising. My fix was to implement bonding, whitelisting and advertisement functionality from the &lt;em&gt;ble_app_hid_keyboard&lt;/em&gt; example, which uses &lt;em&gt;ble_advertising. &lt;/em&gt;Just remember that advertising is automatically restarted when the central disconnects. In order to clear the whitelist/peers, ensure that the device is disconnected and not advertising. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to apply advertisement whitelist during advertisement?</title><link>https://devzone.nordicsemi.com/thread/315658?ContentTypeID=1</link><pubDate>Wed, 16 Jun 2021 14:00:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e589ece9-b1c1-4bcb-abbc-b5c32db1ea15</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Glad that it worked Robin :)&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to apply advertisement whitelist during advertisement?</title><link>https://devzone.nordicsemi.com/thread/315619?ContentTypeID=1</link><pubDate>Wed, 16 Jun 2021 12:59:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a95380d4-4e2e-4e09-a5a9-36cb17d0dfc9</guid><dc:creator>Robin</dc:creator><description>&lt;p&gt;Thanks. That&amp;#39;s very helpful! I believe I&amp;#39;ve managed to implement it as intended now. The reason for my error was that the &lt;em&gt;ble_advertising.h/.c &lt;/em&gt;automatically restarts advertising when the device disconnects. I got &lt;em&gt;INVALID_STATE &lt;/em&gt;because the device was already advertising.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to apply advertisement whitelist during advertisement?</title><link>https://devzone.nordicsemi.com/thread/315553?ContentTypeID=1</link><pubDate>Wed, 16 Jun 2021 09:30:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8b13bc5a-545a-4002-9e91-8a22914ace6f</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Robin,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;ble_advertising_restart_without_whitelist() will not delete the peers.&amp;nbsp;pm_peers_delete() does&lt;/p&gt;
&lt;p&gt;However , you need to wait until you receive&amp;nbsp;PM_EVT_PEERS_DELETE_SUCCEEDED event after you call&amp;nbsp;&lt;span&gt;pm_peers_delete() before continue.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Note that whitelisting is independent from peer data. So after you delete peer data, you may want to remove or update whitelist as well.&amp;nbsp;&lt;br /&gt;When you remove or update whitelist, you need to make sure the device is not advertising or scanning.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Please try stepping into the code of&amp;nbsp;ble_advertising_start() and check which exact function that throwing the error.&amp;nbsp; I&amp;#39;m not sure which error code is the&amp;nbsp;&lt;em&gt;UNKNOWN_ERROR_CODE, &lt;/em&gt;how did you catch that ?&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to apply advertisement whitelist during advertisement?</title><link>https://devzone.nordicsemi.com/thread/315428?ContentTypeID=1</link><pubDate>Tue, 15 Jun 2021 13:38:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4c4ff696-32c3-4055-9843-ed538d9c64b0</guid><dc:creator>Robin</dc:creator><description>&lt;p&gt;Thanks for the help! That makes sense. I think I was confused since the &lt;em&gt;advertising_init() &lt;/em&gt;is usually called once on startup. I thought these parameters couldn&amp;#39;t/shouldn&amp;#39;t be modified later.&lt;/p&gt;
&lt;p&gt;It helped looking into the &lt;em&gt;ble_app_hid_keyboard &lt;/em&gt;example and using the methods in &lt;em&gt;ble_advertising.h &lt;/em&gt;to manage advertising. I am now able to use whitelisting and bonding functionality as intended.&lt;/p&gt;
&lt;p&gt;However, I am unable to erase bonds without doing a full reset. I intend to use a button to remove bonding info and start advertising without a whitelist. In addition, I want maximum one central device to be in the whitelist. Do you have any tips on how I can remove bonds, whitelist and restart advertisements?&lt;/p&gt;
&lt;p&gt;I see the &lt;em&gt;ble_advertising_restart_without_whitelist()&lt;/em&gt;, however, this function does not delete the peers first, right?&lt;/p&gt;
&lt;p&gt;After I disconnect from the bonded &amp;amp; whitelisted central and erasing all bonds using &lt;em&gt;pm_peers_delete(),&lt;/em&gt; the &lt;em&gt;ble_advertising_start(&amp;amp;m_advertising, BLE_ADV_MODE_FAST) &lt;/em&gt;returns &lt;em&gt;INVALID_STATE&lt;/em&gt;. Do you have any idea why that might be?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Edit: &lt;/strong&gt;Unknown error code was thrown by &lt;em&gt;pm_device_identities_list_set() &lt;/em&gt;as advertisement was automatically restarted by the &lt;em&gt;ble_advertising.c/.h&lt;/em&gt; module after &lt;em&gt;BLE_GAP_EVT_DISCONNECTED&lt;/em&gt;. Once I ensured advertising was switched off before setting the whitelist, everything worked perfectly.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to apply advertisement whitelist during advertisement?</title><link>https://devzone.nordicsemi.com/thread/315191?ContentTypeID=1</link><pubDate>Mon, 14 Jun 2021 14:57:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f75cae60-dcdc-4e05-afed-8bca3a907b48</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Robin,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please correct me if I&amp;#39;m wrong. So what you want to do is to start advertising with no whitelist but with&amp;nbsp;filter_policy = BLE_GAP_ADV_FP_FILTER_CONNREQ; ? And then you will update the whitelist after you have bonded to the central ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If it&amp;#39;s the case it&amp;#39;s will cause an error as it&amp;#39;s described in the documentation of the sd_ble_gap_adv_set_configure() function:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;* @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied:&lt;br /&gt; * - Invalid advertising data configuration specified. See @ref ble_gap_adv_data_t.&lt;br /&gt; * - Invalid configuration of p_adv_params. See @ref ble_gap_adv_params_t.&lt;br /&gt; &lt;strong&gt;* - Use of whitelist requested but whitelist has not been set,&amp;nbsp;&lt;/strong&gt;&lt;strong&gt;* see @ref sd_ble_gap_whitelist_set.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I would suggest to advertise without the&amp;nbsp;BLE_GAP_ADV_FP_FILTER_CONNREQ filter. After you have the central credential for whitelist, you can start advertising again with whitelist. You can have a look at the ble_app_hid_mouse to see an example when whitelist is used.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>