Dear Dialog,
I have started using the new SDK 5 series.
I have want to change the advertisement data dynamically, and I have your example "Ble_app_peripheral", which works great, but as usual I have a small twist.
I want to broadcast in non-connectable advertise in this configuration:
static const struct advertise_configuration user_non_connectable_advertise_conf ={
/// Advertise operation type.
.advertise_operation=ADV_NON_CONN,
/// Own BD address source of the device:
.address_src=GAPM_PUBLIC_ADDR,
/// Advertise interval
.intv = 8000, // *0.625ms (+ pseudo random advDelay from 0 to 10ms)
///Advertising channel map
.channel_map = 0x7,
};
static const enum gap_adv_mode user_non_connectable_advertise_mode = GAP_BROADCASTER_MODE;
IMPORTANT issue here: I am using GAP_BROADCASTER_MODE.
Now I would like to continue after your example "Ble_app_peripheral", which is using the callback configuration in "user_callback_config.h" for restarting the advertisement, but I cannot get the callback function working:
.app_on_adv_undirect_complete = user_app_adv_undirect_complete,
.app_on_adv_direct_complete = NULL,
My question is: Does any callback map to a COMPLETE of my above mentioned advertisement?
Best Regards,
Ciano Frost
Denmark
Hi ciano,
No there isn't a callback for catching the ending of a non connectable advertisement. But what you can is:
1-option is the easyiest one, you can just place this "case GAPM_ADV_NON_CONN:" in the app_task.c above the "case GAPM_ADV_UNDIRECT" in the gapm_cmp_evt_handler() and use the undirected advertising callback for getting the ending of a non-connectable advertisement.
2-option (the proper one) is to catch the ending of a non connectable advertisement through the catch rest function (user_catch_rest_hndl). You can just place the below code in the user_peripheral.c function:
case GAPM_CMP_EVT:
{
struct gapm_cmp_evt const *msg_param = (struct gapm_cmp_evt const *)(param);
switch (msg_param->operation)
{
case GAPM_ADV_NON_CONN:
user_app_adv_start(); //or whatever you want after completetion
break;
default:
break;
} break;
}
Thanks MT_dialog
Thank you Dialog,
I used the second and proper solution, and it works very well.
I was actually also looking into using the "app_process_catch_rest_cb", so your answer was very helpfull.
我也挑选第二option, since I do not want to "hijack" the SDK, by adding usercode in it. Upgrading the SDK is easier this way.
Best Regards,
Ciano Frost
Denmark