<?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>Large “virtual” read only characteristic?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/8907/large-virtual-read-only-characteristic</link><description>I would like to create a large “virtual” read only characteristic that does not fully exist in memory. I understand that large characteristics are transferred in chunks of about 22 bytes at a time and I would like to dynamically control the contents of</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 04 Sep 2015 08:56:44 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/8907/large-virtual-read-only-characteristic" /><item><title>RE: Large “virtual” read only characteristic?</title><link>https://devzone.nordicsemi.com/thread/32779?ContentTypeID=1</link><pubDate>Fri, 04 Sep 2015 08:56:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:baf98c0e-d061-4ee0-a4b9-6565bbc38733</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi machine,&lt;/p&gt;
&lt;p&gt;Please aware that the characteristic with bigger value size than 20 bytes, when transmitting via long read or long write will still be split into chunks of 18 bytes payload and send over the link. The largest payload size on link layer packet is still 23 bytes (5 bytes for opcode, handle, and offset)&lt;/p&gt;
&lt;p&gt;It&amp;#39;s just the softdevice do the pay load split processing for the application. But only long write and long read support this, not notification/indication.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t really understand your need of having sd_ble_gatts_rw_authorize_reply() command that don&amp;#39;t update the value of the characteristic. If you want to have a &amp;quot;virtual&amp;quot; characteristic ( that has the size of more than 20 bytes for example) why do you need to worry if the data is updated into the value of the real characteristic on the server ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Large “virtual” read only characteristic?</title><link>https://devzone.nordicsemi.com/thread/32778?ContentTypeID=1</link><pubDate>Thu, 03 Sep 2015 18:10:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:397fb3a8-b5f5-4ddc-be7a-a92f8caed371</guid><dc:creator>machine</dc:creator><description>&lt;p&gt;I found that as of SDK 8.0, a &amp;quot;virtual characteristic&amp;quot; is not supported.&lt;/p&gt;
&lt;p&gt;Instead, the characteristic MUST be backed in full by stack or user memory.  In cases where the value is stored offline or calculated on the fly, it MUST be copied to the characteristic&amp;#39;s value memory.  It can NOT simply be returned via the BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST reply.&lt;/p&gt;
&lt;p&gt;If the characteristic is larger than the max allowed (about 500 bytes), it can be &amp;quot;streamed&amp;quot; to the client via notifications or indications.&lt;/p&gt;
&lt;p&gt;A large characteristic can also be accessed in chunks of about 500 bytes at a time using one characteristic to specify the chunk index and another to represent the 500 byte data chunk.  For example, if chunk index is 0 then the data chunk represents the first 500 or so bytes of a larger dataset; if chunk index is set 1 then the data chunk represents bytes 500-999, etc.&lt;/p&gt;
&lt;p&gt;It would be &lt;em&gt;nice&lt;/em&gt; if a future SDK release could allow the BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST read reply to return the data on the fly instead of requiring the data to be stored.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Large “virtual” read only characteristic?</title><link>https://devzone.nordicsemi.com/thread/32777?ContentTypeID=1</link><pubDate>Wed, 26 Aug 2015 20:24:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2f39f9d0-71ab-4ab2-afc4-d70b3b61bb93</guid><dc:creator>machine</dc:creator><description>&lt;p&gt;Unfortunately, it seems that my original goal of implementing a &amp;quot;virtual&amp;quot; characteristic using the read authorization event is not possible with the Nordic S110 softdevice.  The characteristic must be fully backed by real memory (in either the user space or softdevice space).&lt;/p&gt;
&lt;p&gt;However, I am considering your advise of using a notification or indication to stream the data to the client on demand.&lt;/p&gt;
&lt;p&gt;Meanwhile I will forget about sending only 22 bytes and use a maximum sized 512 byte characteristic with a &amp;quot;bank switching&amp;quot; scheme to read blocks of data at a time.  It is wasteful since only 22 bytes will be sent at a time but at least it will work.  Once that is working I will look into using notifications/indications to send over all of the data as an option if it proves to have more throughout.&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Large “virtual” read only characteristic?</title><link>https://devzone.nordicsemi.com/thread/32776?ContentTypeID=1</link><pubDate>Wed, 26 Aug 2015 14:11:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ae204b4d-5bd4-4699-93fa-f25bb0149432</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Machine,&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t really get it with this part &lt;em&gt;&amp;quot;to set the value of the data chunk dynamically but it always copies the new data into the characteristic&amp;#39;s value at the offset and length specified in the reply. This method requires the characteristic&amp;#39;s value buffer to be large enough to hold the entire external dataset.&amp;quot;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;You meant you tried to write the entire data of the large &amp;quot;virtual&amp;quot; characteristic with one write request with authorization ?&lt;/p&gt;
&lt;p&gt;Why don&amp;#39;t  you split that single write into multiple write requests, with 20 bytes chunk each. (maximum payload for a write/notification/read is 20 bytes)&lt;/p&gt;
&lt;p&gt;In the application you can then write each 20 bytes chunk into the external RAM.&lt;/p&gt;
&lt;p&gt;The same when you want send large data from nRF51 to the central. You can use a small 20 bytes characteristic, and update and notify its value with the 20 bytes chunks from the external memory.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Large “virtual” read only characteristic?</title><link>https://devzone.nordicsemi.com/thread/32775?ContentTypeID=1</link><pubDate>Wed, 26 Aug 2015 14:10:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:52e8e0d4-5643-4953-9e48-67f9b6688398</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;If your characteristic value is in user memory then you don&amp;#39;t need to use read auth, you just need to tell the stack how long it is and it will return it piecewise.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Large “virtual” read only characteristic?</title><link>https://devzone.nordicsemi.com/thread/32774?ContentTypeID=1</link><pubDate>Wed, 26 Aug 2015 13:55:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c544f55b-2f56-4427-b0e9-0e105252fd3f</guid><dc:creator>machine</dc:creator><description>&lt;p&gt;This is exactly what I already tried but it did not work.  My characteristic value is in user memory and I am using read authorization.  The reply data gets ignored when update=0.  When update=1 the characteristic value gets overwritten with the reply data at the specified offset/length.  So I cannot simply send out 22 bytes without backing it with a full size characteristic value (that will get overwritten).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Large “virtual” read only characteristic?</title><link>https://devzone.nordicsemi.com/thread/32773?ContentTypeID=1</link><pubDate>Wed, 26 Aug 2015 05:37:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:448a2537-5476-4527-907a-d0baca92a056</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;Many ways.&lt;/p&gt;
&lt;p&gt;Easiest one is to specify the data as being in user memory not on the stack, you can then point directly to your data and it will read it right out of the memory.&lt;/p&gt;
&lt;p&gt;Alternately if you specify the characteristic as in user memory and use the RW authorize request, it will send the 22 bytes you give it out as the reply and won&amp;#39;t try to copy it anywhere.&lt;/p&gt;
&lt;p&gt;I also don&amp;#39;t remember what the &amp;#39;update&amp;#39; flag in the reply does if you don&amp;#39;t set it, I think it quite possibly just sends the data out and doesn&amp;#39;t try updating anything.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>