<?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 get data length in bytes in notification only characteristics without enabling notification</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/33670/how-to-get-data-length-in-bytes-in-notification-only-characteristics-without-enabling-notification</link><description>hi, 
 i am working on generic ble central device which has nrf52832 as it&amp;#39;s core. 
 my question is that i want to know the length of data in bytes which are being sent by notification only characteristic. without enabling notification. 
 so, for evaluation</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 23 Apr 2018 06:29:14 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/33670/how-to-get-data-length-in-bytes-in-notification-only-characteristics-without-enabling-notification" /><item><title>RE: how to get data length in bytes in notification only characteristics without enabling notification</title><link>https://devzone.nordicsemi.com/thread/129257?ContentTypeID=1</link><pubDate>Mon, 23 Apr 2018 06:29:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0485c1ac-f1d2-4cec-aadd-900a75d2c93f</guid><dc:creator>Andy</dc:creator><description>&lt;p&gt;No, each characteristic has its own p_data, so it doesn&amp;#39;t matter if you receive data from another characteristic. And yes, essentially you should have an array(per characteristic) big enough to hold the maximum amount of data that you can receive from a characteristic. Those things should be documented somewhere in the peripheral&amp;#39;s API. If you don&amp;#39;t have access to that, making each array size 20 will be the safest bet. You are&amp;nbsp;already using 512 bytes in your previous implementation, so I guess RAM is not a limitation for you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to get data length in bytes in notification only characteristics without enabling notification</title><link>https://devzone.nordicsemi.com/thread/129255?ContentTypeID=1</link><pubDate>Mon, 23 Apr 2018 06:19:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:29b6e121-5304-47d4-ac83-d2a72795d156</guid><dc:creator>nikunj8086</dc:creator><description>&lt;p&gt;hi andy,&lt;/p&gt;
&lt;p&gt;thanks for reply. so the array will be used as spi register table by user and will be accessed by used via spi interface. and array index will be register address.&lt;/p&gt;
&lt;p&gt;i like your idea but problem is that *p_data pointer is pointing to received data from ble and will be changed if another characteristic will send data to central device. so what i will do is that i will make p_data as array of size 20 because my ble data has maximum length of 20 bytes and copy ble data to it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to get data length in bytes in notification only characteristics without enabling notification</title><link>https://devzone.nordicsemi.com/thread/129251?ContentTypeID=1</link><pubDate>Mon, 23 Apr 2018 05:25:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fe2ca678-1488-46d9-ae75-69cf22bd74df</guid><dc:creator>Andy</dc:creator><description>&lt;p&gt;Ah, I understand. Is there any particular reason why you decided to implement it that way? That is a very bad, error prone architecture.&lt;/p&gt;
&lt;p&gt;May I suggest you use something like this?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;typedef struct {
	uint16_t uuid;
	uint8_t * p_data;
} notification_data_t

static notification_data_t notification[NUM_OF_CHARACTERISTICS];&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to get data length in bytes in notification only characteristics without enabling notification</title><link>https://devzone.nordicsemi.com/thread/129250?ContentTypeID=1</link><pubDate>Mon, 23 Apr 2018 05:17:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6a9327a2-b438-4b14-a261-8041bc91080b</guid><dc:creator>nikunj8086</dc:creator><description>&lt;p&gt;hi andy,&lt;/p&gt;
&lt;p&gt;i am not using any memory allocation,&lt;/p&gt;
&lt;p&gt;basically i have a array of uint16_t type with length of 0xFF,&lt;/p&gt;
&lt;p&gt;i only want to reserve space in array for all the characteristics, and after that, that particuler array area will be used to store data from same characteristics.&lt;/p&gt;
&lt;p&gt;for example&lt;/p&gt;
&lt;p&gt;0x00 reserved&lt;br /&gt;0x01 char1 uuid&lt;br /&gt;0x02 char1 data1 &lt;br /&gt;0x03 char1 data2&lt;br /&gt;0x04 char2 uuid&lt;br /&gt;0x05 char2 data1&lt;br /&gt;0x06 char2 data2&lt;/p&gt;
&lt;p&gt;so when i will receive data from char 1 i will store only on it&amp;#39;s reserved location on array.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to get data length in bytes in notification only characteristics without enabling notification</title><link>https://devzone.nordicsemi.com/thread/129241?ContentTypeID=1</link><pubDate>Sun, 22 Apr 2018 19:05:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ae815052-a1ff-4220-be4a-a85e09e97ca8</guid><dc:creator>Andy</dc:creator><description>&lt;p&gt;I don&amp;#39;t understand how you&amp;#39;re planning to create that table. What do you mean with &amp;quot;allocate address&amp;quot;? Are you using malloc and the heap?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to get data length in bytes in notification only characteristics without enabling notification</title><link>https://devzone.nordicsemi.com/thread/129237?ContentTypeID=1</link><pubDate>Sun, 22 Apr 2018 15:48:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:843b9bc6-7857-45d7-a7fa-9138ae478ca9</guid><dc:creator>nikunj8086</dc:creator><description>&lt;p&gt;hi andy,&lt;/p&gt;
&lt;p&gt;so basically i have to create a register table where all the data will be stored.&lt;/p&gt;
&lt;p&gt;now to store that data i need to know the exact data size to allocate address of current characteristic and next characteristic&lt;/p&gt;
&lt;p&gt;example:&lt;/p&gt;
&lt;p&gt;address&amp;nbsp; &amp;nbsp;content on that address&lt;/p&gt;
&lt;p&gt;0x0001&amp;nbsp; &amp;nbsp; first char uuid&lt;/p&gt;
&lt;p&gt;&lt;span&gt;0x0002&amp;nbsp; &amp;nbsp; first char data&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;0x0003&amp;nbsp; &amp;nbsp; second char uuid&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;0x0004&amp;nbsp; &amp;nbsp; second char data&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;i am using nordic thingy 52 as periphreal for testing, in that most services are notification only. and notification only be sent to central device on any event. like buttun service.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to get data length in bytes in notification only characteristics without enabling notification</title><link>https://devzone.nordicsemi.com/thread/129235?ContentTypeID=1</link><pubDate>Sun, 22 Apr 2018 14:55:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d3d434f2-997a-41f5-ac65-7966ca808b92</guid><dc:creator>Andy</dc:creator><description>&lt;p&gt;Why do you need to know the data length if notifications are not enabled?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>