how to add a delay of 15 minutes to a looop?appended the code!!!
[CODE]
TBool CGpsPositionRequest::GetCurrentPostionL(TReal& aLatitude, TReal& aLongitude)
{
// cancel previous request (just in case)
Cancel();
// request current location
iPositioner.NotifyPositionUpdate(iPositionInfo, iStatus);
SetActive();
// start wait note and wait for request end
ShowWaitNoteL();
// process result
if (iError == KErrNone)
{
// success, return given position
TPosition pos;
iPositionInfo.GetPosition(pos);
aLatitude = pos.Latitude();
aLongitude = pos.Longitude();
return ETrue;
}
// fail
return EFalse;
}
void CGpsPositionRequest::RunL()
{
// request ended, store error code and dismiss wait dialog
if(flg)
{
iError = iStatus.Int();
DismissWaitNote();
flg=false;
Cancel();
iTimer.After(iStatus,5000000000000);// HERE i WANT A DELAY OF 15 MINUTES
SetActive();
}
if(!flg)
{
iloc->getGPSLocation();
}
}
getGPSLocation()
{
result= request->GetCurrentPostionL(latitude, longitude);
}
[/CODE]
Re: how to add a delay of 15 minutes to a looop?appended the code!!!
You can use the same active object, just create an RTimer member and use its After method.
And of course you will need a status variable tracking what the AO is waiting for (GPS result or the timer). Set the variable when issuing the request, and check it in RunL to decide what to do.
Re: how to add a delay of 15 minutes to a looop?appended the code!!!
I changed the runl and it run s fine
void CGpsPositionRequest::RunL()
{
// request ended, store error code and dismiss wait dialog
if(flg)
{
iError = iStatus.Int();
DismissWaitNote();
flg=false;
Cancel();
iTimer.After(iStatus,60000000);
SetActive();
return;
}
if(!flg)
{
iloc->getGPSLocation();
flg=true;
}
}
Re: how to add a delay of 15 minutes to a looop?appended the code!!!
Yes, that is it. Note that while it will not cause any problems, the Cancel() call is not needed in this context.