<?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 make an automatic Bluetooth connection?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/66144/how-can-i-make-an-automatic-bluetooth-connection</link><description>Hello, 
 
 I have a question about Bluetooth connectivity issues. The BLE code I&amp;#39;m trying to make will be connected to the smartphone (Android). If phone out of the Bluetooth range and return to the reachable range when the connection is lost, I want</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 22 Sep 2020 07:39:18 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/66144/how-can-i-make-an-automatic-bluetooth-connection" /><item><title>RE: How can I make an automatic Bluetooth connection?</title><link>https://devzone.nordicsemi.com/thread/270740?ContentTypeID=1</link><pubDate>Tue, 22 Sep 2020 07:39:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:72f3d625-fbdf-45fb-a15d-03834a921f28</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;The application may call&amp;nbsp;&lt;span&gt;ble_advertising_start() at any time, for instance on the&amp;nbsp;BLE_GAP_EVT_CONNECTED event.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;br /&gt;Kenneth&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I make an automatic Bluetooth connection?</title><link>https://devzone.nordicsemi.com/thread/270737?ContentTypeID=1</link><pubDate>Tue, 22 Sep 2020 07:16:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bc7c69c8-8d85-482a-a860-8271ee349043</guid><dc:creator>schosdas</dc:creator><description>&lt;p&gt;Hello Kenneth!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;As you said, I can enable or disable automatic pairing by adding that code.&lt;/p&gt;
&lt;p&gt;But it only works when I manually disconnect it.&amp;nbsp;&amp;nbsp;The function I want is similar to Bluetooth earphones.&amp;nbsp; The Bluetooth connection may be lost, such as when the Central is out of range of Bluetooth communication or when power is off. And if it&amp;#39;s possible to reconnect, It is sending a pairing request to the Central that previously connected to.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Can you help me with this?&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;Thank you.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void advertising_init(void)
{
    uint32_t               err_code;
    ble_advertising_init_t init;

    memset(&amp;amp;init, 0, sizeof(init));

    init.advdata.name_type          = BLE_ADVDATA_FULL_NAME;
    init.advdata.include_appearance = false; 
    init.advdata.flags              = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE; 

    init.srdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
    init.srdata.uuids_complete.p_uuids  = m_adv_uuids;

    init.config.ble_adv_fast_enabled  = true;
    init.config.ble_adv_fast_interval = APP_ADV_INTERVAL;
    init.config.ble_adv_fast_timeout  = APP_ADV_DURATION; //advertising timeout
    init.evt_handler = on_adv_evt;

    init.config.ble_adv_on_disconnect_disabled = false; //Auto pairing test, true : if disconnet no advertising(scan) / false : if disconnet auto advertising(scan) and connected

    err_code = ble_advertising_init(&amp;amp;m_advertising, &amp;amp;init);
    APP_ERROR_CHECK(err_code);

    ble_advertising_conn_cfg_tag_set(&amp;amp;m_advertising, APP_BLE_CONN_CFG_TAG);
}
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I make an automatic Bluetooth connection?</title><link>https://devzone.nordicsemi.com/thread/270611?ContentTypeID=1</link><pubDate>Mon, 21 Sep 2020 13:13:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a45c04c3-0765-4dab-9dfe-d4ef603d65f8</guid><dc:creator>schosdas</dc:creator><description>&lt;p&gt;Thank you! I will refer to it and test it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I make an automatic Bluetooth connection?</title><link>https://devzone.nordicsemi.com/thread/270528?ContentTypeID=1</link><pubDate>Mon, 21 Sep 2020 09:53:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9aa48bd4-911a-4670-9ab8-39671794b3d5</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Advertising is typically is configured by calling&amp;nbsp;ble_advertising_init() and started by calling&amp;nbsp;ble_advertising_start(). When calling&amp;nbsp;ble_advertising_init() you can configure it to advertise on disconnect by:&lt;/p&gt;
&lt;p&gt;init.config.ble_adv_on_disconnect_disabled&amp;nbsp; &amp;nbsp; &amp;nbsp;= false;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>