BLE advertising data update with SDK v17.0

FormerMember
FormerMember

Hello Noridc Support Team and All members,

I am new to BLE development.

I am using the nRF52 development kit and the SDK v17.0.2

My intent is to send the sensor data within BLE advertising packet.[BLE beacon mode]

I started of with the BLE beacon example from SDK and was able to send the sensor data.
However I faced issues when updating the sensor data at runtime. Data was not being sent.

After digging a bit into the stack code and reading forum posts I got to know that from SDK 15 on wards there was a change in the API


//Old API
err_code = ble_advdata_set(&advdata, NULL);
APP_ERROR_CHECK(err_code);

//New API
err_code = ble_advdata_encode(&siwi_ble_data.advdata, m_adv_data.adv_data.p_data, &m_adv_data.adv_data.len);
APP_ERROR_CHECK(err_code);

err_code = sd_ble_gap_adv_set_configure(&m_adv_handle, &m_adv_data, &m_adv_params);
APP_ERROR_CHECK(err_code);


Also I read the description about the data structure “ble_gap_adv_data_t”, which says this memory will remain unmodified in application RAM and in order to update user needs to create another buffer.

I tried few things but was not successful.


However I achieved the update of sensor data using SDK v14.2.0

What I would like to know is
- what is the correct way to update it using SDK v17.0
- Is there any documentation given by Nordic related to same.
- I am sure Nordic must have done these changes for a reason.
- I am also sure people must have reported this behaviour since the API was introduced in SDK v15

Can anyone help me with the same.

Thanks in advance

Related