<?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>DIS Update Serial Number</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/41257/dis-update-serial-number</link><description>Hi, 
 I would like to update the Device Information Service&amp;#39;s (DIS) serial number characteristic to reflect the actual serial number assigned by our production equipment. I understand that ble_dis.c (as supplied by Nordic) cannot do this. 
 Now I wonder</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 10 Dec 2018 10:30:40 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/41257/dis-update-serial-number" /><item><title>RE: DIS Update Serial Number</title><link>https://devzone.nordicsemi.com/thread/160935?ContentTypeID=1</link><pubDate>Mon, 10 Dec 2018 10:30:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b23882ca-a3d1-4277-bf65-02a1f2ffe6a0</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;There is essentially two things you need to think of:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The initial length becomes the maximum length.&lt;/li&gt;
&lt;li&gt;The maximum length is always used unless you set is_var_len in the characteristics properties to true (I did not mention this in my initial post).&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;With those things in mind updating the serial number works when I tested on my side. You can see these modifications from SDK 15.2 where I used your code and the HRS example. Button 4 on the DK is used to update to a new and shorter serial number.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-cb8e362791c849c89bacd4ed64feab93/main.c.diff"&gt;devzone.nordicsemi.com/.../main.c.diff&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-cb8e362791c849c89bacd4ed64feab93/ble_5F00_dis.c.diff"&gt;devzone.nordicsemi.com/.../ble_5F00_dis.c.diff&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DIS Update Serial Number</title><link>https://devzone.nordicsemi.com/thread/160787?ContentTypeID=1</link><pubDate>Fri, 07 Dec 2018 15:29:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bea91a64-8f00-40ad-9345-dc028c8ce8d6</guid><dc:creator>oneguy</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;With respect to persistency: yes, of course...&lt;/p&gt;
&lt;p&gt;With respect to what doesn&amp;#39;t work: The text displayed on nRF Connect (for example) is different to the string I&amp;#39;m passing to sd_ble_gatts_value_set. Do I need to pad out my string with \0 to max_len?&lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;assume max_len is set to 16&lt;/li&gt;
&lt;li&gt;I set serial_number to &amp;quot;1232&amp;quot; -&amp;gt; what do I need to do?&lt;/li&gt;
&lt;li&gt;I update serial number to &amp;quot;aaddbbtt&amp;quot; -&amp;gt;&amp;nbsp;&lt;span&gt;what do I need to do?&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;I update serial number to &amp;quot;?&amp;quot; -&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;what do I need to do?&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I would like nRF Connect to display exactly what is shown in the example.&lt;/p&gt;
&lt;p&gt;Cheers&lt;/p&gt;
&lt;p&gt;M&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DIS Update Serial Number</title><link>https://devzone.nordicsemi.com/thread/160720?ContentTypeID=1</link><pubDate>Fri, 07 Dec 2018 11:59:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a9dbaf19-53db-47d7-a943-baa0e8c05db5</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The length you are using during initialization becomes the maximum length for each characteristic, so using the maximum length for ble_dis_init_t::serial_num_str.length in the call to&amp;nbsp;ble_dis_init() should be all you need to do. In what way does it not work?&lt;/p&gt;
&lt;p&gt;As a side note: If you want the serial number to be persistent so that the new serial number is used after reset, you have to write it to flash (for instance using &lt;a href="https://www.nordicsemi.com/en/DocLib/Content/SDK_Doc/nRF5_SDK/v15-2-0/lib_fds"&gt;FDS&lt;/a&gt;) and read it and set it accordingly when you call&amp;nbsp;ble_dis_init() after reset.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>