<?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>Deleting Bonds then Restart Advertising does not enable Advertising w/ LE General Discoverable Mode</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/53796/deleting-bonds-then-restart-advertising-does-not-enable-advertising-w-le-general-discoverable-mode</link><description>Hello, 
 I have the following issue. I am developing an application very similar to the &amp;quot;ble app hids keyboard&amp;quot; example. SDK 15.0, S132 V6.0.0, nrf52832. 
 I would like to implement a function where the user can hold a button, and cause the device to</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 01 Nov 2019 20:56:24 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/53796/deleting-bonds-then-restart-advertising-does-not-enable-advertising-w-le-general-discoverable-mode" /><item><title>RE: Deleting Bonds then Restart Advertising does not enable Advertising w/ LE General Discoverable Mode</title><link>https://devzone.nordicsemi.com/thread/218032?ContentTypeID=1</link><pubDate>Fri, 01 Nov 2019 20:56:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6f9efe94-68d9-406c-95fd-60826ff6784c</guid><dc:creator>jj99</dc:creator><description>&lt;p&gt;I see, thank you for the detailed response Havard.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Deleting Bonds then Restart Advertising does not enable Advertising w/ LE General Discoverable Mode</title><link>https://devzone.nordicsemi.com/thread/218029?ContentTypeID=1</link><pubDate>Fri, 01 Nov 2019 19:05:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:61568dd2-4158-4006-80b4-aed6cbb412d4</guid><dc:creator>H&amp;#229;vard</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;When the advertising is first initialized in main it supplies the advertising data to the advertising module with the flag&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;adv_flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Later, when we start advertising, we check if we are using the whitelist, and if we are, the flags are now replaced with&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;But the only case they are set back to&amp;nbsp;BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE is if we call&amp;nbsp;ble_advertising_restart_without_whitelist().&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Ideally, we should set the flag back to&amp;nbsp;&lt;span&gt;BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE whenever the check for whitelist returns false.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;(before:)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    if (use_whitelist(p_advertising))
    {
        p_adv_params-&amp;gt;filter_policy = BLE_GAP_ADV_FP_FILTER_CONNREQ;

        // Set correct flags.
        ret = flags_set(p_advertising, BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED);
        VERIFY_SUCCESS(ret);

        p_advertising-&amp;gt;adv_evt = BLE_ADV_EVT_FAST_WHITELIST;
    }&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;(after:)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    if (use_whitelist(p_advertising))
    {
        p_adv_params-&amp;gt;filter_policy = BLE_GAP_ADV_FP_FILTER_CONNREQ;

        // Set correct flags.
        ret = flags_set(p_advertising, BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED);
        VERIFY_SUCCESS(ret);

        p_advertising-&amp;gt;adv_evt = BLE_ADV_EVT_FAST_WHITELIST;
    }
    else
    {
        // Set correct flags.
        ret = flags_set(p_advertising, BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
        VERIFY_SUCCESS(ret);
    }&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;But if you want to avoid making changes to the module, the best workaround that I tested on my desk would what you found yourself. Using the restart function to set the flag in the correct state.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void test_timeout(void * p_context)
{
    ble_advertising_restart_without_whitelist(&amp;amp;m_advertising);
    (void) sd_ble_gap_adv_stop(m_advertising.adv_handle);
    NRF_LOG_INFO(&amp;quot;timeout!&amp;quot;);
    delete_bonds();
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;For most of our examples, the bonds are cleared by holding button 2 during reset/power cycle. So the flag would always revert back to&amp;nbsp;BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE whenever the whitelist is deleted because advertising_init() would be called again. Historically, peer devices have tended to ignore the flag(s) of the advertising packet. Which could be another reason this has gone unnoticed for a long time.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I will report this internally. Let me know if you have more problems with this and we will be happy to help out.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>