<?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 set Service UUID for central and peripheral</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/19861/how-to-set-service-uuid-for-central-and-peripheral</link><description>Hi. I&amp;#39;m using nRF51822AC, SDK12.2.0, S130 as central and peripheral. 
 Q1. What&amp;#39;s &amp;quot;sd_ble_uuid_vs_add&amp;quot; function? is it for setting service UUID?
Q2. If Q1 yes, how to change service uuid? 
 for example)
I want to set service uuid as below. 
 For</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 28 Feb 2017 01:28:20 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/19861/how-to-set-service-uuid-for-central-and-peripheral" /><item><title>RE: How to set Service UUID for central and peripheral</title><link>https://devzone.nordicsemi.com/thread/77253?ContentTypeID=1</link><pubDate>Tue, 28 Feb 2017 01:28:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:360999de-279a-4ed6-8b58-1e09acce27a7</guid><dc:creator>roger.k</dc:creator><description>&lt;p&gt;Thank you so much for your help. It&amp;#39;s very helpful. I solved it with your answer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to set Service UUID for central and peripheral</title><link>https://devzone.nordicsemi.com/thread/77255?ContentTypeID=1</link><pubDate>Mon, 27 Feb 2017 12:17:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac861837-5f7c-44a2-adf4-d515ec187f18</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;If you add multiple BASE_UUIDs to the stack using &lt;code&gt;sd_ble_uuid_vs_add()&lt;/code&gt;, you have to set the UUID type to the correct number.&lt;/p&gt;
&lt;p&gt;In ble_app_uart example, the UUID type is set to &lt;code&gt;BLE_UUID_TYPE_VENDOR_BEGIN&lt;/code&gt;, as there is only one vendor specific base UUID added to the stack. If you add multiple base UUIDs, you will have to set the UUID type in the order the base UUIDs are added to the stack:&lt;/p&gt;
&lt;p&gt;If you have two vendor specific services that you want to advertise, defined like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define NUS_BASE_UUID					{{0x9E, 0xCA, 0xDC, 0x24, 0x0E, 0xE5, 0xA9, 0xE0, 0x93, 0xF3, 0xA3, 0xB5, 0x00, 0x00, 0x40, 0x6E}}
#define LBS_UUID_BASE        			{{0x23, 0xD1, 0xBC, 0xEA, 0x5F, 0x78, 0x23, 0x15, 0xDE, 0xEF, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00}}

#define BLE_UUID_NUS_SERVICE 			0x0001
#define LBS_UUID_SERVICE				0x1523
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Your UUID types should be:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define NUS_SERVICE_UUID_TYPE      		BLE_UUID_TYPE_VENDOR_BEGIN
#define LBS_SERVICE_UUID_TYPE			BLE_UUID_TYPE_VENDOR_BEGIN + 1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And you should add the base UUIDs to the stack in this order:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sd_ble_uuid_vs_add(NUS_BASE_UUID)
sd_ble_uuid_vs_add(LBS_UUID_BASE)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can then add the two UUIDs, with different base UUIDs, to the advertising/scan response packet:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static ble_uuid_t                       m_adv_uuids[] = {{BLE_UUID_NUS_SERVICE, NUS_SERVICE_UUID_TYPE},{LBS_UUID_SERVICE, LBS_SERVICE_UUID_TYPE}};

advdata.uuids_more_available.uuid_cnt = 1;
advdata.uuids_more_available.p_uuids  = &amp;amp;m_adv_uuids[0];

scanrsp.uuids_more_available.uuid_cnt = 1;
scanrsp.uuids_more_available.p_uuids  = &amp;amp;m_adv_uuids[1];
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to set Service UUID for central and peripheral</title><link>https://devzone.nordicsemi.com/thread/77254?ContentTypeID=1</link><pubDate>Mon, 27 Feb 2017 00:04:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c5e9267f-c911-4bdf-b8a1-5fc59a7f1813</guid><dc:creator>roger.k</dc:creator><description>&lt;p&gt;I want to use nRF51822 as Central and Peripheral as well. Please refer to my question at the top. I made init code for Central using &amp;quot;lbs_base_uuid&amp;quot; and then made init code for Peripheral using &amp;quot;p_base_uuid&amp;quot;. Central function is working well, but Peripheral is not working well. I&amp;#39;m sure that I added all the code what you let me know. But it still advertises &amp;quot;lbs_base_uuid&amp;quot; not &amp;quot;p_base_uuid&amp;quot;.
When I remove Central init code, it advertises &amp;quot;p_base_uuid&amp;quot;. I don&amp;#39;t know why does it advertise central UUID? That&amp;#39;s what i&amp;#39;m asking.&lt;/p&gt;
&lt;p&gt;I need your help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to set Service UUID for central and peripheral</title><link>https://devzone.nordicsemi.com/thread/77252?ContentTypeID=1</link><pubDate>Thu, 23 Feb 2017 13:37:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:23c501df-d970-405e-bcb8-b6831daa43ee</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;You need to add the base UUID to the stack using &lt;code&gt;sd_ble_uuid_vs_add()&lt;/code&gt;. This function is described in &lt;a href="https://devzone.nordicsemi.com/question/639/how-can-i-use-a-vendor-specific-uuid/?answer=640#post-id-640"&gt;this answer&lt;/a&gt;. You then need to add the characteristics to the GATT table with the new base UUID. Why do you want to change the base UUID outside initialization?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to set Service UUID for central and peripheral</title><link>https://devzone.nordicsemi.com/thread/77251?ContentTypeID=1</link><pubDate>Wed, 22 Feb 2017 23:38:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c07dab80-3152-4210-8eef-72a024b1f55d</guid><dc:creator>roger.k</dc:creator><description>&lt;p&gt;If i want to use 2 different Base UUID, how can I change them?
I want to change them whenever I want.&lt;/p&gt;
&lt;p&gt;I need your help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to set Service UUID for central and peripheral</title><link>https://devzone.nordicsemi.com/thread/77247?ContentTypeID=1</link><pubDate>Wed, 22 Feb 2017 14:39:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9a40271a-fdaf-49c0-905b-39487905bbfd</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;The Nordic UART Service is a 128-bit vendor-specific UUID, as described in &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v12.2.0/ble_sdk_app_nus_eval.html?cp=4_0_1_4_2_2_18"&gt;example documentation&lt;/a&gt; in the infocenter. The base UUID, &lt;code&gt;NUS_BASE_UUID&lt;/code&gt;, is defined in &lt;em&gt;ble_nus.c&lt;/em&gt;. This is added to the stack in &lt;code&gt;services_init()&lt;/code&gt; with a call to &lt;code&gt;sd_ble_uuid_vs_add()&lt;/code&gt;. When the UUID is added to the advertising data, the &lt;code&gt;NUS_SERVICE_UUID_TYPE&lt;/code&gt; is used to get the base UUID from the stack.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to set Service UUID for central and peripheral</title><link>https://devzone.nordicsemi.com/thread/77250?ContentTypeID=1</link><pubDate>Wed, 22 Feb 2017 08:08:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9c756526-6816-4a33-9c31-180f8df8e1da</guid><dc:creator>roger.k</dc:creator><description>&lt;p&gt;How can it be 128bit? BLE_UUID_NUS_SERVICE is 16bit as below.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define BLE_UUID_NUS_SERVICE 0x0001
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I still need your help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to set Service UUID for central and peripheral</title><link>https://devzone.nordicsemi.com/thread/77249?ContentTypeID=1</link><pubDate>Wed, 22 Feb 2017 07:57:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3e6d0aea-13a4-49c4-afd2-3a1c36b90b67</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;The advdata struct can take 128-bit UUIDs, you just needs to specify the correct &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v3.0.0/group___b_l_e___u_u_i_d___t_y_p_e_s.html"&gt;UUID type&lt;/a&gt;. You should use the type &lt;code&gt;BLE_UUID_TYPE_VENDOR_BEGIN&lt;/code&gt; for 128-bit UUIDs.&lt;/p&gt;
&lt;p&gt;This is how a 128-bit UUID is added to the scan response package in the ble_app_uart example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define NUS_SERVICE_UUID_TYPE           BLE_UUID_TYPE_VENDOR_BEGIN  
static ble_uuid_t                       m_adv_uuids[] = {{BLE_UUID_NUS_SERVICE, NUS_SERVICE_UUID_TYPE}};
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And in &lt;code&gt;advertising_init()&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;scanrsp.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
scanrsp.uuids_complete.p_uuids  = m_adv_uuids;
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to set Service UUID for central and peripheral</title><link>https://devzone.nordicsemi.com/thread/77248?ContentTypeID=1</link><pubDate>Wed, 22 Feb 2017 05:17:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:508977fb-5e64-46ea-99ab-1fc4fa80a12b</guid><dc:creator>roger.k</dc:creator><description>&lt;p&gt;Thank you very much for your reply.
In &amp;quot;advertising_init&amp;quot; function, I can make custom advertising data as below.&lt;/p&gt;
&lt;p&gt;static void advertising_init(void)
{
uint32_t      err_code;
ble_advdata_t advdata;
ble_advdata_t scanrsp;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;// Build advertising data struct to pass into @ref ble_advertising_init.
memset(&amp;amp;advdata, 0, sizeof(advdata));
advdata.name_type          = BLE_ADVDATA_NO_NAME;
advdata.include_appearance = false;
advdata.flags              = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
advdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
advdata.uuids_complete.p_uuids  = m_adv_uuids;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;......
}&lt;/p&gt;
&lt;p&gt;In advdata structure, I can&amp;#39;t see &amp;quot;Complete list of 128-bit UUIDs available&amp;quot;.
I think &amp;quot;advdata.uuids_complete&amp;quot; supports just 16-bit UUID.
How can I send &amp;quot;Complete list of 128-bit UUIDs&amp;quot; in advertising data?&lt;/p&gt;
&lt;p&gt;I need your help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to set Service UUID for central and peripheral</title><link>https://devzone.nordicsemi.com/thread/77246?ContentTypeID=1</link><pubDate>Tue, 21 Feb 2017 09:01:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d8d626be-b01b-476c-b675-82aabe1ffc57</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The function &lt;code&gt;sd_ble_uuid_vs_add()&lt;/code&gt; is described &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v3.0.0/group___b_l_e___c_o_m_m_o_n___f_u_n_c_t_i_o_n_s.html#ga265b4251110a15120d0aa97e5152163b"&gt;in the infocenter&lt;/a&gt;. The UUIDs in the stack is not put into the advertising data by default, you have to add it yourself.&lt;/p&gt;
&lt;p&gt;If you application advertise the LBS UUID and you are using one of the examples from the SDK (ble_app_blinky?), it is most likely added to the advertising data in &lt;code&gt;advertising_init()&lt;/code&gt; function. You can have a look at the &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v12.2.0/ble_sdk_app_nus_eval.html?cp=4_0_1_4_2_2_18"&gt;ble_app_uart example&lt;/a&gt;, as this shows how to advertise a custom UUID.&lt;/p&gt;
&lt;p&gt;If you connect to your peripheral and perform a service discovery, do you see your custom service?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>