<?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>Reding GATT Characterictic value.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/108204/reding-gatt-characterictic-value</link><description>Hi All, 
 I am using the samples/bluetooth/central_hr and samples/bluetooth/peripheral_hr examples form the zephyr tree for evaluating the GATT characteristic value reading. I am getting output like: 
 
 I know this is the dummy heart rate values from</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 13 Feb 2024 13:04:53 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/108204/reding-gatt-characterictic-value" /><item><title>RE: Reding GATT Characterictic value.</title><link>https://devzone.nordicsemi.com/thread/468611?ContentTypeID=1</link><pubDate>Tue, 13 Feb 2024 13:04:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a0341205-4dac-4d10-98b6-acacb5c903e6</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;I am not sure of all the code on the central (here) and peripheral (GATT server) so there may be something I am not aware of regardign what this data represetn, but in any case, the read callback holds the data. It might be easier to test with something like the&amp;nbsp;NUS &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/bluetooth/central_uart/README.html"&gt;central&lt;/a&gt; and &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/bluetooth/peripheral_uart/README.html"&gt;peripheral&lt;/a&gt; samples, where you clearly have just a data &amp;quot;channel&amp;quot;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reding GATT Characterictic value.</title><link>https://devzone.nordicsemi.com/thread/468502?ContentTypeID=1</link><pubDate>Tue, 13 Feb 2024 05:10:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:457a35e0-a1da-4f49-8366-81946b066153</guid><dc:creator>Gotak</dc:creator><description>&lt;p&gt;Hi I actually use the central heart rate monitor example before posting this ticket,&lt;/p&gt;
&lt;p&gt;I am able to hear the GATT data from the peripheral hr example by giving the HRS UUID&amp;nbsp; to read the GATT characteristic value for the heart rate monitor.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I wanted to use this example to read by customised gatt UUID characteristics, so I modified the GATT UUID as required and I am able to read some gatt value which is as told in the above reply&lt;/p&gt;
&lt;p&gt;3 bytes + Characteristic UUID&lt;/p&gt;
&lt;p&gt;And as you told they these prefixed 3 bytes are the characteristic value but when I verified it in the nRF mobile app the same characteristic value is like : (0x) 01 which is not equal to the 3 bytes I got in my nRF gatt reading code output...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reding GATT Characterictic value.</title><link>https://devzone.nordicsemi.com/thread/468406?ContentTypeID=1</link><pubDate>Mon, 12 Feb 2024 12:05:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4bbc0848-6bff-4283-be62-5210ac00e7a1</guid><dc:creator>Gotak</dc:creator><description>&lt;p&gt;But in the nRF mobile app if I see the characteristic value it is like&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Value: (0x) 01&lt;/p&gt;
&lt;p&gt;Are they both considered same values?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reding GATT Characterictic value.</title><link>https://devzone.nordicsemi.com/thread/468397?ContentTypeID=1</link><pubDate>Mon, 12 Feb 2024 11:51:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:36296150-4738-4159-ab41-da1f55891084</guid><dc:creator>Einar Thorsrud</dc:creator><description>[quote user="Gotak"]&lt;p&gt;But what is 10 1B 00??&lt;/p&gt;
&lt;p&gt;Is it the characteristic value?&lt;/p&gt;[/quote]
&lt;p&gt;Yes, it is.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reding GATT Characterictic value.</title><link>https://devzone.nordicsemi.com/thread/468381?ContentTypeID=1</link><pubDate>Mon, 12 Feb 2024 11:01:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:afff0b88-f4da-4a5c-ade1-96ebdb7a7c31</guid><dc:creator>Gotak</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have tried the below logic for reading:&lt;/p&gt;
&lt;p&gt;static void read_cb(struct bt_conn *conn, uint8_t err,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; struct bt_gatt_read_params *params,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; const void *data, uint16_t length)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;&amp;nbsp;printk(&amp;quot;\nread_cb&amp;quot;);&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; if (err)&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; {&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printk(&amp;quot;Read failed (err %u)\n&amp;quot;, err);&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; }&lt;/p&gt;
&lt;p&gt;&amp;nbsp;else{&lt;/p&gt;
&lt;p&gt;&amp;nbsp; printk(&amp;quot;\nGATT_READ&amp;quot;);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;}&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; printk(&amp;quot;Read successful. Value: &amp;quot;);&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; for (int i = 0; i &amp;lt; length; i++)&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; {&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printk(&amp;quot;%02X &amp;quot;, ((uint8_t *)data)[i]);&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; }&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; printk(&amp;quot;\n&amp;quot;);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;//bt_conn_disconnect(conn, BT_HCI_ERR_REMOTE_USER_TERM_CONN);&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;The output: Read successful. Value: 10 1B 00 37 2A&lt;/p&gt;
&lt;p&gt;37 2A --&amp;gt; are the characteristic UUID which I can recognise&lt;/p&gt;
&lt;p&gt;But what is 10 1B 00??&lt;/p&gt;
&lt;p&gt;Is it the characteristic value?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reding GATT Characterictic value.</title><link>https://devzone.nordicsemi.com/thread/468335?ContentTypeID=1</link><pubDate>Mon, 12 Feb 2024 08:48:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7ee6a1e3-d44c-41ea-aa77-081634080e33</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The characteristic value is accessible by the data pointer. For some reason this sample prints the pointer to the data and the length, and not the data itself. But the data is there.&lt;/p&gt;
&lt;p&gt;To decode the data, you can refer to the &lt;a href="https://www.bluetooth.com/specifications/specs/heart-rate-service-1-0/"&gt;Heart Rate Service specification&lt;/a&gt;. Or more easily, you can refer to &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/bluetooth/central_hr_coded/README.html"&gt;Bluetooth: Central Heart Rate Monitor with Coded PHY&lt;/a&gt;&amp;nbsp;(and the acompanying &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/bluetooth/peripheral_hr_coded/README.html"&gt;Bluetooth: Peripheral Heart Rate Monitor with Coded PHY&lt;/a&gt;). This is a much more complete example, and the central here will decode and print all the information in the received notification. So I would say this is a significatnly better sample to refer to. (If you don&amp;#39;t want coded PHY).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reding GATT Characterictic value.</title><link>https://devzone.nordicsemi.com/thread/468303?ContentTypeID=1</link><pubDate>Sun, 11 Feb 2024 15:55:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fa28ae3f-ad4e-4cea-b8af-497915637270</guid><dc:creator>Gotak</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static uint8_t notify_func(struct bt_conn *conn,
			   struct bt_gatt_subscribe_params *params,
			   const void *data, uint16_t length)
{
	if (!data) {
		printk(&amp;quot;[UNSUBSCRIBED]\n&amp;quot;);
		params-&amp;gt;value_handle = 0U;
		return BT_GATT_ITER_STOP;
	}

	printk(&amp;quot;[NOTIFICATION] data %p length %u\n&amp;quot;, data, length);

	return BT_GATT_ITER_CONTINUE;
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The structure &amp;quot;&lt;span&gt;struct&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;bt_gatt_subscribe_params&lt;/span&gt;&lt;span&gt; *&lt;/span&gt;&lt;span&gt;params&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;from the above function contains the parameters:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;uint16_t&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;value&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;does this store the GATT characteristic value?&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>