locationmanager/locationtrail/src/cpositioninfo.cpp
branchRCL_3
changeset 6 646a02f170b9
parent 3 6752808b2036
child 7 3cebc1a84278
equal deleted inserted replaced
3:6752808b2036 6:646a02f170b9
    50     iTrailCaptureSetting = RLocationTrail::ECaptureAll;
    50     iTrailCaptureSetting = RLocationTrail::ECaptureAll;
    51     
    51     
    52     // Set update interval.
    52     // Set update interval.
    53     iUpdateOptions.SetUpdateInterval( TTimeIntervalMicroSeconds(KFirstInterval) );
    53     iUpdateOptions.SetUpdateInterval( TTimeIntervalMicroSeconds(KFirstInterval) );
    54     // Set time out level. 
    54     // Set time out level. 
    55     iUpdateOptions.SetUpdateTimeOut( TTimeIntervalMicroSeconds(KUpdateTimeOut) );
    55     iUpdateOptions.SetUpdateTimeOut( TTimeIntervalMicroSeconds(KFirstTimeOut) );
    56     // Positions which have time stamp below KMaxAge can be reused
    56     // Positions which have time stamp below KMaxAge can be reused
    57     iUpdateOptions.SetMaxUpdateAge( TTimeIntervalMicroSeconds(KMaxAge) );
    57     iUpdateOptions.SetMaxUpdateAge( TTimeIntervalMicroSeconds(KMaxAge) );
    58     // Disables location framework to send partial position data
    58     // Disables location framework to send partial position data
    59     iUpdateOptions.SetAcceptPartialUpdates( EFalse );    
    59     iUpdateOptions.SetAcceptPartialUpdates( EFalse );    
    60     }
    60     }
    70     
    70     
    71 // --------------------------------------------------------------------------
    71 // --------------------------------------------------------------------------
    72 // CPositionInfo::~CPositionInfo
    72 // CPositionInfo::~CPositionInfo
    73 // --------------------------------------------------------------------------
    73 // --------------------------------------------------------------------------
    74 //    
    74 //    
    75 CPositionInfo::~CPositionInfo()
    75 EXPORT_C CPositionInfo::~CPositionInfo()
    76     {
    76     {
    77     Cancel();
    77     Cancel();
    78     iPositioner.Close();
    78     iPositioner.Close();
    79     iPosServer.Close();
    79     iPosServer.Close();
    80     }
    80     }
    96     {
    96     {
    97     LOG( "CPositionInfo::StartL(), begin" );
    97     LOG( "CPositionInfo::StartL(), begin" );
    98 
    98 
    99     iTrailCaptureSetting = aCaptureSetting;
    99     iTrailCaptureSetting = aCaptureSetting;
   100     iUpdateInterval = aUpdateInterval;
   100     iUpdateInterval = aUpdateInterval;
       
   101     iFirstInterval = ETrue;
       
   102     iPositionInfo = TPositionSatelliteInfo();
   101     
   103     
   102     if ( aCaptureSetting == RLocationTrail::ECaptureAll ) 
   104     if ( aCaptureSetting == RLocationTrail::ECaptureAll ) 
   103     	{
   105     	{
   104 	    User::LeaveIfError( iPosServer.Connect() );
   106 	    User::LeaveIfError( iPosServer.Connect() );
   105 	    User::LeaveIfError( iPositioner.Open( iPosServer ) );
   107 	    User::LeaveIfError( iPositioner.Open( iPosServer ) );
   148 void CPositionInfo::Stop()
   150 void CPositionInfo::Stop()
   149     {
   151     {
   150     Cancel();
   152     Cancel();
   151     
   153     
   152     iFirstInterval = ETrue;
   154     iFirstInterval = ETrue;
   153     iUpdateOptions.SetUpdateInterval( TTimeIntervalMicroSeconds(KFirstInterval) );
   155     iUpdateOptions.SetUpdateInterval( TTimeIntervalMicroSeconds( KFirstInterval ) );
   154     
   156     
   155     iPositioner.Close();
   157     iPositioner.Close();
   156     iPosServer.Close();
   158     iPosServer.Close();
   157     }    
   159     }    
   158         
   160         
   164     { 
   166     { 
   165     iTrail->Position( iPositionInfo, iStatus.Int() );
   167     iTrail->Position( iPositionInfo, iStatus.Int() );
   166     if ( iFirstInterval && iTrailCaptureSetting == RLocationTrail::ECaptureAll )
   168     if ( iFirstInterval && iTrailCaptureSetting == RLocationTrail::ECaptureAll )
   167     	{
   169     	{
   168     	iUpdateOptions.SetUpdateInterval( TTimeIntervalMicroSeconds( iUpdateInterval ) );
   170     	iUpdateOptions.SetUpdateInterval( TTimeIntervalMicroSeconds( iUpdateInterval ) );
       
   171     	iUpdateOptions.SetUpdateTimeOut( TTimeIntervalMicroSeconds( KUpdateTimeOut ) );
   169     	User::LeaveIfError( iPositioner.SetUpdateOptions( iUpdateOptions ) );
   172     	User::LeaveIfError( iPositioner.SetUpdateOptions( iUpdateOptions ) );
   170     	iFirstInterval = EFalse;
   173     	iFirstInterval = EFalse;
   171     	}
   174     	}
   172     }    
   175     }    
   173 
   176