Hi guys,
I am currently working on a project where the client requires to dynamically change the advertising interval of the nrf52832 device from the mobile app. Below is my implementation, However the advertising interval is remaining the same as initially set by the application after running this function which I call from the on_write event of the service.
static uint32_t ble_cus_adv_update_interval(int8_t adv_interval) { uint32_t err_code; if (conn_handle != BLE_CONN_HANDLE_INVALID) { err_code = sd_ble_gap_disconnect(conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION); if (err_code != NRF_ERROR_INVALID_STATE) { APP_ERROR_CHECK(err_code); } } err_code = sd_ble_gap_adv_stop(_p_advertising->adv_handle); if (err_code != NRF_ERROR_INVALID_STATE) { APP_ERROR_CHECK(err_code); } _p_advertising->adv_params.interval = adv_interval; err_code = sd_ble_gap_adv_set_configure(&_p_advertising->adv_handle, NULL, &_p_advertising->adv_params); VERIFY_SUCCESS(err_code); err_code = sd_ble_gap_adv_start(&_p_advertising->adv_handle, &_p_advertising->conn_cfg_tag); VERIFY_SUCCESS(err_code); }
Any pointers on how to do it or where I am getting it wrong?