Sometimes you may want to call a function or do some task in regular interval without extending the class from CActive (i.e. You may want to show a informationNote on map - just like google maps does ;-)) . In that Situation it would be appropriate to a CPeriodic Object. Usage is trivial -
In the header file add:
CPeriodic* iTimer;
Use two functions which should look like following
/*Use this function whenever you have to start the time*/
void StartTimerL(TInt aStart, TInt aInterval)
{
if(iTimer)
{
delete iTimer;
iTimer = NULL;
}
iTimer = CPeriodic::NewL(EPriorityLow);
iTimer->Start(aStart, aInterval, TCallBack(TimerCallback, this));
}
/*This function will be called after the specified interval*/
TInt TimerCallback(TAny* aThis)
{
// Do whatever you have to do locally or you may call the following function
static_cast<>(aThis)->GlobalNoteProcessTimerEvent();
return 0;
}
/*Use this function to stop the timer*/
void CancelTimer()
{
iTimer->Cancel();
}
Thats it!!
গাছগুলো!
3 days ago


