Hi Nordic Team,
I am using ble_advertising_advdata_update() to update some of the advertising data. I am doing every time the device is asked to advertise. In my code I do at the event 'BLE_ADV_EVT_FAST' in the advertising events handler. See below my code.
The issue I am facing is when I include the adv_data_update() to the code, the device doesn't advertise. When it's not there, the device advertises.
Is this expected? Am I doing something wrong?
I am using SDK 17.0.2 and nRF Connect Desktop to see and connect to my device.
Many thanks
/* Code */
1/ advertising events handler
static void on_adv_evt(ble_adv_evt_t ble_adv_evt)
{
ret_code_t err_code;
switch (ble_adv_evt)
{
case BLE_ADV_EVT_FAST:
{
NRF_LOG_INFO("start - advertising.");
adv_data_update();
break;
}
case BLE_ADV_EVT_IDLE:
{
NRF_LOG_INFO("stop - advertising.");
break;
}
default:
break;
}
NRF_LOG_FLUSH();
}
2/ advertising data update function
void adv_data_update(void)
{
ret_code_t err_code;
ble_advdata_manuf_data_t manuf_data;
new_advdata.p_manuf_specific_data = &manuf_data;
NRF_LOG_INFO("Updating advertising data!");
manuf_data.company_identifier = APP_COMPANY_IDENTIFIER;
manuf_data.data.p_data = (uint8_t *)&adv_data;
manuf_data.data.size = sizeof(adv_data);
err_code = ble_advertising_advdata_update(&m_advertising, &new_advdata, NULL);
APP_ERROR_CHECK(err_code);
NRF_LOG_INFO("Advertising data updated!");
NRF_LOG_FLUSH();
}