This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

how to change the device name dynamically

Hi , i want to change the device name by connecting the device using nrf_toolbox , have a look at my code , you will get  what i am trying to do . By the way i am using nRF52832 , sdk 15,2 , i have modified the ble_app_uart example . please have a look . my device name is not changing 

main.zip

Thanks&Regards 

pspavi

Parents
  • Hi,

    Your code will always advertise the name in DEVICE_NAME. This is because you have already generated the advertising packet by the time you call sd_ble_gap_device_name_set() again with DEVICE_NAME_2. You need to generate the advertising data again after calling sd_ble_gap_device_name_set() for that to be reflected in the advertising data. Since you use the advertising module, you should call ble_advertising_advdata_update() (which in turn calls ble_advdata_encode()).

Reply
  • Hi,

    Your code will always advertise the name in DEVICE_NAME. This is because you have already generated the advertising packet by the time you call sd_ble_gap_device_name_set() again with DEVICE_NAME_2. You need to generate the advertising data again after calling sd_ble_gap_device_name_set() for that to be reflected in the advertising data. Since you use the advertising module, you should call ble_advertising_advdata_update() (which in turn calls ble_advdata_encode()).

Children
Related