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