<?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 generate different UUID&amp;#39;s for service and characteristics</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/19857/how-to-generate-different-uuid-s-for-service-and-characteristics</link><description>Hello, 
 I want to generate different UUID for service and for characteristics with different base address for both. 
 I am updating base address in characteristics_add function and uses this function:
err_code = sd_ble_uuid_vs_add(&amp;amp;base_uuid, &amp;amp;char_uuid</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 05 May 2017 19:28:06 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/19857/how-to-generate-different-uuid-s-for-service-and-characteristics" /><item><title>RE: How to generate different UUID's for service and characteristics</title><link>https://devzone.nordicsemi.com/thread/77239?ContentTypeID=1</link><pubDate>Fri, 05 May 2017 19:28:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:05967f02-1190-4ad8-9929-66d8e7dfd1cc</guid><dc:creator>Vegar Westerlund</dc:creator><description>&lt;p&gt;Your problem is in the struct you send in to sd_ble_gatts_service_add. The call to sd_ble_uuid_vs_add will populate only the .type field of service_uuid, not .uuid. Instead, try this:&lt;/p&gt;
&lt;blockquote&gt;
&lt;pre&gt;&lt;code&gt;service_uuid.uuid = BLE_UUID_TEMPERATURE_SRV_UUID; // e.g. 0xaf22 or what ever...

err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY,
                                    &amp;amp;service_uuid,
                                    &amp;amp;m_temperature_service.service_handle);
APP_ERROR_CHECK(err_code);
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt;You can then have BLE_UUID_TEMPERATURE_ATTR_UUID for the attribute and so on....&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to generate different UUID's for service and characteristics</title><link>https://devzone.nordicsemi.com/thread/77238?ContentTypeID=1</link><pubDate>Fri, 24 Feb 2017 08:53:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7a03675d-d582-4742-9f69-276bd65c51a2</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;You say it &amp;quot;crashes&amp;quot;, do you mean that you get an error code? Have you checked what the error code is using &lt;a href="https://devzone.nordicsemi.com/question/60125/my-device-is-freezing-and-restarting/"&gt;debugging&lt;/a&gt;? I checked your code (incorporated the relevant lines into one of the SDK examples, as I don&amp;#39;t have your complete application), and I got two separate base UUIDs showing in nRF Connect.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to generate different UUID's for service and characteristics</title><link>https://devzone.nordicsemi.com/thread/77237?ContentTypeID=1</link><pubDate>Fri, 24 Feb 2017 08:45:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f3b6232-afa4-4cad-a7be-bc97dc33b623</guid><dc:creator>Swapnil</dc:creator><description>&lt;p&gt;The above code gives only one base UUID, but i need two separate base UUID&amp;#39;s for service and characteristics. when I add separate base UUID for characteristics it get crashes. I am checking UUID&amp;#39;s directly on mobile app nRF Connect.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to generate different UUID's for service and characteristics</title><link>https://devzone.nordicsemi.com/thread/77236?ContentTypeID=1</link><pubDate>Thu, 23 Feb 2017 10:29:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a42b0d52-11c6-46f0-9ae3-3282417f1c61</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;It looks correct to me. How are you checking the UUIDs?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to generate different UUID's for service and characteristics</title><link>https://devzone.nordicsemi.com/thread/77235?ContentTypeID=1</link><pubDate>Wed, 22 Feb 2017 15:13:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:290bca1a-6161-4af3-9505-4dfca1b52c1b</guid><dc:creator>Swapnil</dc:creator><description>&lt;p&gt;Thank you for your reply.
This is my code:
BLE stack init:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static void ble_stack_init(void)
{
	uint32_t err_code;

	nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;

	// Initialize the SoftDevice handler module
	SOFTDEVICE_HANDLER_INIT(&amp;amp;clock_lf_cfg, NULL);

	ble_enable_params_t ble_enable_params;
	err_code = softdevice_enable_get_default_config(CENTRAL_LINK_COUNT,
													PERIPHERAL_LINK_COUNT,
													&amp;amp;ble_enable_params);
	APP_ERROR_CHECK(err_code);

	// Check the ram settings against the used number of links
	CHECK_RAM_START_ADDR(CENTRAL_LINK_COUNT, PERIPHERAL_LINK_COUNT);

	// Enable BLE stack
	ble_enable_params.gatts_enable_params.service_changed = IS_SRVC_CHANGED_CHARACT_PRESENT;
	err_code = softdevice_enable(&amp;amp;ble_enable_params);
	APP_ERROR_CHECK(err_code);

	// Register with the SoftDevice handler module for BLE events
	err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch);
	APP_ERROR_CHECK(err_code);

	// Register with the SoftDevice handler module for BLE events
	err_code = softdevice_sys_evt_handler_set(sys_evt_dispatch);
	APP_ERROR_CHECK(err_code);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For service initialization:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void temperature_service_init()
{
    ble_uuid_t service_uuid;
    ble_uuid128_t base_uuid = BLE_UUID_TEMPERATURE_BASE_UUID;
    uint8_t i;
    uint32_t err_code;

    service_uuid.uuid = BLE_UUID_TEMPERATURE_SERVICE;
    err_code = sd_ble_uuid_vs_add(&amp;amp;base_uuid, &amp;amp;service_uuid.type);
    APP_ERROR_CHECK(err_code);

    m_temperature_service.conn_handle = BLE_CONN_HANDLE_INVALID;

    err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY,
                                        &amp;amp;service_uuid,
                                        &amp;amp;m_temperature_service.service_handle);
    APP_ERROR_CHECK(err_code);

    temperature_service_char_add(BLE_UUID_TEMPERATURE_CHAR_UUID, 0, true, false, true, 4);
}

temperature_service_char_add()--&amp;gt;

ble_uuid128_t base_uuid = {{0xa5, 0xa5, 0x00, 0x5b, 0x02, 0x00, 0x23, 0x9b, 0xe1, 0x11, 0x02, 0xd1, 0x00, 0x00, 0x34, 0x12}};
	ble_uuid_t char_uuid;
	ble_gatts_char_md_t char_md;
	ble_gatts_attr_md_t cccd_md;
	ble_gatts_attr_md_t attr_md;
	ble_gatts_attr_t attr_char_value;
	uint8_t value[20] = {0x12,0x34,0x56,0x78};
	uint32_t err_code = 0;

	char_uuid.uuid = uuid;
	char_uuid.type = BLE_UUID_TYPE_VENDOR_BEGIN;
	err_code = sd_ble_uuid_vs_add(&amp;amp;base_uuid, &amp;amp;char_uuid.type);
	APP_ERROR_CHECK(err_code);

	memset(&amp;amp;char_md, 0, sizeof(char_md));
	memset(&amp;amp;cccd_md, 0, sizeof(cccd_md));
	memset(&amp;amp;attr_md, 0, sizeof(attr_md));
	memset(&amp;amp;attr_char_value, 0, sizeof(attr_char_value));

	if(read_perm == true) {
		char_md.char_props.read = 1;
	} else {
		char_md.char_props.read = 0;
	}// if(read_perm == true)
	BLE_GAP_CONN_SEC_MODE_SET_OPEN(&amp;amp;cccd_md.read_perm);
	BLE_GAP_CONN_SEC_MODE_SET_OPEN(&amp;amp;attr_md.read_perm);
	if(write_perm == true) {
		char_md.char_props.write = 1;
	} else {
		char_md.char_props.write = 0;
	}// if(write_perm == true)
	BLE_GAP_CONN_SEC_MODE_SET_OPEN(&amp;amp;cccd_md.write_perm);
	BLE_GAP_CONN_SEC_MODE_SET_OPEN(&amp;amp;attr_md.write_perm);

	cccd_md.vloc = BLE_GATTS_VLOC_STACK;
	char_md.p_cccd_md = &amp;amp;cccd_md;
	if(notify_status == true) {
		char_md.char_props.notify = 1;
	} else {
		char_md.char_props.notify = 0;
	}// if(notify_status == true)

	attr_md.vloc = BLE_GATTS_VLOC_STACK;

	attr_char_value.p_uuid = &amp;amp;char_uuid;
	attr_char_value.p_attr_md = &amp;amp;attr_md;
	attr_char_value.max_len = char_length;
	attr_char_value.init_len = char_length;
	attr_char_value.p_value = value;

	err_code = sd_ble_gatts_characteristic_add(m_temperature_service.service_handle,
									   &amp;amp;char_md,
									   &amp;amp;attr_char_value,
									   &amp;amp;m_temperature_service.char_handles[handle_num]);
	APP_ERROR_CHECK(err_code);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I want separate base UUID for service and for characteristics&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to generate different UUID's for service and characteristics</title><link>https://devzone.nordicsemi.com/thread/77234?ContentTypeID=1</link><pubDate>Tue, 21 Feb 2017 10:01:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:68c3768d-cdaf-49e8-b37a-e310a20817ce</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Can you post some more detailed code about how you do this? How are you checking the new UUID? Also, see &lt;a href="https://devzone.nordicsemi.com/question/95102/different-uuids-for-characteristics/"&gt;this thread&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>