<?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 the Advertising Name using NRF tool App</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/47703/changing-the-advertising-name-using-nrf-tool-app</link><description>Hi, 
 I am using NRF51822 pca10028 UART ble example , 
 I need to give provision to change the name of the device after pairing and reset the device so that it starts advertising with the name provided by the user, 
 
 Thank you</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 12 Jun 2019 14:38:34 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/47703/changing-the-advertising-name-using-nrf-tool-app" /><item><title>RE: Changing the Advertising Name using NRF tool App</title><link>https://devzone.nordicsemi.com/thread/192444?ContentTypeID=1</link><pubDate>Wed, 12 Jun 2019 14:38:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2312d919-f19f-49d0-bf23-8d6fc2666f73</guid><dc:creator>Mttrinh</dc:creator><description>&lt;p&gt;Before updating the name via UART, do you get the correct name up in the Bluetooth settings on your phone?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The app get the name from the advertisement packet, while the bluetooth settings get the name using this function &lt;a href="https://developer.android.com/reference/android/bluetooth/BluetoothDevice.html#getName()" rel="noopener noreferrer" target="_blank"&gt;BluetoothDevice.getName()&lt;/a&gt;.&amp;nbsp;&lt;span&gt;This method just returns the name for this device from the cache. It seems like the issue might be that the cache doesn&amp;#39;t get cleared.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing the Advertising Name using NRF tool App</title><link>https://devzone.nordicsemi.com/thread/191601?ContentTypeID=1</link><pubDate>Fri, 07 Jun 2019 10:32:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:11f98c79-7f55-4913-97cd-d83874c0da4d</guid><dc:creator>Nitin Kumar</dc:creator><description>&lt;p&gt;As i said in the post it&amp;nbsp; works on NRF tool app but i need the updated&amp;nbsp; name to be displayed in normal Bluetooth setting.Is there any other method&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing the Advertising Name using NRF tool App</title><link>https://devzone.nordicsemi.com/thread/191014?ContentTypeID=1</link><pubDate>Wed, 05 Jun 2019 08:53:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5e4e8b15-c454-4183-a04c-4647c51d9c82</guid><dc:creator>Mttrinh</dc:creator><description>&lt;p&gt;Have you tried with nRF Connect? Do you see the same issue?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing the Advertising Name using NRF tool App</title><link>https://devzone.nordicsemi.com/thread/190791?ContentTypeID=1</link><pubDate>Tue, 04 Jun 2019 12:58:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:36a92aeb-2660-49c4-9984-d1f8ffa85258</guid><dc:creator>Nitin Kumar</dc:creator><description>&lt;p&gt;HI Mttrinh,&lt;/p&gt;
&lt;p&gt;I tried doing that and even i did a hard reset ,its not working .&lt;/p&gt;
&lt;p&gt;Kindly guide&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing the Advertising Name using NRF tool App</title><link>https://devzone.nordicsemi.com/thread/190514?ContentTypeID=1</link><pubDate>Mon, 03 Jun 2019 12:41:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c19f301c-9a5f-4264-ad2d-647c01a7c701</guid><dc:creator>Mttrinh</dc:creator><description>&lt;p&gt;Like awneil mentioned, you might need to turn Bluetooth off and on again to clear the cache.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing the Advertising Name using NRF tool App</title><link>https://devzone.nordicsemi.com/thread/190069?ContentTypeID=1</link><pubDate>Thu, 30 May 2019 13:29:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6fcc3e87-be62-40b5-8c9b-eb12c85dcc51</guid><dc:creator>Nitin Kumar</dc:creator><description>&lt;p&gt;Hi Awneil,&lt;/p&gt;
&lt;p&gt;I am using this&amp;nbsp;&lt;a title="app" href="https://play.google.com/store/apps/details?id=com.macdom.ble.blescanner&amp;amp;hl=en_IN"&gt;https://play.google.com/store/apps/details?id=com.macdom.ble.blescanner&amp;amp;hl=en_IN&lt;/a&gt;&amp;nbsp; app&lt;/p&gt;
[quote userid="6462" url="~/f/nordic-q-a/47703/changing-the-advertising-name-using-nrf-tool-app/190063"]You previously said that it was &lt;em&gt;&lt;strong&gt;not&lt;/strong&gt;&lt;/em&gt; updated.[/quote]
&lt;p&gt;Yes i am not seeing the updated name, its shows N/A but in the&lt;span&gt;&amp;nbsp;NRF toolbox UART app ble name is&amp;nbsp; Correctly updated.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing the Advertising Name using NRF tool App</title><link>https://devzone.nordicsemi.com/thread/190063?ContentTypeID=1</link><pubDate>Thu, 30 May 2019 12:57:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eb7af1db-ed1f-404c-9387-92c604b12806</guid><dc:creator>awneil</dc:creator><description>[quote userid="79399" url="~/f/nordic-q-a/47703/changing-the-advertising-name-using-nrf-tool-app/190058"]the name is updated as N/A[/quote]
&lt;p&gt;What do you mean by that?&lt;/p&gt;
&lt;p&gt;You previously said that it was &lt;em&gt;&lt;strong&gt;not&lt;/strong&gt;&lt;/em&gt; updated.&lt;/p&gt;
[quote userid="79399" url="~/f/nordic-q-a/47703/changing-the-advertising-name-using-nrf-tool-app/190058"]the BLE Scanner App from the Google App store[/quote]
&lt;p&gt;There are dozens of &amp;quot;BLE scanner&amp;quot; apps on&amp;nbsp;&lt;span&gt;the Google App store!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing the Advertising Name using NRF tool App</title><link>https://devzone.nordicsemi.com/thread/190058?ContentTypeID=1</link><pubDate>Thu, 30 May 2019 12:14:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f43d92a2-fa52-4b6d-8bcb-bd2759a4db79</guid><dc:creator>Nitin Kumar</dc:creator><description>&lt;p&gt;My bad, Normal BLE Scanner means the settings option in the phone and&amp;nbsp; i also checked the same from other phone the name is updated as N/A .&lt;/p&gt;
&lt;p&gt;Even i checked in the BLE Scanner App from the Google App store it also reflects the same N/A&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing the Advertising Name using NRF tool App</title><link>https://devzone.nordicsemi.com/thread/190051?ContentTypeID=1</link><pubDate>Thu, 30 May 2019 11:44:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:60811a48-a4c7-4ad8-b2c1-9267b8a56a86</guid><dc:creator>awneil</dc:creator><description>[quote userid="79399" url="~/f/nordic-q-a/47703/changing-the-advertising-name-using-nrf-tool-app/190050"]normal BLE Scanner[/quote]
&lt;p&gt;What do you mean by that? What is, &amp;quot;normal&amp;quot;?!&lt;/p&gt;
&lt;p&gt;Note that the OS may be &amp;quot;caching&amp;quot; the old name - so you may have to turn the BT off &amp;amp; on again to clear the cache ...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing the Advertising Name using NRF tool App</title><link>https://devzone.nordicsemi.com/thread/190050?ContentTypeID=1</link><pubDate>Thu, 30 May 2019 11:33:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:da8ef600-3374-4c55-9835-22dd52b00247</guid><dc:creator>Nitin Kumar</dc:creator><description>&lt;p&gt;Hi Mttrinh,&lt;/p&gt;
&lt;p&gt;I tried using pstorage ,got the data in&amp;nbsp;&lt;span&gt;nus_data_handler() and used&amp;nbsp;sd_ble_gap_device_name_set () passed the value and gave a soft reset&amp;nbsp;sd_nvic_SystemReset() .&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The name change works or reflects&amp;nbsp;&amp;nbsp;only in NRF toolbox UART app but when i search in normal BLE Scanner the name is not updated .&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt; 
int main(void)
{
 uint32_t err_code;
    bool erase_bonds;
    uint8_t  start_string[] = START_STRING;
   
    // Initialize.
    APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, false);
     uart_init();
    buttons_leds_init(&amp;amp;erase_bonds);
    ble_stack_init();
		 device_manager_init(erase_bonds);
		
				pstorage_test_store_and_update();
  //		printf(&amp;quot;pstorage load blocks 0 \r\n&amp;quot;);
				pstorage_load(dest_data_0, &amp;amp;block_0_handle, 16, 0);				 //Read from flash, only one block is allowed for each pstorage_load command
				nrf_delay_ms(2000);
			
				printf(&amp;quot;    Data loaded from block 0: %s\r\n&amp;quot;, dest_data_0);  
		
		gap_params_init();
    services_init();
	
    advertising_init();
    conn_params_init();
    


    err_code = ble_advertising_start(BLE_ADV_MODE_FAST);
    APP_ERROR_CHECK(err_code);
    
	    printf(&amp;quot;%s&amp;quot;,start_string);
				
    
//		DATA_NAME=dest_data_0;
		// Enter main loop.
    for (;;)
    {
			
        power_manage();
        printf(&amp;quot;\n\rtime0=%lld&amp;quot;,time0);
					nrf_delay_ms(1000);
					time0++;
    }
}


static void example_cb_handler(pstorage_handle_t  * handle,
															 uint8_t              op_code,
                               uint32_t             result,
                               uint8_t            * p_data,
                               uint32_t             data_len)
{
		if(handle-&amp;gt;block_id == pstorage_wait_handle) { pstorage_wait_flag = 0; }  //If we are waiting for this callback, clear the wait flag.
	
		switch(op_code)
		{
			case PSTORAGE_LOAD_OP_CODE:
				 if (result == NRF_SUCCESS)
				 {
						 printf(&amp;quot;pstorage LOAD callback received \r\n&amp;quot;);
						 bsp_indication_set(BSP_INDICATE_ALERT_0);				 
				 }
				 else
				 {
						 printf(&amp;quot;pstorage LOAD ERROR callback received \r\n&amp;quot;);
						 bsp_indication_set(BSP_INDICATE_RCV_ERROR);
				 }
				 break;
			case PSTORAGE_STORE_OP_CODE:
				 if (result == NRF_SUCCESS)
				 {
						 printf(&amp;quot;pstorage STORE callback received \r\n&amp;quot;);
						 bsp_indication_set(BSP_INDICATE_ALERT_1);
				 }
				 else
				 {
					   printf(&amp;quot;pstorage STORE ERROR callback received \r\n&amp;quot;);
						 bsp_indication_set(BSP_INDICATE_RCV_ERROR);
				 }
				 break;				 
			case PSTORAGE_UPDATE_OP_CODE:
				 if (result == NRF_SUCCESS)
				 {
						 printf(&amp;quot;pstorage UPDATE callback received \r\n&amp;quot;);
						 bsp_indication_set(BSP_INDICATE_ALERT_2);
				 }
				 else
				 {
						 printf(&amp;quot;pstorage UPDATE ERROR callback received \r\n&amp;quot;);
						 bsp_indication_set(BSP_INDICATE_RCV_ERROR);
				 }
				 break;
			case PSTORAGE_CLEAR_OP_CODE:
				 if (result == NRF_SUCCESS)
				 {
						 printf(&amp;quot;pstorage1 CLEAR callback received \r\n&amp;quot;);
						 bsp_indication_set(BSP_INDICATE_ALERT_3);
				 }
				 else
				 {
					   printf(&amp;quot;pstorage 2CLEAR ERROR callback received \r\n&amp;quot;);
						 bsp_indication_set(BSP_INDICATE_RCV_ERROR);
				 }
				 break;	 
		}			
}

static void pstorage_test_store_and_update(void)
{
	
		pstorage_module_param_t param;

	
	
		retval = pstorage_init();
		if(retval != NRF_SUCCESS)
		{
				bsp_indication_set(BSP_INDICATE_FATAL_ERROR);
		}
	     
		param.block_size  = 16;                   //Select block size of 16 bytes
		param.block_count = 4;                   //Select 10 blocks, total of 160 bytes
		param.cb          = example_cb_handler;   //Set the pstorage callback handler
			nrf_delay_ms(1000);
		printf(&amp;quot;\r\n\r\npstorage initializing ... \r\n&amp;quot;);
		retval = pstorage_register(&amp;amp;param, &amp;amp;handle);
		if (retval != NRF_SUCCESS)
		{
				bsp_indication_set(BSP_INDICATE_FATAL_ERROR);
		}

        pstorage_block_identifier_get(&amp;amp;handle, 0, &amp;amp;block_0_handle);
}

static void nus_data_handler(ble_nus_t * p_nus, uint8_t * p_data, uint16_t length)
{
if(p_data[0] == &amp;#39;N&amp;#39;)
    {
					for (int a = 1; a &amp;lt; length; a++) 
        { 
       source_data_0[a] =p_data[a] ; 
			// while(app_uart_put(p_data[a]) != NRF_SUCCESS);
		}
		printf(&amp;quot;pstorage clear 48 bytes from block 0 \r\n&amp;quot;);
		retval = pstorage_clear(&amp;amp;block_0_handle, 48);                       
		if(retval != NRF_SUCCESS)  { bsp_indication_set(BSP_INDICATE_RCV_ERROR); }
		
			printf(&amp;quot;pstorage store into block 0\r\n    Data written into block 0: %s\r\n&amp;quot;, source_data_0);
		pstorage_store(&amp;amp;block_0_handle, source_data_0, 16, 0);     //Write to flash
			nrf_delay_ms(2000);
		printf(&amp;quot;pstorage wait for block 0 store to complete ... \r\n&amp;quot;);
		while(pstorage_wait_flag) { power_manage(); }              //Sleep until store operation is finished.
		nrf_delay_ms(2000);
		
		printf(&amp;quot;pstorage load blocks 0 \r\n&amp;quot;);
		pstorage_load(dest_data_0, &amp;amp;block_0_handle, 16, 0);				 //Read from flash, only one block is allowed for each pstorage_load command
			nrf_delay_ms(3000);
			
			printf(&amp;quot;    Data loaded from block 0: %s\r\n&amp;quot;, dest_data_0);
     }
     if(p_data[0] == &amp;#39;R&amp;#39;)
				{
					app_uart_flush();
					printf(&amp;quot;Resetcause0x01&amp;quot;);
					nrf_delay_ms(3000);
					sd_nvic_SystemReset();
				}
}

static void gap_params_init(void)
{
    uint32_t                err_code;
    ble_gap_conn_params_t   gap_conn_params;
    ble_gap_conn_sec_mode_t sec_mode;

    BLE_GAP_CONN_SEC_MODE_SET_OPEN(&amp;amp;sec_mode);
    
    err_code = sd_ble_gap_device_name_set(&amp;amp;sec_mode,
                                          (const uint8_t *) dest_data_0,
                                         sizeof(dest_data_0));																	
    APP_ERROR_CHECK(err_code);

    memset(&amp;amp;gap_conn_params, 0, sizeof(gap_conn_params));

    gap_conn_params.min_conn_interval = MIN_CONN_INTERVAL;
    gap_conn_params.max_conn_interval = MAX_CONN_INTERVAL;
    gap_conn_params.slave_latency     = SLAVE_LATENCY;
    gap_conn_params.conn_sup_timeout  = CONN_SUP_TIMEOUT;

    err_code = sd_ble_gap_ppcp_set(&amp;amp;gap_conn_params);
    APP_ERROR_CHECK(err_code);
		m_static_pin_option.gap_opt.passkey.p_passkey = &amp;amp;passkey[0];
    err_code = sd_ble_opt_set(BLE_GAP_OPT_PASSKEY, &amp;amp;m_static_pin_option);
    APP_ERROR_CHECK(err_code); 
}
    
    
    &lt;/pre&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing the Advertising Name using NRF tool App</title><link>https://devzone.nordicsemi.com/thread/189888?ContentTypeID=1</link><pubDate>Wed, 29 May 2019 12:55:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e7a7f564-feb2-4b0c-b330-ed4d19861b94</guid><dc:creator>Mttrinh</dc:creator><description>[quote user="Nitin Kumar"]i change the name of the BLE by taking the input from the BLEUART&amp;nbsp; and handle the name change in the&amp;nbsp;nus_data_handler()[/quote]
&lt;p&gt;Yes, that is correct :) you can change the name with this function&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v3.0.0/group___b_l_e___g_a_p___f_u_n_c_t_i_o_n_s.html#gae779f7eed346027dc4cbaf438352e5db" rel="noopener noreferrer" target="_blank"&gt;sd_ble_gap_device_name_set(..)&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing the Advertising Name using NRF tool App</title><link>https://devzone.nordicsemi.com/thread/189756?ContentTypeID=1</link><pubDate>Wed, 29 May 2019 06:35:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:721e9227-9d4d-45ff-980e-a3cb1e497b05</guid><dc:creator>Nitin Kumar</dc:creator><description>&lt;p&gt;Hi Mttrinh,&lt;/p&gt;
&lt;p&gt;I have tried the pstorage example from the Git LAB and got to know how to access the Flash memory .But now can i change the name of the BLE by taking the input from the BLEUART&amp;nbsp; and handle the name change in the&amp;nbsp;nus_data_handler() or is there any option to change the BLE name&lt;/p&gt;
&lt;p&gt;It would be helpful if i get a example or document or usefullthread regarding the same .&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thankyou,&lt;/p&gt;
&lt;p&gt;Nitin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing the Advertising Name using NRF tool App</title><link>https://devzone.nordicsemi.com/thread/189396?ContentTypeID=1</link><pubDate>Mon, 27 May 2019 15:18:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5cb6e471-637c-4015-8f77-88bcd079b012</guid><dc:creator>Mttrinh</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;This can be done in the following way: You have &lt;span&gt;update the device&amp;#39;s name&amp;nbsp;over UART&lt;/span&gt;, store the new name in flash, and set the new device name after reset.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The new device name is not automatically written to flash, it means that upon a reset, the device will have the original device name. If you want to store and re-store the updated device name upon a reset, you will have to do that manually using &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v12.3.0/lib_fstorage.html?cp=5_5_7_3_38" rel="noopener noreferrer" target="_blank"&gt;fstorage&lt;/a&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;There are many&amp;nbsp;threads discussing&amp;nbsp;this topic already on the forum, I would suggest you use the search function to examples on how to do it :)&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>