Changing the advertised device name at runtime and making the device name characteristic read-only

Hi,

I've started working with the nRF52-DK for developing a new product based on the nRF52832. I'll be using custom services so I took as a starting point the projects provided with this (https://www.youtube.com/watch?v=hY_tDext6zA) webinar. I'm using nRF Connect SDK version 1.9.1 with VS Code and nRF Connect for Android.

First, I want to do is to change the advertised name programmatically at runtime. I called bt_set_name("The-new-name") after calling bt_enable(...) and configured CONFIG_BT_DEVICE_NAME_DYNAMIC=y in prj.conf. The new name appears when reading the Device Name characteristic from the Generic Access profile, but the advertised name continues being the same configured with CONFIG_BT_DEVICE_NAME="Remote_controller".

How can I change the advertised name at runtime? Is it required to stop advertising, modify the advertising data passed to bt_le_adv_start() and start advertising again?

Second, the Device Name characteristic allows read and write accesses. When written to, the device just disconnects. After reconnecting it has been reverted again to its previous value. Is this behaviour correct?

And last, how do I configure the profile/characteristic/etc for making the Device Name characteristic read only?

Thanks a lot in advance.

BR

Related