<?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>Method of reading value from peripheral by BLE communication</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/46459/method-of-reading-value-from-peripheral-by-ble-communication</link><description>Hello 
 
 I am using Android and BLE communication with nRF52832 (BLENano2) now. 
 I am using SDK 15.0.0 with keil uversion. 
 Central is Android and peripheral is nRF52832. 
 Use the SDK &amp;quot;app_ble_blinky. 
 I want to send the sensor output value from</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 14 May 2019 06:00:07 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/46459/method-of-reading-value-from-peripheral-by-ble-communication" /><item><title>RE: Method of reading value from peripheral by BLE communication</title><link>https://devzone.nordicsemi.com/thread/186823?ContentTypeID=1</link><pubDate>Tue, 14 May 2019 06:00:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9f325ed0-6c24-4dfc-ac74-9fb061e5dc26</guid><dc:creator>y001</dc:creator><description>&lt;p&gt;It solved by calling the function in the main for loop without using Timer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Method of reading value from peripheral by BLE communication</title><link>https://devzone.nordicsemi.com/thread/185817?ContentTypeID=1</link><pubDate>Wed, 08 May 2019 05:13:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b34098b5-444e-41f0-abce-ca730cd14919</guid><dc:creator>y001</dc:creator><description>&lt;p&gt;&lt;span title=""&gt;I&amp;#39;m sorry&lt;/span&gt;&lt;br /&gt;&lt;span title=""&gt;It seems that I can not see the log information with my BLENano2 (nRF52832)&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;I will try it in other ways&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Method of reading value from peripheral by BLE communication</title><link>https://devzone.nordicsemi.com/thread/184810?ContentTypeID=1</link><pubDate>Thu, 02 May 2019 09:12:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b2cb75d4-2a67-42a2-9994-7ec3b77e5fd6</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Do you have any way of knowing what happens in your code? Do you have possibilities for logging? Do you see: &amp;quot;Blinky example started.&amp;quot; in a log when you run your project? (which is coming from:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;NRF_LOG_INFO(&amp;quot;Blinky example started.&amp;quot;);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;If yes, then you can try to do this when you use send_value():&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void notification_timeout_handler(void * p_context)
{
    UNUSED_PARAMETER(p_context);
    ret_code_t err_code;
    
    // Increment the value of m_custom_value before nortifing it.
    m_custom_value++;
    
    err_code = send_value(m_conn_handle,&amp;amp;m_lbs, m_custom_value);
    NRF_LOG_INFO(&amp;quot;send_value() returned %d&amp;quot;, err_code):
    //APP_ERROR_CHECK(err_code);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Remember to comment out this APP_ERROR_CHECK();&lt;/p&gt;
&lt;p&gt;If you have logging enabled, it may also be a good idea to add DEBUG to your preprocessor defines:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-f46a45ee92a6483aba0a95346c7518d1/pastedimage1556788298505v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;It will make sure your log prints the errors that are caught by the APP_ERROR_CHECK(err_code).&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Method of reading value from peripheral by BLE communication</title><link>https://devzone.nordicsemi.com/thread/183920?ContentTypeID=1</link><pubDate>Fri, 26 Apr 2019 02:31:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:084b0692-8425-4aae-8371-2e49bb89c189</guid><dc:creator>y001</dc:creator><description>&lt;p&gt;&lt;span style="background-attachment:scroll;background-color:transparent;background-image:none;background-repeat:repeat;background-size:auto;color:rgba(0, 0, 0, 0.87);font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:pre-wrap;" title=""&gt;I see, I was mistaken&lt;/span&gt;&lt;br style="background-attachment:scroll;background-color:transparent;background-image:none;background-repeat:repeat;background-size:auto;color:rgba(0, 0, 0, 0.87);font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:pre-wrap;" /&gt;&lt;br style="background-attachment:scroll;background-color:transparent;background-image:none;background-repeat:repeat;background-size:auto;color:rgba(0, 0, 0, 0.87);font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:pre-wrap;" /&gt;&lt;span style="background-attachment:scroll;background-color:transparent;background-image:none;background-repeat:repeat;background-size:auto;color:rgba(0, 0, 0, 0.87);font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:pre-wrap;" title=""&gt;Where can I check &amp;quot;err_code&amp;quot;?&lt;/span&gt;&lt;br style="background-attachment:scroll;background-color:transparent;background-image:none;background-repeat:repeat;background-size:auto;color:rgba(0, 0, 0, 0.87);font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:pre-wrap;" /&gt;&lt;span style="background-attachment:scroll;background-color:transparent;background-image:none;background-repeat:repeat;background-size:auto;color:rgba(0, 0, 0, 0.87);font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:pre-wrap;" title=""&gt;Can I not see if I do not have a debugger such as J-Link?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Method of reading value from peripheral by BLE communication</title><link>https://devzone.nordicsemi.com/thread/183781?ContentTypeID=1</link><pubDate>Thu, 25 Apr 2019 11:47:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cda5190f-33d4-4cde-9944-febd3c1bfe9e</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;no. Your send_value function returns an uint32_t. At the last line of your function you see that it returns:&lt;/p&gt;
&lt;p&gt;return err_code;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Depending on the behavior of the function, and the state of the nRF, it returns the return value of either&amp;nbsp;sd_ble_gatts_value_set() if it is not NRF_SUCCESS. If not it returns or else it returns&amp;nbsp;NRF_ERROR_INVALID_STATE if the conn_handle is not set. If none of the above, it returns the return value of&amp;nbsp;sd_ble_gatts_hvx().&lt;/p&gt;
&lt;p&gt;So what number does send_value() return? If it is not 0 (=NRF_SUCCESS), what function call inside send_value() does the return value, err_code, come from?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Method of reading value from peripheral by BLE communication</title><link>https://devzone.nordicsemi.com/thread/183688?ContentTypeID=1</link><pubDate>Thu, 25 Apr 2019 08:38:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1c16cdb3-67ea-4874-bf38-e4613379bc03</guid><dc:creator>y001</dc:creator><description>&lt;p&gt;&lt;span style="background-attachment:scroll;background-color:transparent;background-image:none;background-repeat:repeat;background-size:auto;color:rgba(0, 0, 0, 0.87);font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:pre-wrap;" title=""&gt;Returns the argument &amp;quot;sensor_value&amp;quot;.&lt;/span&gt;&lt;br style="background-attachment:scroll;background-color:transparent;background-image:none;background-repeat:repeat;background-size:auto;color:rgba(0, 0, 0, 0.87);font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:pre-wrap;" /&gt;&lt;span style="background-attachment:scroll;background-color:transparent;background-image:none;background-repeat:repeat;background-size:auto;color:rgba(0, 0, 0, 0.87);font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:pre-wrap;" title=""&gt;The initial value of this argument is 0, increasing by 1 each second.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-attachment:scroll;background-color:transparent;background-image:none;background-repeat:repeat;background-size:auto;color:rgba(0, 0, 0, 0.87);font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:pre-wrap;" title=""&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span title=""&gt;The timer may not be send_value working because the value is constant&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Method of reading value from peripheral by BLE communication</title><link>https://devzone.nordicsemi.com/thread/183638?ContentTypeID=1</link><pubDate>Thu, 25 Apr 2019 06:49:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b062475b-481a-448e-aed5-2b9acd31d1c1</guid><dc:creator>Edvin</dc:creator><description>[quote user="Edvin Holmseth"]What does send_value return?[/quote]
&lt;p&gt;&amp;nbsp;0? or something else? What?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Method of reading value from peripheral by BLE communication</title><link>https://devzone.nordicsemi.com/thread/183607?ContentTypeID=1</link><pubDate>Thu, 25 Apr 2019 00:37:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ef24278f-c9ae-4823-9eec-54f55bcf1a56</guid><dc:creator>y001</dc:creator><description>&lt;p&gt;&lt;span title=""&gt;static void notification_timeout_handler (void * p_context)&lt;/span&gt;&lt;br /&gt;&lt;span title=""&gt;In it, we added +1 to the variable named m_custom_value.&lt;/span&gt; &lt;span title=""&gt;Since this is called by the timer function, there should be enough data that is 0 to +1 every second.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span title=""&gt;However, as in the previous screen shot, it is always 0x62, so it may be considered that the timer function is not working properly or the send_value function is not working properly.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Method of reading value from peripheral by BLE communication</title><link>https://devzone.nordicsemi.com/thread/183417?ContentTypeID=1</link><pubDate>Wed, 24 Apr 2019 11:28:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bc1a688b-75f4-4d2c-8c0c-01d2c36c96bf</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Ok. So you have enabled the notifications on the phone app by tapping the three arrows pointing down next to the characteristic of which you want to enable notifications.&lt;/p&gt;
&lt;p&gt;What does send_value return?&lt;/p&gt;
&lt;p&gt;It looks like you sent 0x62, since that is the current value in your screenshot?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Method of reading value from peripheral by BLE communication</title><link>https://devzone.nordicsemi.com/thread/183283?ContentTypeID=1</link><pubDate>Wed, 24 Apr 2019 01:34:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e5277f49-4e54-446c-b2e9-6f093474987a</guid><dc:creator>y001</dc:creator><description>&lt;p&gt;Thank you for reply!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-attachment:scroll;background-color:transparent;background-image:none;background-repeat:repeat;background-size:auto;color:rgba(0, 0, 0, 0.87);font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:pre-wrap;" title=""&gt;The previous window is as follows.&lt;/span&gt;&lt;br style="background-attachment:scroll;background-color:transparent;background-image:none;background-repeat:repeat;background-size:auto;color:rgba(0, 0, 0, 0.87);font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:pre-wrap;" /&gt;&lt;span style="background-attachment:scroll;background-color:transparent;background-image:none;background-repeat:repeat;background-size:auto;color:rgba(0, 0, 0, 0.87);font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:pre-wrap;" title=""&gt;It will be the button and LED characteristic of &amp;quot;ble_app_blinky&amp;quot; with its own characteristic added&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/IMG_5F00_4063.PNG" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;quot;send_value&amp;quot; is a function that sends the argument &amp;quot;sonsor_value&amp;quot;.&lt;/p&gt;
&lt;p&gt;At this stage, when calling &amp;quot;send_value&amp;quot; in the main, it is made to transmit +1 every second by Timer function.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;uint32_t send_value(uint16_t conn_handle, ble_lbs_t * p_lbs, uint8_t sensor_value)
{
	
	if (p_lbs == NULL)
    {
        return NRF_ERROR_NULL;
    }

		
		
	ble_gatts_value_t gatts_value;
	uint32_t err_code = NRF_SUCCESS;

	
	// 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;sensor_value;

	// Update database.
  err_code = sd_ble_gatts_value_set(conn_handle,
                                      p_lbs-&amp;gt;sensor_char_handles.value_handle,
                                      &amp;amp;gatts_value);

	
		
		if (err_code != NRF_SUCCESS)
{
    return err_code;
}


	
	// Send value if connected and notifying.
    if ((conn_handle != BLE_CONN_HANDLE_INVALID)) 
    {
        ble_gatts_hvx_params_t hvx_params;

        memset(&amp;amp;hvx_params, 0, sizeof(hvx_params));

        hvx_params.handle = p_lbs-&amp;gt;sensor_char_handles.value_handle;
        hvx_params.type   = BLE_GATT_HVX_NOTIFICATION;
        hvx_params.offset = gatts_value.offset;
        hvx_params.p_len  = &amp;amp;gatts_value.len;
        hvx_params.p_data = gatts_value.p_value;

        err_code = sd_ble_gatts_hvx(conn_handle, &amp;amp;hvx_params);
    }
    else
    {
        err_code = NRF_ERROR_INVALID_STATE;
    }
		return err_code;
}
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Method of reading value from peripheral by BLE communication</title><link>https://devzone.nordicsemi.com/thread/183184?ContentTypeID=1</link><pubDate>Tue, 23 Apr 2019 14:52:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e0ac19bd-9ed1-4122-ba0f-a80f7d0fab85</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;The Client Configure Characteristic will not change when you send notifications. When this characteristic is 1, it means that notifications are turned on. If you go one level up (the window that was there before you clicked the service which led to this screenshot. What does that look like?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Where do you send the notifications/data from your peripheral? It looks like it is the function send_value(). What does it do, and what does it return?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>