I have set a manufacturer specific data string in the advertising data. I use a OS_timer to call a function repeatedly to update the advertising data. using the following code:
static void mnf_tim_cb(OS_TIMER timer)
{
// hw_gpio_toggle(HW_GPIO_PORT_1, HW_GPIO_PIN_5);//devkit use 0_7 for device
mnf_flag_1++;
ble_gap_adv_stop();
if(mnf_flag_1 == 0xFF)
mnf_flag_1 = 0x04;
adv_data[10] = mnf_flag_1;
ble_gap_adv_data_set(sizeof(adv_data), adv_data, name_len + 2, scan_rsp);
ble_gap_adv_start(GAP_CONN_MODE_UNDIRECTED);
}
The problem it updates before the extended sleep cycle starts. Once the sleep cycle starts it stops updating the advertising data. I have confirmed that the timer callback function is being executed as i toggle the LED to see it.
I have tried with stop and start advertising and without it also.
With stop and start it never updates the data; without those commands however it updates perfectly until the sleep cycle starts.
What can be the problem.
Warm Regards
also this is using prox-reporter as base
Hi mutahir,
Try to stop the advertising in the timer that you have set and then catch the advertising completion message in your main task, BLE_EVT_GAP_ADV_COMPLETED, in that handler, change the advertising string and then start advertising.
Thanks MT_dialog
I have tried this, but it's not working. As soon as the sleep cycle starts it stops updating. With sleep disabled in debug mode it keeps updating.
Tried the same thing with ble_prepherial project and that works correctly.
Please Help.
Hi mutahir,
Follow the procedure i ve descibed and also make sure that the data that you ve placed in the advertising string belongs to the retain section of memory, have the the adv_data that you are using as INITIALISED_PRIVILEGED_DATA variable.
Thanks MT_dialog
Thanks! using it as INITIALISED_PRIVILEGED_DATA fixed the problem.
Thanks for the help. Much appreciated.