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

Setting Bluetooth Device Name in Zephyr

Using Zephyr, I'm looking to configure the BLE name of my devices to use the serial number they are provisioned with.  

To this end there is the API "bt_set_name" that seems like it should do it, but I have not yet found anyway to get it to actually change the name.  The Device always advertises with whatever CONFIG_BT_DEVICE_NAME is set to.

Has anyone successfully done this with Zephyr?

Thank you so much for your help!

Parents
  • You need to enable the config "Allow to set Bluetooth device name on runtime". 

    In SESne:

    (top toolbar) Project --> Configure nRF Connect SDK project --> menuconfig --> type "device name" in the filter box --> enable the 'Allow to set Bluetooth device name on runtime' configuration by toggling it's button and click 'configure' afterwards.


  • I did try this and it didn't help on its own.

    What DID help is realizing that the "Advertising Data" struct that gets passed to "bt_le_adv_start" is where the name is actually being configured.  I just modified the value and length in that struct before starting the advertisement and it all worked.


    I think there is a way to use "bt_set_name" but I still haven't gotten that way to work.  Too many flags.

Reply
  • I did try this and it didn't help on its own.

    What DID help is realizing that the "Advertising Data" struct that gets passed to "bt_le_adv_start" is where the name is actually being configured.  I just modified the value and length in that struct before starting the advertisement and it all worked.


    I think there is a way to use "bt_set_name" but I still haven't gotten that way to work.  Too many flags.

Children
No Data
Related