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...
Where SendMessageis a method that send form a socket.
My question is: method "After( KThreadWatchdogInterval );" work after method SendMessage has finished?
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.
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.
Forum posts: 672
Please..... http://www.symbian.com/developer/techlib/v8.1adocs/doc_source/reference/reference-cpp/N101BA/TimersAndTimingServices/CTimerClass.html
Forum posts: 158
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
Forum posts: 1233
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...
Forum posts: 158
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
Forum posts: 672
It is a bit difficult to understand what you mean.
By this:
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.
Forum posts: 672
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.