Implementing a Timer

Login to reply to this topic.
Mon, 2008-02-25 10:29
Joined: 2006-12-19
Forum posts: 72

Hi,

I want to implement a timer in my program having two view.
I want to implemet it this way. the proram displays view1 when started.When the user will select change view application shows view2. Or If s/he does not select any option for 5 seconds the application shows view2.

Which timer class to be used and how to be used for it.
Thanks for ur suggestions.

regards,


Mon, 2008-02-25 10:50
Joined: 2007-08-31
Forum posts: 54
Re: Implementing a Timer

you can use any of the timer class which is available in sdk, for the usage of the class just search in this forum definitely you will get the help

Regards
Praveen

Mon, 2008-02-25 11:10
Joined: 2006-12-19
Forum posts: 72
Re: Implementing a Timer

Thanks Praveen.
I have tried to search this forum and FN also and did not find a good explanation to start with.I got rather confused.
Will u pls, take the pain to explain the thing a breif or points to a source that can guide me to use the timer properly.
A small code example kind of thing will be betterr.

Thanks again..

Mon, 2008-02-25 11:12
Joined: 2007-12-19
Forum posts: 49
Re: Implementing a Timer

You can use RTimer or CTimer.

Mon, 2008-02-25 11:32
Joined: 2007-08-31
Forum posts: 54
Re: Implementing a Timer

just impement your timer like this

CCustomTimer:CTimer

CCustomTimer::CCustomTimer()
:CTimer(EPriorityLow)
{
After (Val);//making the Interrupt
}

CCustomTimer::RunL()
{
//Call Back Function
//write the Code For changinig the views
After(val);
}

cCustomTimer::After(TTimeIntervalMicroSeconds32 aInterval)
{
CTimer::After(aInterval);
}

CCustomTimer::Cancel()
{
Cancel();
}

i think this will help you

Regards
Praveen

Tue, 2008-02-26 20:38
Joined: 2007-09-23
Forum posts: 159
Re: Implementing a Timer

What additional functionality does CCustomTimer introduce to CTimer apart from the infinite recursive loop in Cancel()?

Wed, 2008-02-27 10:10
Joined: 2007-12-19
Forum posts: 49
Re: Implementing a Timer

praveenvlm wrote wrong code, it should look like this

class CCustomTimer: public CTimer {
...
};

CCustomTimer::CCustomTimer()
:CTimer(EPriorityLow)
{
    CActiveScheduler::add( this );
}

CCustomTimer::RunL()
{
//Call Back Function
//write the Code For changinig the views
}

CCustomTimer::SwitchViewAfter(TTimeIntervalMicroSeconds32 aInterval)
{
CTimer::After( aInterval );
}

Wed, 2008-02-27 10:44
Joined: 2007-08-31
Forum posts: 54
Re: Implementing a Timer

Thanks Iman

the code what you have written is correct
by mistake i written the above code

Thanks & Regadrs
Praveen

  • Login to reply to this topic.