<?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>Write to variable length characteristic</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/2686/write-to-variable-length-characteristic</link><description>I want to send 512 bytes of data over ble through the characteristic value, as maximum length of the characterstic value is 512. When I try to do the transfer more than 20 bytes, it will fail. When I checked in this forum, I got know that we can only</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 06 Jun 2014 09:40:04 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/2686/write-to-variable-length-characteristic" /><item><title>RE: Write to variable length characteristic</title><link>https://devzone.nordicsemi.com/thread/10533?ContentTypeID=1</link><pubDate>Fri, 06 Jun 2014 09:40:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9032c88c-5633-412d-ae66-61a3c8ffe7fa</guid><dc:creator>Ulrich Myhre</dc:creator><description>&lt;p&gt;If you don&amp;#39;t need to write everything at once (i.e. data is not always consistent during writes), you can write with offsets. The way to do this is to run sd_ble_tx_buffer_count_get() to get the maximum number of buffers. Split the data into N 20-byte chunks, then for i=0 to N-1 queue them with gattc_write(data[i*20], len=min(20,total_len-20*i),offset=i*20), decrementing your buffer count manually. If you run out of buffers or receive a BUSY return code, wait/sleep until you receive more BLE_EVT_TX_COMPLETE events, and increment your buffer count by the count in the event.&lt;/p&gt;
&lt;p&gt;If you lose your connection, you can only assume that [Total count of TX_COMPLETE counts] packets were sent, and you should continue writing from that place upon reconnection.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write to variable length characteristic</title><link>https://devzone.nordicsemi.com/thread/10532?ContentTypeID=1</link><pubDate>Fri, 06 Jun 2014 09:33:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bd558d06-5cf0-4488-baf2-0bdbae012654</guid><dc:creator>Ulrich Myhre</dc:creator><description>&lt;p&gt;Long writes can be used to write everything in a single go, even across multiple characteristics, but it is not required to write to longer attributes. If it is acceptable that the data is half-written at any point, writing with an offset is perfectly possible.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write to variable length characteristic</title><link>https://devzone.nordicsemi.com/thread/10531?ContentTypeID=1</link><pubDate>Thu, 05 Jun 2014 11:39:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0389927f-675c-4fd4-af69-018d614a87d3</guid><dc:creator>Naveen</dc:creator><description>&lt;p&gt;I will come back on this example. As it is not working properly with Master Control Panel, I will check with iphone.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write to variable length characteristic</title><link>https://devzone.nordicsemi.com/thread/10529?ContentTypeID=1</link><pubDate>Thu, 05 Jun 2014 11:38:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ee6836a1-ab26-495b-9f7d-b867f4af1594</guid><dc:creator>Naveen</dc:creator><description>&lt;p&gt;nRF51822 with the S110 is  peripheral and iphone is central
characteristic in the GATT Server at the peripheral (nRF51822 with the S110) and iphone as client.
I want to send data more than 20 bytes from GATT server and vice versa.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write to variable length characteristic</title><link>https://devzone.nordicsemi.com/thread/10530?ContentTypeID=1</link><pubDate>Thu, 05 Jun 2014 08:01:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:02acedf4-31db-4d2a-a86f-5edfe1ba57d6</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;If you want to transfer more than 20 bytes from the GATT Client to GATT Server, GATT Long write has to be used, see &lt;a href="https://devzone.nordicsemi.com/question/7413/is-there-an-up-to-date-example-for-long-attributes-available/?answer=12051#post-id-12051"&gt;this&lt;/a&gt; post.&lt;/p&gt;
&lt;p&gt;If you want to transfer more than 20 bytes from GATT Server to GATT Client, read blob or notification can be used.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write to variable length characteristic</title><link>https://devzone.nordicsemi.com/thread/10528?ContentTypeID=1</link><pubDate>Thu, 05 Jun 2014 07:11:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6161b055-c539-47be-88b8-84f35ae52c56</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;What peripheral and central device are you using? nRF51822 with the S110? Is the characteristic in the GATT Server at the peripheral or central device? &lt;a href="https://devzone.nordicsemi.com/question/232/what-is-a-client-and-server-in-ble/"&gt;devzone.nordicsemi.com/.../&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>