locationmanager/locationtrail/src/clocationrecord.cpp
branchRCL_3
changeset 14 646a02f170b9
parent 8 6752808b2036
child 15 3cebc1a84278
equal deleted inserted replaced
8:6752808b2036 14:646a02f170b9
   108     
   108     
   109 // --------------------------------------------------------------------------
   109 // --------------------------------------------------------------------------
   110 // CLocationRecord::~CLocationRecord
   110 // CLocationRecord::~CLocationRecord
   111 // --------------------------------------------------------------------------
   111 // --------------------------------------------------------------------------
   112 //    
   112 //    
   113 CLocationRecord::~CLocationRecord()
   113 EXPORT_C CLocationRecord::~CLocationRecord()
   114     {
   114     {
   115     Stop();
   115     Stop();
   116     iProperty.Delete( KPSUidLocationTrail, KLocationTrailState );
   116     iProperty.Delete( KPSUidLocationTrail, KLocationTrailState );
   117     iProperty.Close();
   117     iProperty.Close();
   118     iTrail.Close();
   118     iTrail.Close();
   210 // CLocationRecord::GetLocationByTimeL
   210 // CLocationRecord::GetLocationByTimeL
   211 // --------------------------------------------------------------------------
   211 // --------------------------------------------------------------------------
   212 //
   212 //
   213 EXPORT_C void CLocationRecord::GetLocationByTimeL( const TTime aTime, 
   213 EXPORT_C void CLocationRecord::GetLocationByTimeL( const TTime aTime, 
   214 												   TLocationData& aLocationData,
   214 												   TLocationData& aLocationData,
   215                                                    TLocTrailState& aState )
   215                                                    TLocTrailState& aState ) __SOFTFP 
   216     {
   216     {
   217     LOG( "CLocationRecord::GetLocationByTimeL(), begin" );
   217     LOG( "CLocationRecord::GetLocationByTimeL(), begin" );
   218     TInt posFound( EFalse );
   218     TInt posFound( EFalse );
   219 
   219 
   220 #ifdef _DEBUG
   220 #ifdef _DEBUG
   240         iTrail[i].iTimeStamp.FormatL( str, KDateTimeFormat );
   240         iTrail[i].iTimeStamp.FormatL( str, KDateTimeFormat );
   241         LOG1( "CLocationRecord::GetLocationByTimeL - Trail timestamp: %S", &str );
   241         LOG1( "CLocationRecord::GetLocationByTimeL - Trail timestamp: %S", &str );
   242         LOG1( "CLocationRecord::GetLocationByTimeL - timeDiff: %d", timeDiff );
   242         LOG1( "CLocationRecord::GetLocationByTimeL - timeDiff: %d", timeDiff );
   243 #endif
   243 #endif
   244 
   244 
   245         if ( err == KErrNone && timeDiff <= KIntervalSeconds )
   245         if ( err == KErrNone && timeDiff <= KMaximumIntervalSeconds )
   246             {
   246             {
   247             // The nearest time is in iTrail[i] or in iTrail[i-1].
   247             // The nearest time is in iTrail[i] or in iTrail[i-1].
   248             if ( i > 0 )
   248             if ( i > 0 )
   249                 {
   249                 {
   250                 iTrail[i-1].iTimeStamp.SecondsFrom( aTime, nextInterval );
   250                 iTrail[i-1].iTimeStamp.SecondsFrom( aTime, nextInterval );
   315         
   315         
   316 // --------------------------------------------------------------------------
   316 // --------------------------------------------------------------------------
   317 // CLocationRecord::GetNetworkInfo
   317 // CLocationRecord::GetNetworkInfo
   318 // --------------------------------------------------------------------------
   318 // --------------------------------------------------------------------------
   319 //
   319 //
   320 EXPORT_C void CLocationRecord::GetNetworkInfo( CTelephony::TNetworkInfoV1& aNetworkInfo )
   320 EXPORT_C void CLocationRecord::GetNetworkInfo( CTelephony::TNetworkInfoV1& aNetworkInfo ) __SOFTFP 
   321     {
   321     {
   322     LOG("CLocationRecord::GetNetworkInfo");
   322     LOG("CLocationRecord::GetNetworkInfo");
   323 
   323 
   324     aNetworkInfo = iNetwork;
   324     aNetworkInfo = iNetwork;
   325     }
   325     }
   326     
   326     
   327 // --------------------------------------------------------------------------
   327 // --------------------------------------------------------------------------
   328 // CLocationRecord::SetObserver
   328 // CLocationRecord::SetObserver
   329 // --------------------------------------------------------------------------
   329 // --------------------------------------------------------------------------
   330 //
   330 //
   331 EXPORT_C void CLocationRecord::SetObserver( MLocationTrailObserver* aObserver)
   331 EXPORT_C void CLocationRecord::SetObserver( MLocationTrailObserver* aObserver) 
   332     {
   332     {
   333     iObserver = aObserver;
   333     iObserver = aObserver;
   334     }
   334     }
   335 
   335 
   336 // --------------------------------------------------------------------------
   336 // --------------------------------------------------------------------------
   346 // From MNetworkInfoObserver.
   346 // From MNetworkInfoObserver.
   347 // CLocationRecord::Position
   347 // CLocationRecord::Position
   348 // --------------------------------------------------------------------------
   348 // --------------------------------------------------------------------------
   349 //    
   349 //    
   350 void CLocationRecord::Position( const TPositionInfo& aPositionInfo,
   350 void CLocationRecord::Position( const TPositionInfo& aPositionInfo,
   351                                 const TInt aError  )
   351                                 const TInt aError  ) __SOFTFP
   352     {    
   352     {    
   353     const TPositionSatelliteInfo& positionSatelliteInfo = 
   353     const TPositionSatelliteInfo& positionSatelliteInfo = 
   354     	static_cast<const TPositionSatelliteInfo&>(aPositionInfo);
   354     	static_cast<const TPositionSatelliteInfo&>(aPositionInfo);
   355 
   355 
   356     if ( iRequestCurrentLoc )
   356     if ( iRequestCurrentLoc )
   455 // From MPositionerObserver.
   455 // From MPositionerObserver.
   456 // CLocationRecord::NetworkInfo
   456 // CLocationRecord::NetworkInfo
   457 // --------------------------------------------------------------------------
   457 // --------------------------------------------------------------------------
   458 //    
   458 //    
   459 void CLocationRecord::NetworkInfo( const CTelephony::TNetworkInfoV1 &aNetworkInfo, 
   459 void CLocationRecord::NetworkInfo( const CTelephony::TNetworkInfoV1 &aNetworkInfo, 
   460 		const TInt aError )
   460 		const TInt aError ) __SOFTFP
   461     {
   461     {
   462     LOG("CLocationRecord::NetworkInfo");
   462     LOG("CLocationRecord::NetworkInfo");
   463     if ( aError == KErrNone )
   463     if ( aError == KErrNone )
   464         {
   464         {
   465         LOG("CLocationRecord::NetworkInfo - KErrNone");
   465         LOG("CLocationRecord::NetworkInfo - KErrNone");
   583 	return KErrNone;
   583 	return KErrNone;
   584 	}
   584 	}
   585 
   585 
   586 
   586 
   587 EXPORT_C void CLocationRecord::CreateLocationObjectL( const TLocationData& aLocationData,
   587 EXPORT_C void CLocationRecord::CreateLocationObjectL( const TLocationData& aLocationData,
   588 		const TUint& aObjectId )
   588 		const TUint& aObjectId ) __SOFTFP
   589 	{
   589 	{
   590 	TItemId locationId = DoCreateLocationL( aLocationData );
   590 	TItemId locationId = DoCreateLocationL( aLocationData );
   591 	CreateRelationL( aObjectId, locationId );
   591 	CreateRelationL( aObjectId, locationId );
   592 	}
   592 	}
   593 
   593 
   790 		iLocationQuery->FindL();			
   790 		iLocationQuery->FindL();			
   791 		}
   791 		}
   792 	}
   792 	}
   793 
   793 
   794 	
   794 	
   795 TItemId CLocationRecord::DoCreateLocationL( const TLocationData& aLocationData )
   795 TItemId CLocationRecord::DoCreateLocationL( const TLocationData& aLocationData ) __SOFTFP 
   796 	{
   796 	{
   797 	LOG("CLocationRecord::DoCreateLocationL - start");
   797 	LOG("CLocationRecord::DoCreateLocationL - start");
   798 	TItemId locationObjectId;
   798 	TItemId locationObjectId;
   799 	
   799 	
   800 	CMdENamespaceDef& namespaceDef = iMdeSession->GetDefaultNamespaceDefL();
   800 	CMdENamespaceDef& namespaceDef = iMdeSession->GetDefaultNamespaceDefL();