<?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>Variable length attribute</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/17191/variable-length-attribute</link><description>I wasn&amp;#39;t able to figure this one out from the documentation: 
 when do I set attr_md.vlen to 1 or 0? What are the implications? 
 Thanks
M</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 17 Nov 2016 16:29:46 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/17191/variable-length-attribute" /><item><title>RE: Variable length attribute</title><link>https://devzone.nordicsemi.com/thread/66031?ContentTypeID=1</link><pubDate>Thu, 17 Nov 2016 16:29:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f6945a83-1050-4064-8069-92f105203a2a</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi Moritz. It will then read the length of the whole characteristic. For the UART example it will therefore read 20 bytes, even though you maybe just sent 5 bytes. The 15 other bytes will be garbage values. If you want to send more data, you should instead create a new characteristic.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Variable length attribute</title><link>https://devzone.nordicsemi.com/thread/66030?ContentTypeID=1</link><pubDate>Wed, 16 Nov 2016 16:34:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:84787eaa-a029-406d-a560-0da23bd08395</guid><dc:creator>Moritz</dc:creator><description>&lt;p&gt;What happens when vlen is set to 0, but the received data length is shorter or longer than specified?&lt;/p&gt;
&lt;p&gt;Use case: Today I specify a characteristic that uses only 1 byte. But later on I realize I want to send more (optional) data, that should be ignored by devices that don&amp;#39;t understand it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Variable length attribute</title><link>https://devzone.nordicsemi.com/thread/66029?ContentTypeID=1</link><pubDate>Thu, 20 Oct 2016 10:11:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:644dc818-d7f6-401b-9657-0ca429e49109</guid><dc:creator>oneguy</dc:creator><description>&lt;p&gt;Thank you!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Variable length attribute</title><link>https://devzone.nordicsemi.com/thread/66028?ContentTypeID=1</link><pubDate>Thu, 20 Oct 2016 09:42:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c63f7c4a-416d-4855-91c6-273974eaea69</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;The vlen field can be set to mark a characteristic as variable length. A characteristic can either be of constant length (vlen = 0), or of variable length (vlen = 1).&lt;/p&gt;
&lt;p&gt;E.g. for the UART characteristics, it makes sense to have vlen = 1, since you may want to transmit any size of data from 1 to 20 bytes. But, e.g. for the &lt;a href="http://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.temperature_type.xml"&gt;Temperature Type&lt;/a&gt;, which is a fixed length characteristic (it has 8 bits and every bit is fixed),vlen should be 0.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>