Stop and Start Ctimer

Login to reply to this topic.
Fri, 2007-11-16 16:55
Joined: 2006-07-21
Forum posts: 158

Hi,
i need to stop and restart CTimer, how method I nedd to used?
if I use Docancel and ConstructL, is a problem?
Thanks
Silvia


Fri, 2007-11-16 17:23
Joined: 2003-12-05
Forum posts: 672
Re: Stop and Start Ctimer
Mon, 2007-11-19 16:13
Joined: 2006-07-21
Forum posts: 158
Re: Stop and Start Ctimer

My problem is that I don't know how much time this Timer are stopped.

After, Lock and Inactivity have a parameter that is the time of stop, is rigth?

Many thanks
Silvia

Mon, 2007-11-19 16:38
Joined: 2004-11-29
Forum posts: 1233
Re: Stop and Start Ctimer

So your problem has nothing to do with starting or stopping the CTimer, you know how to do that, right?

Only After and Inactivity have a time argument, Lock has an enum specifying what second fraction to tick on.
At and AtUTC also has a time argument, but instead of an interval, it tells the time it should complete.

I am guessing what you are trying to ask is:
"I have started a timer, that will complete at time X. How do I stop it, and later resume it, so that it still completes at time X."?

Is this right?

If so, there is no way to "pause" it, you will have to use TTime to actually save what time it will stop at (If it is a specific time you want to stop at, you should use At or AtUTC too)
and when you cancel, either measure with the help of TTime, how long time you had it stopped, so you can calculate the new time to set.
Or, if you use At, you can simply just re-issue the request with the same TTime value...

Mon, 2007-11-19 17:45
Joined: 2006-07-21
Forum posts: 158
Re: Stop and Start Ctimer

Thanks i Try this.
But one question:
I have this runl

void CTaskGprs::RunL()
{
if(!circBuf->isLock())
{
SendMessage();
}
After( KThreadWatchdogInterval );
}

Where SendMessageis a method that send form a socket.
My question is: method "After( KThreadWatchdogInterval );" work after method SendMessage has finished?

Many thanks
SIlvia

Mon, 2007-11-19 20:23
Joined: 2003-12-05
Forum posts: 672
Re: Stop and Start Ctimer

It is a bit difficult to understand what you mean.

By this:


Where SendMessageis a method that send form a socket.
My question is: method "After( KThreadWatchdogInterval );" work after method SendMessage has finished?

I assume you mean "when the method SendMessage returns, is the method After... called?". The answer to that is: Yes.

But -- if SendMessage is asynchronous, it also might mean that the message itself is not sent when SendMessage returns, only you have requested that the message is sent. Sending happens asynchronously (perhaps/probably??) and timer is started also asynchronously. Probably this is the fact, but I do not know for sure from this code.

Mon, 2007-11-19 20:26
Joined: 2003-12-05
Forum posts: 672
Re: Stop and Start Ctimer

Also, I wonder if you are trying to do two asynch things from one active object, which is a no-no. You have methods SendMessage and in this class, also you inherit from CTimer and use the asynch After method. One active object can handle only one async service at a time, not several. If this is so, you need to do this differently. One active object for asynchronous data transfer using sockets, and another for handling the timer events.

  • Login to reply to this topic.