<?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 add the descriptions of GATT Primary Service(0x2800) and GATT characteristic?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/9289/how-to-add-the-descriptions-of-gatt-primary-service-0x2800-and-gatt-characteristic</link><description>How to add the descriptions of GATT Primary Service(0x2800) and GATT characteristic? Just like the picture below.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 18 Sep 2015 07:39:45 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/9289/how-to-add-the-descriptions-of-gatt-primary-service-0x2800-and-gatt-characteristic" /><item><title>RE: How to add the descriptions of GATT Primary Service(0x2800) and GATT characteristic?</title><link>https://devzone.nordicsemi.com/thread/34268?ContentTypeID=1</link><pubDate>Fri, 18 Sep 2015 07:39:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2516918c-067c-41fc-9d34-1fdbbd85f329</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;The example is located in &amp;quot;&lt;em&gt;your_sdk_folder\examples\ble_peripheral\ble_app_hids_mouse&lt;/em&gt;&amp;quot;. The &lt;code&gt;sd_ble_gatts_descriptor_add()&lt;/code&gt; function is used in e.g. the &lt;code&gt;rep_char_add()&lt;/code&gt; function found in ble_hids.c file.&lt;/p&gt;
&lt;p&gt;The code above is copy-pasted from a random example i made. &lt;em&gt;ble_os_t&lt;/em&gt; and &lt;em&gt;char_handle&lt;/em&gt; are just residues from that example. &lt;em&gt;ble_os_t&lt;/em&gt; is a service struct containing data about the service being worked on and &lt;em&gt;char_handle&lt;/em&gt; is the handle to the characteristic that you want to add a descriptor to. If you want to use the code above you will have to modify it a bit to fit your particular application.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to add the descriptions of GATT Primary Service(0x2800) and GATT characteristic?</title><link>https://devzone.nordicsemi.com/thread/34270?ContentTypeID=1</link><pubDate>Thu, 17 Sep 2015 17:38:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:02a9bc3b-981f-4f9e-95cb-210f1c03854f</guid><dc:creator>zqclzz</dc:creator><description>&lt;p&gt;Hi, Martin Børs-Lind&lt;/p&gt;
&lt;p&gt;I can&amp;#39;t find the example how to add descriptors in the ble_app_hids_mouse example . And, what is the ble_os_t and and char_handle in the code you showed above. Can you tell me how to use the &amp;quot;our_descriptor_add()&amp;quot; detailedly?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to add the descriptions of GATT Primary Service(0x2800) and GATT characteristic?</title><link>https://devzone.nordicsemi.com/thread/34269?ContentTypeID=1</link><pubDate>Thu, 17 Sep 2015 13:26:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ead08203-660e-4c67-9652-b642c8d12fda</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;You can use &lt;code&gt;sd_ble_gatts_descriptor_add()&lt;/code&gt; to add &lt;a href="https://developer.bluetooth.org/gatt/descriptors/Pages/DescriptorViewer.aspx?u=org.bluetooth.descriptor.gatt.characteristic_user_description.xml"&gt;Characteristic User Descriptions&lt;/a&gt; to your characteristics.&lt;/p&gt;
&lt;p&gt;You can do something like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static uint32_t our_descriptor_add(ble_os_t * p_our_service, uint16_t char_handle)
{
    uint32_t   err_code; // Variable to hold return codes from library and softdevice functions
    
    ble_gatts_attr_md_t    attr_md;
    memset(&amp;amp;attr_md, 0, sizeof(attr_md));

    BLE_GAP_CONN_SEC_MODE_SET_OPEN(&amp;amp;attr_md.read_perm);
    BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&amp;amp;attr_md.write_perm);

    attr_md.vloc    = BLE_GATTS_VLOC_STACK;
    attr_md.rd_auth = 0;
    attr_md.wr_auth = 0;
    attr_md.vlen    = 0;
    
    ble_uuid_t          attr_uuid;
    attr_uuid.uuid      = BLE_UUID_DESCRIPTOR_CHAR_USER_DESC;
    ble_uuid128_t       base_uuid = {0x23, 0xD1, 0x13, 0xEF, 0x5F, 0x78, 0x23, 0x15, 0xDE, 0xEF, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00}; // 128-bit base UUID
    err_code = sd_ble_uuid_vs_add(&amp;amp;base_uuid, &amp;amp;attr_uuid.type);
    APP_ERROR_CHECK(err_code); 
    
    
    uint8_t attr_value[]  = &amp;quot;Your User description&amp;quot;;
    const uint16_t attr_len   = sizeof(attr_value);
    
    ble_gatts_attr_t    attr;
    memset(&amp;amp;attr, 0, sizeof(attr));
    
    attr.init_len       = attr_len;
    attr.max_len        = attr_len;
    attr.init_offs      = 0;
    attr.p_value        = attr_value;
    attr.p_attr_md      = &amp;amp;attr_md;
    attr.p_uuid         = &amp;amp;attr_uuid;
    
    err_code = sd_ble_gatts_descriptor_add(char_handle, &amp;amp;attr, &amp;amp;p_our_service-&amp;gt;descr_handle);
    APP_ERROR_CHECK(err_code); 
    
    return err_code;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Please have a look at e.g. the &lt;em&gt;ble_app_hids_mouse&lt;/em&gt; example in e.g. SDK 9.0.0. It shows how to add descriptors like this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>