<?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>Reading a subset of data on a BLE server</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/519/reading-a-subset-of-data-on-a-ble-server</link><description>I am definitely missing something here, but I can&amp;#39;t figure out how to specify a subset of data to read from my peripheral. 
 Here&amp;#39;s the setup: my nrf51822 device is a server, publishing a custom service with custom characteristics. 
 I have in memory</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 28 May 2014 11:06:48 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/519/reading-a-subset-of-data-on-a-ble-server" /><item><title>RE: Reading a subset of data on a BLE server</title><link>https://devzone.nordicsemi.com/thread/2707?ContentTypeID=1</link><pubDate>Wed, 28 May 2014 11:06:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:58c61e14-3379-4987-aa6e-d7393f711d9c</guid><dc:creator>Joe Merten</dc:creator><description>&lt;p&gt;Unfortunately, the attachment has been lost, isn&amp;#39;t it?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading a subset of data on a BLE server</title><link>https://devzone.nordicsemi.com/thread/2710?ContentTypeID=1</link><pubDate>Thu, 26 Sep 2013 13:04:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a3c6b38-15b6-4f07-8405-ed2fada39ae1</guid><dc:creator>Jim</dc:creator><description>&lt;p&gt;Ah, I see.  Not surprising then that the naming comes from a committee. :-)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading a subset of data on a BLE server</title><link>https://devzone.nordicsemi.com/thread/2709?ContentTypeID=1</link><pubDate>Thu, 26 Sep 2013 13:00:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5f74cb28-e8f7-4528-bc6c-86f8dbf9eb3b</guid><dc:creator>Carles</dc:creator><description>&lt;blockquote&gt;
&lt;p&gt;FYI, I would have called the two flavors of reading something like &amp;quot;read static&amp;quot; (your default), and &amp;quot;read dynamic&amp;quot; (where I implement the code to compute the result). This is similar to how you can implement accessors in languages like C#, Java, or Scala. They can be just values, or you can write code to dynamically compute the value.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Thanks for the suggestion, but one of the core tenets of our API is &amp;quot;use the wordings of the Bluetooth spec whenever possible&amp;quot;. The Bluetooth specification uses &amp;quot;authorization&amp;quot; for this particular use case, and hence we adopted the same nomenclature.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading a subset of data on a BLE server</title><link>https://devzone.nordicsemi.com/thread/2708?ContentTypeID=1</link><pubDate>Thu, 26 Sep 2013 12:58:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a11caf9a-ad3f-4f47-8152-814855c3f540</guid><dc:creator>Jim</dc:creator><description>&lt;p&gt;Yes, I came across this last night, and now have it working.  I hadn&amp;#39;t noticed it before because I&amp;#39;m not currently thinking of securing the communications, and rd_auth seemed like a security mechanism.  It does precisely what I want.  Thanks.&lt;/p&gt;
&lt;p&gt;FYI, I would have called the two flavors of reading something like &amp;quot;read static&amp;quot; (your default), and &amp;quot;read dynamic&amp;quot; (where I implement the code to compute the result).  This is similar to how you can implement accessors in languages like C#, Java, or Scala.  They can be just values, or you can write code to dynamically compute the value.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading a subset of data on a BLE server</title><link>https://devzone.nordicsemi.com/thread/2706?ContentTypeID=1</link><pubDate>Thu, 26 Sep 2013 06:21:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9dc5e097-f162-4fdb-b723-53c8df758ff0</guid><dc:creator>Carles</dc:creator><description>&lt;blockquote&gt;
&lt;p&gt;In the meantime, is there a way to get an event when the server gets a read from a client?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;What you are looking for is called &amp;quot;Read Authorization&amp;quot;.&lt;/p&gt;
&lt;p&gt;The attached MSC should help you out.&lt;/p&gt;
&lt;p&gt;To create a characteristic with read authorization set the following bit:&lt;/p&gt;
&lt;p&gt;ble_gatts_attr_md_t :: rd_auth&lt;/p&gt;
&lt;p&gt;when calling:&lt;/p&gt;
&lt;p&gt;sd_ble_gatts_characteristic_add()&lt;/p&gt;
&lt;p&gt;So, combining rd_auth on your side with usage of Read Long Characteristic Values (aka Read Blob) you could simply do this:&lt;/p&gt;
&lt;p&gt;&amp;lt;- Read_Blob_Req(offset = 0)
-&amp;gt; Read_Blob_Resp(first 20 bytes of data)
&amp;lt;- Read_Blob_req(offset = 20)
-&amp;gt; Read_Blob_Resp(bytes 20 to 40)
...&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/msc_5F00_inline_5F00_mscgraph_5F00_29.png" alt="msc_inline_mscgraph_29.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading a subset of data on a BLE server</title><link>https://devzone.nordicsemi.com/thread/2705?ContentTypeID=1</link><pubDate>Wed, 25 Sep 2013 19:05:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c2623d8c-5b3f-4d6c-a166-0fba1ba533f6</guid><dc:creator>Jim</dc:creator><description>&lt;p&gt;I&amp;#39;ll take a look.&lt;/p&gt;
&lt;p&gt;In the meantime, is there a way to get an event when the server gets a read from a client?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading a subset of data on a BLE server</title><link>https://devzone.nordicsemi.com/thread/2704?ContentTypeID=1</link><pubDate>Wed, 25 Sep 2013 16:11:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d8568a55-3974-465c-8f6b-6ff3c144d952</guid><dc:creator>Ole Morten</dc:creator><description>&lt;p&gt;I&amp;#39;d say that the &amp;quot;Bluetooth way&amp;quot; of doing this is using a Control Point characteristic to which the Client writes which data period or interval it&amp;#39;s interested in, and then letting the Server send the actual data as either Notifications or Indications on a Data characteristic.&lt;/p&gt;
&lt;p&gt;This scheme is implemented by for example the Glucose Profile and Service, so its profile document could be a useful place to start. The profile document is &lt;a href="https://www.bluetooth.org/docman/handlers/downloaddoc.ashx?doc_id=248025"&gt;here&lt;/a&gt;, and the service document &lt;a href="https://www.bluetooth.org/docman/handlers/downloaddoc.ashx?doc_id=248026"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading a subset of data on a BLE server</title><link>https://devzone.nordicsemi.com/thread/2703?ContentTypeID=1</link><pubDate>Wed, 25 Sep 2013 13:12:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bbaa90b7-3576-4895-8100-efc40f2f2d6f</guid><dc:creator>Jim</dc:creator><description>&lt;p&gt;I want this to support arbitrary lengths, so option 1 doesn&amp;#39;t really scale well.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not sure what rd_auth does for me.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m thinking what I&amp;#39;ll do is have a separate characteristic that lets me set up the value for the next read, kind of like writing to a read pointer.&lt;/p&gt;
&lt;p&gt;I would still like to get notified after the read happens, so I can increment the pointer and set up the next read.  Is there a way to register for read notifications?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading a subset of data on a BLE server</title><link>https://devzone.nordicsemi.com/thread/2702?ContentTypeID=1</link><pubDate>Wed, 25 Sep 2013 07:49:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:01882954-ee6e-4afb-be8e-f7520e6ee810</guid><dc:creator>Carles</dc:creator><description>&lt;p&gt;Hi there,&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;I want to allow a client to be able to read a specific portion of this data rather than having to transfer all 2048 bytes (which I can&amp;#39;t anyway).&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;There is no &amp;quot;official&amp;quot; way to read buffers from a server that are longer than 512 bytes (the maximum length of a characteristic value).&lt;/p&gt;
&lt;p&gt;You have several options to achieve that:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Create 4x characteristics (since each characteristic can only be 512 bytes long) and use VLOC_USER to make each of those point to a quarter of your historical data. Then the client can use read long operations on all those characteristics to obtain the data&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create a single characteristic, and mark it rd_auth = 1. Then every time your client asks for data you are free to provide the data you want with sd_ble_gatts_rw_auth_reply()&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Carles&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>