<?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>[BLE] why restart advertising after disconnect?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/79251/ble-why-restart-advertising-after-disconnect</link><description>Hi, 
 My project is combined &amp;#39;Multi-link Central Example&amp;#39; and &amp;#39;ble_app_uart&amp;#39;, so that it is a central that can be connected to multiple peripherals and a peripheral that can be connected to a single central. 
 When I disconnect from the central which</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 06 Sep 2021 02:26:20 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/79251/ble-why-restart-advertising-after-disconnect" /><item><title>RE: [BLE] why restart advertising after disconnect?</title><link>https://devzone.nordicsemi.com/thread/328072?ContentTypeID=1</link><pubDate>Mon, 06 Sep 2021 02:26:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:02076cbb-d5c1-4c29-914d-1cb50639fc19</guid><dc:creator>lyrics</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;span style="font-family:inherit;"&gt;I&amp;#39;m sorry for late reply.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I understand your explanation for question 1. Thank you.&lt;/span&gt;&lt;/p&gt;
[quote userid="7377" url="~/f/nordic-q-a/79251/ble-why-restart-advertising-after-disconnect/327936#327936"]Where do you look for the event, and in what situation?[/quote]
&lt;p&gt;I asked this question because I didn&amp;#39;t understand the above case, but I think I missed some of this, so I&amp;#39;ll ask you additional questions later.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you. :)&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [BLE] why restart advertising after disconnect?</title><link>https://devzone.nordicsemi.com/thread/327936?ContentTypeID=1</link><pubDate>Fri, 03 Sep 2021 09:36:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a89f4e44-d807-4bc4-9540-401c69d18fff</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Lyrics,&lt;/p&gt;
[quote user=""]&lt;p&gt;1. my question is, what is meaning of&lt;/p&gt;
&lt;p&gt;&amp;quot;&amp;nbsp;if (p_ble_evt-&amp;gt;evt.gap_evt.conn_handle == p_advertising-&amp;gt;current_slave_link_conn_handle &amp;amp;&amp;amp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;p_advertising-&amp;gt;adv_modes_config.ble_adv_on_disconnect_disabled == false) &amp;quot;&lt;/p&gt;
&lt;p&gt;and why it restart advertising?&lt;/p&gt;[/quote]
&lt;p&gt;The reason the advertising module supports automatically starting to advertise upon a disconnect is that this is a very common scenario. However this is configurable and if you do not want it, you can disable it. Looking at the code snippet you posed, you see the&amp;nbsp;ble_adv_on_disconnect_disabled&amp;nbsp; field is what is relevant here. This can be set in the configuration struct before you call&amp;nbsp;ble_advertising_init(), as is demonstrated in &amp;lt;SDK 17.0.2&amp;gt;\examples\ble_peripheral\experimental\ble_app_cgms\main.c. You can also set it at a later point if you want it normally on, but to disable it at a specific point, as demonstrated in for instance &amp;lt;SDK17.0.2&amp;gt;\examples\ble_peripheral\ble_app_buttonless_dfu\main.c.&lt;/p&gt;
[quote user=""]&lt;p&gt;And, when it restarts advertising because of above code part,&amp;nbsp;BLE_GAP_EVT_DISCONNECTED case in the ble_evt_handler is not triggered.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;(but it triggered well if I erase restart advertising code part..)&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;2. Does this mean that it didn&amp;#39;t disconnected properly?&amp;nbsp;&lt;/span&gt;Why this problem happening?&lt;/p&gt;[/quote]
&lt;p&gt;I did not get that. You should always get the&amp;nbsp;BLE_GAP_EVT_DISCONNECTED if there as been a disconnect. Can you explain in more detail? Where do you look for the event, and in what situation? Please elaborate.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>