diff -r 646a02f170b9 -r 3cebc1a84278 locationmanager/locationtrail/src/cpositioninfo.cpp --- a/locationmanager/locationtrail/src/cpositioninfo.cpp Fri Mar 12 15:44:28 2010 +0200 +++ b/locationmanager/locationtrail/src/cpositioninfo.cpp Mon Mar 15 12:42:24 2010 +0200 @@ -45,6 +45,7 @@ : CActive( CActive::EPriorityStandard ), iFirstInterval( ETrue ) { + LOG( "CPositionInfo::CPositionInfo()"); CActiveScheduler::Add( this ); iTrail = aTrail; iTrailCaptureSetting = RLocationTrail::ECaptureAll; @@ -101,6 +102,15 @@ iFirstInterval = ETrue; iPositionInfo = TPositionSatelliteInfo(); + // Set update interval. + iUpdateOptions.SetUpdateInterval( TTimeIntervalMicroSeconds(KFirstInterval) ); + // Set time out level. + iUpdateOptions.SetUpdateTimeOut( TTimeIntervalMicroSeconds( KFirstTimeOut) ); + // Positions which have time stamp below KMaxAge can be reused + iUpdateOptions.SetMaxUpdateAge( TTimeIntervalMicroSeconds(KMaxAge) ); + // Disables location framework to send partial position data + iUpdateOptions.SetAcceptPartialUpdates( EFalse ); + if ( aCaptureSetting == RLocationTrail::ECaptureAll ) { User::LeaveIfError( iPosServer.Connect() ); @@ -149,11 +159,8 @@ // void CPositionInfo::Stop() { - Cancel(); - - iFirstInterval = ETrue; - iUpdateOptions.SetUpdateInterval( TTimeIntervalMicroSeconds( KFirstInterval ) ); - + Cancel(); + iPositioner.Close(); iPosServer.Close(); } @@ -165,11 +172,19 @@ void CPositionInfo::RunL() { iTrail->Position( iPositionInfo, iStatus.Int() ); - if ( iFirstInterval && iTrailCaptureSetting == RLocationTrail::ECaptureAll ) + + if ( iFirstInterval && IsActive() ) { - iUpdateOptions.SetUpdateInterval( TTimeIntervalMicroSeconds( iUpdateInterval ) ); - iUpdateOptions.SetUpdateTimeOut( TTimeIntervalMicroSeconds( KUpdateTimeOut ) ); - User::LeaveIfError( iPositioner.SetUpdateOptions( iUpdateOptions ) ); + Cancel(); + LOG("CPositionInfo::RunL() - First Time"); + iUpdateOptions.SetUpdateInterval( TTimeIntervalMicroSeconds (iUpdateInterval) ); + iUpdateOptions.SetUpdateTimeOut( TTimeIntervalMicroSeconds(KUpdateTimeOut ) ); + if ( iTrailCaptureSetting == RLocationTrail::ECaptureAll ) + { + User::LeaveIfError( iPositioner.SetUpdateOptions( iUpdateOptions ) ); + iPositioner.NotifyPositionUpdate( iPositionInfo, iStatus ); + } + SetActive(); iFirstInterval = EFalse; } } @@ -180,7 +195,8 @@ // void CPositionInfo::DoCancel() { - if ( !IsActive() ) + LOG( "CPositionInfo::DoCancel()" ); + if ( IsActive() ) { iPositioner.CancelRequest( EPositionerNotifyPositionUpdate ); }