Problem changing the BLE device name.

I need to be able to change the device name the SoftDevice uses  AFTER the soft device is up and running. To change the device name, To do this I use

errorCode = sd_ble_gap_device_name_set(&sec_mode, deviceName,
strlen(deviceName));

which also returns with no errors.

The problem is, the SoftDevice does not switch to the new device name the next time advertising is started. But the SoftDevice does seem to be locking the new name into its own flash because if I do a complete pull-the-power cold-start then the SoftStack will start advertising using the new device name.

Can anybody tell me how to get the SoftDevice to start using the new device name as soon as I change it? 

On small point, the name doesn't get changed while the device is SoftDevice is advertising, only when its connected.

Thanks,

Ed H.

  • Hello,

    The device name will become updated as soon as you have called  the sd_ble_gap_device_name_set() function. So if the client reads the name characteristic after that, it will receive the new name and not the old one. This new name will however not be reflected in the advertisement until next time you update/configure the adv. payload, which usually is on the next startup when advertising_init() is executed again.

    Here I've put together based on the ble_app_uart project to show how the advertisement data can be updated while connected in case it helps:

    nRF5_SDK17.1.0_ble_app_uart_name_update.zip

    Best regards,

    Vidar

Related