3 posts / 0 new
Last post
oren
Offline
Last seen:1 year 3 months ago
Expert
Joined:2014-06-28 22:03
Bug in app_task.c

Under dk_apps\src\modules\app\src\app_task.c, function gapm_cmp_evt_handler, line 155:


case GAPM_CANCEL:
{
if(param->status != GAP_ERR_NO_ERROR)
{
ASSERT_ERR(0); // unexpected error
}
}

case GAPM_SCAN_ACTIVE:
case GAPM_SCAN_PASSIVE:
{
app_scanning_completed_func();
}
break;

It looks like someone forgot tobreakthe GAPM_CANCEL case :)

In some scenario of my application, I need to change the advertise packet periodically.
Sending the GAPM_START_ADVERTISE_CMD doesn't work when the module is already advertising - GAPM_CANCEL_CMD must be sent first (by callingapp_adv_stop()).
Furthermore, I couldn't send the GAPM_START_ADVERTISE_CMD right after sending the GAPM_CANCEL_CMD - probably because the GAPM_CANCEL_CMD didn't finish.
One way to solve this is by sending the GAPM_START_ADVERTISE_CMD with a delay, but a more correct way is to wait for the GAPM_CMP_EVT that announces that the GAPM_CANCEL_CMD really finished.

如果GAPM_START_AD就好了VERTISE_CMD would restart the advertising with the new configuration.

Does GAPM_CANCEL_CMD cancel other operations besides the advertising? Are there any side effects to calling GAPM_CANCEL_CMD when the advertising is off?

Thanks

oren
Offline
Last seen:1 year 3 months ago
Expert
Joined:2014-06-28 22:03
My feature did not require

My feature did not require changingapp_task.cafter all (except for the missing break).
app_adv_undirect_completeandapp_adv_direct_completeare called whenever the advertising stops.
To avoid restarting the advertising during a connection, make sure thatke_state_get(TASK_APP) == APP_CONNECTABLEbefore you callapp_adv_start().

JE_Dialog
Offline
Last seen:2 days 7 hours ago
Staff
Joined:2013-12-05 14:02
thanks for letting us know

thanks for letting us know you solved this problem Oren.

BR JE_Dialog