<?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>Stop Advertising on nrf52832</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/74060/stop-advertising-on-nrf52832</link><description>Hi! What is the proper use of sd_ble_gap_adv_stop in SDK 15? I&amp;#39;m using nrf52832 in my application but can&amp;#39;t seen to find a corret way to stop advertising. 
 Looking on ble_gap.h I&amp;#39;ve seen that this function requires a adv_handle as a parameter but what</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 22 Apr 2021 12:21:59 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/74060/stop-advertising-on-nrf52832" /><item><title>RE: Stop Advertising on nrf52832</title><link>https://devzone.nordicsemi.com/thread/306325?ContentTypeID=1</link><pubDate>Thu, 22 Apr 2021 12:21:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:81739174-72b8-4213-866c-d9004b583519</guid><dc:creator>Mauro Silva</dc:creator><description>&lt;p&gt;I&amp;#39;ve found a workaround.&lt;/p&gt;
&lt;p&gt;I was using&amp;nbsp;&lt;em&gt;sd_ble_gap_adv_stop(m_advertising.adv_handle)&amp;nbsp;&lt;/em&gt; inside a timer handler which had a return type of&amp;nbsp;&lt;em&gt;void&lt;/em&gt; while&amp;nbsp;&lt;em&gt;sd_ble_gap_adv_stop&lt;/em&gt; has a return type of uint32_t, so I just adjusted that and now it&amp;#39;s stopping advertising and not showing the error.&lt;/p&gt;
&lt;p&gt;Since app_timer_create was complaining about the uint32_t type I just called a function inside it to match the types.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;//handler
void test_handler(void *p_context){

advertising_stop();

}
//advertising_stop
uint32_t advertising_stop(void)
{

uint32_t ret_error2;
ret_error2=sd_ble_gap_adv_stop(m_advertising.adv_handle);
APP_ERROR_CHECK(ret_error2);
NRF_LOG_INFO(&amp;quot;ADV. Stopped&amp;quot;);

}
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stop Advertising on nrf52832</title><link>https://devzone.nordicsemi.com/thread/305946?ContentTypeID=1</link><pubDate>Tue, 20 Apr 2021 17:45:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dca4980a-0066-4387-a241-44b79ce89f1e</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Try this:&lt;/p&gt;
&lt;p&gt;sd_ble_gap_adv_stop(m_advertising.adv_handle);&lt;/p&gt;
&lt;p&gt;If it returns 8(&lt;span&gt;NRF_ERROR_INVALID_STATE) it means that, from the documentation:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;quot;Invalid state to perform operation (most probably not in advertising state).&amp;quot;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stop Advertising on nrf52832</title><link>https://devzone.nordicsemi.com/thread/305820?ContentTypeID=1</link><pubDate>Tue, 20 Apr 2021 11:26:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0055c6fc-b8d8-4b16-8742-7ed71f5b55ae</guid><dc:creator>Mauro Silva</dc:creator><description>&lt;p&gt;I double checked it and the library is included and&amp;nbsp;&lt;span&gt;BLE_ADVERTISING_ENABLED&amp;nbsp;is properly enabled.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/533x665/__key/communityserver-discussions-components-files/4/propertis_5F00_BLE.jpg" /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stop Advertising on nrf52832</title><link>https://devzone.nordicsemi.com/thread/305696?ContentTypeID=1</link><pubDate>Tue, 20 Apr 2021 06:14:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:94fc594a-f0a8-4d67-aab3-ea9896002ec8</guid><dc:creator>Eric Nguyen</dc:creator><description>[quote userid="98865" url="~/f/nordic-q-a/74060/stop-advertising-on-nrf52832/305588#305588"]On advertising start I&amp;#39;m using an instance defined by&amp;nbsp;&lt;em&gt;BLE_ADVERTISING_DEF,&amp;nbsp;&lt;/em&gt; but I realized that the instance create doesn&amp;#39;t have a adv_handle on it.How can I know if I&amp;#39;m&amp;nbsp;defining the proper instance and treat this error?[/quote]
&lt;p&gt;The BLE_ADVERTISING_DEF is defined at ble_advertising.h. Can you help me check again that: the ble_advertising.h is included your project? If not please add this library and in sdk_config.h file, please certainly the BLE_ADVERTISING_ENABLED sets 1.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stop Advertising on nrf52832</title><link>https://devzone.nordicsemi.com/thread/305588?ContentTypeID=1</link><pubDate>Mon, 19 Apr 2021 14:01:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6f6d36aa-b128-43b0-a8e4-5298cae6b039</guid><dc:creator>Mauro Silva</dc:creator><description>&lt;p&gt;Oh, thank You! I&amp;#39;ve been looking at the documentation you provided and it says that the parameter&amp;nbsp; &lt;em&gt;adv_handle&lt;/em&gt;&amp;nbsp;is &amp;quot;&lt;em&gt;The advertising handle that should stop advertising.&amp;quot;.&lt;/em&gt;I&amp;#39;ve tried to set this parameter as the same I used in&amp;nbsp; my Advertising start function, but now I&amp;#39;m getting the error: ERROR 8 [NRF_ERROR_INVALID_STATE] .&lt;/p&gt;
&lt;p&gt;On advertising start I&amp;#39;m using an instance defined by&amp;nbsp;&lt;em&gt;BLE_ADVERTISING_DEF,&amp;nbsp;&lt;/em&gt; but I realized that the instance create doesn&amp;#39;t have a adv_handle on it.How can I know if I&amp;#39;m&amp;nbsp;defining the proper instance and treat this error?&lt;/p&gt;
&lt;p&gt;As for your suggestion, from what I understood that would be a timed event to stop advertising right? Is it possible to stop it after a particular condition is met?&lt;/p&gt;
&lt;p&gt;In my application i&amp;#39;m trying to stop the advertising after a certain variable is set, this would be like after pressing a button or something similar. Thanks in advance for your time.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stop Advertising on nrf52832</title><link>https://devzone.nordicsemi.com/thread/305186?ContentTypeID=1</link><pubDate>Fri, 16 Apr 2021 02:03:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:41e08364-12d3-4a8f-bde9-2faa749f4376</guid><dc:creator>Eric Nguyen</dc:creator><description>&lt;p&gt;I think you can look around this &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"&gt;document&lt;/a&gt;&amp;nbsp;which shows how to use Advertising on BLE. Moreover, if you want to stop advertising, you can do like this.&lt;/p&gt;
&lt;p&gt;- You have to&amp;nbsp;generate the event with interval delay after sd_ble_gap_adv_start is called then try to call sd_ble_gap_adv_stop after calling sd_ble_gap_adv_start and waiting for time with timer.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>