<?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 make Service and Characteristic UUIDs show as 16-bit instead of 128-bit?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/85256/how-to-make-service-and-characteristic-uuids-show-as-16-bit-instead-of-128-bit</link><description>I currently am working on a BLE device in which I am trying to set the Service and Characteristic UUIDs. Here is an example of what I mean: 
 
 As can be seen here, the Service and Characteristic UUIDs are all custom 16-bit UUIDs. 
 However, when I try</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 01 Mar 2022 20:34:42 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/85256/how-to-make-service-and-characteristic-uuids-show-as-16-bit-instead-of-128-bit" /><item><title>RE: How to make Service and Characteristic UUIDs show as 16-bit instead of 128-bit?</title><link>https://devzone.nordicsemi.com/thread/355658?ContentTypeID=1</link><pubDate>Tue, 01 Mar 2022 20:34:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:343e0401-2985-4f74-bde8-93097475f7a7</guid><dc:creator>tjhasan</dc:creator><description>&lt;p&gt;Thank you, after looking at your previous response in that thread, I looked into the (&lt;span&gt;components\ble\ble_services\ble_dfu\ble_dfu.c)&lt;/span&gt; code you mentioned and from it found the &lt;strong&gt;&lt;span&gt;BLE_UUID_BLE_ASSIGN&lt;/span&gt;&lt;/strong&gt; method. This method ended up working as I wanted.&lt;/p&gt;
&lt;p&gt;For people who find this thread in the future, here is the source code that I used to create the service:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;uint32_t ble_cus_init(ble_cus_t * p_cus, const ble_cus_init_t * p_cus_init)
{
    if (p_cus == NULL || p_cus_init == NULL)
    {
        return NRF_ERROR_NULL;
    }

    uint32_t   err_code;
    ble_uuid_t ble_uuid;

    // Initialize service structure
    p_cus-&amp;gt;evt_handler               = p_cus_init-&amp;gt;evt_handler;
    p_cus-&amp;gt;conn_handle               = BLE_CONN_HANDLE_INVALID;

    // Add Custom Service UUID
    ble_uuid128_t base_uuid = {CUSTOM_SERVICE_UUID_BASE};

    err_code =  sd_ble_uuid_vs_add(&amp;amp;base_uuid, &amp;amp;p_cus-&amp;gt;uuid_type);
    VERIFY_SUCCESS(err_code);
    
    ble_uuid.type = p_cus-&amp;gt;uuid_type;
    ble_uuid.uuid = CUSTOM_SERVICE_UUID;

    BLE_UUID_BLE_ASSIGN(ble_uuid, CUSTOM_SERVICE_UUID);

    // Add the Custom Service
    err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, &amp;amp;ble_uuid, &amp;amp;p_cus-&amp;gt;service_handle);
    if (err_code != NRF_SUCCESS)
    {
        return err_code;
    }

    // Add Custom Value characteristic
    return custom_value_char_add(p_cus, p_cus_init);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;You can set the characteristic UUIDs in a similar way. Just use the &lt;strong&gt;BLE_UUID_BLE_ASSIGN &lt;/strong&gt;in the same way before the &lt;strong&gt;sd_ble_gatts_characteristic_add&lt;/strong&gt; method.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Here is the resulting UUIDs from using this method:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1646166880716v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to make Service and Characteristic UUIDs show as 16-bit instead of 128-bit?</title><link>https://devzone.nordicsemi.com/thread/355589?ContentTypeID=1</link><pubDate>Tue, 01 Mar 2022 14:13:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ec61697f-4ceb-4291-9df4-ec4b6d9316a2</guid><dc:creator>Kazi Afroza Sultana</dc:creator><description>&lt;p&gt;Hello Tanjim,&lt;/p&gt;
&lt;p&gt;Thanks for your question.&lt;/p&gt;
&lt;p&gt;There is a similar case I answered before&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/support-private/support/280801"&gt;Nordic DevZone (nordicsemi.com)&lt;/a&gt;. A UUID is a 128 value. However there are reserved UUIDs reserved by Bluetooth which contain 16 bits. You need to register to get this certified and which is really expensive&amp;nbsp;&lt;a href="https://www.novelbits.io/uuid-for-custom-services-and-characteristics/"&gt;How do I choose a UUID for my custom services and characteristics? - Novel Bits&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;/p&gt;
&lt;p&gt;Kazi Afroza Sultana&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>