<?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>Long Attributes</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/339/long-attributes</link><description>Hi,
I need to have long attributes. So I need &amp;#39;Read Blob&amp;#39; operation for read and Queued writes (&amp;#39;Prepare Write&amp;#39; and &amp;#39;Execute Write&amp;#39;). Does Soft Device for nrf51822 support mentioned commands? 
 Best regards,
Artem Zemlyanukhin</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 17 Jun 2014 07:13:14 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/339/long-attributes" /><item><title>RE: Long Attributes</title><link>https://devzone.nordicsemi.com/thread/1782?ContentTypeID=1</link><pubDate>Tue, 17 Jun 2014 07:13:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e33450e3-4070-4a70-bf5f-342f9bf19877</guid><dc:creator>Lionel Sacks</dc:creator><description>&lt;p&gt;Could I echo the request of Elecmike2k !&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long Attributes</title><link>https://devzone.nordicsemi.com/thread/1781?ContentTypeID=1</link><pubDate>Mon, 02 Jun 2014 03:57:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e5542da5-b132-45c2-a798-95e7dacdf01c</guid><dc:creator>Elecmike2k</dc:creator><description>&lt;p&gt;Hi Ole,&lt;/p&gt;
&lt;p&gt;My project needs long write and I would like to start with the example code you provided: ble_app_lbs-long-write.zip. Unfortunately when I click it, it says &amp;quot;This Page is Unavailable&amp;quot;. Could you send an working link to this file please?
Thanks,
Michael&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long Attributes</title><link>https://devzone.nordicsemi.com/thread/1787?ContentTypeID=1</link><pubDate>Fri, 13 Sep 2013 13:17:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9a648ead-a599-4433-93c3-1b938e4397a2</guid><dc:creator>Artem Zemlyanukhin</dc:creator><description>&lt;p&gt;Thank you, your answer helped to me!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long Attributes</title><link>https://devzone.nordicsemi.com/thread/1786?ContentTypeID=1</link><pubDate>Fri, 13 Sep 2013 12:29:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fe4f57ce-2b5f-4c3b-9e66-ab0c0da39a1c</guid><dc:creator>Carles</dc:creator><description>&lt;p&gt;Hi there,&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;But why do I have to set p_data = data + offset? I already set offset..&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Because auth_reply.params.read.offset refers to the offset within the attribute value, not the offset from the pointer you provide. You are expected to always provide an updated pointer to the data you want to send back, but that offset you provide is where inside the attribute value the data pointed by by p_data will be written to. Remember that when you set update = 1 the data will actually be written to the local attribute (in your case in user memory) as well as sent over the air as a response.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;So I guess if update = 0, p_data and offset values do not matter&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Correct&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;But I need to use update = 1 because actually I have array strings (each of 64 bytes) and in different cases I want to point in &amp;#39;sd_ble_gatts_rw_authorize_reply&amp;#39;
different rows fo my array.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Then you are already doing the right thing. But remember, you could also do something else instead:
Because the value is in your own memory, you could simply set update to 0 but then modify your value buffer (the one you provided in sd_ble_gatts_characteristic_add() (p_value in ble_gatts_attr_t) so that it fits whatever you want to send back. This may actually be quicker and more efficient than using update = 1 depending on how your application is structured.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long Attributes</title><link>https://devzone.nordicsemi.com/thread/1788?ContentTypeID=1</link><pubDate>Fri, 13 Sep 2013 12:21:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c7640c2e-3801-4117-b897-7bb300bf02c8</guid><dc:creator>Artem Zemlyanukhin</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have an issue with Read Blob, could you help to solve it please?&lt;/p&gt;
&lt;p&gt;I have attribute &amp;#39;att1&amp;#39; with 64 bytes length allocated in user ram (BLE_GATTS_VLOC_USER).
I use authorized read.&lt;/p&gt;
&lt;p&gt;For example, &amp;#39;att1&amp;#39; contains zeroes.
Because MTU = 23, I need 3 ReadBlobRequests to read it.&lt;/p&gt;
&lt;p&gt;In BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST event handler I must set parameters for &amp;#39;sd_ble_gatts_rw_authorize_reply&amp;#39;
and call it.&lt;/p&gt;
&lt;p&gt;At first, I used following parameters:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;auth_reply.type = BLE_GATTS_AUTHORIZE_TYPE_READ;
auth_reply.params.read.offset = offset;
auth_reply.params.read.p_data = data;
auth_reply.params.read.update = 1;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&amp;#39;data&amp;#39; and &amp;#39;att1&amp;#39; is not the same (so I set update = 1).
For example &amp;#39;data&amp;#39; points to array that contains numbers from 0x00 to 0x3F.&lt;/p&gt;
&lt;p&gt;Here are the results from Master Control Panel:&lt;/p&gt;
&lt;p&gt;[17:15:26.5] Received Read Blob Response, offset 0, value (0x): 00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F-10-11-12-13-14-15
[17:15:26.5] Received Read Blob Response, offset 22, value (0x): 00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F-10-11-12-13-14-15
[17:15:26.5] Received Read Blob Response, offset 44, value (0x): 00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F-10-11-12-13&lt;/p&gt;
&lt;p&gt;If you can see melody_offset does not matter...&lt;/p&gt;
&lt;p&gt;Then I changed parameters to:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;auth_reply.type = BLE_GATTS_AUTHORIZE_TYPE_READ;
auth_reply.params.read.offset = 0;
auth_reply.params.read.p_data = data + offset;
auth_reply.params.read.update = 1;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;then:&lt;/p&gt;
&lt;p&gt;[17:17:37.2] Received Read Blob Response, offset 0, value (0x): 00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F-10-11-12-13-14-15
[17:17:37.3] Received Read Blob Response, offset 22, value (0x): 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
[17:17:37.3] Received Read Blob Response, offset 44, value (0x): 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00&lt;/p&gt;
&lt;p&gt;And at the end:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;auth_reply.type = BLE_GATTS_AUTHORIZE_TYPE_READ;
auth_reply.params.read.offset = offset;
auth_reply.params.read.p_data = data + offset;
auth_reply.params.read.update = 1;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And after that I got results that I need:&lt;/p&gt;
&lt;p&gt;[17:19:09.5] Received Read Blob Response, offset 0, value (0x): 00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F-10-11-12-13-14-15
[17:19:09.6] Received Read Blob Response, offset 22, value (0x): 16-17-18-19-1A-1B-1C-1D-1E-1F-20-21-22-23-24-25-26-27-28-29-2A-2B
[17:19:09.6] Received Read Blob Response, offset 44, value (0x): 2C-2D-2E-2F-30-31-32-33-34-35-36-37-38-39-3A-3B-3C-3D-3E-3F&lt;/p&gt;
&lt;p&gt;But why do I have to set p_data = data + offset? I already set offset..&lt;/p&gt;
&lt;p&gt;Also I tried to reset update field and assign to auth_reply.params.read.p_data pointer to &amp;#39;att1&amp;#39;. In this case, all three are correct methods.
So I guess if update = 0, p_data and offset values do not matter.
But I need to use update = 1 because actually I have array strings (each of 64 bytes) and in different cases I want to point in &amp;#39;sd_ble_gatts_rw_authorize_reply&amp;#39; different rows fo my array.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long Attributes</title><link>https://devzone.nordicsemi.com/thread/1785?ContentTypeID=1</link><pubDate>Fri, 06 Sep 2013 12:27:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0412c72b-eddf-4519-8f49-02ed3c67089e</guid><dc:creator>Artem Zemlyanukhin</dc:creator><description>&lt;p&gt;Thank you,&lt;/p&gt;
&lt;p&gt;You are right, TI software buffers PrepareWritesReqs and sends after I send ExecuteWriteReq. I checked this with sniffer, thank you for advice!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long Attributes</title><link>https://devzone.nordicsemi.com/thread/1779?ContentTypeID=1</link><pubDate>Fri, 06 Sep 2013 10:52:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:80507232-cb79-4f71-b929-1986b1400a6c</guid><dc:creator>Ole Morten</dc:creator><description>&lt;p&gt;For completeness, I&amp;#39;ll try to answer these questions separately:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;This is to be expected, as it is the Execute Write event, as you can see in the op field of ble_gatts_evt_write_t. This event will never have a length or a value, and if you need to see the values written, you&amp;#39;ll have to either parse the memory buffer you provided yourself (see the format description in the softdevice headers) or use sd_ble_gatts_value_get() as you&amp;#39;ve done.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;This extra write is the Execute Write.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;This is actually a bug in my code that I didn&amp;#39;t notice when testing. The intention was just to see that the same memory area was released afterwards, but to check this, you have to compare the actual memory pointer, i.e. p_data field of the memory block. However, since the memory allocation is static anyway, it doesn&amp;#39;t really matter in my case.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;See my comment on your other reply below.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;This shouldn&amp;#39;t be possible. When I sniff the link, I can see responses going over the air. Not sending such responses would be a spec violation, and trigger a GATT timeout, most likely causing a disconnect, so I believe this must be a bug in the TI tool.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long Attributes</title><link>https://devzone.nordicsemi.com/thread/1784?ContentTypeID=1</link><pubDate>Fri, 06 Sep 2013 10:46:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:afcd50be-fedb-4184-9e0f-a5ca6201128e</guid><dc:creator>Ole Morten</dc:creator><description>&lt;p&gt;When testing with an iPhone, I don&amp;#39;t have as fine-grained control as you have on when the different requests are sent, so I can unfortunately not duplicate your testing exactly.&lt;/p&gt;
&lt;p&gt;However, I can&amp;#39;t understand how what you say about the sequence of events is possible, since the stack will have no memory or anywhere to store the queued writes if the application haven&amp;#39;t provided a memory buffer.&lt;/p&gt;
&lt;p&gt;Are you sure that the TI tool you&amp;#39;re using isn&amp;#39;t buffering the writes somewhere and send them all at once when you do the execute? If you have access to a sniffer, can you see the packets going over the air, without the corresponding events on the nRF51 side?&lt;/p&gt;
&lt;p&gt;When I sniff a link while doing a long write, I can see that there are Prepare Write Responses sent for each Prepare Write Request, and then an Execute Write Response for the last Execute Request, but since all the events happen automatically, it isn&amp;#39;t easily possible for me to correlate the time in the sniffer and the time on the serial interface.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long Attributes</title><link>https://devzone.nordicsemi.com/thread/1783?ContentTypeID=1</link><pubDate>Fri, 06 Sep 2013 06:50:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cb95ba4a-a0cf-4599-9146-2025ecd0a609</guid><dc:creator>Artem Zemlyanukhin</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Last post is mine, forgot login.&lt;/p&gt;
&lt;p&gt;I understood my 1 and 2 questions. Those BLE_GATTS_EVT_WRITE/BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST events with len = 0, data = 0 were &amp;#39;BLE_GATTS_OP_EXEC_WRITE_REQ_NOW&amp;#39;.&lt;/p&gt;
&lt;p&gt;And I want to expand 4 question. Not only &amp;#39;BLE_EVT_USER_MEM_REQUEST&amp;#39; event stack generates after  &amp;#39;Execute Write Request&amp;#39;. If I use Authorization for attribute, stack generates BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST(BLE_GATTS_OP_EXEC_WRITE_REQ) events also only after &amp;#39;Execute Write Request&amp;#39;.&lt;/p&gt;
&lt;p&gt;But in your documentation I saw Message Sequence Charts, where was following sequence:&lt;/p&gt;
&lt;p&gt;-client send PrepWriteReq1
-stack generates BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST
-server send PrepWriteResp1
-client send PrepWriteReq2
-stack generates BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST
-server send PrepWriteResp2
-client send PrepWriteReq3
-stack generates BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST
-server send PrepWriteResp3
-client send ExecWriteReq
-stack generates BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST
-server send ExecWriteResp&lt;/p&gt;
&lt;p&gt;In fact I have following sequence:&lt;/p&gt;
&lt;p&gt;-client send PrepWriteReq1
-client send PrepWriteReq2
-client send PrepWriteReq3
-client send ExecWriteReq
-stack generates BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST (BLE_GATTS_OP_PREP_WRITE_REQ)
-stack generates BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST (BLE_GATTS_OP_PREP_WRITE_REQ)
-stack generates BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST (BLE_GATTS_OP_PREP_WRITE_REQ)
-stack generates BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST (BLE_GATTS_OP_EXEC_WRITE_REQ_NOW)&lt;/p&gt;
&lt;p&gt;And I don&amp;#39;t know when stack send PrepWriteResps and ExecWriteResp&lt;/p&gt;
&lt;p&gt;Best Regards,
Artem Zemlyanukhin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long Attributes</title><link>https://devzone.nordicsemi.com/thread/1780?ContentTypeID=1</link><pubDate>Wed, 04 Sep 2013 13:51:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:23fa845c-2b25-4fdd-99c6-320634e7863b</guid><dc:creator>Guest</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thanks a lot for code example. I tested it, it works but not completely.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;At first to get additional information I added at the end of &amp;#39;on_ble_evt&amp;#39; some code:&lt;/p&gt;
&lt;p&gt;if(p_ble_evt-&amp;gt;header.evt_id == BLE_GATTS_EVT_WRITE)
{
sprintf(buffer,
&amp;quot;Event 0x50: 0x%lx 0x%lx\r\n&amp;quot;,
p_ble_evt-&amp;gt;evt.gatts_evt.params.write.len,
*(uint8_t *)p_ble_evt-&amp;gt;evt.gatts_evt.params.write.data);
simple_uart_putstring(buffer);
}&lt;/p&gt;
&lt;p&gt;I can&amp;#39;t ability to use iPhone now, so I used TI usb-dongle (CC2540) with their software.&lt;/p&gt;
&lt;p&gt;Here is the sequence of my actions:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Connect with device&lt;/li&gt;
&lt;li&gt;Send first &amp;#39;Prepare Write Request&amp;#39;
handle = 0x11, offset = 0, data = 01&lt;/li&gt;
&lt;li&gt;Send	second &amp;#39;Prepare Write Request&amp;#39;
handle = 0x11, offset = 1, data = 02&lt;/li&gt;
&lt;li&gt;Send	third &amp;#39;Prepare Write Request&amp;#39;
handle = 0x11, offset = 2, data = 03&lt;/li&gt;
&lt;li&gt;Send &amp;#39;Execute Write Request&amp;#39;&lt;/li&gt;
&lt;li&gt;Send &amp;#39;Read Request&amp;#39;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Here is log:&lt;/p&gt;
&lt;p&gt;start
Event: 0x10
Event: 0x12
memory requested, 0x1
Event: 0x2
Event: 0x50
Event 0x50: 0x0 0x0
Event: 0x3&lt;/p&gt;
&lt;p&gt;As you can see (also I sow it via debug) stack don&amp;#39;t give me data in &amp;#39;BLE_GATTS_EVT_WRITE&amp;#39; (len = 0, data = 0).
But when I tried to read attribute after these operations, I received in &amp;#39;Read Respnse&amp;#39; correct data: 01 02 03.
In other words new attribute value was set, but I couldn&amp;#39;t receive this new value in handler (&amp;#39;BLE_GATTS_EVT_WRITE&amp;#39; event).
I viewed in debuger value of &amp;#39;queued_write_buffer&amp;#39; (member of &amp;#39;mem_block&amp;#39; union) passed as parameter in sd_ble_user_mem_reply.
&amp;#39;queued_write_buffer&amp;#39; had correct value:
{
0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01,	//first write (handler, offset, length, value)
0x11, 0x00, 0x01, 0x00, 0x01, 0x00, 0x02,	//second write
0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03	//third write
}&lt;/p&gt;
&lt;ol start="2"&gt;
&lt;li&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I tried to set attr_md.wr_auth = 1. In this case data in &amp;#39;BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST&amp;#39; event handler is correct. I sent for example 3 PrepareWrite packets:
- 2 bytes (0x01 and 0x02) with offset = 0
- 2 bytes (0x03 and 0x04) with offset = 2
- 2 bytes (0x05 and 0x06) with offset = 4&lt;/p&gt;
&lt;p&gt;and I received 4 (not 3) &amp;#39;BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST&amp;#39; events:
- for first write with correct data
- for second write with correct data
- for third write with correct data
- extra event with data = 0, offset = 0, len = 0.&lt;/p&gt;
&lt;p&gt;when I sent 2 writes, I received 3 events. and in case of 1 write, I received 2 events. What does this extra event mean?&lt;/p&gt;
&lt;ol start="3"&gt;
&lt;li&gt;
&lt;p&gt;What does it mean &amp;#39;if (&amp;amp;p_ble_evt-&amp;gt;evt.common_evt.params.user_mem_release.mem_block == &amp;amp;mem_block)&amp;#39; in &amp;#39;BLE_EVT_USER_MEM_RELEASE&amp;#39; case?
It&amp;#39;s never true...&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;As I read in your docemetation, stack send to application &amp;#39;BLE_EVT_USER_MEM_REQUEST&amp;#39; event after first &amp;#39;Prepare Write Request&amp;#39; but really it does it only after
Send &amp;#39;Execute Write Request&amp;#39;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Also my dongle didn&amp;#39;t receive &amp;#39;Prepare Write Response&amp;#39; packets, it received only &amp;#39;Execute Write Response&amp;#39;.
Is this possible? Or this bug of TI software?&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long Attributes</title><link>https://devzone.nordicsemi.com/thread/1778?ContentTypeID=1</link><pubDate>Wed, 04 Sep 2013 13:51:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:590a509e-7337-4f83-a2b3-d968607be772</guid><dc:creator>Bastiaan</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thanks a lot for code example. I tested it, it works but not completely.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;At first to get additional information I added at the end of &amp;#39;on_ble_evt&amp;#39; some code:&lt;/p&gt;
&lt;p&gt;if(p_ble_evt-&amp;gt;header.evt_id == BLE_GATTS_EVT_WRITE)
{
sprintf(buffer,
&amp;quot;Event 0x50: 0x%lx 0x%lx\r\n&amp;quot;,
p_ble_evt-&amp;gt;evt.gatts_evt.params.write.len,
*(uint8_t *)p_ble_evt-&amp;gt;evt.gatts_evt.params.write.data);
simple_uart_putstring(buffer);
}&lt;/p&gt;
&lt;p&gt;I can&amp;#39;t ability to use iPhone now, so I used TI usb-dongle (CC2540) with their software.&lt;/p&gt;
&lt;p&gt;Here is the sequence of my actions:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Connect with device&lt;/li&gt;
&lt;li&gt;Send first &amp;#39;Prepare Write Request&amp;#39;
handle = 0x11, offset = 0, data = 01&lt;/li&gt;
&lt;li&gt;Send	second &amp;#39;Prepare Write Request&amp;#39;
handle = 0x11, offset = 1, data = 02&lt;/li&gt;
&lt;li&gt;Send	third &amp;#39;Prepare Write Request&amp;#39;
handle = 0x11, offset = 2, data = 03&lt;/li&gt;
&lt;li&gt;Send &amp;#39;Execute Write Request&amp;#39;&lt;/li&gt;
&lt;li&gt;Send &amp;#39;Read Request&amp;#39;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Here is log:&lt;/p&gt;
&lt;p&gt;start
Event: 0x10
Event: 0x12
memory requested, 0x1
Event: 0x2
Event: 0x50
Event 0x50: 0x0 0x0
Event: 0x3&lt;/p&gt;
&lt;p&gt;As you can see (also I sow it via debug) stack don&amp;#39;t give me data in &amp;#39;BLE_GATTS_EVT_WRITE&amp;#39; (len = 0, data = 0).
But when I tried to read attribute after these operations, I received in &amp;#39;Read Respnse&amp;#39; correct data: 01 02 03.
In other words new attribute value was set, but I couldn&amp;#39;t receive this new value in handler (&amp;#39;BLE_GATTS_EVT_WRITE&amp;#39; event).
I viewed in debuger value of &amp;#39;queued_write_buffer&amp;#39; (member of &amp;#39;mem_block&amp;#39; union) passed as parameter in sd_ble_user_mem_reply.
&amp;#39;queued_write_buffer&amp;#39; had correct value:
{
0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01,	//first write (handler, offset, length, value)
0x11, 0x00, 0x01, 0x00, 0x01, 0x00, 0x02,	//second write
0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03	//third write
}&lt;/p&gt;
&lt;ol start="2"&gt;
&lt;li&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I tried to set attr_md.wr_auth = 1. In this case data in &amp;#39;BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST&amp;#39; event handler is correct. I sent for example 3 PrepareWrite packets:
- 2 bytes (0x01 and 0x02) with offset = 0
- 2 bytes (0x03 and 0x04) with offset = 2
- 2 bytes (0x05 and 0x06) with offset = 4&lt;/p&gt;
&lt;p&gt;and I received 4 (not 3) &amp;#39;BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST&amp;#39; events:
- for first write with correct data
- for second write with correct data
- for third write with correct data
- extra event with data = 0, offset = 0, len = 0.&lt;/p&gt;
&lt;p&gt;when I sent 2 writes, I received 3 events. and in case of 1 write, I received 2 events. What does this extra event mean?&lt;/p&gt;
&lt;ol start="3"&gt;
&lt;li&gt;
&lt;p&gt;What does it mean &amp;#39;if (&amp;amp;p_ble_evt-&amp;gt;evt.common_evt.params.user_mem_release.mem_block == &amp;amp;mem_block)&amp;#39; in &amp;#39;BLE_EVT_USER_MEM_RELEASE&amp;#39; case?
It&amp;#39;s never true...&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;As I read in your docemetation, stack send to application &amp;#39;BLE_EVT_USER_MEM_REQUEST&amp;#39; event after first &amp;#39;Prepare Write Request&amp;#39; but really it does it only after
Send &amp;#39;Execute Write Request&amp;#39;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Also my dongle didn&amp;#39;t receive &amp;#39;Prepare Write Response&amp;#39; packets, it received only &amp;#39;Execute Write Response&amp;#39;.
Is this possible? Or this bug of TI software?&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long Attributes</title><link>https://devzone.nordicsemi.com/thread/1777?ContentTypeID=1</link><pubDate>Tue, 03 Sep 2013 12:15:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bf4fabd4-10bd-4447-a5c5-801d4c35834a</guid><dc:creator>Ole Morten</dc:creator><description>&lt;p&gt;There shouldn&amp;#39;t be any problems making this work. I just did a quick test, as in the attachment, and I&amp;#39;m not able to see any problems when testing with iOS.&lt;/p&gt;
&lt;p&gt;If you take this zip, place it in Boards/nrf6310/ble/, you should be able to see everything working, as long as you have replaced the softdevice headers included in the SDK with the ones from the 6.0.0 zip.&lt;/p&gt;
&lt;p&gt;If you don&amp;#39;t get it working, I&amp;#39;d be interested to see what this example outputs on the UART.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/ble_5F00_app_5F00_lbs_2D00_long_2D00_write.zip"&gt;ble_app_lbs-long-write.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long Attributes</title><link>https://devzone.nordicsemi.com/thread/1776?ContentTypeID=1</link><pubDate>Tue, 03 Sep 2013 12:06:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eb2ebcef-998f-4fa5-a705-f6a455ecfa70</guid><dc:creator>Artem Zemlyanukhin</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;As I see in ble.h, &amp;#39;BLE_EVT_USER_MEM_REQUEST&amp;#39; is a member of enum BLE_COMMON_EVTS:&lt;/p&gt;
&lt;p&gt;enum BLE_COMMON_EVTS
{
BLE_EVT_TX_COMPLETE  = BLE_EVT_BASE,  /&lt;strong&gt;&amp;lt; Transmission Complete. */
BLE_EVT_USER_MEM_REQUEST,             /&lt;/strong&gt;&amp;lt; User Memory request. */
BLE_EVT_USER_MEM_RELEASE              /**&amp;lt; User Memory release. */
};&lt;/p&gt;
&lt;p&gt;For example, event &amp;#39;BLE_EVT_TX_COMPLETE &amp;#39; is used in GLS service. It is processed in &amp;#39;ble_gls_on_ble_evt&amp;#39; calling from &amp;#39;ble_evt_dispatch&amp;#39;. So I suppose, BLE_EVT_USER_MEM_REQUEST event I must handle in function calling from &amp;#39;ble_evt_dispatch&amp;#39; too. But stack don&amp;#39;t call &amp;#39;ble_evt_dispatch&amp;#39; with such event..&lt;/p&gt;
&lt;p&gt;Can I use any new options for attributes which I need to Long Read?&lt;/p&gt;
&lt;p&gt;Thank you for your response!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long Attributes</title><link>https://devzone.nordicsemi.com/thread/1775?ContentTypeID=1</link><pubDate>Tue, 03 Sep 2013 11:02:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:42a6ab05-ba6f-461c-aef2-f30c85d3065f</guid><dc:creator>Carles</dc:creator><description>&lt;p&gt;Hi there,&lt;/p&gt;
&lt;p&gt;I am guessing the issue here is that the SDK does not support BLE_EVT_USER_MEM_REQUEST yet, so that is why is not being handled in ble_evt_dispatch.&lt;/p&gt;
&lt;p&gt;I will let the people in charge of the SDK know of this and see if they can help you out.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Carles&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long Attributes</title><link>https://devzone.nordicsemi.com/thread/1774?ContentTypeID=1</link><pubDate>Mon, 02 Sep 2013 13:07:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2b212a04-be19-4608-8d0e-4ab81e42c8a7</guid><dc:creator>Artem Zemlyanukhin</dc:creator><description>&lt;p&gt;Hi Carles,&lt;/p&gt;
&lt;p&gt;I have some questions about Write Long.&lt;/p&gt;
&lt;p&gt;Because Master Control Panel 3.4.0 doesn&amp;#39;t support &amp;#39;Prepare Write&amp;#39; and &amp;#39;Execute Write&amp;#39; I use CC2540-based usb dongle (from TI) and BTool software to test Write Long.
I decided to implement &amp;#39;GATTS Queued Writes: App handled, one or more attributes require authorization&amp;#39;.
But I can&amp;#39;t catch &amp;#39;BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST&amp;#39; after I send PrepareWriteRequest or ExecuteWriteRequest via BTool.
As I saw in your Message Sequence Charts, I also have to handle &amp;#39;BLE_EVT_USER_MEM_REQUEST&amp;#39; and call &amp;#39;sd_ble_user_mem_reply&amp;#39;.
But I don&amp;#39;t know where I can handle &amp;#39;BLE_EVT_USER_MEM_REQUEST&amp;#39; event, stack doesn&amp;#39;t call &amp;#39;ble_evt_dispatch&amp;#39; with corresponding event.
Do you have any example how to use Write Long?&lt;/p&gt;
&lt;p&gt;Best Regards,
Artem Zemlyanukhin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long Attributes</title><link>https://devzone.nordicsemi.com/thread/1773?ContentTypeID=1</link><pubDate>Thu, 22 Aug 2013 11:39:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:97681ea1-1b3a-4e6c-8253-4eb8fe9be12f</guid><dc:creator>Artem Zemlyanukhin</dc:creator><description>&lt;p&gt;Carles,
Thanks a lot, try to test 6.0.0-1.alpha version!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long Attributes</title><link>https://devzone.nordicsemi.com/thread/1772?ContentTypeID=1</link><pubDate>Thu, 22 Aug 2013 11:26:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d130f6c4-6af1-4467-b22e-aa20a71983f0</guid><dc:creator>Carles</dc:creator><description>&lt;p&gt;Hi there,&lt;/p&gt;
&lt;p&gt;Read Long as a GATT server has been supported since very early versions of the SoftDevice.&lt;/p&gt;
&lt;p&gt;Version 6.0.0-1.alpha of the SoftDevice adds Write Long (and Reliable Write) support to the SoftDevice GATT server.&lt;/p&gt;
&lt;p&gt;Hope that helps,&lt;/p&gt;
&lt;p&gt;Carles&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long Attributes</title><link>https://devzone.nordicsemi.com/thread/1771?ContentTypeID=1</link><pubDate>Thu, 22 Aug 2013 11:23:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ccd11138-56fb-4e7c-8c27-24fcbef65e60</guid><dc:creator>Artem Zemlyanukhin</dc:creator><description>&lt;p&gt;Yes, my device is only GATT Server, so I need to receive Requests and send Responses.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long Attributes</title><link>https://devzone.nordicsemi.com/thread/1789?ContentTypeID=1</link><pubDate>Thu, 22 Aug 2013 11:15:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:61b40621-d143-4b74-a9a0-800e70a66920</guid><dc:creator>Carles</dc:creator><description>&lt;p&gt;Do you need them only as a GATT server? i.e. your nRF51 application will only act as a GATT server?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>