<?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>Problem with sd_ble_gatts_hvx without notifications enabled</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/18908/problem-with-sd_ble_gatts_hvx-without-notifications-enabled</link><description>Hi there! 
 I am trying to add custom UUID&amp;#39;s for my BLE application.
I have a custom service which has 2 RX and 3 TX characteristics. 
 I have a situation where the Android APP that I am using doesn&amp;#39;t notify. Because of this I am not able to write</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 18 Jan 2019 09:31:20 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/18908/problem-with-sd_ble_gatts_hvx-without-notifications-enabled" /><item><title>RE: Problem with sd_ble_gatts_hvx without notifications enabled</title><link>https://devzone.nordicsemi.com/thread/166423?ContentTypeID=1</link><pubDate>Fri, 18 Jan 2019 09:31:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ca827ad2-5d2b-4cd7-bc24-704912e3afc8</guid><dc:creator>Eugene0469</dc:creator><description>&lt;p&gt;Hello. I&amp;#39;d like to read the temperature values in my nordic thingy without enabling notifications. Is there a way one can use the function sd_ble_gatts_value_set() to do this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with sd_ble_gatts_hvx without notifications enabled</title><link>https://devzone.nordicsemi.com/thread/73072?ContentTypeID=1</link><pubDate>Fri, 10 Feb 2017 10:07:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4da6b8a2-3448-4f2b-bec2-174e42a1427a</guid><dc:creator>Anders Strand</dc:creator><description>&lt;p&gt;Hey. Would you mind sharing a code snippet that works for you? it would be nice too know how and where you calculated the CRC as well.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with sd_ble_gatts_hvx without notifications enabled</title><link>https://devzone.nordicsemi.com/thread/73071?ContentTypeID=1</link><pubDate>Fri, 13 Jan 2017 10:50:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fe000ae9-4c86-4dd1-aa39-ecf542aeed47</guid><dc:creator>Gauti</dc:creator><description>&lt;p&gt;Manually enable notification and calculate the CRC (CRC-CCIT - 0xFFFF). Update the new attributes along with CRC using the function  sd_ble_gatts_sys_attr_set(). With the updated system attributes, use sd_ble_gatts_hvx() to write the values. This seems to be working fine. Of course we have to explicitly read the value from the mobile.
Each CCCD is 3 byte long (SDK12.1). This is followed by 2 byte CRC at the end.
So if the CCCD count is 3, length would be: 3x6 + 2 = 14&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with sd_ble_gatts_hvx without notifications enabled</title><link>https://devzone.nordicsemi.com/thread/73070?ContentTypeID=1</link><pubDate>Fri, 13 Jan 2017 10:41:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f4a93a5a-1dd9-4059-b0db-4d9eaa4f8957</guid><dc:creator>Gauti</dc:creator><description>&lt;p&gt;Yes true, I used sd_ble_gatts_value_set() to set the value directly as you mentioned.
I did not get any error code, meaning return from this function was 0. I did try to explicitly read from the phone to fetch the value, but this was not successful.
However I used another method. I manually enabled notification by using the function sd_ble_gatts_sys_attr_set(). I calculated the CRC (CRC-CCIT - 0xFFFF) and updated the same using this function. With the updated system attributes, I used sd_ble_gatts_hvx() to write the values. This seems to be working fine. Of course I have to explicitly read the value from the mobile.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with sd_ble_gatts_hvx without notifications enabled</title><link>https://devzone.nordicsemi.com/thread/73069?ContentTypeID=1</link><pubDate>Thu, 12 Jan 2017 12:33:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7b3ba3d0-5de7-40b2-a39c-6267dabaa3b6</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;That link only say that you cannot write the cccd of the characteristics using &lt;code&gt;sd_ble_gatts_value_set()&lt;/code&gt;. You should still be able to set the value of the characteristics using this function. I tested this on the BLE UART example, and that works fine. Are you getting any error codes from &lt;code&gt;sd_ble_gatts_value_set()&lt;/code&gt; when you use that code? Note that you explicitly have to read the characteristics on the phone to get the value, you will not get any hints that a new value is available.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with sd_ble_gatts_hvx without notifications enabled</title><link>https://devzone.nordicsemi.com/thread/73068?ContentTypeID=1</link><pubDate>Wed, 11 Jan 2017 14:39:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3e7f4ba6-3b02-483b-bd49-b87bff3bbb35</guid><dc:creator>Gauti</dc:creator><description>&lt;p&gt;Hi, Thanks for your reply!
I did add the below piece of code in on_connect() with no luck:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;uint32_t          err_code;
uint8_t           default_protocol_mode;
ble_gatts_value_t gatts_value;

lsp_nus-&amp;gt;conn_handle = lsp_ble_evt-&amp;gt;evt.gap_evt.conn_handle;

if (lsp_nus-&amp;gt;rx_handles.value_handle)
{
    // Set Protocol Mode characteristic value to default value
    default_protocol_mode = 0;

    // Initialize value struct.
    memset(&amp;amp;gatts_value, 0, sizeof(gatts_value));

    gatts_value.len     = sizeof(uint8_t);
    gatts_value.offset  = 0;
    gatts_value.p_value = &amp;amp;default_protocol_mode;

    err_code = sd_ble_gatts_value_set(lsp_nus-&amp;gt;conn_handle,
    		lsp_nus-&amp;gt;rx_handles.value_handle, &amp;amp;gatts_value);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The following link:
&lt;a href="https://devzone.nordicsemi.com/question/89647/automatically-start-notification-upon-connection-event-manually-write-cccd-short-tutorial-on-notifications/"&gt;devzone.nordicsemi.com/.../&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;claims that sd_ble_gatts_value_set() might not serve the purpose.
Any thing else that I can try to make this work?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with sd_ble_gatts_hvx without notifications enabled</title><link>https://devzone.nordicsemi.com/thread/73067?ContentTypeID=1</link><pubDate>Wed, 11 Jan 2017 07:48:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5cd89278-35eb-48da-86b5-e8bbff2a3e66</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;If notifications is not enabled, you should use &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s130.api.v2.0.1/group___b_l_e___g_a_t_t_s___f_u_n_c_t_i_o_n_s.html#ga2760c51ea71853bd74e2e7e7117ef52a"&gt;&lt;code&gt;sd_ble_gatts_value_set()&lt;/code&gt;&lt;/a&gt; to set the value of the characteristics. The other side then needs to read the characteristics to get the new value.&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>