|
1 /* |
|
2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Symbian Foundation License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * ?description_line |
|
16 * |
|
17 */ |
|
18 |
|
19 // INCLUDES |
|
20 #include "FT_CPosTp153.h" |
|
21 #include <EPos_CPosLandmarkDatabase.h> |
|
22 #include <EPos_CPosLandmarkParser.h> |
|
23 #include <EPos_CPosLandmarkEncoder.h> |
|
24 #include <LbsPosition.h> |
|
25 #include <e32math.h> |
|
26 #include <bautils.h> |
|
27 #include <utf.h> |
|
28 #include <xml/xmlparsererrors.h> |
|
29 |
|
30 // CONSTANTS |
|
31 |
|
32 _LIT(KFileTrace, "c:\\documents\\LandmarksTP153Trace.txt"); |
|
33 |
|
34 // See \epoc32\include\xml\XmlParserErrors.h for error codes |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 // See \epoc32\include\xml\XmlParserErrors.h for error codes |
|
40 |
|
41 |
|
42 _LIT(KCorrectFile, "c:\\system\\test\\TestData\\CorrectFileFor_LandmarksTP153Trace.txt"); |
|
43 |
|
44 _LIT(KKMZFile, "c:\\system\\test\\TestData\\Tp153KMZFile.kmz"); |
|
45 |
|
46 |
|
47 // Maxmimum size for each line in trace file |
|
48 const TInt KBufSize = 5000; |
|
49 |
|
50 // ================= MEMBER FUNCTIONS ======================= |
|
51 // --------------------------------------------------------- |
|
52 // CPosTp153::CloseTest |
|
53 // |
|
54 // (other items were commented in a header). |
|
55 // --------------------------------------------------------- |
|
56 // |
|
57 void CPosTp153::CloseTest() |
|
58 { |
|
59 iLog->Log(_L("CloseTest")); |
|
60 |
|
61 delete iEncoderBuffer; |
|
62 iEncoderBuffer = NULL; |
|
63 |
|
64 iLandmarks.ResetAndDestroy(); |
|
65 iLandmarks.Close(); |
|
66 |
|
67 delete iDatabase; |
|
68 iDatabase=NULL; |
|
69 |
|
70 delete iLandmarkEncoder; |
|
71 iLandmarkEncoder = NULL; |
|
72 |
|
73 delete iLandmarkParser; |
|
74 iLandmarkParser = NULL; |
|
75 |
|
76 delete iOperation; |
|
77 iOperation = NULL; |
|
78 |
|
79 TRAPD(err, RemoveGlobalCategoriesL()); |
|
80 if (err != KErrNone && err != KErrNotFound) |
|
81 { |
|
82 HBufC* buf = HBufC::NewLC( 128 ); |
|
83 TPtr buffer = buf->Des(); |
|
84 |
|
85 buffer.Format(_L("RemoveGlobalCategoriesL leaved with %d"), err); |
|
86 iLog->Log( buffer ); |
|
87 |
|
88 CleanupStack::PopAndDestroy( buf ); |
|
89 } |
|
90 |
|
91 iLog->Log(_L("CloseTest Done")); |
|
92 } |
|
93 |
|
94 // --------------------------------------------------------- |
|
95 // CPosTp153::StartL |
|
96 // |
|
97 // (other items were commented in a header). |
|
98 // --------------------------------------------------------- |
|
99 // |
|
100 void CPosTp153::StartL() |
|
101 { |
|
102 BaflUtils::EnsurePathExistsL( iFileSession, KKMZFile ); |
|
103 |
|
104 // Use same lm db as in composite search test |
|
105 iDatabase = UseCompositeLandmarksDbFileL(); |
|
106 if (iDatabase->IsInitializingNeeded()) |
|
107 { |
|
108 ExecuteAndDeleteLD(iDatabase->InitializeL()); |
|
109 } |
|
110 |
|
111 // Delete the trace file |
|
112 DeleteFileL(KFileTrace); |
|
113 |
|
114 delete iDatabase; |
|
115 iDatabase = NULL; |
|
116 |
|
117 iDatabase = CPosLandmarkDatabase::OpenL(); |
|
118 |
|
119 if (iDatabase->IsInitializingNeeded()) |
|
120 { |
|
121 ExecuteAndDeleteLD(iDatabase->InitializeL()); |
|
122 } |
|
123 |
|
124 // Do reset so that global categories are included |
|
125 CPosLmCategoryManager* categoryManager = CPosLmCategoryManager::NewL(*iDatabase); |
|
126 CleanupStack::PushL(categoryManager); |
|
127 |
|
128 ExecuteAndDeleteLD(categoryManager->ResetGlobalCategoriesL()); |
|
129 CleanupStack::PopAndDestroy(categoryManager); |
|
130 |
|
131 HBufC8* emptyBuffer=NULL; |
|
132 |
|
133 iLog->Log(_L("Test with Tp153KMZFile.kmz")); |
|
134 PrintParsedDataFromEncoderL(KKMZFile, *emptyBuffer, -993, KKmzMimeType ); //EXmlTagMismatch = -993 |
|
135 |
|
136 |
|
137 // Now compare tha trace file against the correct one |
|
138 RFile correctFile; |
|
139 RFile file; |
|
140 |
|
141 iLog->Log(_L(">>>>>>>Comparing files<<<<<")); |
|
142 |
|
143 TFileName filename; |
|
144 CreateCorrectXmlFileL( KCorrectFile, filename ); |
|
145 |
|
146 User::LeaveIfError(correctFile.Open(iFileSession, filename, EFileRead)); |
|
147 CleanupClosePushL(correctFile); |
|
148 User::LeaveIfError(file.Open(iFileSession, KFileTrace, EFileRead)); |
|
149 CleanupClosePushL(file); |
|
150 |
|
151 HBufC* correctLinebuffer = HBufC::NewLC( KBufSize ); |
|
152 TPtr correctLine = correctLinebuffer->Des(); |
|
153 HBufC* linebuffer = HBufC::NewLC( KBufSize ); |
|
154 TPtr line = linebuffer->Des(); |
|
155 |
|
156 TInt err = KErrNone; |
|
157 TBool done = EFalse; |
|
158 TInt lineNr = 0; |
|
159 |
|
160 while (ReadLn(correctFile, correctLine) != KErrEof && !done) |
|
161 { |
|
162 lineNr++; |
|
163 err = ReadLn(file, line); |
|
164 if ( err == KErrEof ) |
|
165 { |
|
166 done = ETrue; |
|
167 } |
|
168 correctLine.Trim(); |
|
169 line.Trim(); |
|
170 if (correctLine.Compare(line) != KErrNone) |
|
171 { |
|
172 HBufC* buf = HBufC::NewLC( 128 ); |
|
173 TPtr buffer = buf->Des(); |
|
174 |
|
175 buffer.Format(_L("ERROR in TraceFile on line %d: "), lineNr); |
|
176 |
|
177 iLog->Log( buffer ); |
|
178 iLog->Log( correctLine ); |
|
179 iLog->Log( line ); |
|
180 iErrorsFound++; |
|
181 CleanupStack::PopAndDestroy( buf ); |
|
182 } |
|
183 } |
|
184 CleanupStack::PopAndDestroy(linebuffer); |
|
185 CleanupStack::PopAndDestroy(correctLinebuffer); |
|
186 CleanupStack::PopAndDestroy(&file); |
|
187 CleanupStack::PopAndDestroy(&correctFile); |
|
188 |
|
189 // EOF for trace file was reach before EOF in the correct file |
|
190 if (done) |
|
191 { |
|
192 iLog->Log(_L("ERROR: EOF for Trace file was reached to early")); |
|
193 iErrorsFound++; |
|
194 } |
|
195 |
|
196 |
|
197 DoCancelTestL(); |
|
198 |
|
199 if (iErrorsFound != KErrNone) |
|
200 { |
|
201 iLog->Log(_L("Errors found in TP153")); |
|
202 User::Leave(-1); |
|
203 } |
|
204 } |
|
205 |
|
206 // --------------------------------------------------------- |
|
207 // CPosTp153::DoCancelTestL |
|
208 // |
|
209 // (other items were commented in a header). |
|
210 // --------------------------------------------------------- |
|
211 // |
|
212 void CPosTp153::DoCancelTestL() |
|
213 { |
|
214 iLog->Log(_L("DoCancelTestL")); |
|
215 iLandmarkParser = CPosLandmarkParser::NewL(KKmzMimeType); |
|
216 iLandmarkParser->SetInputFileL(KKMZFile); |
|
217 |
|
218 iOperation = iLandmarkParser->ParseContentL(); |
|
219 |
|
220 TRequestStatus status = KPosLmOperationNotComplete; |
|
221 TReal32 progress; |
|
222 |
|
223 // 1 ) Cancel parse function by deleting iOperation |
|
224 delete iOperation; |
|
225 iOperation = NULL; |
|
226 |
|
227 TUint32 nr = iLandmarkParser->NumOfParsedLandmarks(); |
|
228 if ((TInt)nr != 0) |
|
229 { |
|
230 iLog->Log(_L("No landmarks should be found")); |
|
231 User::Leave(KErrNone); |
|
232 } |
|
233 |
|
234 // No landmark should be found |
|
235 TRAPD(err, iLandmarkParser->LandmarkLC()); |
|
236 if (err != KErrNotFound) |
|
237 { |
|
238 iLog->Log(_L("ERROR: No Landmark should be found")); |
|
239 iErrorsFound++; |
|
240 } |
|
241 |
|
242 // 1 ) Cancel parse function by changing input |
|
243 iOperation = iLandmarkParser->ParseContentL(); |
|
244 |
|
245 // Get the first landmark |
|
246 iOperation->NextStep(status, progress); |
|
247 // Wait for NextStep to complete |
|
248 User::WaitForRequest(status); |
|
249 if(status == KErrNone) |
|
250 { |
|
251 nr = iLandmarkParser->NumOfParsedLandmarks(); |
|
252 if ((TInt)nr != 1) |
|
253 { |
|
254 iLog->Log(_L("One landmark should be found")); |
|
255 iErrorsFound++; |
|
256 } |
|
257 } |
|
258 |
|
259 // Change input |
|
260 iLandmarkParser->SetInputFileL(KKMZFile); |
|
261 |
|
262 nr = iLandmarkParser->NumOfParsedLandmarks(); |
|
263 if ((TInt)nr != 0) |
|
264 { |
|
265 iLog->Log(_L("No landmarks should be found")); |
|
266 User::Leave(KErrNone); |
|
267 } |
|
268 |
|
269 // No landmark should be found |
|
270 TRAP(err, iLandmarkParser->LandmarkLC()); |
|
271 if (err != KErrNotFound) |
|
272 { |
|
273 iLog->Log(_L("ERROR: No Landmark should be found")); |
|
274 iErrorsFound++; |
|
275 } |
|
276 |
|
277 delete iOperation; |
|
278 iOperation = NULL; |
|
279 delete iLandmarkParser; |
|
280 iLandmarkParser = NULL; |
|
281 iLog->Log(_L("DoCancelTestL Done")); |
|
282 } |
|
283 |
|
284 // --------------------------------------------------------- |
|
285 // CPosTp153::PrintParsedDataFromEncoderL |
|
286 // |
|
287 // (other items were commented in a header). |
|
288 // --------------------------------------------------------- |
|
289 // |
|
290 void CPosTp153::PrintParsedDataFromEncoderL( |
|
291 const TDesC& aFile, |
|
292 const TDesC8& aBuffer, |
|
293 TInt aExpectedStatusCode, |
|
294 const TDesC8& aMimeType) |
|
295 { |
|
296 iLog->Log(_L("===== PrintParsedDataFromEncoderL =======")); |
|
297 |
|
298 iLandmarkParser = CPosLandmarkParser::NewL(aMimeType); |
|
299 |
|
300 if (aFile != KNullDesC) |
|
301 { |
|
302 TFileName file( aFile ); |
|
303 iLog->Log(_L("FILE (%S)"), &file ); |
|
304 TraceL(_L("----->Using FILE<-------")); |
|
305 TraceL(file); |
|
306 iLandmarkParser->SetInputFileL(file); |
|
307 } |
|
308 else |
|
309 { |
|
310 iLog->Log(_L("BUFFER (size %d)"), aBuffer.Size() ); |
|
311 TraceL(_L("----->Using BUFFER<-------")); |
|
312 iLandmarkParser->SetInputBuffer(aBuffer); |
|
313 } |
|
314 |
|
315 iOperation = iLandmarkParser->ParseContentL(); |
|
316 TRequestStatus status = KPosLmOperationNotComplete; |
|
317 TReal32 progress; |
|
318 TInt number = 0; |
|
319 |
|
320 RArray<TPosLmItemId> array; |
|
321 CleanupClosePushL(array); |
|
322 |
|
323 while (status == KPosLmOperationNotComplete) |
|
324 { |
|
325 iLog->Log(_L("--- Parsing ---------------------------")); |
|
326 TraceL(_L("------------------------------")); |
|
327 iOperation->NextStep(status, progress); |
|
328 |
|
329 // Wait for NextStep to complete |
|
330 User::WaitForRequest(status); |
|
331 if (status != KPosLmOperationNotComplete && status != KErrNone) |
|
332 { |
|
333 iLog->Log(_L("Parsing Complete")); |
|
334 |
|
335 HBufC* buffer = HBufC::NewLC( 128); |
|
336 TPtr buf = buffer->Des(); |
|
337 buf.Format(_L("\tStatus %d"), status.Int()); |
|
338 iLog->Log(buf); |
|
339 TraceL(buf); |
|
340 CleanupStack::PopAndDestroy( buffer ); |
|
341 buffer = NULL; |
|
342 } |
|
343 else |
|
344 { |
|
345 iLog->Log(_L("Parsing element")); |
|
346 if ( iLandmarkParser->NumOfParsedLandmarks() ) |
|
347 { |
|
348 // Get last parsed landmark |
|
349 CPosLandmark* lm = iLandmarkParser->LandmarkLC(); |
|
350 TPtrC lmName; |
|
351 TPtrC catName; |
|
352 lm->GetLandmarkName(lmName); |
|
353 lm->GetCategoriesL(array); |
|
354 //iLog->Log(lmName); |
|
355 for (TInt i=0;i<array.Count();i++) |
|
356 { |
|
357 CPosLandmarkCategory* category = iLandmarkParser->LandmarkCategoryLC(array[i]); |
|
358 category->GetCategoryName( catName ); |
|
359 |
|
360 HBufC* buffer = HBufC::NewLC( 128 + catName.Length()); |
|
361 TPtr buf = buffer->Des(); |
|
362 |
|
363 if ( category->GlobalCategory()) |
|
364 { |
|
365 buf.Append(_L("\tGlobal category: ")); |
|
366 } |
|
367 else |
|
368 { |
|
369 buf.Append(_L("\tLocal category: ")); |
|
370 } |
|
371 |
|
372 buf.Append( catName ); |
|
373 iLog->Log( buf ); |
|
374 TraceL( buf ); |
|
375 |
|
376 CleanupStack::PopAndDestroy( buffer ); |
|
377 buffer = NULL; |
|
378 CleanupStack::PopAndDestroy(category); |
|
379 } |
|
380 |
|
381 PrintLandmarkFieldsWithDescriptionL(*lm, ETrue); |
|
382 |
|
383 |
|
384 number++; |
|
385 CleanupStack::PopAndDestroy(lm); |
|
386 } |
|
387 } |
|
388 } |
|
389 |
|
390 iLog->Log(_L("--- Parsing end ---------------------------")); |
|
391 TraceL(_L("------------------------------")); |
|
392 CleanupStack::PopAndDestroy(&array); |
|
393 |
|
394 if (status.Int() != aExpectedStatusCode) |
|
395 { |
|
396 HBufC* buffer = HBufC::NewLC( 128 ); |
|
397 TPtr buf = buffer->Des(); |
|
398 |
|
399 buf.Format(_L("\tERROR: Wrong status returned, was %d, should be %d"), status.Int(), aExpectedStatusCode); |
|
400 iLog->Log( buf ); |
|
401 iErrorsFound++; |
|
402 |
|
403 CleanupStack::PopAndDestroy( buffer ); |
|
404 buffer = NULL; |
|
405 } |
|
406 |
|
407 TUint32 nr = iLandmarkParser->NumOfParsedLandmarks(); |
|
408 HBufC* buffer = HBufC::NewLC( 256 ); |
|
409 TPtr buf = buffer->Des(); |
|
410 buf.Format(_L("\tNr of Parsed landmarks %d, should be %d"), nr, number); |
|
411 iLog->Log(buf); |
|
412 TraceL(buf); |
|
413 |
|
414 CleanupStack::PopAndDestroy( buffer ); |
|
415 buffer = NULL; |
|
416 if (nr != (TUint32)number) |
|
417 { |
|
418 iLog->Log(_L("\tERROR: Wrong number of landmarks parsed returned!")); |
|
419 iErrorsFound++; |
|
420 } |
|
421 |
|
422 TPosLmCollectionDataId lmId = iLandmarkParser->FirstCollectionDataId(); |
|
423 |
|
424 iLog->Log(_L("--- CollectionData ---")); |
|
425 TraceL(_L("--- CollectionData ---")); |
|
426 |
|
427 if (lmId != EPosLmCollDataNone) |
|
428 { |
|
429 TPtrC first = iLandmarkParser->CollectionData(lmId); |
|
430 HBufC* buffer = HBufC::NewLC( first.Length() + 256 ); |
|
431 TPtr buf = buffer->Des(); |
|
432 buf.Zero(); |
|
433 buf.Format(_L("\t(1)Collection Id: %d CollectionData: "), lmId); |
|
434 buf.Append(first); |
|
435 iLog->Log(buf); |
|
436 TraceL(buf); |
|
437 CleanupStack::PopAndDestroy( buffer ); |
|
438 buffer = NULL; |
|
439 } |
|
440 else |
|
441 { |
|
442 iLog->Log(_L("\tNo collection data found 1")); |
|
443 } |
|
444 |
|
445 while (lmId != EPosLmCollDataNone) |
|
446 { |
|
447 lmId = iLandmarkParser->NextCollectionDataId(lmId); |
|
448 if (lmId != EPosLmCollDataNone) |
|
449 { |
|
450 TPtrC first = iLandmarkParser->CollectionData(lmId); |
|
451 |
|
452 HBufC* buffer = HBufC::NewLC( first.Length() + 256 ); |
|
453 TPtr buf = buffer->Des(); |
|
454 buf.Zero(); |
|
455 buf.Format(_L("\t(2)Collection Id: %d CollectionData: "), lmId); |
|
456 buf.Append(first); |
|
457 iLog->Log(buf); |
|
458 TraceL(buf); |
|
459 CleanupStack::PopAndDestroy( buffer ); |
|
460 buffer = NULL; |
|
461 } |
|
462 else |
|
463 { |
|
464 iLog->Log(_L("\tNo collection data found 2")); |
|
465 } |
|
466 } |
|
467 |
|
468 iLog->Log(_L("--- CollectionData ---")); |
|
469 TraceL(_L("--- CollectionData ---")); |
|
470 |
|
471 delete iOperation; |
|
472 iOperation = NULL; |
|
473 delete iLandmarkParser; |
|
474 iLandmarkParser = NULL; |
|
475 iLog->Log(_L("====== PrintParsedDataFromEncoderL Done ========\n")); |
|
476 } |
|
477 |
|
478 |
|
479 // --------------------------------------------------------- |
|
480 // CPosTp153::PrintLandmarkFieldsWithDescriptionL |
|
481 // |
|
482 // (other items were commented in a header). |
|
483 // --------------------------------------------------------- |
|
484 // |
|
485 void CPosTp153::PrintLandmarkFieldsWithDescriptionL(const CPosLandmark& aLandmark, TBool aTraceFlag) |
|
486 { |
|
487 iLog->Log(_L("Parsing Description ... \n")); |
|
488 TPositionFieldId sourceFieldId = aLandmark.FirstPositionFieldId(); |
|
489 TLocality loc; |
|
490 |
|
491 TInt err; |
|
492 TPtrC landmarkName; |
|
493 TPtrC landmarkDescription; |
|
494 err = aLandmark.GetLandmarkName(landmarkName); |
|
495 if (err == KErrNone) |
|
496 { |
|
497 HBufC* buffer = HBufC::NewLC( landmarkName.Length() + 256 ); |
|
498 TPtr buf = buffer->Des(); |
|
499 |
|
500 buf.Append( _L(" \tLandmark Name: ")); |
|
501 buf.Append( landmarkName ); |
|
502 iLog->Log( buf ); |
|
503 if( aTraceFlag ) |
|
504 { |
|
505 TraceL( buf ); |
|
506 } |
|
507 |
|
508 CleanupStack::PopAndDestroy( buffer ); |
|
509 buffer = NULL; |
|
510 } |
|
511 |
|
512 err = aLandmark.GetPosition(loc); |
|
513 if (err == KErrNone) |
|
514 { |
|
515 HBufC* buffer = HBufC::NewLC( 1024 ); |
|
516 TPtr buf = buffer->Des(); |
|
517 TRealFormat format( 12, KRealFormatFixed ); |
|
518 format.iPoint = TChar('.'); |
|
519 format.iTriLen = KDoNotUseTriads; |
|
520 format.iPlaces = 6; |
|
521 |
|
522 TBuf<20> sLon, sLat, sVacc, sHacc, sAlt, sRad; |
|
523 sLon.Num( loc.Longitude(), format ); |
|
524 sLat.Num( loc.Latitude(), format ); |
|
525 sAlt.Num( loc.Altitude(), format ); |
|
526 sVacc.Num( loc.VerticalAccuracy(), format ); |
|
527 sHacc.Num( loc.HorizontalAccuracy(), format ); |
|
528 buf.Format( |
|
529 _L("\tLM: Long %S Lat %S vertAcc %S horAcc %S alt %S "), |
|
530 &sLon, &sLat, &sVacc, &sHacc, &sAlt); |
|
531 |
|
532 TReal32 sourceR; |
|
533 err = aLandmark.GetCoverageRadius(sourceR); |
|
534 if (err == KErrNone ) |
|
535 { |
|
536 sRad.Num( sourceR, format ); |
|
537 buf.AppendFormat(_L("srcRadius %S"), &sRad); |
|
538 } |
|
539 iLog->Log(buf); |
|
540 if (aTraceFlag) TraceL(buf); |
|
541 CleanupStack::PopAndDestroy( buffer ); |
|
542 buffer = NULL; |
|
543 } |
|
544 |
|
545 //Get landmark description |
|
546 err = aLandmark.GetLandmarkDescription(landmarkDescription); |
|
547 if (err == KErrNone) |
|
548 { |
|
549 HBufC* buffer = HBufC::NewLC( landmarkDescription.Length() + 256 ); |
|
550 TPtr buf = buffer->Des(); |
|
551 buf.Format(_L("\tLandmark Description: ")); |
|
552 buf.Append(landmarkDescription); |
|
553 iLog->Log(buf); |
|
554 if ( aTraceFlag ) |
|
555 { |
|
556 TraceL( buf ); |
|
557 } |
|
558 |
|
559 CleanupStack::PopAndDestroy( buffer ); |
|
560 buffer = NULL; |
|
561 } |
|
562 |
|
563 |
|
564 while (sourceFieldId != EPositionFieldNone) |
|
565 { |
|
566 TPtrC sourceValue; |
|
567 aLandmark.GetPositionField(sourceFieldId, sourceValue); |
|
568 |
|
569 HBufC* buffer = HBufC::NewLC( sourceValue.Length() + 256 ); |
|
570 TPtr buf = buffer->Des(); |
|
571 buf.Format(_L("\tIdField Id: %d Value:"), sourceFieldId); |
|
572 buf.Append(sourceValue); |
|
573 iLog->Log(buf); |
|
574 if ( aTraceFlag ) |
|
575 { |
|
576 TraceL( buf ); |
|
577 } |
|
578 sourceFieldId = aLandmark.NextPositionFieldId(sourceFieldId); |
|
579 |
|
580 CleanupStack::PopAndDestroy( buffer ); |
|
581 } |
|
582 } |
|
583 |
|
584 |
|
585 // --------------------------------------------------------- |
|
586 // CPosTp153::TraceL |
|
587 // |
|
588 // (other items were commented in a header). |
|
589 // --------------------------------------------------------- |
|
590 // |
|
591 void CPosTp153::TraceL(const TDesC& msg) |
|
592 { |
|
593 _LIT8( KEnd, "\r\n" ); |
|
594 |
|
595 RFile file; |
|
596 TInt err = file.Open(iFileSession, KFileTrace, EFileWrite); |
|
597 if (err == KErrNotFound) |
|
598 { |
|
599 file.Create(iFileSession, KFileTrace, EFileWrite); |
|
600 } |
|
601 |
|
602 HBufC8* line8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( msg ); |
|
603 |
|
604 TInt pos( 0 ); |
|
605 file.Seek( ESeekEnd, pos ); |
|
606 file.Write( *line8 ); |
|
607 file.Write( KEnd ); |
|
608 file.Close(); |
|
609 |
|
610 delete line8; |
|
611 } |
|
612 |
|
613 // End of File |