<?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>Proper way to start/stop advertising?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/18277/proper-way-to-start-stop-advertising</link><description>It seems like this should be a simple thing, but I can&amp;#39;t find an example of it, and nothing I&amp;#39;ve read here seems to help. 
 I want my app to come up in general advertising mode and stay there, forever, until certain things happen. Then I want it to shut</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 03 Feb 2020 17:52:15 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/18277/proper-way-to-start-stop-advertising" /><item><title>RE: Proper way to start/stop advertising?</title><link>https://devzone.nordicsemi.com/thread/232414?ContentTypeID=1</link><pubDate>Mon, 03 Feb 2020 17:52:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0d890736-92c5-4cd5-af44-30f509727ad6</guid><dc:creator>stecla</dc:creator><description>&lt;p&gt;vould you share that code that you referenced with the 180 seconds between advertising? love to have a look at it for inspiration.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Proper way to start/stop advertising?</title><link>https://devzone.nordicsemi.com/thread/204879?ContentTypeID=1</link><pubDate>Tue, 20 Aug 2019 01:08:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:82084e8c-20de-45b4-885e-02ff96dce345</guid><dc:creator>Vasiliy Baryshnikov</dc:creator><description>&lt;p&gt;In SDK 15, if you are using a template derived project, you should use the following statement with the parameter to stop advertising:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;sd_ble_gap_adv_stop(m_advertising.adv_handle);&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Proper way to start/stop advertising?</title><link>https://devzone.nordicsemi.com/thread/70574?ContentTypeID=1</link><pubDate>Mon, 12 Dec 2016 10:36:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a2941dd1-0912-45c0-81ad-d76e5d61cf02</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;The device is not shut down completely, it is put into &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/power.html?cp=2_2_0_17_1#unique_863354678"&gt;&lt;em&gt;system off&lt;/em&gt; sleep mode&lt;/a&gt;. A wakeup from this mode will trigger a reset. You can avoid putting the device into &lt;em&gt;system off&lt;/em&gt; mode by removing the call to &lt;code&gt;sleep_mode_enter()&lt;/code&gt; on the &lt;code&gt;BLE_ADV_EVT_IDLE&lt;/code&gt; event. You can disable the softdevice by calling &lt;code&gt;softdevice_handler_sd_disable()&lt;/code&gt;, but make sure you are not advertising or in a connection when calling this. Notice that you will have to initialize the softdevice and all advertising settings before staring advertising again. Also, make sure you are not calling any softdevice functions if you disable the softdevice. Softdevice functions have a &lt;code&gt;sd_&lt;/code&gt; prefix.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Proper way to start/stop advertising?</title><link>https://devzone.nordicsemi.com/thread/70573?ContentTypeID=1</link><pubDate>Fri, 09 Dec 2016 18:23:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5d0bd7e5-e449-4950-88c8-8786adef27de</guid><dc:creator>Lee Daniel Crocker</dc:creator><description>&lt;p&gt;Looks like all the samples do the same thing: on getting the &lt;code&gt;BLE_ADV_EVT_IDLE&lt;/code&gt;, they shut down completely. I can&amp;#39;t find any example where they continue without advertising. I wouldn&amp;#39;t mind shutting down the whole Bluetooth stack if I could restart it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Proper way to start/stop advertising?</title><link>https://devzone.nordicsemi.com/thread/70572?ContentTypeID=1</link><pubDate>Fri, 09 Dec 2016 18:19:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1eb05138-4562-45f5-9d98-17d97636703c</guid><dc:creator>Lee Daniel Crocker</dc:creator><description>&lt;p&gt;I&amp;#39;m basing my code on ble_app_uart, but it just advertises once for 180 seconds and then powers down, restarting on the button press. I don&amp;#39;t want to shut down, I just want to stop advertising, shut off my display, etc.  I tried another tack of just letting it go to IDLE after its timeout, then restarting advertising. That works, but if I don&amp;#39;t restart I get a timer crash. If try &lt;code&gt;sd_ble_gap_adv_stop()&lt;/code&gt; I get an &lt;code&gt;INVALID_STATE&lt;/code&gt; error and then a timer crash.  I don&amp;#39;t want to shut down, I just want it to shut up.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Proper way to start/stop advertising?</title><link>https://devzone.nordicsemi.com/thread/70571?ContentTypeID=1</link><pubDate>Fri, 09 Dec 2016 10:40:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0cdc9786-684c-42cc-8427-f29a740751b6</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;If you get &lt;code&gt;NRF_ERROR_INVALID_STATE&lt;/code&gt; when calling &lt;code&gt;sd_ble_gap_adv_stop()&lt;/code&gt;, it usually means you are not advertising. You will not get this error if you are &amp;quot;between intervals&amp;quot;, you will still be in the advertising state. Where are calling &lt;code&gt;sd_ble_gap_adv_stop()&lt;/code&gt;? Most of the BLE peripheral examples in the SDK is setup to advertise in 180s and then stop until button 1 is pressed. You can disable this timeout by setting &lt;code&gt;APP_ADV_TIMEOUT_IN_SECONDS&lt;/code&gt; to 0. You should easily be able to change the code to stop/start advertising on some other event than the timeot/button. Notice that the device is also going to sleep while advertising. Have a look at the call to &lt;code&gt;power_manage()&lt;/code&gt; in the BLE examples.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>