BTA timer configuration

Hello everyone,

Can you help me, I have a problem with a timer that don’t woke up and I have a period of 1 minutes.

thank you,

le_result_t Motion::StartTimer()
{
le_result_t ret = LE_FAULT;
static size_t PeriodetosendP = 0;

puts(" ---[Motion] *** Start timer *** \n");

/*mutexPeriod.lock();
PeriodetosendP = Alert_Motion_Period;
mutexPeriod.unlock();*/

//std::cout<<"---[Motion] ***periode = "<<PeriodetosendP <<"***"<<std::endl;

if((ModeExecTimer = le_timer_Create("ModeExecTimer")) == NULL)
{
	std::cout<<"---[Motion] *** Could not create the ModeExecTimer"<<std::endl;

}
le_clk_Time_t clk = { .sec = 60, .usec = 1000000 };
std::cout<<"clk sec = "<<clk.sec<<"clk usec "<<clk.usec<<std::endl;
le_timer_SetInterval(ModeExecTimer, clk);

/*if(le_timer_SetMsInterval(ModeExecTimer, PeriodetosendP*1000) == LE_OK)
{
	std::cout<<"---[Motion] ***success status to set interval ret == LE_OK *** \n"<<std::endl;
}
else
{

}*/

if(le_timer_SetRepeat(ModeExecTimer, 0) == LE_OK)
{
	std::cout<<"---[Motion] success to repeat Timer"<<std::endl;
}
else
{
	std::cout<<"---[Motion] this  timer is currently running echeck to repeat timer "<<std::endl;
}

if(le_timer_SetHandler(ModeExecTimer, SetHundler) != LE_OK)
{
	std::cout<<"---[Motion] *** Could not set the handler for ModeExecTimer *** "<<std::endl;
}

if( le_timer_Start(ModeExecTimer) == LE_OK)
{
	printf("---[Motion] *** timer start *** \n");
}
else
{
	printf("---[Motion] *** timer start = LE_BUSY the timer is already running *** \n");

}

if(le_timer_IsRunning(ModeExecTimer))
{
	std::cout<<"---[Motion] *** is running status le_timer_IsRunning = LE_OK "<<std::endl;
}
else
{
	std::cout<<"---[Motion] *** this timer object currently running *** \n"<<std::endl;

	if(le_timer_SetMsInterval(ModeExecTimer, PeriodetosendP*1000) != LE_OK)
	{
		std::cout<<"---[Motion] **** Cannot set Interval timer! *** "<<std::endl;
	}
	else
	{
		le_timer_Start(ModeExecTimer);

	}
}
le_timer_GetContextPtr(ModeExecTimer);
NumrExpTimer = le_timer_GetExpiryCount(ModeExecTimer);
std::cout<<"---[Motion] **** Expiry Count *** " << NumrExpTimer <<std::endl;

return ret;

}

void SetHundler(le_timer_Ref_t timerRef)
{
timerRef = NULL;
Motion motion;

std::cout <<"---[Motion] **** hello *** \n"<< "***"<< __func__<<"***"<<std::endl;

if(ModeExecTimer != NULL)
{
	le_timer_Stop(ModeExecTimer);
	std::cout<<"---[Motion] *** Timer != NULL *** \n"<<std::endl;
}
else
{
	std::cout<<"---[Motion] *** Timer == NULL *** \n "<<std::endl;
}

//std::cout<<"---[Motion] *** Set Period *** \n"<<std::endl;
//motion.SetPeriod();

std::cout<<"---[Motion] *** Start Timer *** \n"<<std::endl;
motion.StartTimer();

}

Hi,

What happens if your timer handler just do the following?

void SetHundler(le_timer_Ref_t timerRef)
{
   std::cout <<"---[Motion] **** hello *** \n"<< "***"<< __func__<<"***"<<std::endl;
}

Hi,

thank you for answering my question.
when I call it right, that’s what like result,

void SetHundler(le_timer_Ref_t timerRef)
{
timerRef = NULL;
Motion motion;

std::cout <<"---[Motion] **** hello *** \n"<< "***"<< __func__<<"***"<<std::endl;

/*if(ModeExecTimer != NULL)
{
	le_timer_Stop(ModeExecTimer);
	std::cout<<"---[Motion] *** Timer != NULL *** \n"<<std::endl;
}
else
{
	std::cout<<"---[Motion] *** Timer == NULL *** \n "<<std::endl;
}

//std::cout<<"---[Motion] *** Set Period *** \n"<<std::endl;
//motion.SetPeriod();

std::cout<<"---[Motion] *** Start Timer *** \n"<<std::endl;
motion.StartTimer();

*/

}

application is blocked completely:

Oct 12 16:29:41 (none) user.emerg Legato: EMR | PsaServices[1459]/framework T=MgrLifecycle_task | timer.c le_timer_SetRepeat() 805 | Assert Failed: ‘timerRef != NULL’
Oct 12 16:29:41 (none) user.info Legato: INFO | PsaServices[1459] | coucou je suis dans la case IPC_ID_DR_VEHICLE_POSITION_INFO

thanks you,

Hi,

Has this issue been resolved? If not can you shared the completed application package with source file and adef and cdef files.

Regards,
Vasantha