<?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>Avoid automatic connection</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/56375/avoid-automatic-connection</link><description>I am currently developing a device and would like the default behavior at boot to be: 
 1. Boot up 
 2. The device should start advertising for non-bonded devices. 
 3. When there is a certain physical interaction of the user with the device, the device</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 10 Jan 2020 14:23:28 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/56375/avoid-automatic-connection" /><item><title>RE: Avoid automatic connection</title><link>https://devzone.nordicsemi.com/thread/228610?ContentTypeID=1</link><pubDate>Fri, 10 Jan 2020 14:23:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:77cd0805-1435-4566-8171-27ec9faad833</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Hi Enrique,&amp;nbsp;&lt;/p&gt;
[quote user=""]2. The device should start advertising for non-bonded devices.[/quote]
&lt;p&gt;&amp;nbsp;You can either do directed advertisment( advertising to devices addresses in a whitelist) or undirected advertisment, advertise to all devices in range. In the latter case both bonded and unbonded device will be able to scan for the advertisment packet. It is not possible to advertise to unbonded peers exclusivly.&amp;nbsp;&lt;/p&gt;
[quote user=""]3. When there is a certain physical interaction of the user with the device, the device should try to connect with any previously bonded device already on the white list.[/quote]
&lt;p&gt;&amp;nbsp;Yes, you can use the physical interaction to configure the advertisement module in our SDK to start advertising using a whitelist which consists of the peers that it has bonded with.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;You start advertising with the whitelist by calling&amp;nbsp;ble_advertising_start with the advertising_mode parameter set to either: BLE_ADV_EVT_FAST_WHITELIST or&amp;nbsp;BLE_ADV_EVT_SLOW_WHITELIST&lt;/p&gt;
[quote user=""]4. When the host device disconnects, the device should return to state 2.[/quote]
&lt;p&gt;&amp;nbsp;Call&amp;nbsp; ble_advertising_restart_without_whitelist() when you receive the&amp;nbsp;BLE_GAP_EVT_DISCONNECTED event.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I recommend that you take a look at the ble_app_hids_keyboard example in our SDK.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Bjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>