<?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 can I close a open BLE connection properly from peripheral side</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/8467/how-can-i-close-a-open-ble-connection-properly-from-peripheral-side</link><description>Hello, 
 in our final device, I want to give the user the opportunity, to close an opened BLE connection between our device and another smart device. This should be done by pushing a button.
At the moment, if the button is pressed, I call the &amp;quot;closeBLEconnection</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sun, 04 Oct 2015 02:33:01 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/8467/how-can-i-close-a-open-ble-connection-properly-from-peripheral-side" /><item><title>RE: How can I close a open BLE connection properly from peripheral side</title><link>https://devzone.nordicsemi.com/thread/30882?ContentTypeID=1</link><pubDate>Sun, 04 Oct 2015 02:33:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cf859d2a-bd9b-414d-a176-7f4235fcdf38</guid><dc:creator>shin</dc:creator><description>&lt;p&gt;Hello,
As you mentioned BLE_HCL_REMOTE_USER_TERMINATED_CONNECTION stopped the connection between central and peripheral. But advertising packets are still broadcasted even though I called sd_ble_gap_adv_stop() after stopping the connection. I checked this situation with a packet sniffer.
Let me know how to stop advertising. I am using S110. Thanks.
Now I mistook understanding my code: ble_evt_dispatch() calls ble_advertising_on_ble_evt(). Therefore, after stopping advertising, advertising restarts  automatically. Sorry my dump message. Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I close a open BLE connection properly from peripheral side</title><link>https://devzone.nordicsemi.com/thread/30881?ContentTypeID=1</link><pubDate>Fri, 07 Aug 2015 11:22:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cdbc6f60-cb3b-40df-a8f9-5e2dfeebac54</guid><dc:creator>Andreas</dc:creator><description>&lt;p&gt;Oh, Ok. Thank you. Then I have to take care of this by my own...
Regards,
BTprogrammer&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I close a open BLE connection properly from peripheral side</title><link>https://devzone.nordicsemi.com/thread/30880?ContentTypeID=1</link><pubDate>Fri, 07 Aug 2015 10:54:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cc1ae210-9309-476a-8cc0-733b99ecd4ad</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;There is not. Please see &lt;a href="https://devzone.nordicsemi.com/question/47410/ble-status/"&gt;this&lt;/a&gt; question.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I close a open BLE connection properly from peripheral side</title><link>https://devzone.nordicsemi.com/thread/30879?ContentTypeID=1</link><pubDate>Fri, 07 Aug 2015 07:27:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c8dd9ad5-1c3b-4c94-8f26-10d6aaf236a2</guid><dc:creator>Andreas</dc:creator><description>&lt;p&gt;Hello Petter, thank you for your reply! And sorry for my late response. The explanations about this topic helped a lot. Is there a function to get the actual state of the softdevice?&lt;/p&gt;
&lt;p&gt;Regards,
BTprogrammer&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I close a open BLE connection properly from peripheral side</title><link>https://devzone.nordicsemi.com/thread/30878?ContentTypeID=1</link><pubDate>Fri, 31 Jul 2015 12:32:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9a2004c5-8898-48b3-9f74-20dea1e33a6d</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;As Alex mentioned you should use BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION, please see &lt;a href="https://devzone.nordicsemi.com/question/6021/whats-the-difference-between-disconnection-reason-0x13-and-0x16/"&gt;this&lt;/a&gt; question for the difference between BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION and BLE_HCI_LOCAL_HOST_TERMINATED_CONNECTION.&lt;/p&gt;
&lt;p&gt;Error code 0x00000007 from sd_ble_gap_adv_stop(); is NRF_ERROR_INVALID_STATE, which you can see above the function in ble_gap.h. And as Alex mentioned you probably get this because you are not actually advertising.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I close a open BLE connection properly from peripheral side</title><link>https://devzone.nordicsemi.com/thread/30876?ContentTypeID=1</link><pubDate>Fri, 31 Jul 2015 11:23:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7121930e-0221-49c5-ac0f-16ff63d21437</guid><dc:creator>Alex</dc:creator><description>&lt;p&gt;You don&amp;#39;t need to stop advertising because you haven&amp;#39;t started it after disconnection.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I close a open BLE connection properly from peripheral side</title><link>https://devzone.nordicsemi.com/thread/30875?ContentTypeID=1</link><pubDate>Fri, 31 Jul 2015 11:19:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dd00a310-4aa6-4220-8d03-75822bf6f3b3</guid><dc:creator>Andreas</dc:creator><description>&lt;p&gt;Hi, yes I also tried &amp;quot;BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION&amp;quot; then I will get no error for the sd_ble_gap_disconnect function. But stopAdvertising still returns error 8. Another question for me is, what does nordic mean with &amp;quot;REMOTE_USER&amp;quot;. The person that uses the device or the connected receiver? For my understanding, LOCAL_HOST would be the more logical value...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I close a open BLE connection properly from peripheral side</title><link>https://devzone.nordicsemi.com/thread/30877?ContentTypeID=1</link><pubDate>Fri, 31 Jul 2015 10:19:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7326fcbb-6141-452e-9941-d8761d41a045</guid><dc:creator>Alex</dc:creator><description>&lt;p&gt;For S110:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; * @param[in] hci_status_code HCI status code, see @ref BLE_HCI_STATUS_CODES (accepted values are @ref BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION and @ref BLE_HCI_CONN_INTERVAL_UNACCEPTABLE).
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;not sure about S120, check in function definition in ble_gap.h I think.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>