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

Generic Access Profile Device Name change

One can change value of Device Name characteristics in Generic Access Profile. How can I register the change event? At the moment I would be able to do it by periodically reading sd_ble_gap_device_name_get() and compare read name with old name. If they are not equal then name was changed.

Is there a better way? I use softdevice 8.0.0.

How to properly start advertising with new name in advertising packet when advertising is already in progress?

Parents
  • FormerMember
    0 FormerMember

    You can set the device name using sd_ble_gap_device_name_set(..).

    In order to update the advertising data, you do only need to call sd_ble_gap_adv_data_set(..). Its documentation says the following: "Set, clear or update advertising and scan response data. "

    I would think the easiest way to update the new device name to the advertising data is to call sd_ble_gap_adv_data_set(..) when sd_ble_gap_device_name_set(..) returns NRF_SUCCESS.

    Update 07.04.16 If a central wants to update the name of a peripheral, it has to write to the device name characteristic. When writing to the device name characteristic, the device name will automatically be updated, no need to add extra code for that. However, what you need to verify is the security level required for updating the device name. The permissions are set with the p_write_perm parameter when calling sd_ble_gap_device_name_set(..).

    Note that 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.

  • FormerMember
    0 FormerMember in reply to FormerMember

    After taking a closer look, the device name is being updated automatically upon a write operation to the peripheral. I apologize for the confusion.

Reply Children
No Data
Related