<?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>Who owns a characteristic&amp;#39;s value ?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/12734/who-owns-a-characteristic-s-value</link><description>My system is a BLE peripheral with 2 states. There is a characteristic that represents the state, and it can take 2 values: 0 and 1.
You can read the state, write it (force the system to change state), or be notified (be informed when system state changes</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 23 Mar 2016 09:07:27 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/12734/who-owns-a-characteristic-s-value" /><item><title>RE: Who owns a characteristic's value ?</title><link>https://devzone.nordicsemi.com/thread/48350?ContentTypeID=1</link><pubDate>Wed, 23 Mar 2016 09:07:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:120dbf61-7370-4d53-821d-aad2b573005f</guid><dc:creator>Thomas</dc:creator><description>&lt;p&gt;I thought that vloc =... USER meant that I could give a pointer of my state to the characteristic, and the characteristic value would always point to my state. is it wrong ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Who owns a characteristic's value ?</title><link>https://devzone.nordicsemi.com/thread/48349?ContentTypeID=1</link><pubDate>Wed, 23 Mar 2016 09:06:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9b8dd33a-1f7d-47a7-9a15-2929f86828c8</guid><dc:creator>Thomas</dc:creator><description>&lt;p&gt;your solution works when I used &lt;code&gt;attr_md.vloc = BLE_GATTS_VLOC_STACK&lt;/code&gt;. thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Who owns a characteristic's value ?</title><link>https://devzone.nordicsemi.com/thread/48348?ContentTypeID=1</link><pubDate>Wed, 23 Mar 2016 09:02:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:75283de4-6616-4d6d-a966-c33626d18706</guid><dc:creator>Thomas</dc:creator><description>&lt;p&gt;this doesn&amp;#39;t work. I did that in the on_write() method, of my ble service, just after calling my write_handler.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Who owns a characteristic's value ?</title><link>https://devzone.nordicsemi.com/thread/48347?ContentTypeID=1</link><pubDate>Wed, 23 Mar 2016 08:47:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6eb09289-6271-40a0-ba32-29e37b767f31</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Maybe you can to a control check of the received value at the write event. You can read the value with e.g. &lt;code&gt;p_ble_evt-&amp;gt;evt.gatts_evt.params.write.data&lt;/code&gt;. If the value is &amp;#39;0&amp;#39; or &amp;#39;1&amp;#39; everything is good, but if it is something else you can do:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;uint8_t your_state = 0x01;     // Your desired alternate state
ble_gatts_value_t value;       // Variable to hold desired state value with length and offset information
value.len = 1;                 // Lenght of your state characteristic
value.offset = 0;              // Offset of your state characteristic
value.p_value = &amp;amp;your_state;   // Alternate state
sd_ble_gatts_value_set(&amp;quot;current connection handle&amp;quot;, &amp;quot;characteristic handle&amp;quot;, &amp;amp;value); // Write new state to characteristic
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;to overwrite the new value.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>