Hi All,
In my application i am trying to turn off the advertisement and after 5 seconds i am trying to turn it on.But for the first connection after loading the code it is stable. But when i try to send an immediate alert code to disconnect it starts connecting and disconnecting continously.Here is my code snippet
if(ADVERT_OFF_PERIOD)
{
osal_start_timerEx( keyfobapp_TaskID, ADVERT_OFF_EVT, ADVERT_OFF_PERIOD );
}
if((advert_mode==1)&&( gapProfileState == GAPROLE_CONNECTED ))
{
flag=FALSE;
// operation=1;
operation_mode=0;
GAPRole_TerminateConnection();
GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &flag );
osal_stop_timerEx( keyfobapp_TaskID,ADVERT_OFF_EVT);
/osal_start_timerEx( keyfobapp_TaskID, ADVERT_ON_EVT, ADVERT_ON_PERIOD );
}
return (events ^ ADVERT_OFF_EVT);
}
if ( events & ADVERT_ON_EVT )
{
if(ADVERT_ON_PERIOD)
{
osal_start_timerEx( keyfobapp_TaskID, ADVERT_ON_EVT, ADVERT_ON_PERIOD );
}
if(operation==1) //&&(gapProfileState = GAPROLE_ADVERTISING));
{
flag=TRUE;
advert_mode=0;
operation=0;
GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &flag );
}
After executing this it is continously start connecting and disconnecting.Can anybody tell what is the procedure to follow inorder to stay connected
Regards
Don