<?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>Setting Bluetooth Device Name in Zephyr</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/62190/setting-bluetooth-device-name-in-zephyr</link><description>Using Zephyr, I&amp;#39;m looking to configure the BLE name of my devices to use the serial number they are provisioned with. 
 
 To this end there is the API &amp;quot;bt_set_name&amp;quot; that seems like it should do it, but I have not yet found anyway to get it to actually</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 16 Nov 2021 10:11:26 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/62190/setting-bluetooth-device-name-in-zephyr" /><item><title>RE: Setting Bluetooth Device Name in Zephyr</title><link>https://devzone.nordicsemi.com/thread/339183?ContentTypeID=1</link><pubDate>Tue, 16 Nov 2021 10:11:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:648186ce-1911-4e8c-8b85-81ae1d62b108</guid><dc:creator>Saleh</dc:creator><description>&lt;p&gt;You can set the device name in your code by calling &amp;quot;bt_set_name&amp;quot; function, after when Bluetooth has enabled but before when advertisement has started.&lt;/p&gt;
&lt;p&gt;Also it is necessary to enable dynamic name capability in the project configuration in addition to add BT_LE_ADV_OPT_USE_NAME to&amp;nbsp; bt_le_adv_param variable.&lt;/p&gt;
&lt;p&gt;Add these options to prfj.conf file:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;....

# Enable Dynamic name modification
CONFIG_BT_DEVICE_NAME_DYNAMIC=y
# Maximum chcaracter of the device name
# (Range: 2 to 248)
CONFIG_BT_DEVICE_NAME_MAX=30&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;and call bt_set_name after when bt has enabled but advertisement has not started&lt;/p&gt;
&lt;p&gt;main.c&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void main(void)
{
    struct bt_le_adv_param param;
    ...
    bt_enable(NULL);
    ...
    bt_set_name(&amp;quot;new name&amp;quot;);
    ...
    param.options = BT_LE_ADV_OPT_USE_NAME;
    ...
    bt_le_ext_adv_create(&amp;amp;param, NULL, &amp;amp;adv_set);
    bt_le_per_adv_start(adv_set);
    
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Setting Bluetooth Device Name in Zephyr</title><link>https://devzone.nordicsemi.com/thread/253608?ContentTypeID=1</link><pubDate>Fri, 05 Jun 2020 19:23:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:abdb0edd-7711-4080-b38b-909394a53987</guid><dc:creator>DevinCallahan</dc:creator><description>&lt;p&gt;I did try this and it didn&amp;#39;t help on its own.&lt;/p&gt;
&lt;p&gt;What DID help is realizing that the &amp;quot;Advertising Data&amp;quot; struct that gets passed to &amp;quot;bt_le_adv_start&amp;quot; is where the name is actually being configured.&amp;nbsp; I just modified the value and length in that struct before starting the advertisement and it all worked.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;I think there is a way to use &amp;quot;bt_set_name&amp;quot; but I still haven&amp;#39;t gotten&amp;nbsp;that way to work.&amp;nbsp; Too many flags.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Setting Bluetooth Device Name in Zephyr</title><link>https://devzone.nordicsemi.com/thread/253534?ContentTypeID=1</link><pubDate>Fri, 05 Jun 2020 12:20:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:251f6f1a-d3a8-4586-8ff2-e327c3721dd4</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;You need to enable the config &amp;quot;Allow to set Bluetooth device name on runtime&amp;quot;.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;In SESne:&lt;br /&gt;&lt;br /&gt;(top toolbar)&amp;nbsp;Project --&amp;gt; Configure nRF Connect SDK project --&amp;gt; menuconfig --&amp;gt; type &amp;quot;device name&amp;quot; in the filter box --&amp;gt; enable the &amp;#39;&lt;span&gt;Allow to set Bluetooth device name on runtime&amp;#39; configuration by toggling it&amp;#39;s button and click &amp;#39;configure&amp;#39; afterwards.&lt;br /&gt;&lt;br /&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x240/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-c05b6f6b3bd846a395a440d6f3739dc6/device_5F00_name_5F00_config.PNG" /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>