|
1 /* |
|
2 * Copyright (c) 2002 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 "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include "TLocTest.h" |
|
23 |
|
24 #include <e32svr.h> |
|
25 #include <StifParser.h> |
|
26 #include <Stiftestinterface.h> |
|
27 #include <AiwCommon.h> |
|
28 #include <lbs.h> |
|
29 |
|
30 const TInt Ksecond = 1000000; |
|
31 |
|
32 const TInt KUpdatetimeOut = 2*Ksecond ; |
|
33 //Log file for math operation |
|
34 _LIT(LogFileName , "C:\\mathlog.txt") ; |
|
35 _LIT(KRequestor,"testapp"); |
|
36 |
|
37 |
|
38 // ============================ MEMBER FUNCTIONS =============================== |
|
39 |
|
40 // ----------------------------------------------------------------------------- |
|
41 // CTLocTest::Delete |
|
42 // Delete here all resources allocated and opened from test methods. |
|
43 // Called from destructor. |
|
44 // ----------------------------------------------------------------------------- |
|
45 // |
|
46 void CTLocTest::Delete() |
|
47 { |
|
48 |
|
49 } |
|
50 |
|
51 // ----------------------------------------------------------------------------- |
|
52 // CTLocTest::RunMethodL |
|
53 // Run specified method. Contains also table of test mothods and their names. |
|
54 // ----------------------------------------------------------------------------- |
|
55 // |
|
56 TInt CTLocTest::RunMethodL( |
|
57 CStifItemParser& aItem ) |
|
58 { |
|
59 |
|
60 static TStifFunctionInfo const KFunctions[] = |
|
61 { |
|
62 // Copy this line for every implemented function. |
|
63 // First string is the function name used in TestScripter script file. |
|
64 // Second is the actual implementation member function. |
|
65 ENTRY( "GetLocation", CTLocTest::GetLocation ), |
|
66 ENTRY("LocationUpdates", CTLocTest :: LocationUpdates), |
|
67 ENTRY("CancelLocationUpdates1", CTLocTest :: CancelLocationUpdatesA), |
|
68 ENTRY("CancelLocationUpdates2", CTLocTest :: CancelLocationUpdatesB), |
|
69 ENTRY( "LastKnownLoc" , CTLocTest :: LastKnownLoc), |
|
70 ENTRY("FindDistance", CTLocTest :: FindDistance ), |
|
71 ENTRY("FindBearingTo", CTLocTest :: FindBearingTo ), |
|
72 ENTRY("MoveCoordinates",CTLocTest :: MoveCoordinates), |
|
73 ENTRY("GetLocationAsynch", CTLocTest :: GetLocationAsynch ), |
|
74 ENTRY("CancelLocationAsynch", CTLocTest :: CancelLocationAsynch ), |
|
75 ENTRY("StraySignal" , CTLocTest :: StraySignal), |
|
76 ENTRY("StraySignalGetLoc" , CTLocTest :: StraySignalGetLoc), |
|
77 ENTRY("ConcurrentCallsGetLoc" , CTLocTest:: ConcurrentCallsGetLoc), |
|
78 ENTRY("ConcurrentCallsTrace" , CTLocTest:: ConcurrentCallsTrace), |
|
79 ENTRY("EmptyCancelTrace" , CTLocTest:: EmptyCancelTrace), |
|
80 ENTRY("EmptyCancelLocAsynch" , CTLocTest:: EmptyCancelLocAsynch) |
|
81 |
|
82 |
|
83 }; |
|
84 |
|
85 const TInt count = sizeof( KFunctions ) / |
|
86 sizeof( TStifFunctionInfo ); |
|
87 |
|
88 return RunInternalL( KFunctions, count, aItem ); |
|
89 |
|
90 } |
|
91 |
|
92 // ----------------------------------------------------------------------------- |
|
93 // CTLocTest::ExampleL |
|
94 // Example test method function. |
|
95 // (other items were commented in a header). |
|
96 // ----------------------------------------------------------------------------- |
|
97 // |
|
98 TInt CTLocTest::GetLocation( CStifItemParser& /*aItem*/ ) |
|
99 { |
|
100 |
|
101 // Print to UI |
|
102 _LIT( KTLocTest, "TLocTest" ); |
|
103 _LIT( KExample, "GetLocation" ); |
|
104 iLog->Log(KTLocTest) ; |
|
105 // iLog->Log(KExample) ; |
|
106 //TestModuleIf().Printf( 0, KTLocTest, KExample ); |
|
107 // Print to log file |
|
108 |
|
109 TPositionInfo position; |
|
110 |
|
111 |
|
112 iLog->Log( KExample ); |
|
113 CLocationService *CoreObj = CLocationService :: NewL(); |
|
114 |
|
115 //not needed any more |
|
116 /*RRequestorStack infostack; |
|
117 |
|
118 const CRequestor* identityInfo = CRequestor::NewL(CRequestor::ERequestorService,CRequestor::EFormatApplication, |
|
119 KRequestor) ; |
|
120 infostack.Append(identityInfo); |
|
121 CoreObj->SetRequestorIdentityL(infostack);*/ |
|
122 |
|
123 |
|
124 |
|
125 TInt Result =CoreObj->GetLocationL(&position) ; |
|
126 TPosition pos ; |
|
127 |
|
128 position.GetPosition(pos) ; |
|
129 TReal64 aLatitude = pos.Latitude(); |
|
130 TReal64 aLongitude = pos.Longitude() ; |
|
131 TReal32 aAltitude = pos.Altitude() ; |
|
132 delete CoreObj ; |
|
133 |
|
134 |
|
135 return Result ; |
|
136 |
|
137 } |
|
138 |
|
139 |
|
140 |
|
141 |
|
142 //DummyCB MyUpdates ; |
|
143 //CGetLoc *Coreobj = NULL ; |
|
144 |
|
145 |
|
146 TInt CTLocTest :: LocationUpdates(CStifItemParser& /*aItem*/) |
|
147 { |
|
148 _LIT(KTLocTest ,"TLocTest"); |
|
149 iLog->Log(KTLocTest) ; |
|
150 |
|
151 TRequestStatus Status = KRequestPending ; |
|
152 RThread FunctionThread ; |
|
153 |
|
154 TInt ret = FunctionThread.Create(_L(" LocationUpdates Thread") , GetLocUpdates ,KDefaultStackSize , |
|
155 KMinHeapSize , KDefaultStackSize ,(TAny *) NULL); |
|
156 |
|
157 if(!ret) |
|
158 { |
|
159 FunctionThread.Logon(Status) ; |
|
160 FunctionThread.Resume() ; |
|
161 |
|
162 User :: WaitForRequest (Status) ; |
|
163 FunctionThread.Close(); |
|
164 |
|
165 ret = Status.Int() ; |
|
166 } |
|
167 return ret; |
|
168 } |
|
169 |
|
170 TInt CTLocTest :: LastKnownLoc(CStifItemParser& /*aItem*/) |
|
171 { |
|
172 _LIT(KTLocTest , "TLocTest") ; |
|
173 iLog->Log(KTLocTest) ; |
|
174 // CLocationService *CoreObj = CLocationService :: NewL(); |
|
175 // TPosition LastKnownPos ; |
|
176 |
|
177 // CoreObj->GetLastKnownLoc(LastKnownPos) ; |
|
178 return KErrNone ; |
|
179 } |
|
180 |
|
181 |
|
182 TInt CTLocTest ::GetLocationAsynch(CStifItemParser& /*aItem*/) |
|
183 { |
|
184 |
|
185 _LIT(KTLocTest ,"TLocTest"); |
|
186 iLog->Log(KTLocTest) ; |
|
187 |
|
188 TRequestStatus Status = KRequestPending ; |
|
189 RThread FunctionThread ; |
|
190 |
|
191 FunctionThread.Create(_L("GetLocationAsynch Thread") , FindLocationAsynch ,KDefaultStackSize , |
|
192 KMinHeapSize , KDefaultStackSize ,(TAny *) NULL); |
|
193 |
|
194 FunctionThread.Logon(Status) ; |
|
195 FunctionThread.Resume() ; |
|
196 |
|
197 User :: WaitForRequest (Status) ; |
|
198 FunctionThread.Close(); |
|
199 |
|
200 return Status.Int() ; |
|
201 |
|
202 |
|
203 } |
|
204 |
|
205 |
|
206 |
|
207 |
|
208 |
|
209 |
|
210 |
|
211 TInt CTLocTest :: FindDistance(CStifItemParser& /*aItem*/) |
|
212 { |
|
213 CLocationService *CoreObj = CLocationService :: NewL(); |
|
214 |
|
215 |
|
216 TReal32 distance; |
|
217 TTime systemtime; |
|
218 systemtime.HomeTime(); //for getting the system time |
|
219 |
|
220 |
|
221 //scenarion 1: both input param are within the valid range |
|
222 //coordinate1 = ,coordinate2 = |
|
223 TCoordinate cordinate1(22,88),cordinate2(13,77); |
|
224 |
|
225 |
|
226 |
|
227 //preparing for input param |
|
228 |
|
229 inpparam input; |
|
230 input.servicechoice = EDistance; |
|
231 input.source = cordinate1; |
|
232 input.destination = cordinate2; |
|
233 |
|
234 |
|
235 |
|
236 |
|
237 CoreObj->MathOperation(input) ; |
|
238 |
|
239 |
|
240 distance = input.result; |
|
241 |
|
242 |
|
243 //Logging result into a file |
|
244 RFile LogFile ; |
|
245 RFs LogSession ; |
|
246 TBuf8<50> Buffer(_L8("Distance = ")) ; |
|
247 LogSession.Connect() ; |
|
248 |
|
249 if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) |
|
250 { |
|
251 LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) ; |
|
252 |
|
253 } |
|
254 |
|
255 TInt End = 0 ; |
|
256 |
|
257 LogFile.Seek(ESeekEnd , End) ; //Seek to end of the file before writing |
|
258 |
|
259 TBuf8<50> num ; |
|
260 TRealFormat format ; |
|
261 //TReal64 Val = aPosition.Latitude() ; |
|
262 num.Num(distance , format) ; |
|
263 |
|
264 //Logging Latitude |
|
265 LogFile.Write(_L8("distance = ")); |
|
266 LogFile.Write(num) ; |
|
267 LogFile.Write(_L8("\n")) ; |
|
268 LogFile.Close() ; |
|
269 LogSession.Close() ; |
|
270 |
|
271 //scenario 1 ends here |
|
272 |
|
273 //scenario 2: longitude is out of range |
|
274 |
|
275 TCoordinate cordinate3(0,0,0),cordinate4(0,0,0); |
|
276 |
|
277 |
|
278 //preparing for input param |
|
279 |
|
280 |
|
281 input.servicechoice = EDistance; |
|
282 input.source = cordinate3; |
|
283 input.destination = cordinate4; |
|
284 |
|
285 |
|
286 |
|
287 |
|
288 CoreObj->MathOperation(input) ; |
|
289 |
|
290 |
|
291 distance = input.result; |
|
292 |
|
293 |
|
294 //Logging result into a file |
|
295 |
|
296 LogSession.Connect() ; |
|
297 |
|
298 if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) |
|
299 { |
|
300 LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) ; |
|
301 |
|
302 } |
|
303 |
|
304 |
|
305 LogFile.Seek(ESeekEnd , End) ; //Seek to end of the file before writing |
|
306 |
|
307 |
|
308 num.Num(distance , format) ; |
|
309 |
|
310 //Logging Latitude |
|
311 LogFile.Write(_L8("distance(longitude out of range) = ")); |
|
312 LogFile.Write(num) ; |
|
313 LogFile.Write(_L8("\n")) ; |
|
314 LogFile.Close() ; |
|
315 LogSession.Close() ; |
|
316 //scenario 2: ends here |
|
317 |
|
318 //scenario 3: latitude is out of range |
|
319 TCoordinate cordinate5(91,172),cordinate6(94,145); |
|
320 |
|
321 |
|
322 |
|
323 //preparing for input param |
|
324 |
|
325 |
|
326 input.servicechoice = EDistance; |
|
327 input.source = cordinate5; |
|
328 input.destination = cordinate6; |
|
329 |
|
330 |
|
331 |
|
332 |
|
333 |
|
334 CoreObj->MathOperation(input) ; |
|
335 |
|
336 |
|
337 distance = input.result; |
|
338 |
|
339 |
|
340 //Logging result into a file |
|
341 |
|
342 LogSession.Connect() ; |
|
343 |
|
344 if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) |
|
345 { |
|
346 LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) ; |
|
347 |
|
348 } |
|
349 |
|
350 |
|
351 LogFile.Seek(ESeekEnd , End) ; //Seek to end of the file before writing |
|
352 |
|
353 |
|
354 num.Num(distance , format) ; |
|
355 |
|
356 //Logging Latitude |
|
357 LogFile.Write(_L8("distance(latitude out of range) = ")); |
|
358 LogFile.Write(num) ; |
|
359 LogFile.Write(_L8("\n")) ; |
|
360 LogFile.Close() ; |
|
361 LogSession.Close() ; |
|
362 |
|
363 //scenario 3: ends here |
|
364 |
|
365 //scenario 4: both are out of range |
|
366 TCoordinate cordinate7(91,182),cordinate8(98,187); |
|
367 |
|
368 |
|
369 |
|
370 //preparing for input param |
|
371 |
|
372 |
|
373 input.servicechoice = EDistance; |
|
374 input.source = cordinate7; |
|
375 input.destination = cordinate8; |
|
376 |
|
377 |
|
378 |
|
379 |
|
380 |
|
381 CoreObj->MathOperation(input) ; |
|
382 |
|
383 |
|
384 distance = input.result; |
|
385 |
|
386 |
|
387 //Logging result into a file |
|
388 |
|
389 LogSession.Connect() ; |
|
390 |
|
391 if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) |
|
392 { |
|
393 LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) ; |
|
394 |
|
395 } |
|
396 |
|
397 |
|
398 LogFile.Seek(ESeekEnd , End) ; //Seek to end of the file before writing |
|
399 |
|
400 |
|
401 num.Num(distance , format) ; |
|
402 |
|
403 //Logging Latitude |
|
404 LogFile.Write(_L8("distance(both out of range) = ")); |
|
405 LogFile.Write(num) ; |
|
406 LogFile.Write(_L8("\n")) ; |
|
407 LogFile.Close() ; |
|
408 LogSession.Close() ; |
|
409 |
|
410 |
|
411 |
|
412 //scenario 4: ends here |
|
413 |
|
414 |
|
415 delete CoreObj; |
|
416 return KErrNone ; |
|
417 } |
|
418 |
|
419 /** Manual test case for findbearingto |
|
420 */ |
|
421 TInt CTLocTest :: FindBearingTo(CStifItemParser& /*aItem*/) |
|
422 { |
|
423 CLocationService *CoreObj = CLocationService :: NewL(); |
|
424 |
|
425 |
|
426 TReal32 bearingTo; |
|
427 |
|
428 |
|
429 //scenarion 1: both input param are within the valid range |
|
430 //coordinate1 = ,coordinate2 = |
|
431 TCoordinate cordinate1(22,88),cordinate2(13,77); |
|
432 |
|
433 |
|
434 |
|
435 //preparing for input param |
|
436 |
|
437 inpparam input; |
|
438 input.servicechoice = EBearingTo; |
|
439 input.source = cordinate1; |
|
440 input.destination = cordinate2; |
|
441 |
|
442 |
|
443 |
|
444 |
|
445 CoreObj->MathOperation(input) ; |
|
446 |
|
447 |
|
448 bearingTo = input.result; |
|
449 |
|
450 |
|
451 //Logging result into a file |
|
452 RFile LogFile ; |
|
453 RFs LogSession ; |
|
454 TBuf8<50> Buffer(_L8("Bearing = ")) ; |
|
455 LogSession.Connect() ; |
|
456 |
|
457 if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) |
|
458 { |
|
459 LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) ; |
|
460 |
|
461 } |
|
462 |
|
463 TInt End = 0 ; |
|
464 |
|
465 LogFile.Seek(ESeekEnd , End) ; //Seek to end of the file before writing |
|
466 |
|
467 TBuf8<50> num ; |
|
468 TRealFormat format ; |
|
469 |
|
470 num.Num(bearingTo, format) ; |
|
471 |
|
472 //Logging |
|
473 LogFile.Write(_L8("Bearing = ")); |
|
474 LogFile.Write(num) ; |
|
475 LogFile.Write(_L8("\n")) ; |
|
476 LogFile.Close() ; |
|
477 LogSession.Close() ; |
|
478 |
|
479 //scenario 1 ends here |
|
480 |
|
481 //scenario 2: |
|
482 |
|
483 TCoordinate cordinate3(0,0,0),cordinate4(0,0,0); |
|
484 |
|
485 |
|
486 //preparing for input param |
|
487 |
|
488 |
|
489 input.servicechoice = EBearingTo; |
|
490 input.source = cordinate3; |
|
491 input.destination = cordinate4; |
|
492 |
|
493 |
|
494 |
|
495 |
|
496 CoreObj->MathOperation(input) ; |
|
497 |
|
498 |
|
499 bearingTo = input.result; |
|
500 |
|
501 |
|
502 //Logging result into a file |
|
503 |
|
504 LogSession.Connect() ; |
|
505 |
|
506 if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) |
|
507 { |
|
508 LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) ; |
|
509 |
|
510 } |
|
511 |
|
512 |
|
513 LogFile.Seek(ESeekEnd , End) ; //Seek to end of the file before writing |
|
514 |
|
515 |
|
516 num.Num(bearingTo , format) ; |
|
517 |
|
518 //Logging |
|
519 LogFile.Write(_L8("Bearing= ")); |
|
520 LogFile.Write(num) ; |
|
521 LogFile.Write(_L8("\n")) ; |
|
522 LogFile.Close() ; |
|
523 LogSession.Close() ; |
|
524 //scenario 2: ends here |
|
525 |
|
526 //scenario 3: latitude is out of range |
|
527 TCoordinate cordinate5(91,172),cordinate6(94,145); |
|
528 |
|
529 |
|
530 |
|
531 //preparing for input param |
|
532 |
|
533 |
|
534 input.servicechoice = EBearingTo; |
|
535 input.source = cordinate5; |
|
536 input.destination = cordinate6; |
|
537 |
|
538 |
|
539 |
|
540 |
|
541 |
|
542 CoreObj->MathOperation(input) ; |
|
543 |
|
544 |
|
545 bearingTo = input.result; |
|
546 |
|
547 |
|
548 //Logging result into a file |
|
549 |
|
550 LogSession.Connect() ; |
|
551 |
|
552 if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) |
|
553 { |
|
554 LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) ; |
|
555 |
|
556 } |
|
557 |
|
558 |
|
559 LogFile.Seek(ESeekEnd , End) ; //Seek to end of the file before writing |
|
560 |
|
561 |
|
562 num.Num(bearingTo , format) ; |
|
563 |
|
564 //Logging Latitude |
|
565 LogFile.Write(_L8("Bearing(latitude out of range) = ")); |
|
566 LogFile.Write(num) ; |
|
567 LogFile.Write(_L8("\n")) ; |
|
568 LogFile.Close() ; |
|
569 LogSession.Close() ; |
|
570 |
|
571 //scenario 3: ends here |
|
572 |
|
573 //scenario 4: both are out of range |
|
574 TCoordinate cordinate7(91,182),cordinate8(98,187); |
|
575 |
|
576 |
|
577 |
|
578 //preparing for input param |
|
579 |
|
580 |
|
581 input.servicechoice = EBearingTo; |
|
582 input.source = cordinate7; |
|
583 input.destination = cordinate8; |
|
584 |
|
585 |
|
586 |
|
587 |
|
588 |
|
589 CoreObj->MathOperation(input) ; |
|
590 |
|
591 |
|
592 bearingTo= input.result; |
|
593 |
|
594 |
|
595 //Logging result into a file |
|
596 |
|
597 LogSession.Connect() ; |
|
598 |
|
599 if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) |
|
600 { |
|
601 LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) ; |
|
602 |
|
603 } |
|
604 |
|
605 |
|
606 LogFile.Seek(ESeekEnd , End) ; //Seek to end of the file before writing |
|
607 |
|
608 |
|
609 num.Num(bearingTo , format) ; |
|
610 |
|
611 //Logging Latitude |
|
612 LogFile.Write(_L8("Bearing(both out of range) = ")); |
|
613 LogFile.Write(num) ; |
|
614 LogFile.Write(_L8("\n")) ; |
|
615 LogFile.Close() ; |
|
616 LogSession.Close() ; |
|
617 |
|
618 |
|
619 |
|
620 //scenario 4: ends here |
|
621 |
|
622 |
|
623 delete CoreObj; |
|
624 return KErrNone ; |
|
625 } |
|
626 |
|
627 |
|
628 |
|
629 /** |
|
630 * Manual test case for MathOperation Move |
|
631 */ |
|
632 TInt CTLocTest :: MoveCoordinates(CStifItemParser& /*aItem*/) |
|
633 { |
|
634 CLocationService *CoreObj = CLocationService :: NewL(); |
|
635 |
|
636 |
|
637 |
|
638 |
|
639 |
|
640 |
|
641 TCoordinate cordinate1(22,88); |
|
642 |
|
643 |
|
644 |
|
645 //preparing for input param |
|
646 |
|
647 inpparam input; |
|
648 input.servicechoice = EMove; |
|
649 input.source = cordinate1; |
|
650 input.bearing = 34; |
|
651 input.distance = 234; |
|
652 |
|
653 |
|
654 |
|
655 |
|
656 |
|
657 CoreObj->MathOperation(input) ; |
|
658 TReal64 latitudeval = input.source.Latitude(); |
|
659 TReal64 longitudeval = input.source.Longitude(); |
|
660 |
|
661 TReal64 altitudeval = input.source.Altitude(); |
|
662 |
|
663 |
|
664 |
|
665 |
|
666 |
|
667 |
|
668 |
|
669 //Logging result into a file |
|
670 RFile LogFile ; |
|
671 RFs LogSession ; |
|
672 TBuf8<50> Buffer(_L8("Longitude = ")) ; |
|
673 LogSession.Connect() ; |
|
674 |
|
675 if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) |
|
676 { |
|
677 LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) ; |
|
678 |
|
679 } |
|
680 |
|
681 TInt End = 0 ; |
|
682 |
|
683 LogFile.Seek(ESeekEnd , End) ; //Seek to end of the file before writing |
|
684 |
|
685 TBuf8<50> num ; |
|
686 TRealFormat format ; |
|
687 |
|
688 num.Num(longitudeval, format) ; |
|
689 |
|
690 //Logging |
|
691 LogFile.Write(_L8("Longitude = ")); |
|
692 LogFile.Write(num) ; |
|
693 LogFile.Write(_L8("\n")) ; |
|
694 //LogFile.Seek(ESeekEnd , End) ; |
|
695 num.Num(latitudeval, format) ; |
|
696 LogFile.Write(_L8("Latitude = ")); |
|
697 LogFile.Write(num) ; |
|
698 LogFile.Write(_L8("\n")) ; |
|
699 num.Num(altitudeval, format) ; |
|
700 LogFile.Write(_L8("altitude = ")); |
|
701 LogFile.Write(num) ; |
|
702 LogFile.Write(_L8("\n")) ; |
|
703 |
|
704 |
|
705 LogFile.Close() ; |
|
706 LogSession.Close() ; |
|
707 delete CoreObj; |
|
708 return KErrNone ; |
|
709 } |
|
710 /* |
|
711 * This is a manual test case were the service was available when the |
|
712 * request was made and then Lost the service (Contact to location servier lost |
|
713 */ |
|
714 |
|
715 |
|
716 |
|
717 |
|
718 /** |
|
719 *Stray signal test, tests for any unhandled events from location server |
|
720 */ |
|
721 |
|
722 TInt CTLocTest :: StraySignal(CStifItemParser& /*aItem*/) |
|
723 { |
|
724 _LIT(KTLocTest ,"TLocTest"); |
|
725 iLog->Log(KTLocTest) ; |
|
726 _LIT(KLog , "StraySignalTest ") ; |
|
727 iLog->Log(KTLocTest) ; |
|
728 |
|
729 TRequestStatus Status = KRequestPending ; |
|
730 RThread FunctionThread ; |
|
731 |
|
732 TInt ret = FunctionThread.Create(_L("stray signal") , StrayTest ,KDefaultStackSize , |
|
733 KMinHeapSize , KDefaultStackSize ,(TAny *) NULL);; |
|
734 |
|
735 if(!ret) |
|
736 { |
|
737 |
|
738 _LIT(Klog , "Created the thread ") ; |
|
739 iLog->Log(Klog) ; |
|
740 FunctionThread.Logon(Status) ; |
|
741 FunctionThread.Resume() ; |
|
742 |
|
743 User :: WaitForRequest (Status) ; |
|
744 FunctionThread.Close(); |
|
745 |
|
746 ret = Status.Int() ; |
|
747 } |
|
748 |
|
749 return ret; |
|
750 } |
|
751 |
|
752 TInt CTLocTest :: StraySignalGetLoc(CStifItemParser& /*aItem*/) |
|
753 { |
|
754 _LIT(KTLocTest ,"TLocTest"); |
|
755 iLog->Log(KTLocTest) ; |
|
756 _LIT(KLog , "StraySignalTestGetLoc ") ; |
|
757 iLog->Log(KTLocTest) ; |
|
758 |
|
759 TRequestStatus Status = KRequestPending ; |
|
760 RThread FunctionThread ; |
|
761 |
|
762 TInt ret = FunctionThread.Create(_L("stray signal GetLocation") , StrayTestGetLoc ,KDefaultStackSize , |
|
763 KMinHeapSize , KDefaultStackSize ,(TAny *) NULL);; |
|
764 |
|
765 if(!ret) |
|
766 { |
|
767 |
|
768 _LIT(Klog , "thread created ") ; |
|
769 iLog->Log(Klog) ; |
|
770 FunctionThread.Logon(Status) ; |
|
771 FunctionThread.Resume() ; |
|
772 |
|
773 User :: WaitForRequest (Status) ; |
|
774 FunctionThread.Close(); |
|
775 |
|
776 ret = Status.Int() ; |
|
777 } |
|
778 |
|
779 |
|
780 return ret; |
|
781 } |
|
782 |
|
783 TInt CTLocTest :: EmptyCancelTrace(CStifItemParser& /*aItem*/) |
|
784 { |
|
785 /*_LIT(KTLocTest ,"TLocTest"); |
|
786 iLog->Log(KTLocTest) ; |
|
787 _LIT(KLog , "EmptyCanceltest ") ; |
|
788 iLog->Log(KTLocTest) ;*/ |
|
789 |
|
790 CLocationService *CoreObj = CLocationService ::NewL() ; |
|
791 //not needed any more |
|
792 /*RRequestorStack infostack; |
|
793 |
|
794 const CRequestor* identityInfo = CRequestor::NewL(CRequestor::ERequestorService,CRequestor::EFormatApplication, |
|
795 KRequestor) ; |
|
796 infostack.Append(identityInfo); |
|
797 CoreObj->SetRequestorIdentityL(infostack);*/ |
|
798 TInt error= CoreObj->CancelOnGoingService(ECancelTrace); |
|
799 if( error==KErrNotFound ) |
|
800 { |
|
801 delete CoreObj; |
|
802 return KErrNone; |
|
803 } |
|
804 |
|
805 delete CoreObj; |
|
806 } |
|
807 |
|
808 TInt CTLocTest :: EmptyCancelLocAsynch(CStifItemParser& /*aItem*/) |
|
809 { |
|
810 _LIT(KTLocTest ,"TLocTest"); |
|
811 iLog->Log(KTLocTest) ; |
|
812 _LIT(KLog , "EmptyCanceltest ") ; |
|
813 iLog->Log(KTLocTest) ; |
|
814 |
|
815 CLocationService *CoreObj = CLocationService ::NewL() ; |
|
816 //not needed any more |
|
817 /*RRequestorStack infostack; |
|
818 |
|
819 const CRequestor* identityInfo = CRequestor::NewL(CRequestor::ERequestorService,CRequestor::EFormatApplication, |
|
820 KRequestor) ; |
|
821 infostack.Append(identityInfo); |
|
822 CoreObj->SetRequestorIdentityL(infostack);*/ |
|
823 TInt error= CoreObj->CancelOnGoingService(ECancelGetLocation); |
|
824 if( error==KErrNotFound ) |
|
825 { |
|
826 delete CoreObj; |
|
827 return KErrNone; |
|
828 } |
|
829 |
|
830 delete CoreObj; |
|
831 return KErrGeneral; |
|
832 } |
|
833 |
|
834 |