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

Changing the advertising name "on the fly" on nrf52832

Hello everyone,

I am having difficulties on changing the advertising name of my device (nRF52832).

Here is the piece of code that I am using to do it:

ble_gap_conn_sec_mode_t	sec_mode;

BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode);
err_code = sd_ble_gap_device_name_set(&sec_mode, (const uint8_t *)ble_dev_info_device_name, name_size);
APP_ERROR_CHECK(err_code);

"ble_dev_info_device_name" and "name_size" are well set to a different value than the one currently advertising.

Everything seems to goes well and the err_code returned is 0x00, but the name of the device is still the same (I use the nrfConnect application on my smartphone).

Am I missing something?

Parents Reply
  • @Jørgen

    What that answer seems to not explain is that you need to write the raw data advertising data using sd_ble_gap_adv_data_set(..) But AFIK there is no easy way to determine what the existing advertising data looks like.

    I posted a question about this some time ago, and the consensus was the best method was to capture an advertising packet and reverse engineer it to determine what you need to change.

    Its a shame the SD does not have a function to "get" the current adv data.

Children
No Data
Related