locationmanager/locationtrail/src/ctracklog.cpp
branchRCL_3
changeset 63 e538444823de
parent 47 b73252188534
equal deleted inserted replaced
57:2872ae438bf7 63:e538444823de
    66 	}
    66 	}
    67 
    67 
    68 EXPORT_C CTrackLog::~CTrackLog()
    68 EXPORT_C CTrackLog::~CTrackLog()
    69 	{
    69 	{
    70 	delete iGpxConverter;
    70 	delete iGpxConverter;
    71 	iGpxConverter = NULL;
       
    72 	iFs.Close();
    71 	iFs.Close();
    73 	}
    72 	}
    74 
    73 
    75 EXPORT_C void CTrackLog::StartRecordingL(TItemId aId)
    74 EXPORT_C void CTrackLog::StartRecordingL(TItemId aId)
    76 	{
    75 	{
   200 						aTrailItem.iLocationData.iPosition.HorizontalAccuracy()	);
   199 						aTrailItem.iLocationData.iPosition.HorizontalAccuracy()	);
   201 				TInt err = newCoords.Distance(*lastCoords, distance);
   200 				TInt err = newCoords.Distance(*lastCoords, distance);
   202 				if ( err == KErrNone )
   201 				if ( err == KErrNone )
   203 					{
   202 					{
   204 					delete lastCoords;
   203 					delete lastCoords;
   205 					lastCoords = NULL;
       
   206 					lastCoords = new TCoordinate( aTrailItem.iLocationData.iPosition );
   204 					lastCoords = new TCoordinate( aTrailItem.iLocationData.iPosition );
   207 					iBoundaries->distance += distance;
   205 					iBoundaries->distance += distance;
   208 					}
   206 					}
   209 				}
   207 				}
   210 			iBoundaries->maxLatitude = Max( iBoundaries->maxLatitude, newItem.iLatitude );
   208 			iBoundaries->maxLatitude = Max( iBoundaries->maxLatitude, newItem.iLatitude );
   221 	LOG("CTrackLog::WriteBufferToFileL start");
   219 	LOG("CTrackLog::WriteBufferToFileL start");
   222 
   220 
   223 	RFile64 file;
   221 	RFile64 file;
   224 	RFileWriteStream writer;
   222 	RFileWriteStream writer;
   225 	
   223 	
   226 	CleanupClosePushL( writer );
       
   227 	
       
   228 	TInt err;
   224 	TInt err;
   229 	err = file.Open( iFs, iTmpFileName, EFileRead );
   225 	err = file.Open( iFs, iTmpFileName, EFileRead );
   230 	if ( err != KErrNone )
   226 	if ( err != KErrNone )
   231 		{
   227 		{
   232 		err = writer.Create( iFs, iTmpFileName, EFileWrite );
   228 		err = writer.Create( iFs, iTmpFileName, EFileWrite );
   248 			{
   244 			{
   249 			User::Leave( err );
   245 			User::Leave( err );
   250 			}
   246 			}
   251 		writer.Sink()->SeekL( MStreamBuf::EWrite, TStreamPos( endpos ));
   247 		writer.Sink()->SeekL( MStreamBuf::EWrite, TStreamPos( endpos ));
   252 		}
   248 		}
       
   249 	
       
   250 	CleanupClosePushL( writer );
   253 	
   251 	
   254 	TInt count = iTrackLogItemArray.Count();
   252 	TInt count = iTrackLogItemArray.Count();
   255 	
   253 	
   256 	for( TInt i = 0; i < count; i++ )
   254 	for( TInt i = 0; i < count; i++ )
   257 		{
   255 		{
   306 			filename->Append((*files)[i].iName);
   304 			filename->Append((*files)[i].iName);
   307 			TRAP_IGNORE( iGpxConverter->AddToQueueL( *filename, NULL ));
   305 			TRAP_IGNORE( iGpxConverter->AddToQueueL( *filename, NULL ));
   308 			}
   306 			}
   309 		}
   307 		}
   310 	delete filename;
   308 	delete filename;
   311 	filename = NULL;
       
   312 	delete files;
   309 	delete files;
   313 	files = NULL;
       
   314 	}
   310 	}
   315 
   311 
   316 void CTrackLog::ReadCenRepValueL(TInt aKey, TInt& aValue)
   312 void CTrackLog::ReadCenRepValueL(TInt aKey, TInt& aValue)
   317 	{
   313 	{
   318 	LOG( "LocationManagerServer::ReadCenRepValueL(), begin" );
   314 	LOG( "LocationManagerServer::ReadCenRepValueL(), begin" );