<?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 stop advertising and disconnect bluetooth properly?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/67555/how-to-stop-advertising-and-disconnect-bluetooth-properly</link><description>Hello, 
 I am working on ble_app_uart example on nRF52840DK. 
 I am using one switch (gpio) for advertising_switch() function. It means on changing the position of the switch, the advertising will start and after that I will connect to the Bluetooth on</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 27 Oct 2020 10:48:09 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/67555/how-to-stop-advertising-and-disconnect-bluetooth-properly" /><item><title>RE: How to stop advertising and disconnect bluetooth properly?</title><link>https://devzone.nordicsemi.com/thread/277102?ContentTypeID=1</link><pubDate>Tue, 27 Oct 2020 10:48:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9e4bd954-4212-4626-a9da-b9844a5a6040</guid><dc:creator>Jagruti</dc:creator><description>&lt;p&gt;Ok I understood how to do that.&lt;/p&gt;
&lt;p&gt;I added &amp;quot;init.config.ble_adv_on_disconnect_disabled = true;&amp;quot; in&amp;nbsp;advertising_init() function.&lt;/p&gt;
&lt;p&gt;Thanks for your help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to stop advertising and disconnect bluetooth properly?</title><link>https://devzone.nordicsemi.com/thread/277069?ContentTypeID=1</link><pubDate>Tue, 27 Oct 2020 09:33:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:31b5200d-b24d-4fb1-8f63-d28e1ece244b</guid><dc:creator>Jagruti</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Thank you for the reply.&lt;/p&gt;
&lt;p&gt;Yes I tried switching the functions. But still it did not stop the advertising. I did not understand this behaviour.&lt;/p&gt;
&lt;p&gt;Just to avoid advertising after the disconnect event, I removed the&amp;nbsp;&lt;span&gt;&lt;em&gt;on_disconnected&lt;/em&gt;&lt;/span&gt;&lt;em&gt;() in&amp;nbsp;&lt;/em&gt;&lt;span&gt;ble_advertising_on_ble_evt() in ble_advertising.c. But I don&amp;#39;t want to change the sdk files.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;So is there any other way to stop advertising?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to stop advertising and disconnect bluetooth properly?</title><link>https://devzone.nordicsemi.com/thread/277068?ContentTypeID=1</link><pubDate>Tue, 27 Oct 2020 09:26:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:edb6ec91-4fcd-4d3b-98d7-1c527313a0da</guid><dc:creator>Mttrinh</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&lt;span&gt;After you get the BLE_GAP_EVT_DISCONNECTED event in ble_advertising_on_ble_evt() in ble_advertising.c, the code&amp;nbsp;&lt;em&gt;on_disconnected&lt;/em&gt;&lt;/span&gt;&lt;em&gt;()&amp;nbsp;&lt;/em&gt;will make your device advertise again. You can fix it by switching the code on line 12 and 13(Disconnect before stopping advertising).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>