Dear Dialog_Support,
Is it possible to call "user_app_adv_undirect_complete" function in user space except user_callback_config.h file? If yes then what should be the argument? Here the function "void user_app_adv_undirect_complete(uint8_t status)" has "status" as argument so during function call what should be used in place of "status"?
With Regards,
前腿Patel
Keywords:
Device:
Hi Ruchi Patel,
What is that you would like to do ? You cannot just invoke the user_app_adv_undirect_complete, this is a callback triggered by the SDK when the advertising actually stops. The function is triggered by the reception of the gapm_cmp_evt_handler() as soon as a GAPM_CMP_EVT is captured from the BLE stack that will notify the application that the advertising has stopped, the status is a parameter of the message from the stack for the status of the operation.
Thanks MT_dialog
Dear Dialog_Support Team,
I want to configure role switch part in my application and i have configured that successfully but on timer based. Here is the code snippet of role switch part.
uint8_t advertising = true;
void user_adv_stopped(uint8_t status)
{
arch_set_pxact_gpio();
// Change the GAP role to central
advertising = false;
user_app_configuration_func(GAP_CENTRAL_MST);
}
void user_scan_complete(uint8_t status)
{
advertising = true;
user_app_configuration_func(GAP_PERIPHERAL_SLV);
}
void user_app_on_set_dev_config_complete()
{
arch_set_pxact_gpio();
if(advertising)
{
app_easy_gap_non_connectable_advertise_start();
}
else // Ready to scan
{
// start a scan and a timer to stop it after some time
user_scan_start();
app_easy_timer(200, user_stop_scan);
}
}
Now i want to add role switch part on button press. Means by default device must be advertise and as i press the button it should stop advertise and start scanning. After finishing of all task as a central at the end it should go to peripheral mode means either on completion of task or timer based. So i need to calluser_app_adv_undirect_completefunction as i want to switch to central mode from advertising. If i can't calluser_app_adv_undirect_completeoruser_adv_stoppedfunctions then how to stop advertising? Can you suggest me any other way around?
With Regards,
前腿Patel
Hi Ruchi Patel,
I allready mention in order to stop advertise you should invoke the app_easy_gap_advertise_stop() and then as soon as the advertising stops the user_app_adv_undirect_complete() function will be invoked. So in order to stop advertise you should invoke the app_easy_gap_advertise_stop() and wait for the completion callback to occur, as soon as that callback occurs then you can continue doing whatever your application should do.
Thanks MT_dialog