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