<?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>[advertising stop]</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/18195/advertising-stop</link><description>Hi all, 
 Someone can give me a information about the difference between function uint32_t err_code = sd_ble_gap_adv_stop(); and stop the advertising with using the timeout that put the state machine to ADV_MODE_SLOW and after in IDLE_MODE when arrive</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 14 Dec 2016 13:22:49 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/18195/advertising-stop" /><item><title>RE: [advertising stop]</title><link>https://devzone.nordicsemi.com/thread/70262?ContentTypeID=1</link><pubDate>Wed, 14 Dec 2016 13:22:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1617e165-0185-4e79-84aa-f92d961a364d</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Q1: i think that the softdevice stops the timer when connection occurs.Correct?&lt;/p&gt;
&lt;p&gt;A1: Correct.&lt;/p&gt;
&lt;p&gt;Q2: And is there an api function to avoid that the timer will expire?&lt;/p&gt;
&lt;p&gt;A2: No.&lt;/p&gt;
&lt;p&gt;If you use sd_ble_gap_adv_stop() the timer and advertising is stopped, and you dont get &lt;code&gt;BLE_GAP_TIMEOUT&lt;/code&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [advertising stop]</title><link>https://devzone.nordicsemi.com/thread/70257?ContentTypeID=1</link><pubDate>Tue, 13 Dec 2016 14:38:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:41ecd93e-b631-4363-947a-9c53e34def19</guid><dc:creator>annapalu</dc:creator><description>&lt;p&gt;Ok, perfect.
i think that the softdevice stops the timer when connection occurs.Correct?
And is there an api function to avoid that the timer will expire? Because sometimes i want to stop the advertising not using a state machine ADV_MODE_FAST --&amp;gt; BLE_ADV_MODE_IDLE, but using a advertising_stop() api function(for example when i press the bottom) and in this case i would that the timers don&amp;#39;t occurs.
Thanks, so much&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [advertising stop]</title><link>https://devzone.nordicsemi.com/thread/70259?ContentTypeID=1</link><pubDate>Tue, 13 Dec 2016 14:32:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:60d4f4bc-861c-440a-ae53-402d71ed4762</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Yes, the timer is stopped. The timer will not expire or timeout, and therfore you dont get the  &lt;code&gt;BLE_GAP_TIMOUT&lt;/code&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [advertising stop]</title><link>https://devzone.nordicsemi.com/thread/70258?ContentTypeID=1</link><pubDate>Tue, 13 Dec 2016 14:29:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:20b53602-20e6-46fe-9576-89fae9d2efc4</guid><dc:creator>annapalu</dc:creator><description>&lt;p&gt;Ok, this is clear. But the my idea(maybe is wrong) is that when i set the options, ble_adv_fast_timeout  = 30; a timer starts and when expires send a BLE_GAP_TIMEOUT. When the connection occurs, this timers is stopped by softdevice and BLE_GAP_TIMOUT is not getting?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [advertising stop]</title><link>https://devzone.nordicsemi.com/thread/70261?ContentTypeID=1</link><pubDate>Tue, 13 Dec 2016 14:23:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5215620b-12d5-411e-8a49-7e5d6068e686</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;If your phone connects to the board, you will not get the &lt;code&gt;BLE_GAP_TIMEOUT&lt;/code&gt;. Instead advertising is stopped by the softdevice, and you will get the event &lt;code&gt;BLE_GAP_EVT_CONNECTED&lt;/code&gt; telling you that the phone has connected to the board.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [advertising stop]</title><link>https://devzone.nordicsemi.com/thread/70260?ContentTypeID=1</link><pubDate>Tue, 13 Dec 2016 14:03:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:98e8505a-d01b-4e51-a4f9-9a2683806b0b</guid><dc:creator>annapalu</dc:creator><description>&lt;p&gt;Hi sigurd,&lt;/p&gt;
&lt;p&gt;sorry i have another question ( hope the last). If the advertising starts and my board connect to the phone. the BLE_GAP_TIMEOUT doesn&amp;#39;t occurs or it occurs and the  connection state ignore it.
How can i understand this procedure?
Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [advertising stop]</title><link>https://devzone.nordicsemi.com/thread/70256?ContentTypeID=1</link><pubDate>Mon, 12 Dec 2016 16:40:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2a8a5378-7b8e-42c1-a2db-d5171eb26ef9</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Yes, that is correct.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [advertising stop]</title><link>https://devzone.nordicsemi.com/thread/70253?ContentTypeID=1</link><pubDate>Mon, 12 Dec 2016 15:13:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d8233693-76cf-4560-be5e-fa6f5d2f19cf</guid><dc:creator>annapalu</dc:creator><description>&lt;p&gt;Perfect. Now it&amp;#39;s all clear. So when the Advertising go in BLE_ADV_MODE_IDLE is the softdevice that worry to stop the advertising?
Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [advertising stop]</title><link>https://devzone.nordicsemi.com/thread/70255?ContentTypeID=1</link><pubDate>Mon, 12 Dec 2016 09:49:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a025ef39-6f55-4c3f-8a35-6de6d6d5529b</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Yes, if you have not enabled the &lt;code&gt;ADV_MODE_SLOW&lt;/code&gt;, only &lt;code&gt;ADV_MODE_FAST&lt;/code&gt;, the advertising will stop when ADV_MODE_FAST timeouts(&lt;code&gt;BLE_GAP_EVT_TIMEOUT&lt;/code&gt;). So ADV_MODE_FAST --&amp;gt; BLE_ADV_MODE_IDLE(advertising is stopped). ADV_MODE_SLOW is completely skipped.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [advertising stop]</title><link>https://devzone.nordicsemi.com/thread/70254?ContentTypeID=1</link><pubDate>Mon, 12 Dec 2016 09:45:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6ffd48b6-5847-4465-a28c-f1a5d2fe0177</guid><dc:creator>annapalu</dc:creator><description>&lt;p&gt;Hi Sigurd,&lt;/p&gt;
&lt;p&gt;thank you for the clear answer.
I have only a last question. On the gls example, only the BLE_ADV_FAST is enable in the advertising_init().
But when the BLE_GAP_EVT_TIMEOUT occurs, the advertising go in slow mode and advertising stop. This is is possible, if in the advertising_init the slow advertising is not enable?&lt;/p&gt;
&lt;p&gt;thanks,
Anna&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [advertising stop]</title><link>https://devzone.nordicsemi.com/thread/70252?ContentTypeID=1</link><pubDate>Thu, 08 Dec 2016 14:06:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5876940b-80fd-45a4-ac79-2a81b723d325</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The function &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.s132.api.v3.0.0%2Fgroup___b_l_e___g_a_p___f_u_n_c_t_i_o_n_s.html&amp;amp;anchor=gaa88eea8e9e95dd96a7633e2c62f3ce16"&gt;sd_ble_gap_adv_stop()&lt;/a&gt; is used to stop the advertising directly from your application code.&lt;/p&gt;
&lt;p&gt;In the gls example you can choose to use &lt;code&gt;ADV_MODE_FAST&lt;/code&gt;, &lt;code&gt;ADV_MODE_SLOW&lt;/code&gt; or to use both. You can enable the different modes in the &lt;code&gt;advertising_init()&lt;/code&gt; function with:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;options.ble_adv_fast_enabled  = true;
options.ble_adv_slow_enabled =  true; 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And you can set the timeout for the different modes with:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;options.ble_adv_fast_timeout  = 30;
options.ble_adv_slow_timeout  = 180;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When the timeout happens, you will get the event &lt;code&gt;BLE_GAP_EVT_TIMEOUT&lt;/code&gt;. If you are in &lt;code&gt;ADV_MODE_FAST&lt;/code&gt; mode, it will switch to &lt;code&gt;ADV_MODE_SLOW&lt;/code&gt;, and if you are in &lt;code&gt;ADV_MODE_SLOW&lt;/code&gt; it will switch to &lt;code&gt;BLE_ADV_MODE_IDLE&lt;/code&gt; and the SoftDevice will stop advertising. The function &lt;code&gt;sd_ble_gap_adv_stop()&lt;/code&gt; is not used.&lt;/p&gt;
&lt;p&gt;With the limited discoverable mode(&lt;code&gt;BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE&lt;/code&gt;) it is not allowed to advertise longer than the timeout period. But if you don&amp;#39;t want the advertising to stop, you can switch to general discoverable mode(&lt;code&gt;BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE&lt;/code&gt;), and set the timeout to 0 to do unlimited advertising:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;advdata.flags                 = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
options.ble_adv_fast_timeout  = 0;
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>