<?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 go into a non-connectable state?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/95428/how-to-stop-advertising-and-go-into-a-non-connectable-state</link><description>I want to stop advertising and be in a non-connectable state, if someone connected sends the wrong data through a characteristic three times in a row. I will start a timer, and after x amount of seconds, start advertising again for people to connect.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 06 Jan 2023 13:48:35 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/95428/how-to-stop-advertising-and-go-into-a-non-connectable-state" /><item><title>RE: How to stop advertising and go into a non-connectable state?</title><link>https://devzone.nordicsemi.com/thread/403603?ContentTypeID=1</link><pubDate>Fri, 06 Jan 2023 13:48:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ff741e5d-285d-4394-909a-115c56b6db2a</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Jerome,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;We would need to have a look on how you start advertising. Did you use ble_advertising module ? Or you use the sd_ble_gap_adv directly ?&amp;nbsp;&lt;br /&gt;If you use ble_advertising, you can change&amp;nbsp;ble_adv_on_disconnect_disabled configuration in&amp;nbsp;init.config when you setting up advertising in&amp;nbsp;advertising_init().&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you use the softdevice API directly you need to check you code when you handle the&amp;nbsp;BLE_GAP_EVT_DISCONNECTED event, usually in ble_evt_handler() . Most likely the start of new advertising after disconnected is located there.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Calling&amp;nbsp;sd_ble_gap_adv_stop() right after&amp;nbsp;sd_ble_gap_disconnect() doesn&amp;#39;t work because at that moment the link is not actually disconnected yet. Advertising will restarted when&amp;nbsp;BLE_GAP_EVT_DISCONNECTED&amp;nbsp;event is triggered&lt;strong&gt;&lt;span&gt;.&amp;nbsp;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>