<?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 to programatically connect to an arbitrary peripheral device</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/73420/how-to-programatically-connect-to-an-arbitrary-peripheral-device</link><description>I am using the example ble_app_uart_c, in which the nRF52840 is the central device. Theoretically, I could have more than one peripheral running the Nordic Uart Service (NUS). For this reason, I don&amp;#39;t want to automatically establish a connection with</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 06 Apr 2021 05:53:35 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/73420/how-to-programatically-connect-to-an-arbitrary-peripheral-device" /><item><title>RE: How to programatically connect to an arbitrary peripheral device</title><link>https://devzone.nordicsemi.com/thread/303003?ContentTypeID=1</link><pubDate>Tue, 06 Apr 2021 05:53:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:973a11f1-ca1f-4560-9641-abe187436f55</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Sorry, I see that I didn&amp;#39;t add the snippet in my last reply. Sorry about that.&lt;/p&gt;
&lt;p&gt;I was referring to the static char const m_target_periph_name (line 142 in the main.c). You can edit this to&amp;nbsp;&lt;strong&gt;is_connect_per_addr&lt;/strong&gt; instead for to connect to peripherals with a given address instead.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**@brief Names which the central applications will scan for, and which will be advertised by the peripherals.
 *  if these are set to empty strings, the UUIDs defined below will be used
 */
static char const m_target_periph_name[] = &amp;quot;&amp;quot;;      /**&amp;lt; If you want to connect to a peripheral using a given advertising name, type its name here. */
static bool is_connect_per_addr = false;            /**&amp;lt; If you want to connect to a peripheral with a given address, set this to true and put the correct address in the variable below. */

static ble_gap_addr_t const m_target_periph_addr =
{
    /* Possible values for addr_type:
       BLE_GAP_ADDR_TYPE_PUBLIC,
       BLE_GAP_ADDR_TYPE_RANDOM_STATIC,
       BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE,
       BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE. */
    .addr_type = BLE_GAP_ADDR_TYPE_RANDOM_STATIC,
    .addr      = {0x8D, 0xFE, 0x23, 0x86, 0x77, 0xD9}
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to programatically connect to an arbitrary peripheral device</title><link>https://devzone.nordicsemi.com/thread/302729?ContentTypeID=1</link><pubDate>Wed, 31 Mar 2021 12:21:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b29a95d3-e160-4242-867a-ac4e7a6c7f0d</guid><dc:creator>mr_jj</dc:creator><description>&lt;p&gt;Hi Simon, which function are you referring to. I am looking at the example in the SDK 17 and do not see any function that connects to a peripheral.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to programatically connect to an arbitrary peripheral device</title><link>https://devzone.nordicsemi.com/thread/302723?ContentTypeID=1</link><pubDate>Wed, 31 Mar 2021 12:13:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:70e74d88-31ba-473a-9f7a-f8d483039d49</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Please check out the ble_app_hrs_c example project. The function below lets you decide whether you want to connect to a peripheral using a given advertising name or a given address, so you should be able to give your advertising device the necessary address to connect to it.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>