<?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>Device ID as advertising name</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/63618/device-id-as-advertising-name</link><description>Hello, 
 I am trying to develop a product on a large scale. I need the last 4 digits of DEVICEADDR[0] as the advertising name for uniqueness. But I am not able to get it working. Please kindly help with this. 
 Thankyou.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 13 Jul 2020 14:33:51 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/63618/device-id-as-advertising-name" /><item><title>RE: Device ID as advertising name</title><link>https://devzone.nordicsemi.com/thread/259724?ContentTypeID=1</link><pubDate>Mon, 13 Jul 2020 14:33:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3984cf42-70ae-4979-975b-6a9886166b75</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;I suggest you enter into a debug session and read the value of&amp;nbsp;&lt;span&gt;LddGapParams.pDeviceName after you called&amp;nbsp;snprintf(LddGapParams.pDeviceName, &amp;quot;%c%c%c%c%x%x&amp;#39;, str_1[0], str_1[1], str_1[2], str_1[3]);.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Device ID as advertising name</title><link>https://devzone.nordicsemi.com/thread/259704?ContentTypeID=1</link><pubDate>Mon, 13 Jul 2020 13:37:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e2638a2f-d27a-4d5c-979a-6fdb1270e334</guid><dc:creator>Gunjan</dc:creator><description>&lt;p&gt;we have tried using snprintf but it didn&amp;#39;t work. Instead the device didn&amp;#39;t show any name while advertising.&lt;/p&gt;
&lt;p&gt;&amp;nbsp; unsigned char str_1[10];&lt;br /&gt;&amp;nbsp; str_1[0] = (NRF_FICR-&amp;gt;DEVICEADDR[0] &amp;amp; 0xF);&lt;br /&gt;&amp;nbsp; str_1[1] = ((NRF_FICR-&amp;gt;DEVICEADDR[0] &amp;gt;&amp;gt; 4) &amp;amp; 0xF);&lt;br /&gt;&amp;nbsp; str_1[2] = ((NRF_FICR-&amp;gt;DEVICEADDR[0] &amp;gt;&amp;gt; 8) &amp;amp; 0xF);&lt;br /&gt;&amp;nbsp; str_1[3] = ((NRF_FICR-&amp;gt;DEVICEADDR[0] &amp;gt;&amp;gt; 12) &amp;amp; 0xF);&lt;/p&gt;
&lt;p&gt;&amp;nbsp; snprintf(LddGapParams.pDeviceName, &amp;quot;%c%c%c%c%x%x&amp;#39;, str_1[0], str_1[1], str_1[2], str_1[3]);&lt;/p&gt;
&lt;p&gt;&amp;nbsp; err_code = sd_ble_gap_device_name_set(&amp;amp;sec_mode,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (const uint8_t *)LpGapStruc-&amp;gt;pDeviceName, size);&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&amp;nbsp; APP_ERROR_CHECK(err_code);&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Device ID as advertising name</title><link>https://devzone.nordicsemi.com/thread/259426?ContentTypeID=1</link><pubDate>Fri, 10 Jul 2020 11:51:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0833aee1-862b-4ad0-b53f-3b99e33293ca</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user=""]I need the last 4 digits of DEVICEADDR[0] as the advertising name for uniqueness. But I am not able to get it working. Please kindly help with this.[/quote]
&lt;p&gt;What have you done to implement this, and what unexpected behavior are you seeing?&lt;br /&gt;If you could share some code, that would be very helpful to have a look at.&lt;br /&gt;&lt;br /&gt;To achieve this you will have to append the digits to the end of your device name c-string, before supplying it as part of the advertising data.&lt;br /&gt;You may append the digits to your device name by for example using&amp;nbsp;&lt;em&gt;snprintf&amp;nbsp;&lt;/em&gt;or any other c-string concatication function.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>