<?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>Cannot add multiple custom UUIDs?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/58905/cannot-add-multiple-custom-uuids</link><description>I have reviewed most (if not all) posts on this forum that relate to multiple vendor specific UUIDs but still see issues on my platform. 
 I am using nRF52832 (with minor changes unrelated to Bluetooth) and Soft Device version 6.1.1 
 I have two custom</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 10 Mar 2020 15:48:09 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/58905/cannot-add-multiple-custom-uuids" /><item><title>RE: Cannot add multiple custom UUIDs?</title><link>https://devzone.nordicsemi.com/thread/239183?ContentTypeID=1</link><pubDate>Tue, 10 Mar 2020 15:48:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:49cb6e28-3d2f-4a46-a651-dbcdbdd47158</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Yes, it is no problem to use similar to&amp;nbsp;&lt;span&gt;BLE_UUID_NUS_SERVICE&amp;nbsp;to do this. In ble_app_uart_c, the same approach is used to scan for the NUS UUID:&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**@brief NUS UUID. */
static ble_uuid_t const m_nus_uuid =
{
    .uuid = BLE_UUID_NUS_SERVICE,
    .type = NUS_SERVICE_UUID_TYPE
};

err_code = nrf_ble_scan_filter_set(&amp;amp;m_scan, SCAN_UUID_FILTER, &amp;amp;m_nus_uuid);
APP_ERROR_CHECK(err_code);&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;You can change the&amp;nbsp;.uuid and .type parameters&amp;nbsp;as you like to scan for a different UUIDs, and you can create new ble_uuid_t variables to fill in the new advertising/broadcast packets.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot add multiple custom UUIDs?</title><link>https://devzone.nordicsemi.com/thread/239164?ContentTypeID=1</link><pubDate>Tue, 10 Mar 2020 14:27:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:762e890b-bce6-4e58-8350-7d1459b44b74</guid><dc:creator>RVM</dc:creator><description>&lt;p&gt;Thanks.&lt;/p&gt;
&lt;p&gt;Here is what I am trying to achieve. I want a device to use scan for a specific 128-bit UUID (where bytes 12 and 13 are fixed). When the device detects an incoming advertisement on that 128-bit UUID, I want my device to switch roles and &amp;quot;broadcast/advertise&amp;quot; with the same base UUID but a different combination of bytes 12 and 13.&lt;/p&gt;
&lt;p&gt;Can that be done using the BLE_UUID_NUS_SERVICE kind of set up or something similar to it?&lt;br /&gt;On the one hand I keep getting the impression that bytes 12 and 13 are only meant to play with attributes, services and characteristics -- and not really meant for switching roles between broadcaster and observer/scanner.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot add multiple custom UUIDs?</title><link>https://devzone.nordicsemi.com/thread/239156?ContentTypeID=1</link><pubDate>Tue, 10 Mar 2020 14:17:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0fc3ad83-9c2d-4086-9d41-d4a3189c77c9</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;I&amp;#39;m not sure I understand your question. When advertising, you choose what to put into the advertising packet. For instance, in ble_app_uart, the UUID in the advertising packet is defined like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static ble_uuid_t m_adv_uuids[]          =                                          /**&amp;lt; Universally unique service identifier. */
{
    {BLE_UUID_NUS_SERVICE, NUS_SERVICE_UUID_TYPE}
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;BLE_UUID_NUS_SERVICE is defined as 0x0001, which corresponds to byte 12 and 13 in the advertised UUID. If you would like to advertise a different UUID, with the same base UUID but different byte 12 and 13, you would only change the&amp;nbsp;&lt;span&gt;BLE_UUID_NUS_SERVICE define.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Scanning does not use UUIDs, but you can use UUIDs to filter out devices that advertise the UUID of your service. This is done in a similar way.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot add multiple custom UUIDs?</title><link>https://devzone.nordicsemi.com/thread/239151?ContentTypeID=1</link><pubDate>Tue, 10 Mar 2020 14:01:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b9935ce4-49f3-414a-9e8f-f5842da60c38</guid><dc:creator>RVM</dc:creator><description>&lt;p&gt;I have already read the note and do understand it.&lt;br /&gt;I just wanted to confirm that my understanding was correct.&lt;/p&gt;
&lt;p&gt;In this case, what is the best option to switch between broadcasting and scanning &amp;quot;with the same base UUID but different bytes 12 and 13&amp;quot;? Is that even allowed/possible with Nordic nRF52?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot add multiple custom UUIDs?</title><link>https://devzone.nordicsemi.com/thread/239028?ContentTypeID=1</link><pubDate>Tue, 10 Mar 2020 09:43:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:148c0c80-2bf7-4dd7-87ab-18e4d35dc2cb</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;This is explained in the &lt;strong&gt;Note&lt;/strong&gt; in the API documentation for&amp;nbsp;&lt;span&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v6.1.1/group___b_l_e___c_o_m_m_o_n___f_u_n_c_t_i_o_n_s.html#ga265b4251110a15120d0aa97e5152163b"&gt;sd_ble_uuid_vs_add&lt;/a&gt;:&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;em&gt;&lt;strong&gt;Bytes 12 and 13 of the provided UUID will not be used internally&lt;/strong&gt;, since those are always replaced by the 16-bit uuid field in&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v6.1.1/structble__uuid__t.html"&gt;ble_uuid_t&lt;/a&gt;.&lt;br /&gt;&lt;strong&gt;If a UUID is already present in the BLE stack&amp;#39;s internal table, the corresponding index will be returned&lt;/strong&gt; in p_uuid_type along with an&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v6.1.1/group__nrf__error.html#ga7e6367efeaac363d8cf024940b4ec123"&gt;NRF_SUCCESS&lt;/a&gt;&amp;nbsp;error code.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Since bytes 12 and 13 are masked out, you are adding the same base UUID twice. If the base UUID already exists in the table, the corresponding index will be returned.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>