<?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>How to prevent a client from writing an invalid value into a GATT characteristic?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/46630/how-to-prevent-a-client-from-writing-an-invalid-value-into-a-gatt-characteristic</link><description>Hello, 
 What is the best way to prevent a client from writing wrong values into a characteristic? For example, I created a writable uint8 characteristic on a nRF52832 that affects the duty cycle of a PWM in %. The Client that writes to the characteristic</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 26 Apr 2019 17:03:43 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/46630/how-to-prevent-a-client-from-writing-an-invalid-value-into-a-gatt-characteristic" /><item><title>RE: How to prevent a client from writing an invalid value into a GATT characteristic?</title><link>https://devzone.nordicsemi.com/thread/184138?ContentTypeID=1</link><pubDate>Fri, 26 Apr 2019 17:03:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c153e3a4-0c6a-4188-9d40-597c0a79dcb7</guid><dc:creator>Christian22</dc:creator><description>&lt;p&gt;Thank you. This helps me a lot. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to prevent a client from writing an invalid value into a GATT characteristic?</title><link>https://devzone.nordicsemi.com/thread/184136?ContentTypeID=1</link><pubDate>Fri, 26 Apr 2019 16:50:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:63e81895-eb00-4712-a416-cf4bdc614e89</guid><dc:creator>Andy</dc:creator><description>&lt;p&gt;If you want to let the central know that something went wrong, use an error code. Otherwise, you can just authorize the write, let the central think that everything is fine and ignore the write internally. It&amp;#39;s up to you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to prevent a client from writing an invalid value into a GATT characteristic?</title><link>https://devzone.nordicsemi.com/thread/184135?ContentTypeID=1</link><pubDate>Fri, 26 Apr 2019 16:40:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bf90a553-acbf-4f7a-8690-979f83e551a8</guid><dc:creator>Christian22</dc:creator><description>&lt;p&gt;Hi Andy,&lt;/p&gt;
&lt;p&gt;Thank you very much for your fast response.&lt;/p&gt;
&lt;p&gt;Do you know which error code I have to choose in response to a write request? In the &lt;strong&gt;core spec 5.0 Vol 3, Part G, 4.9.3&lt;/strong&gt; I found:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&amp;quot;If the Characteristic Value that is written is the wrong size, or has an invalid value as defined by the profile, then the value shall not be written and an Error Response shall be sent with the Error Code set to Application Error by the server.&amp;quot; &lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Does this mean I &lt;span style="text-decoration:underline;"&gt;have to use&lt;/span&gt; an error code between BLE_GATT_STATUS_ATTERR_APP_BEGIN and BLE_GATT_STATUS_ATTERR_APP_END if a client tries to write an invalid value?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to prevent a client from writing an invalid value into a GATT characteristic?</title><link>https://devzone.nordicsemi.com/thread/183880?ContentTypeID=1</link><pubDate>Thu, 25 Apr 2019 15:13:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3e4ae52f-0c35-4405-b6f3-f6a668b253b5</guid><dc:creator>Andy</dc:creator><description>&lt;p&gt;Yes, write with authorization is the way to go in this case :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>