<?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>Automatically connect with SDK14.2 for HID</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/76007/automatically-connect-with-sdk14-2-for-hid</link><description>Hi, 
 In our application, we are using HID to control mobile phone or PC.When users connected our product, it will automatically connect next time. 
 But our product is battery powered,so we want to prohibit automatic connection when the battery is low</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 16 Sep 2021 09:05:21 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/76007/automatically-connect-with-sdk14-2-for-hid" /><item><title>RE: Automatically connect with SDK14.2 for HID</title><link>https://devzone.nordicsemi.com/thread/329763?ContentTypeID=1</link><pubDate>Thu, 16 Sep 2021 09:05:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b4cf1d20-e11a-4506-a59b-df6175c409f5</guid><dc:creator>Ben_nrf52840</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Please don&amp;#39;t mind it..&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve found the host doesn&amp;#39;t connect automatically after I set&amp;nbsp;ble_adv_on_disconnect_disabled to true.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Ben&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Automatically connect with SDK14.2 for HID</title><link>https://devzone.nordicsemi.com/thread/329748?ContentTypeID=1</link><pubDate>Thu, 16 Sep 2021 08:28:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b2376834-7c6e-41eb-8036-cdcce78fb603</guid><dc:creator>Ben_nrf52840</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have the same issue which is connected automatically from the host in HID.&lt;/p&gt;
&lt;p&gt;I disconnect by using sd_ble_gap_disconnected() and stop advertising using sd_ble_gap_adv_stop().&lt;/p&gt;
&lt;p&gt;I confirmed the advertise is not started automatically in the BLE_GAP_EVT_DISCONNECTED.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m using nrf52840 with SD version 17.0.2.&lt;/p&gt;
&lt;p&gt;Would you please help to prevent host from connecting automatically?&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Ben&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Automatically connect with SDK14.2 for HID</title><link>https://devzone.nordicsemi.com/thread/314420?ContentTypeID=1</link><pubDate>Wed, 09 Jun 2021 09:56:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0980b1b7-1c1f-4c1f-80a5-ed146dc0e75b</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;If you don&amp;#39;t do advertising when you are in a connection, you just don&amp;#39;t re-start advertising (check in the code if you do re-start advertising after&amp;nbsp;BLE_GAP_EVT_DISCONNECTED event).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you already advertise when you are in a connection, you would need to stop that. You can stop it after using&amp;nbsp;&lt;span&gt;sd_ble_gap_disconnect())&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Automatically connect with SDK14.2 for HID</title><link>https://devzone.nordicsemi.com/thread/314408?ContentTypeID=1</link><pubDate>Wed, 09 Jun 2021 09:21:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8c6bb370-c8eb-42db-9447-4b938a630848</guid><dc:creator>Taylor</dc:creator><description>[quote userid="6462" url="~/f/nordic-q-a/76007/automatically-connect-with-sdk14-2-for-hid/313927#313927"]It&amp;#39;s not the device - it&amp;#39;s the Central which does that.[/quote]
&lt;p&gt;It&amp;#39;s right!&lt;/p&gt;
&lt;p&gt;Should I close advertising immediately after using&amp;nbsp;sd_ble_gap_disconnect()?&lt;/p&gt;
&lt;p&gt;What can be done with the code?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Automatically connect with SDK14.2 for HID</title><link>https://devzone.nordicsemi.com/thread/313927?ContentTypeID=1</link><pubDate>Mon, 07 Jun 2021 12:49:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5751a46c-3129-41a8-91b5-db9c8603900c</guid><dc:creator>awneil</dc:creator><description>[quote userid="97810" url="~/f/nordic-q-a/76007/automatically-connect-with-sdk14-2-for-hid/313876#313876"]the device will still to connect automatically[/quote]
&lt;p&gt;It&amp;#39;s not the device - it&amp;#39;s the Central which does that.&lt;/p&gt;
&lt;p&gt;And that would be the normal behaviour that users would expect - if your mouse disconnects for some reason, you&amp;#39;d want it to automatically re-connect as soon as possible.&lt;/p&gt;
&lt;p&gt;As &lt;a href="https://devzone.nordicsemi.com/members/hungbui"&gt;Hung Bui&lt;/a&gt; said, if you don&amp;#39;t want the Central to connect, then don&amp;#39;t advertise.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Automatically connect with SDK14.2 for HID</title><link>https://devzone.nordicsemi.com/thread/313920?ContentTypeID=1</link><pubDate>Mon, 07 Jun 2021 12:32:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f83b8b6-65bb-4ec0-927a-d4428daa1115</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;What do you meant by &amp;quot;still to connect automatically&amp;quot; ? Would the connection terminated ?&amp;nbsp;&lt;br /&gt;If the connection terminate, you can just don&amp;#39;t restart advertising then the central won&amp;#39;t be able to connect to your device.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Automatically connect with SDK14.2 for HID</title><link>https://devzone.nordicsemi.com/thread/313876?ContentTypeID=1</link><pubDate>Mon, 07 Jun 2021 10:06:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e6b92fea-8336-4ae1-8158-cc1ac92ba08b</guid><dc:creator>Taylor</dc:creator><description>&lt;p&gt;I had used&amp;nbsp;&lt;span&gt;sd_ble_gap_disconnect(),but the device will still to connect automatically.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void ble_disconnect()
{
    uint32_t err_code;

    if (BLE_STATUS_CONNECTED == sg_ble_interface_m.status)
    {
        sg_ble_interface_m.status = BLE_STATUS_W_DISCONN;
        err_code = sd_ble_gap_disconnect(sg_ble_interface_m.conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
        APP_ERROR_CHECK(err_code);
    }
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Automatically connect with SDK14.2 for HID</title><link>https://devzone.nordicsemi.com/thread/313872?ContentTypeID=1</link><pubDate>Mon, 07 Jun 2021 10:01:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c6c793b8-fa47-4499-a176-ba4c20302987</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;&amp;nbsp;Could you please explain this ?&amp;nbsp;&lt;/p&gt;
[quote user="ColorPen"]If the device had connected,I can not disconnect manually,because it had be bonded.[/quote]
&lt;p&gt;If you want to disconnect, on the peripheral side, you can just call&amp;nbsp;sd_ble_gap_disconnect() to terminate the connection.&lt;/p&gt;
&lt;p&gt;If you have battery service you can notify the central about the current battery level of the device.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Automatically connect with SDK14.2 for HID</title><link>https://devzone.nordicsemi.com/thread/313864?ContentTypeID=1</link><pubDate>Mon, 07 Jun 2021 09:42:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b6aedfb4-52c6-4c5b-b406-b9e1ec502360</guid><dc:creator>Taylor</dc:creator><description>&lt;p&gt;Thanks for your reply.&lt;/p&gt;
&lt;p&gt;I had set a mode which would not advertising when the battery is low.If the device had connected,I can not disconnect manually,because it had be bonded.&lt;/p&gt;
&lt;p&gt;How does the Phone/PC know&amp;nbsp;&lt;span&gt;the condition of the device? We don&amp;#39;t have custom service.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Automatically connect with SDK14.2 for HID</title><link>https://devzone.nordicsemi.com/thread/313637?ContentTypeID=1</link><pubDate>Fri, 04 Jun 2021 11:44:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1e21055f-f2b2-41c2-a954-c54ff61c54cb</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;I guess you could make the advertising non-connectable?&lt;/p&gt;
&lt;p&gt;Does the product already&amp;nbsp;indicate battery level in the advertising?&lt;/p&gt;
[quote userid="2121" url="~/f/nordic-q-a/76007/automatically-connect-with-sdk14-2-for-hid/313632#313632"]This way you can tell the phone/PC about the condition of the device[/quote]
&lt;p&gt;Presumably, that would require a custom app on the phone/PC ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Automatically connect with SDK14.2 for HID</title><link>https://devzone.nordicsemi.com/thread/313632?ContentTypeID=1</link><pubDate>Fri, 04 Jun 2021 11:35:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0d4f82a9-d92e-42e1-9c27-bb58274d8875</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Taylor,&lt;/p&gt;
&lt;p&gt;You can do what Andrew suggested, to not advertise.&amp;nbsp;&lt;br /&gt;If you still want the phone/PC to be able to connect but not auto-connect you can think of advertising with different BLE address. This way you can tell the phone/PC about the condition of the device. You can choose to do very long interval advertising when the battery is low.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Automatically connect with SDK14.2 for HID</title><link>https://devzone.nordicsemi.com/thread/313597?ContentTypeID=1</link><pubDate>Fri, 04 Jun 2021 10:08:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6b3dc4a1-3e6d-4ae8-a531-785395dd9403</guid><dc:creator>awneil</dc:creator><description>[quote userid="97810" url="~/f/nordic-q-a/76007/automatically-connect-with-sdk14-2-for-hid"]we want to prohibit automatic connection when the battery is low[/quote]
&lt;p&gt;So just don&amp;#39;t advertise in that condition?&lt;/p&gt;
&lt;p&gt;You would also need some way for the user to know that it&amp;#39;s just low battery - rather than any other problem ...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>