<?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>Changing device name dynamically</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/44513/changing-device-name-dynamically</link><description>Hi there, 
 
 I am using the nRF connect app on Android to see my dongle&amp;#39;s name. I want the name to change every 5 seconds from one name to another. This is just for evaluation. 
 
 How can I do this? I am using SDK 15 with SD S140. I am using the LED</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 13 Mar 2019 15:40:50 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/44513/changing-device-name-dynamically" /><item><title>RE: Changing device name dynamically</title><link>https://devzone.nordicsemi.com/thread/176001?ContentTypeID=1</link><pubDate>Wed, 13 Mar 2019 15:40:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:08bf660b-a9e3-4747-a5dc-2a2cbee7dfb5</guid><dc:creator>Daniel</dc:creator><description>&lt;p&gt;I was able to get this working by doing something like this:&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void setDeviceName(deviceStatus_t status)
{
    ble_gap_conn_sec_mode_t sec_mode;
    BLE_GAP_CONN_SEC_MODE_SET_OPEN(&amp;amp;sec_mode);
    
    // Set the device name
    switch(status)
    {
        case STATUS_LOW:
            sd_ble_gap_device_name_set(&amp;amp;sec_mode, (const uint8_t *)DEVICE_NAME_LOW, strlen(DEVICE_NAME_LOW));
            bsp_board_led_on(BSP_BOARD_LED_1);
            break;
        case STATUS_MED:
            sd_ble_gap_device_name_set(&amp;amp;sec_mode, (const uint8_t *)DEVICE_NAME_MED, strlen(DEVICE_NAME_MED));
            bsp_board_led_on(BSP_BOARD_LED_3);
            break;
        case STATUS_HIGH:
            sd_ble_gap_device_name_set(&amp;amp;sec_mode, (const uint8_t *)DEVICE_NAME_HIGH, strlen(DEVICE_NAME_HIGH));
            bsp_board_led_on(BSP_BOARD_LED_2);
            break;
        case STATUS_ERR:
            sd_ble_gap_device_name_set(&amp;amp;sec_mode, (const uint8_t *)DEVICE_NAME_ERR, strlen(DEVICE_NAME_ERR));
            bsp_board_led_on(BSP_BOARD_LED_0);
            break;   
    }

    // Encode the advertising packet and start advertising
    ble_advdata_encode(&amp;amp;advdata, m_adv_data.adv_data.p_data, &amp;amp;m_adv_data.adv_data.len);
    sd_ble_gap_adv_set_configure(&amp;amp;m_adv_handle, &amp;amp;m_adv_data, &amp;amp;adv_params);
    sd_ble_gap_adv_stop(m_adv_handle);
    sd_ble_gap_adv_start(m_adv_handle, APP_BLE_CONN_CFG_TAG);
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing device name dynamically</title><link>https://devzone.nordicsemi.com/thread/175725?ContentTypeID=1</link><pubDate>Tue, 12 Mar 2019 14:55:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eecb8080-d116-4fad-8802-0041d2f7ccdd</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Are you getting any error codes from your code? You should stop the advertising before each call to sd_ble_gap_adv_start()&lt;/p&gt;
&lt;p&gt;Jared&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing device name dynamically</title><link>https://devzone.nordicsemi.com/thread/174878?ContentTypeID=1</link><pubDate>Thu, 07 Mar 2019 16:48:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:abaa30c4-0ef5-4291-9e1b-4915df3f2903</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;How to properly post source code:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/0167._5F00_Insert-Code-_2D00_-Nordic.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing device name dynamically</title><link>https://devzone.nordicsemi.com/thread/174873?ContentTypeID=1</link><pubDate>Thu, 07 Mar 2019 16:11:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:66dcadb4-dd7b-4578-8c46-0c5c99d9d66c</guid><dc:creator>Daniel</dc:creator><description>&lt;p&gt;Yes, the delay is just there temporarily. Can you add a link to the post which discusses using SDK 15 specifically.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I have searched and nothing has worked so far...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing device name dynamically</title><link>https://devzone.nordicsemi.com/thread/174837?ContentTypeID=1</link><pubDate>Thu, 07 Mar 2019 14:29:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:21492f5b-f940-4f37-a1aa-cd1f6a4eac2e</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/tutorials/b/software-development-kit/posts/application-timer-tutorial"&gt;Instead of using nrf_delay_ms you can use the app timer and handle the name change in its timeout handler. &lt;/a&gt;Changing the device name has been discussed in many threads on this forum, i suggest that you use the search function to find examples on how to do it :)&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Jared&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>