<?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>Connecting to ble device based on mac address</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/51090/connecting-to-ble-device-based-on-mac-address</link><description>We are using nrf52832 in our design. It involves two nrf52832 with a bunch of sensors and one more nrf52832 which has cloud connectivity. We store the sensor information in a spi FLASH (externally interfaced to ble device) of each ble device. After collecting</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 26 Aug 2019 18:34:21 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/51090/connecting-to-ble-device-based-on-mac-address" /><item><title>RE: Connecting to ble device based on mac address</title><link>https://devzone.nordicsemi.com/thread/206190?ContentTypeID=1</link><pubDate>Mon, 26 Aug 2019 18:34:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a280895c-8e65-43ed-9562-8dad0fff21c3</guid><dc:creator>Kotteeswaran</dc:creator><description>&lt;p&gt;Thanks Jared,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Let me try&amp;nbsp; first approach, I am already trying (based on device name).&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Let me get back if facing problems.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Connecting to ble device based on mac address</title><link>https://devzone.nordicsemi.com/thread/204578?ContentTypeID=1</link><pubDate>Sat, 17 Aug 2019 04:39:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0da8792e-4442-4c22-9deb-41dd756c067e</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;You can indeed connect by the MAC address but the peripheral device needs to be ready to accept connections. Advertising is usually the way to do this. This is tricky though if you don&amp;#39;t know the MAC beforehand.&lt;/p&gt;
&lt;p&gt;The easiest way to do this without knowing the MAC address is to filter your scan results. There are a few ways to filter. One is by device name&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    err_code = nrf_ble_scan_filter_set(&amp;amp;m_scan, SCAN_NAME_FILTER, m_target_periph_name);
    APP_ERROR_CHECK(err_code);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The other is by using the UUID for the service you&amp;#39;re targeting&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    err_code = nrf_ble_scan_filter_set(&amp;amp;m_scan, SCAN_UUID_FILTER, &amp;amp;target_uuid);
    APP_ERROR_CHECK(err_code);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;You can set this on the peripheral device by modifying the&amp;nbsp;&lt;strong&gt;m_adv_uuids&lt;/strong&gt;&amp;nbsp;array&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// YOUR_JOB: Use UUIDs for service(s) used in your application.
static ble_uuid_t m_adv_uuids[] = {{BLE_UUID_DEVICE_INFORMATION_SERVICE, BLE_UUID_TYPE_BLE},{PROTOBUF_UUID_SERVICE, BLE_UUID_TYPE_BLE}};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;You&amp;#39;ll also have to configure the service as well. &lt;a href="https://www.jaredwolff.com/how-to-protocol-buffer-bluetooth-low-energy-service-part-2/"&gt;I went into detail about how to configure a new service on my blog&lt;/a&gt;. There&amp;#39;s also tons of examples in the SDK&amp;nbsp;under the&amp;nbsp;&lt;strong&gt;examples/ble_peripheral&amp;nbsp;&lt;/strong&gt;folder.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;On the central, you&amp;#39;ll have to do a device discovery to see if the device indeed has that service. You can also look in the&amp;nbsp;&lt;strong&gt;examples/ble_central&lt;/strong&gt; folder to see how to implement your own. The&amp;nbsp;&lt;strong&gt;ble_app_gatts&amp;nbsp;&lt;/strong&gt;example is good. Look for the &lt;strong&gt;scan_filters_set&amp;nbsp;&lt;/strong&gt;and&amp;nbsp;&lt;strong&gt;&lt;/strong&gt;&lt;strong&gt;scan_start.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Hopefully that makes sense. Let me know if I can help explain further. &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Jared&lt;br /&gt;&lt;a href="https://www.jaredwolff.com/blog/"&gt;jaredwolff.com&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>