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

Is it possible to change GAP device name in runtime without system reset?

Hi, 

Please advise.

I am using (nRF5SDK160098a08e2) , nrf52840 .

This is my code to change name in Runtime not via restart or timeout.

I call the function below every 30 Sec And it does not work.

int global_counter = 0;
char str_name[64];


void setDeviceName(int name_mode)
{
ble_gap_conn_sec_mode_t sec_mode;
advertising_stop();

global_counter++;
sprintf(str_name,"Counter[%d]",global_counter);

BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode);

err_code = sd_ble_gap_device_name_set(&sec_mode,(const uint8_t *) str_name,strlen(str_name));
APP_ERROR_CHECK(err_code);


gap_params_init();


advertising_start();
}

Thanks,

Zvika

Related