|
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Example CTestStep derived implementation |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file SimPsyNmeaPositionerStep.cpp |
|
20 @internalTechnology |
|
21 */ |
|
22 #include "simpsynmeapositionerstep.h" |
|
23 #include "te_lbssimulationpsysuitedefs.h" |
|
24 |
|
25 #include "CSimPsyMultiNmeaPosRequester.h" |
|
26 |
|
27 |
|
28 #include <lbs.h> |
|
29 #include <lbssatellite.h> |
|
30 |
|
31 // A few useful macros |
|
32 #define MAX(x,y) ((x)<(y))?(y):(x) |
|
33 #define MIN(x,y) ((x)<(y))?(x):(y) |
|
34 |
|
35 // CONSTANTS |
|
36 _LIT(KNmeaFile, "c:\\system\\data\\nmea.nme"); |
|
37 _LIT(KNmeaShortFile, "c:\\system\\data\\nmea_short.nme"); |
|
38 _LIT(KWrongFileType, "c:\\system\\data\\simfile.wng"); |
|
39 _LIT(KNmeaSatelliteFile, "c:\\system\\data\\nmea_garmin3plus.nme"); |
|
40 _LIT(KNmeaMagellanFile, "c:\\system\\data\\nmea_Magellantracker.nme"); |
|
41 _LIT(KNmeaPdopMissingFile, "c:\\system\\data\\nmea_pdopmissing.nme"); |
|
42 _LIT(KNmeaPartialUpdateFile, "c:\\system\\data\\nmea_partial_updates.nme"); |
|
43 _LIT(KNmeaError1, "c:\\system\\data\\nmea_error1.nme"); |
|
44 _LIT(KNmeaError2, "c:\\system\\data\\nmea_error2.nme"); |
|
45 _LIT(KNmeaError3, "c:\\system\\data\\nmea_error3.nme"); |
|
46 _LIT(KNmeaSpecialCase, "c:\\system\\data\\nmea_special_case.nme"); |
|
47 |
|
48 const TInt32 KSimModuleId = 270498433; |
|
49 |
|
50 |
|
51 CSimPsyNmeaPositionerStep::~CSimPsyNmeaPositionerStep() |
|
52 /** |
|
53 * Destructor |
|
54 */ |
|
55 { |
|
56 iFileReader->CloseResources(); |
|
57 delete iSimDataArray; |
|
58 iSimDataArray = NULL; |
|
59 delete iFileReader; |
|
60 iFileReader = NULL; |
|
61 |
|
62 #ifdef __CTC__ |
|
63 #pragma CTC APPEND |
|
64 #endif |
|
65 } |
|
66 |
|
67 CSimPsyNmeaPositionerStep::CSimPsyNmeaPositionerStep() |
|
68 /** |
|
69 * Constructor |
|
70 */ |
|
71 { |
|
72 // **MUST** call SetTestStepName in the constructor as the controlling |
|
73 // framework uses the test step name immediately following construction to set |
|
74 // up the step's unique logging ID. |
|
75 SetTestStepName(KSimPsyNmeaPositionerStep); |
|
76 } |
|
77 |
|
78 TVerdict CSimPsyNmeaPositionerStep::doTestStepPreambleL() |
|
79 /** |
|
80 * @return - TVerdict code |
|
81 * Override of base class virtual |
|
82 */ |
|
83 { |
|
84 // uncomment the following 3 lines if you have common pre setting to all the test steps in there |
|
85 CTe_LbsSimulationPSYSuiteStepBase::doTestStepPreambleL(); |
|
86 // if (TestStepResult()!=EPass) |
|
87 // return TestStepResult(); |
|
88 // process some pre setting to this test step then set SetTestStepResult to EFail or Epass. |
|
89 SetTestStepResult(EPass); |
|
90 TTime time; |
|
91 time.UniversalTime(); |
|
92 iSeed = time.Int64(); |
|
93 iFileReader = CPosFileReader::NewL(); |
|
94 return TestStepResult(); |
|
95 } |
|
96 |
|
97 |
|
98 TVerdict CSimPsyNmeaPositionerStep::doTestStepL() |
|
99 /** |
|
100 * @return - TVerdict code |
|
101 * Override of base class pure virtual |
|
102 * Our implementation only gets called if the base class doTestStepPreambleL() did |
|
103 * not leave. That being the case, the current test result value will be EPass. |
|
104 */ |
|
105 { |
|
106 if (TestStepResult()==EPass) |
|
107 { |
|
108 TInt test; |
|
109 if(!GetIntFromConfig(ConfigSection(),KTe_LbsSimulationPSYSuiteInt,test) |
|
110 ) |
|
111 { |
|
112 // Leave if there's any error. |
|
113 User::Leave(KErrNotFound); |
|
114 } |
|
115 SetTestStepResult(EPass); |
|
116 StartL(test); |
|
117 } |
|
118 return TestStepResult(); |
|
119 } |
|
120 |
|
121 |
|
122 |
|
123 TVerdict CSimPsyNmeaPositionerStep::doTestStepPostambleL() |
|
124 /** |
|
125 * @return - TVerdict code |
|
126 * Override of base class virtual |
|
127 */ |
|
128 { |
|
129 // process something post setting to the test step |
|
130 // uncomment the following line if you have common post setting to all the test steps in there |
|
131 // CTe_LbsSimulationPSYSuiteStepBase::doTestStepPostambleL(); |
|
132 // uncomment the following line if you have post process or remove the following line if no post process |
|
133 // SetTestStepResult(EPass); // or EFail |
|
134 return TestStepResult(); |
|
135 } |
|
136 |
|
137 |
|
138 // ================= MEMBER FUNCTIONS ======================= |
|
139 |
|
140 |
|
141 // --------------------------------------------------------- |
|
142 // CSimPsyNmeaPositionerStep::FixSettingsForSimPSY |
|
143 // (other items were commented in a header). |
|
144 // --------------------------------------------------------- |
|
145 // |
|
146 void CSimPsyNmeaPositionerStep::FixSettingsForSimPSY(const TDesC& aFileName) |
|
147 { |
|
148 // Third version of settings simulation psy file |
|
149 TFileName fileName = aFileName; |
|
150 CRepository* repository = CRepository::NewLC(KCRUidSimulationPSY); |
|
151 User::LeaveIfError(repository->Set(KCRKeySimPSYSimulationFile, fileName)); |
|
152 CleanupStack::PopAndDestroy(repository); |
|
153 } |
|
154 |
|
155 |
|
156 // --------------------------------------------------------- |
|
157 // CSimPsyNmeaPositionerStep::StartL |
|
158 // (other items were commented in a header). |
|
159 // --------------------------------------------------------- |
|
160 // |
|
161 void CSimPsyNmeaPositionerStep::StartL(TInt aIndex) |
|
162 { |
|
163 switch (aIndex) |
|
164 { |
|
165 case 0: |
|
166 _LIT(KSingleNmeaRequestTest, "**** Single nmea request test ****"); |
|
167 INFO_PRINTF1(KSingleNmeaRequestTest); |
|
168 FixSettingsForSimPSY(KNmeaFile); |
|
169 //TestSingleNmeaRequestL(); |
|
170 HeapTestL(aIndex); |
|
171 break; |
|
172 case 1: |
|
173 _LIT(KSingleNmeaCancelTest, "**** Single nmea cancel test ****"); |
|
174 INFO_PRINTF1(KSingleNmeaCancelTest); |
|
175 FixSettingsForSimPSY(KNmeaFile); |
|
176 CancelSingleNmeaRequestL(); |
|
177 break; |
|
178 case 2: |
|
179 _LIT(KMultCancelTest, "**** Multiple cancel test 1 ****"); |
|
180 INFO_PRINTF1(KMultCancelTest); |
|
181 FixSettingsForSimPSY(KNmeaFile); |
|
182 TestMultipleNmeaCancelTestL(EFalse, EFalse, ETrue); |
|
183 break; |
|
184 case 3: |
|
185 _LIT(KMultCancelTest2, "**** Multiple cancel test 2 ****"); |
|
186 INFO_PRINTF1(KMultCancelTest2); |
|
187 FixSettingsForSimPSY(KNmeaFile); |
|
188 TestMultipleNmeaCancelTestL(ETrue, EFalse, ETrue); |
|
189 break; |
|
190 case 4: |
|
191 _LIT(KMultCancelTest3, "**** Multiple cancel test 3 ****"); |
|
192 INFO_PRINTF1(KMultCancelTest3); |
|
193 FixSettingsForSimPSY(KNmeaFile); |
|
194 TestMultipleNmeaCancelTestL(ETrue, ETrue, ETrue); |
|
195 break; |
|
196 case 5: |
|
197 _LIT(KMultipleRequestsMemoryTestName, "**** Multiple req memory leak test ****"); |
|
198 INFO_PRINTF1(KMultipleRequestsMemoryTestName); |
|
199 FixSettingsForSimPSY(KNmeaFile); |
|
200 //TestMultipleRequestsL(10); |
|
201 HeapTestL(aIndex); |
|
202 break; |
|
203 case 6: |
|
204 _LIT(KMultipleRequestsAndCancelMemoryTestName, "**** Multiple req and cancel memory leak test ****"); |
|
205 INFO_PRINTF1(KMultipleRequestsAndCancelMemoryTestName); |
|
206 FixSettingsForSimPSY(KNmeaFile); |
|
207 TestMultipleRequestsAndCancelL(5, EFalse, ETrue, EFalse); |
|
208 break; |
|
209 case 7: |
|
210 _LIT(KRequestNmeaData, "**** Request Nmea data ****"); |
|
211 INFO_PRINTF1(KRequestNmeaData); |
|
212 FixSettingsForSimPSY(KNmeaFile); |
|
213 //TestRequestNmeaDataL(); |
|
214 HeapTestL(aIndex); |
|
215 break; |
|
216 case 8: |
|
217 _LIT(KReadUntilEof, "**** Read until eof ****"); |
|
218 INFO_PRINTF1(KReadUntilEof); |
|
219 //TestReadUntilEofL(); |
|
220 HeapTestL(aIndex); |
|
221 break; |
|
222 case 9: |
|
223 _LIT(KWrongPsyMode, "**** Unknown PSY mode ****"); |
|
224 INFO_PRINTF1(KWrongPsyMode); |
|
225 TestWrongSimModeL(); |
|
226 break; |
|
227 case 10: |
|
228 _LIT(KRequestCourseInfo, "**** Request course info ****"); |
|
229 INFO_PRINTF1(KRequestCourseInfo); |
|
230 TestRequestCourseInfoL(); |
|
231 break; |
|
232 case 11: |
|
233 _LIT(KRequestSatelliteInfo, "**** Request satellite info ****"); |
|
234 INFO_PRINTF1(KRequestSatelliteInfo); |
|
235 TestRequestSatelliteInfoL(); |
|
236 break; |
|
237 case 12: |
|
238 _LIT(KRequestGenericInfo, "**** Request generic info ****"); |
|
239 INFO_PRINTF1(KRequestGenericInfo); |
|
240 //TestRequestGenericInfoL(); |
|
241 HeapTestL(aIndex); |
|
242 break; |
|
243 case 13: |
|
244 _LIT(KRequestBasicInfo, "**** Request basic info ****"); |
|
245 INFO_PRINTF1(KRequestBasicInfo); |
|
246 TestRequestBasicInfoL(); |
|
247 break; |
|
248 case 14: |
|
249 _LIT(KRequestMagellan, "**** Request Magellan ****"); |
|
250 INFO_PRINTF1(KRequestMagellan); |
|
251 TestRequestMagellanL(); |
|
252 break; |
|
253 case 15: |
|
254 _LIT(KRequestPartialGenericInfo, "**** Request partial generic info ****"); |
|
255 INFO_PRINTF1(KRequestPartialGenericInfo); |
|
256 TestRequestPartialGenericInfoL(); |
|
257 break; |
|
258 case 16: |
|
259 _LIT(KRequestClearAndSetDefaultPositionData, "**** Test Clear Position Data ****"); |
|
260 INFO_PRINTF1(KRequestClearAndSetDefaultPositionData); |
|
261 //TestClearAndSetDefaultPositionDataL(); |
|
262 HeapTestL(aIndex); |
|
263 break; |
|
264 case 17: |
|
265 _LIT(KTestPartialUpdate, "**** Test Partial Update ****"); |
|
266 INFO_PRINTF1(KTestPartialUpdate); |
|
267 TestPartialUpdateL(); |
|
268 break; |
|
269 case 18: |
|
270 _LIT(KTestErrorSituations, "**** Test wrong situations ****"); |
|
271 INFO_PRINTF1(KTestErrorSituations); |
|
272 TestErrorSituationsL(); |
|
273 break; |
|
274 case 19: |
|
275 _LIT(KTestSpecialCase, "**** Test Special Case ****"); |
|
276 INFO_PRINTF1(KTestSpecialCase); |
|
277 TestSpecialCasesL(); |
|
278 break; |
|
279 |
|
280 // Not a real test only a helper method for printing checksums |
|
281 default: |
|
282 break; |
|
283 } |
|
284 } |
|
285 |
|
286 void CSimPsyNmeaPositionerStep::DoTestL(TInt aIndex) |
|
287 { |
|
288 switch (aIndex) |
|
289 { |
|
290 case 0: TestSingleNmeaRequestL(); break; |
|
291 case 1: CancelSingleNmeaRequestL(); break; |
|
292 case 2: TestMultipleNmeaCancelTestL(EFalse, EFalse, ETrue); break; |
|
293 case 3: TestMultipleNmeaCancelTestL(ETrue, EFalse, ETrue); break; |
|
294 case 4: TestMultipleNmeaCancelTestL(ETrue, ETrue, ETrue); break; |
|
295 case 5: TestMultipleRequestsL(10); break; |
|
296 case 6: TestMultipleRequestsAndCancelL(5, EFalse, ETrue, EFalse); break; |
|
297 case 7: TestRequestNmeaDataL(); break; |
|
298 case 8: TestReadUntilEofL(); break; |
|
299 case 9: TestWrongSimModeL(); break; |
|
300 case 10: TestRequestCourseInfoL(); break; |
|
301 case 11: TestRequestSatelliteInfoL(); break; |
|
302 case 12: TestRequestGenericInfoL(); break; |
|
303 case 13: TestRequestBasicInfoL(); break; |
|
304 case 14: TestRequestMagellanL(); break; |
|
305 case 15: TestRequestPartialGenericInfoL(); break; |
|
306 case 16: TestClearAndSetDefaultPositionDataL(); break; |
|
307 case 17: TestPartialUpdateL(); break; |
|
308 case 18: TestErrorSituationsL(); break; |
|
309 case 19: TestSpecialCasesL(); break; |
|
310 |
|
311 // Not a real test only a helper method for printing checksums |
|
312 default: break; |
|
313 } |
|
314 } |
|
315 |
|
316 // --------------------------------------------------------- |
|
317 // CSimPsyNmeaPositionerStep::TestSingleNmeaRequestL |
|
318 // (other items were commented in a header). |
|
319 // --------------------------------------------------------- |
|
320 // |
|
321 void CSimPsyNmeaPositionerStep::TestSingleNmeaRequestL() |
|
322 { |
|
323 CSimPsyMultiNmeaPosRequester* requester = CSimPsyMultiNmeaPosRequester::NewLC(); |
|
324 |
|
325 TInt status; |
|
326 TTimeIntervalMicroSeconds requestTime; |
|
327 |
|
328 for (TInt i = 0; i < 5; i++) |
|
329 { |
|
330 if (i <= 2) |
|
331 { |
|
332 TPositionInfo position = TPositionInfo(); |
|
333 requester->MakeRequests(&position); |
|
334 requester->GetResult(status, requestTime); |
|
335 CheckRequestResultL(status, position); |
|
336 |
|
337 if (!&position) |
|
338 { |
|
339 User::Leave(KErrGeneral); |
|
340 } |
|
341 TPosition pos; |
|
342 position.GetPosition(pos); |
|
343 TTime time = pos.Time(); |
|
344 TDateTime dtime = time.DateTime(); |
|
345 if (pos.Latitude() < 0 || pos.Longitude() < 0 || dtime.Year() < 2000) |
|
346 { |
|
347 User::Leave(KErrGeneral); |
|
348 } |
|
349 } |
|
350 else |
|
351 { |
|
352 HPositionGenericInfo* genposition = HPositionGenericInfo::NewLC(); |
|
353 User::LeaveIfError(genposition->SetRequestedField(EPositionFieldNMEASentences)); |
|
354 requester->MakeRequests(genposition); |
|
355 requester->GetResult(status, requestTime); |
|
356 CheckRequestResultL(status, *genposition); |
|
357 if (!&genposition && status == KErrNone) |
|
358 { |
|
359 User::Leave(KErrGeneral); |
|
360 } |
|
361 TPosition genpos; |
|
362 genposition->GetPosition(genpos); |
|
363 TTime time = genpos.Time(); |
|
364 TDateTime dtime = time.DateTime(); |
|
365 if (genpos.Latitude() < 0 || genpos.Longitude() < 0 || dtime.Year() < 2000) |
|
366 { |
|
367 User::Leave(KErrGeneral); |
|
368 } |
|
369 |
|
370 // Check that the burst starts with the same sentence all the time. |
|
371 // In the nmea test file, the first burst will be GLL. |
|
372 _LIT8(KExpectedFirstSentence, "$GPGLL"); |
|
373 TPtrC8 firstNmeaString(NULL, 0); |
|
374 User::LeaveIfError(genposition->GetValue(EPositionFieldNMEASentencesStart, firstNmeaString)); |
|
375 if (firstNmeaString.Left(6).Compare(KExpectedFirstSentence) != 0) |
|
376 { |
|
377 _LIT(KError, "Expected GPGLL sentence at the beginning of the burst"); |
|
378 LogErrorAndFail(KError); |
|
379 } |
|
380 |
|
381 CleanupStack::PopAndDestroy(genposition); |
|
382 } |
|
383 } |
|
384 |
|
385 CleanupStack::PopAndDestroy(); // requester |
|
386 _LIT(KSingleNmeaRequestTest, "Ended: **** Single nmea request test ****"); |
|
387 INFO_PRINTF1(KSingleNmeaRequestTest); |
|
388 } |
|
389 |
|
390 // --------------------------------------------------------- |
|
391 // CSimPsyNmeaPositionerStep::CancelSingleNmeaRequestL |
|
392 // (other items were commented in a header). |
|
393 // --------------------------------------------------------- |
|
394 // |
|
395 void CSimPsyNmeaPositionerStep::CancelSingleNmeaRequestL() |
|
396 { |
|
397 CSimPsyMultiNmeaPosRequester* requester = CSimPsyMultiNmeaPosRequester::NewLC(); |
|
398 requester->SetRequesterWillCancelL(); |
|
399 |
|
400 TPositionInfo position = TPositionInfo(); |
|
401 TInt status; |
|
402 TTimeIntervalMicroSeconds requestTime; |
|
403 |
|
404 requester->StopRequests(); |
|
405 requester->MakeRequests(&position); |
|
406 requester->GetResult(status, requestTime); |
|
407 |
|
408 if (status != KErrCancel) |
|
409 { |
|
410 _LIT(KReqWasNotCancelled, "The request was not cancelled"); |
|
411 LogErrorAndFail(KReqWasNotCancelled); |
|
412 } |
|
413 |
|
414 CleanupStack::PopAndDestroy(requester); // requester |
|
415 _LIT(KSingleNmeaCancelTest, "Ended: **** Single nmea cancel test ****"); |
|
416 INFO_PRINTF1(KSingleNmeaCancelTest); |
|
417 } |
|
418 |
|
419 // --------------------------------------------------------- |
|
420 // CSimPsyNmeaPositionerStep::TestMultipleNmeaCancelTestL |
|
421 // (other items were commented in a header). |
|
422 // --------------------------------------------------------- |
|
423 // |
|
424 void CSimPsyNmeaPositionerStep::TestMultipleNmeaCancelTestL( |
|
425 TBool aFirstWillCancel, |
|
426 TBool aSecondWillCancel, |
|
427 TBool aThirdWillCancel) |
|
428 { |
|
429 CSimPsyMultiNmeaPosRequester* requester = CSimPsyMultiNmeaPosRequester::NewLC(3); |
|
430 if (aFirstWillCancel) |
|
431 { |
|
432 requester->SetRequesterWillCancelL(0); |
|
433 } |
|
434 if (aSecondWillCancel) |
|
435 { |
|
436 requester->SetRequesterWillCancelL(1); |
|
437 } |
|
438 if (aThirdWillCancel) |
|
439 { |
|
440 requester->SetRequesterWillCancelL(2); |
|
441 } |
|
442 |
|
443 TPositionInfo position = TPositionInfo(); |
|
444 TInt status; |
|
445 TTimeIntervalMicroSeconds requestTime; |
|
446 |
|
447 requester->MakeRequests(&position); |
|
448 |
|
449 for (TInt i = 0; i < 3; i++) |
|
450 { |
|
451 requester->GetResult(status, requestTime, i); |
|
452 |
|
453 TBool shouldHaveCancelled = |
|
454 (i == 0) ? aFirstWillCancel |
|
455 : (i == 1) ? aSecondWillCancel |
|
456 : aThirdWillCancel; |
|
457 |
|
458 if (shouldHaveCancelled) |
|
459 { |
|
460 if (status != KErrCancel) |
|
461 { |
|
462 _LIT(KReqWasNotCancelled, "The request was not cancelled"); |
|
463 LogErrorAndFail(KReqWasNotCancelled); |
|
464 } |
|
465 } |
|
466 else |
|
467 { |
|
468 if (status != KErrNone) |
|
469 { |
|
470 _LIT(KReqFailed, "The request failed"); |
|
471 LogErrorAndFail(KReqFailed); |
|
472 } |
|
473 if (!&position) |
|
474 { |
|
475 _LIT(KHasNoPosition, "The request did not return a position"); |
|
476 LogErrorAndFail(KHasNoPosition); |
|
477 } |
|
478 } |
|
479 } |
|
480 |
|
481 CleanupStack::PopAndDestroy(); // requester |
|
482 _LIT(KMultCancelTest, "Ended: **** Multiple cancel test ****"); |
|
483 INFO_PRINTF1(KMultCancelTest); |
|
484 } |
|
485 |
|
486 // --------------------------------------------------------- |
|
487 // CSimPsyNmeaPositionerStep::TestMultipleRequestsL |
|
488 // (other items were commented in a header). |
|
489 // --------------------------------------------------------- |
|
490 // |
|
491 void CSimPsyNmeaPositionerStep::TestMultipleRequestsL(TInt aNumberOfRequests) |
|
492 { |
|
493 CSimPsyMultiNmeaPosRequester* requester = CSimPsyMultiNmeaPosRequester::NewLC(); |
|
494 |
|
495 TInt status; |
|
496 TPositionInfo position = TPositionInfo(); |
|
497 TTimeIntervalMicroSeconds requestTime; |
|
498 for (TInt i = 0; i < aNumberOfRequests; i++) |
|
499 { |
|
500 // RDebug::Print(_L("TestMultipleRequestsL making request")); |
|
501 requester->MakeRequests(&position); |
|
502 requester->GetResult(status, requestTime); |
|
503 CheckRequestResultL(status, position); |
|
504 } |
|
505 CleanupStack::PopAndDestroy(); // requester |
|
506 requester = NULL; |
|
507 _LIT(KMultipleRequestsMemoryTestName, "Ended: **** Multiple req memory leak test ****"); |
|
508 INFO_PRINTF1(KMultipleRequestsMemoryTestName); |
|
509 } |
|
510 |
|
511 // --------------------------------------------------------- |
|
512 // CSimPsyNmeaPositionerStep::TestMultipleRequestsAndCancelL |
|
513 // (other items were commented in a header). |
|
514 // --------------------------------------------------------- |
|
515 // |
|
516 void CSimPsyNmeaPositionerStep::TestMultipleRequestsAndCancelL( |
|
517 TInt aNumberOfRequests, TBool aFirstWillCancel, |
|
518 TBool aSecondWillCancel, TBool aThirdWillCancel) |
|
519 { |
|
520 CSimPsyMultiNmeaPosRequester* requester = CSimPsyMultiNmeaPosRequester::NewLC(3); |
|
521 if (aFirstWillCancel) |
|
522 { |
|
523 requester->SetRequesterWillCancelL(0); |
|
524 } |
|
525 if (aSecondWillCancel) |
|
526 { |
|
527 requester->SetRequesterWillCancelL(1); |
|
528 } |
|
529 if (aThirdWillCancel) |
|
530 { |
|
531 requester->SetRequesterWillCancelL(2); |
|
532 } |
|
533 |
|
534 TPositionInfo position = TPositionInfo(); |
|
535 TInt status; |
|
536 TTimeIntervalMicroSeconds requestTime; |
|
537 |
|
538 for (TInt i = 0; i < aNumberOfRequests; i++) |
|
539 { |
|
540 requester->MakeRequests(&position); |
|
541 |
|
542 for (TInt j = 0; j < 3; j++) |
|
543 { |
|
544 requester->GetResult(status, requestTime, j); |
|
545 if (status == KErrNoMemory) |
|
546 { |
|
547 User::Leave(status); |
|
548 } |
|
549 } |
|
550 } |
|
551 CleanupStack::PopAndDestroy(); // requester |
|
552 _LIT(KMultipleRequestsAndCancelMemoryTestName, "Ended: **** Multiple req and cancel memory leak test ****"); |
|
553 INFO_PRINTF1(KMultipleRequestsAndCancelMemoryTestName); |
|
554 } |
|
555 |
|
556 // --------------------------------------------------------- |
|
557 // CSimPsyNmeaPositionerStep::TestRequestNmeaDataL |
|
558 // (other items were commented in a header). |
|
559 // --------------------------------------------------------- |
|
560 // |
|
561 void CSimPsyNmeaPositionerStep::TestRequestNmeaDataL() |
|
562 { |
|
563 CSimPsyMultiNmeaPosRequester* req = CSimPsyMultiNmeaPosRequester::NewLC(); |
|
564 |
|
565 TInt status; |
|
566 TTimeIntervalMicroSeconds requestTime; |
|
567 for (TInt i = 0; i < 3; i++) |
|
568 { |
|
569 HPositionGenericInfo* position = HPositionGenericInfo::NewLC(); |
|
570 TReal32 trueCourse = TReal32(30.00); |
|
571 TInt err = position->SetValue(EPositionFieldTrueCourse, trueCourse); |
|
572 |
|
573 position->SetRequestedField(EPositionFieldNMEASentences); |
|
574 req->MakeRequests(position); |
|
575 req->GetResult(status, requestTime); |
|
576 |
|
577 err = position->GetValue(EPositionFieldTrueCourse, trueCourse); |
|
578 if (err != KErrNotFound) |
|
579 { |
|
580 User::Leave(KErrGeneral); |
|
581 } |
|
582 CheckRequestResultL(status, *position); |
|
583 |
|
584 if (status != KErrNone) |
|
585 { |
|
586 User::Leave(KErrGeneral); |
|
587 } |
|
588 TUint8 sentences; |
|
589 err = position->GetValue(EPositionFieldNMEASentences, sentences); |
|
590 User::LeaveIfError(err); |
|
591 if (sentences <= 0) |
|
592 { |
|
593 User::Leave(KErrGeneral); |
|
594 } |
|
595 |
|
596 TUint8 upper; |
|
597 TUint16 sent = static_cast<TUint16> (EPositionFieldNMEASentencesStart+sentences); |
|
598 err = position->GetValue(sent, upper); |
|
599 if (err != KErrNotFound) |
|
600 { |
|
601 User::Leave(KErrGeneral); |
|
602 } |
|
603 |
|
604 TBuf8<200> buf; |
|
605 for (TInt j = 0; j < sentences; j++) |
|
606 { |
|
607 TUint16 sentnr = static_cast<TUint16> (EPositionFieldNMEASentencesStart+j); |
|
608 err = position->GetValue(sentnr, buf); |
|
609 User::LeaveIfError(err); |
|
610 if (buf.Compare(KNullDesC8) == 0) |
|
611 { |
|
612 User::Leave(KErrGeneral); |
|
613 } |
|
614 } |
|
615 TBool mustbetrue = position->IsFieldAvailable(EPositionFieldNMEASentences); |
|
616 if (!mustbetrue) |
|
617 { |
|
618 User::Leave(KErrGeneral); |
|
619 } |
|
620 CleanupStack::PopAndDestroy(position); |
|
621 } |
|
622 CleanupStack::PopAndDestroy(req); // requester |
|
623 _LIT(KRequestNmeaData, "Ended: **** Request Nmea data ****"); |
|
624 INFO_PRINTF1(KRequestNmeaData); |
|
625 } |
|
626 |
|
627 // --------------------------------------------------------- |
|
628 // CSimPsyNmeaPositionerStep::TestReadUntilEofL |
|
629 // (other items were commented in a header). |
|
630 // --------------------------------------------------------- |
|
631 // |
|
632 void CSimPsyNmeaPositionerStep::TestReadUntilEofL() |
|
633 { |
|
634 FixSettingsForSimPSY(KNmeaShortFile); |
|
635 CSimPsyMultiNmeaPosRequester* requester = CSimPsyMultiNmeaPosRequester::NewLC(); |
|
636 |
|
637 TInt status; |
|
638 TTimeIntervalMicroSeconds requestTime; |
|
639 |
|
640 // TPositionInfo position = TPositionInfo(); |
|
641 HPositionGenericInfo* position = HPositionGenericInfo::NewLC(); |
|
642 for (TInt i = 0; i < 3; i++) |
|
643 { |
|
644 requester->MakeRequests(position); |
|
645 requester->GetResult(status, requestTime); |
|
646 if (status == KErrNoMemory) |
|
647 { |
|
648 User::Leave(status); |
|
649 } |
|
650 else if (status != KErrNotSupported) |
|
651 { |
|
652 User::Leave(KErrGeneral); |
|
653 } |
|
654 } |
|
655 CleanupStack::PopAndDestroy(2, requester); // position |
|
656 _LIT(KReadUntilEof, "Ended: **** Read until eof ****"); |
|
657 INFO_PRINTF1(KReadUntilEof); |
|
658 } |
|
659 |
|
660 |
|
661 // --------------------------------------------------------- |
|
662 // CSimPsyNmeaPositionerStep::TestWrongSimModeL |
|
663 // (other items were commented in a header). |
|
664 // --------------------------------------------------------- |
|
665 // |
|
666 void CSimPsyNmeaPositionerStep::TestWrongSimModeL() |
|
667 { |
|
668 FixSettingsForSimPSY(KWrongFileType); |
|
669 CSimPsyMultiNmeaPosRequester* req = NULL; |
|
670 TRAPD(err, req = CSimPsyMultiNmeaPosRequester::NewLC()); |
|
671 |
|
672 if ((err != KErrNotSupported) || (req!= NULL)) |
|
673 { |
|
674 User::Leave(KErrGeneral); |
|
675 } |
|
676 _LIT(KWrongPsyMode, "Ended: **** Unknown PSY mode ****"); |
|
677 INFO_PRINTF1(KWrongPsyMode); |
|
678 } |
|
679 |
|
680 |
|
681 // --------------------------------------------------------- |
|
682 // CSimPsyNmeaPositionerStep::TestRequestCourseInfoL |
|
683 // (other items were commented in a header). |
|
684 // --------------------------------------------------------- |
|
685 // |
|
686 void CSimPsyNmeaPositionerStep::TestRequestCourseInfoL() |
|
687 { |
|
688 // correct NMEA file |
|
689 FixSettingsForSimPSY(KNmeaSatelliteFile); |
|
690 |
|
691 const TInt KNORequests = 3; |
|
692 CSimPsyMultiNmeaPosRequester* req = CSimPsyMultiNmeaPosRequester::NewLC(); |
|
693 |
|
694 TInt status; |
|
695 TTimeIntervalMicroSeconds requestTime; |
|
696 |
|
697 //expected values for course info parsed from nmea.nme |
|
698 const TReal32 KKnotsToMetrePerSecFactor = 1.852F / 3.6F; |
|
699 const TReal32 KExpectedCourse = 360.0F; |
|
700 const TReal32 KExpectedSpeed = KKnotsToMetrePerSecFactor * 0.0F; |
|
701 |
|
702 for (TInt i = 0; i < KNORequests; i++) |
|
703 { |
|
704 TPositionCourseInfo position = TPositionCourseInfo(); |
|
705 |
|
706 req->MakeRequests(&position); |
|
707 req->GetResult(status, requestTime); |
|
708 |
|
709 CheckRequestResultL(status, position); |
|
710 |
|
711 // check data from returned course-info object |
|
712 TCourse course; |
|
713 position.GetCourse(course); |
|
714 |
|
715 if (course.Speed() != KExpectedSpeed) |
|
716 { |
|
717 User::Leave(KErrGeneral); |
|
718 } |
|
719 if (course.Heading() != KExpectedCourse) |
|
720 { |
|
721 User::Leave(KErrGeneral); |
|
722 } |
|
723 } |
|
724 CleanupStack::PopAndDestroy(req); // requester |
|
725 _LIT(KRequestCourseInfo, "Ended: **** Request course info ****"); |
|
726 INFO_PRINTF1(KRequestCourseInfo); |
|
727 } |
|
728 |
|
729 |
|
730 // --------------------------------------------------------- |
|
731 // CSimPsyNmeaPositionerStep::TestRequestSatelliteInfoL |
|
732 // (other items were commented in a header). |
|
733 // --------------------------------------------------------- |
|
734 // |
|
735 void CSimPsyNmeaPositionerStep::TestRequestSatelliteInfoL() |
|
736 { |
|
737 // correct NMEA file |
|
738 FixSettingsForSimPSY(KNmeaSatelliteFile); |
|
739 |
|
740 const TInt KNORequests = 3; |
|
741 CSimPsyMultiNmeaPosRequester* req = CSimPsyMultiNmeaPosRequester::NewLC(); |
|
742 |
|
743 TInt status; |
|
744 TTimeIntervalMicroSeconds requestTime; |
|
745 |
|
746 // expected values for satellite info parsed from KNmeaSatelliteFile |
|
747 // RMC |
|
748 const TInt KExpectedYear = 2003; |
|
749 const TMonth KExpectedMonth = EApril; |
|
750 const TInt KExpectedDay = 1; |
|
751 const TInt KExpectedHour = 14; |
|
752 const TInt KExpectedMin[KNORequests] = {18, 19, 19}; |
|
753 const TInt KExpectedSec[KNORequests] = {59, 1, 3}; |
|
754 const TReal32 KKnotsToMetrePerSecFactor = 1.852F / 3.6F; |
|
755 const TReal32 KExpectedCourse = 360.0F; |
|
756 const TReal32 KExpectedSpeed = KKnotsToMetrePerSecFactor * 0.0F; |
|
757 // GSA |
|
758 const TInt KExpectedSatUsed = 6; |
|
759 const TInt KExpectedSatInView = 10; |
|
760 // IDs of satellites used in solution |
|
761 const TInt KExpectedUsedSatId[KExpectedSatUsed] = {7,9,11,18,23,28}; |
|
762 const TReal32 KExpectedHDOP= 2.2F; |
|
763 const TReal32 KExpectedVDOP= 2.7F; |
|
764 // GSV |
|
765 // IDs of satellites in view |
|
766 const TInt KExpectedInViewSatId[KExpectedSatInView] = {7,9,11,18,23,28,3,14,20,31}; |
|
767 const TReal32 KExpectedElevation[KExpectedSatInView] = {2,16,57,8,3,19,10,51,9,30}; |
|
768 const TReal32 KExpectedAzimuth[KNORequests][KExpectedSatInView] = |
|
769 { |
|
770 {331,26,267,66,64,301,179,106,240,196}, |
|
771 {331,26,267,66,64,301,179,105,240,196}, |
|
772 {331,26,267,66,64,301,179,105,240,196} |
|
773 }; |
|
774 |
|
775 const TInt KExpectedSR[KNORequests][KExpectedSatInView] = |
|
776 { |
|
777 {42,47,44,39,38,46,0,33,0,0}, |
|
778 {42,48,44,39,38,45,0,33,0,0}, |
|
779 {42,48,44,39,38,45,0,34,0,0} |
|
780 }; |
|
781 |
|
782 |
|
783 for (TInt i = 0; i < KNORequests; i++) |
|
784 { |
|
785 TPositionSatelliteInfo position = TPositionSatelliteInfo(); |
|
786 |
|
787 req->MakeRequests(&position); |
|
788 req->GetResult(status, requestTime); |
|
789 |
|
790 CheckRequestResultL(status, position); |
|
791 |
|
792 // check data from returned satellite-info object... |
|
793 // from RMC |
|
794 TTime sattime = position.SatelliteTime(); |
|
795 TDateTime dtime = sattime.DateTime(); |
|
796 TInt year = dtime.Year(); |
|
797 TMonth month = dtime.Month(); |
|
798 TInt day = dtime.Day(); |
|
799 TInt hour = dtime.Hour(); |
|
800 TInt min = dtime.Minute(); |
|
801 TInt sec = dtime.Second(); |
|
802 |
|
803 if (year != KExpectedYear) |
|
804 { |
|
805 User::Leave(KErrGeneral); |
|
806 } |
|
807 if (month != KExpectedMonth) |
|
808 { |
|
809 User::Leave(KErrGeneral); |
|
810 } |
|
811 if (day != KExpectedDay) |
|
812 { |
|
813 User::Leave(KErrGeneral); |
|
814 } |
|
815 if (hour != KExpectedHour) |
|
816 { |
|
817 User::Leave(KErrGeneral); |
|
818 } |
|
819 if (min != KExpectedMin[i]) |
|
820 { |
|
821 User::Leave(KErrGeneral); |
|
822 } |
|
823 if (sec != KExpectedSec[i]) |
|
824 { |
|
825 User::Leave(KErrGeneral); |
|
826 } |
|
827 |
|
828 TCourse course; |
|
829 position.GetCourse(course); |
|
830 |
|
831 if (course.Speed() != KExpectedSpeed) |
|
832 { |
|
833 User::Leave(KErrGeneral); |
|
834 } |
|
835 if (course.Heading() != KExpectedCourse) |
|
836 { |
|
837 User::Leave(KErrGeneral); |
|
838 } |
|
839 |
|
840 // from GSA |
|
841 TInt satused = position.NumSatellitesUsed(); |
|
842 TInt satinview = position.NumSatellitesInView(); |
|
843 if (satused != KExpectedSatUsed) |
|
844 { |
|
845 User::Leave(KErrGeneral); |
|
846 } |
|
847 if (satinview != KExpectedSatInView) |
|
848 { |
|
849 User::Leave(KErrGeneral); |
|
850 } |
|
851 |
|
852 TSatelliteData satdata; |
|
853 TInt k = 0; |
|
854 TInt j; |
|
855 for (j = 0; j < satinview; j++) |
|
856 { |
|
857 TInt err = position.GetSatelliteData(j, satdata); |
|
858 if (err != KErrNone) |
|
859 { |
|
860 User::Leave(KErrGeneral); |
|
861 } |
|
862 if (satdata.SatelliteId() == KExpectedUsedSatId[k] && satdata.IsUsed()) |
|
863 { |
|
864 k++; |
|
865 } |
|
866 } |
|
867 if (k != satused) |
|
868 { |
|
869 User::Leave(KErrGeneral); // correct n.o Ids used for fix NOT present |
|
870 } |
|
871 |
|
872 if (position.HorizontalDoP() != KExpectedHDOP) |
|
873 { |
|
874 User::Leave(KErrGeneral); |
|
875 } |
|
876 if (position.VerticalDoP() != KExpectedVDOP) |
|
877 { |
|
878 User::Leave(KErrGeneral); |
|
879 } |
|
880 |
|
881 // from GSV |
|
882 for (j = 0; j < satinview; j++) |
|
883 { |
|
884 TInt err = position.GetSatelliteData(j, satdata); |
|
885 if (err != KErrNone) |
|
886 { |
|
887 User::Leave(KErrGeneral); |
|
888 } |
|
889 if (satdata.SatelliteId() != KExpectedInViewSatId[j]) |
|
890 { |
|
891 User::Leave(KErrGeneral); |
|
892 } |
|
893 if (satdata.Azimuth() != KExpectedAzimuth[i][j]) |
|
894 { |
|
895 User::Leave(KErrGeneral); |
|
896 } |
|
897 if (satdata.Elevation() != KExpectedElevation[j]) |
|
898 { |
|
899 User::Leave(KErrGeneral); |
|
900 } |
|
901 if (satdata.SignalStrength() != KExpectedSR[i][j]) |
|
902 { |
|
903 User::Leave(KErrGeneral); |
|
904 } |
|
905 } |
|
906 } |
|
907 CleanupStack::PopAndDestroy(req); // requester |
|
908 _LIT(KRequestSatelliteInfo, "Ended: **** Request satellite info ****"); |
|
909 INFO_PRINTF1(KRequestSatelliteInfo); |
|
910 } |
|
911 |
|
912 |
|
913 // --------------------------------------------------------- |
|
914 // CSimPsyNmeaPositionerStep::TestRequestGenericInfoL |
|
915 // (other items were commented in a header). |
|
916 // --------------------------------------------------------- |
|
917 // |
|
918 void CSimPsyNmeaPositionerStep::TestRequestGenericInfoL() |
|
919 { |
|
920 // correct NMEA file |
|
921 FixSettingsForSimPSY(KNmeaSatelliteFile); |
|
922 |
|
923 const TInt KNORequests = 3; |
|
924 CSimPsyMultiNmeaPosRequester* req = CSimPsyMultiNmeaPosRequester::NewLC(); |
|
925 |
|
926 TInt status; |
|
927 TTimeIntervalMicroSeconds requestTime; |
|
928 |
|
929 // expected values for satellite info parsed from nmea.nme |
|
930 // GGA |
|
931 const TReal32 KExpectedWGS84Alt[KNORequests] = |
|
932 {169.5F, 169.8F, 169.6F}; |
|
933 const TReal32 KExpectedGeodialSep = 20.7F; |
|
934 // RMC |
|
935 const TInt KExpectedYear = 2003; |
|
936 const TMonth KExpectedMonth = EApril; |
|
937 const TInt KExpectedDay = 1; |
|
938 const TInt KExpectedHour = 14; |
|
939 const TInt KExpectedMin[KNORequests] = {18, 19, 19}; |
|
940 const TInt KExpectedSec[KNORequests] = {59, 1, 3}; |
|
941 const TReal32 KKnotsToMetrePerSecFactor = 1.852F / 3.6F; |
|
942 const TReal32 KExpectedCourse = 360.0F; |
|
943 const TReal32 KExpectedSpeed = KKnotsToMetrePerSecFactor * 0.0F; |
|
944 const TReal32 KExpectedMagCourse = 354.0F; |
|
945 // GSA |
|
946 const TInt KExpectedSatUsed = 6; |
|
947 const TReal32 KExpectedPDOP= 3.5F; |
|
948 const TReal32 KExpectedHDOP= 2.2F; |
|
949 const TReal32 KExpectedVDOP= 2.7F; |
|
950 // GSV |
|
951 const TInt8 KExpectedSatInView = 10; |
|
952 |
|
953 |
|
954 for (TInt i = 0; i < KNORequests; i++) |
|
955 { |
|
956 HPositionGenericInfo* position = HPositionGenericInfo::NewLC(); |
|
957 |
|
958 // set requested fields.. |
|
959 // GGA |
|
960 position->SetRequestedField(EPositionFieldSatelliteSeaLevelAltitude); |
|
961 position->SetRequestedField(EPositionFieldSatelliteGeoidalSeparation); |
|
962 // RMC |
|
963 position->SetRequestedField(EPositionFieldSatelliteTime); |
|
964 position->SetRequestedField(EPositionFieldTrueCourse); |
|
965 position->SetRequestedField(EPositionFieldHorizontalSpeed); |
|
966 // position->SetRequestedField(EPositionFieldMagneticVariation); |
|
967 position->SetRequestedField(EPositionFieldMagneticCourse); |
|
968 // GSA |
|
969 position->SetRequestedField(EPositionFieldSatelliteNumUsed); |
|
970 position->SetRequestedField(EPositionFieldSatelliteHorizontalDoP); |
|
971 position->SetRequestedField(EPositionFieldSatelliteVerticalDoP); |
|
972 position->SetRequestedField(EPositionFieldSatellitePositionDoP); |
|
973 // GSV |
|
974 position->SetRequestedField(EPositionFieldSatelliteNumInView); |
|
975 |
|
976 req->MakeRequests(position); |
|
977 req->GetResult(status, requestTime); |
|
978 |
|
979 CheckRequestResultL(status, *position); |
|
980 |
|
981 // check data from returned generic-info object... |
|
982 // from GGA |
|
983 TBool mustbetrue = position->IsFieldAvailable(EPositionFieldSatelliteSeaLevelAltitude); |
|
984 if (!mustbetrue) |
|
985 { |
|
986 User::Leave(KErrGeneral); |
|
987 } |
|
988 TReal32 wgs84alt; |
|
989 position->GetValue(EPositionFieldSatelliteSeaLevelAltitude, |
|
990 wgs84alt); |
|
991 if (wgs84alt != KExpectedWGS84Alt[i]) |
|
992 { |
|
993 User::Leave(KErrGeneral); |
|
994 } |
|
995 |
|
996 mustbetrue = position->IsFieldAvailable(EPositionFieldSatelliteGeoidalSeparation); |
|
997 if (!mustbetrue) |
|
998 { |
|
999 User::Leave(KErrGeneral); |
|
1000 } |
|
1001 TReal32 geosep; |
|
1002 position->GetValue(EPositionFieldSatelliteGeoidalSeparation, |
|
1003 geosep); |
|
1004 if (geosep != KExpectedGeodialSep) |
|
1005 { |
|
1006 User::Leave(KErrGeneral); |
|
1007 } |
|
1008 |
|
1009 // from RMC |
|
1010 mustbetrue = position->IsFieldAvailable(EPositionFieldSatelliteTime); |
|
1011 if (!mustbetrue) |
|
1012 { |
|
1013 User::Leave(KErrGeneral); |
|
1014 } |
|
1015 TTime sattime; |
|
1016 position->GetValue(EPositionFieldSatelliteTime, |
|
1017 sattime); |
|
1018 TDateTime dtime = sattime.DateTime(); |
|
1019 TInt year = dtime.Year(); |
|
1020 TMonth month = dtime.Month(); |
|
1021 TInt day = dtime.Day(); |
|
1022 TInt hour = dtime.Hour(); |
|
1023 TInt min = dtime.Minute(); |
|
1024 TInt sec = dtime.Second(); |
|
1025 if (year != KExpectedYear) |
|
1026 { |
|
1027 User::Leave(KErrGeneral); |
|
1028 } |
|
1029 if (month != KExpectedMonth) |
|
1030 { |
|
1031 User::Leave(KErrGeneral); |
|
1032 } |
|
1033 if (day != KExpectedDay) |
|
1034 { |
|
1035 User::Leave(KErrGeneral); |
|
1036 } |
|
1037 if (hour != KExpectedHour) |
|
1038 { |
|
1039 User::Leave(KErrGeneral); |
|
1040 } |
|
1041 if (min != KExpectedMin[i]) |
|
1042 { |
|
1043 User::Leave(KErrGeneral); |
|
1044 } |
|
1045 if (sec != KExpectedSec[i]) |
|
1046 { |
|
1047 User::Leave(KErrGeneral); |
|
1048 } |
|
1049 |
|
1050 mustbetrue = position->IsFieldAvailable(EPositionFieldTrueCourse); |
|
1051 if (!mustbetrue) |
|
1052 { |
|
1053 User::Leave(KErrGeneral); |
|
1054 } |
|
1055 TReal32 trueCourse; |
|
1056 position->GetValue(EPositionFieldTrueCourse, |
|
1057 trueCourse); |
|
1058 if (trueCourse != KExpectedCourse) |
|
1059 { |
|
1060 User::Leave(KErrGeneral); |
|
1061 } |
|
1062 |
|
1063 mustbetrue = position->IsFieldAvailable(EPositionFieldHorizontalSpeed); |
|
1064 if (!mustbetrue) |
|
1065 { |
|
1066 User::Leave(KErrGeneral); |
|
1067 } |
|
1068 TReal32 speed; |
|
1069 position->GetValue(EPositionFieldHorizontalSpeed, |
|
1070 speed); |
|
1071 if (speed != KExpectedSpeed) |
|
1072 { |
|
1073 User::Leave(KErrGeneral); |
|
1074 } |
|
1075 mustbetrue = position->IsFieldAvailable(EPositionFieldMagneticCourse); |
|
1076 if (!mustbetrue) |
|
1077 { |
|
1078 User::Leave(KErrGeneral); |
|
1079 } |
|
1080 // TReal32 magvar; |
|
1081 TReal32 magCourse; |
|
1082 position->GetValue(EPositionFieldMagneticCourse, |
|
1083 magCourse); |
|
1084 if (magCourse != KExpectedMagCourse) |
|
1085 { |
|
1086 User::Leave(KErrGeneral); |
|
1087 } |
|
1088 |
|
1089 // from GSA |
|
1090 mustbetrue = position->IsFieldAvailable(EPositionFieldSatelliteNumUsed); |
|
1091 if (!mustbetrue) |
|
1092 { |
|
1093 User::Leave(KErrGeneral); |
|
1094 } |
|
1095 TInt8 numUsedSatellites; |
|
1096 position->GetValue(EPositionFieldSatelliteNumUsed, |
|
1097 numUsedSatellites); |
|
1098 if (numUsedSatellites != KExpectedSatUsed) |
|
1099 { |
|
1100 User::Leave(KErrGeneral); |
|
1101 } |
|
1102 |
|
1103 mustbetrue = position->IsFieldAvailable(EPositionFieldSatelliteHorizontalDoP); |
|
1104 if (!mustbetrue) |
|
1105 { |
|
1106 User::Leave(KErrGeneral); |
|
1107 } |
|
1108 TReal32 hdop; |
|
1109 position->GetValue(EPositionFieldSatelliteHorizontalDoP, |
|
1110 hdop); |
|
1111 if (hdop != KExpectedHDOP) |
|
1112 { |
|
1113 User::Leave(KErrGeneral); |
|
1114 } |
|
1115 |
|
1116 mustbetrue = position->IsFieldAvailable(EPositionFieldSatelliteVerticalDoP); |
|
1117 if (!mustbetrue) |
|
1118 { |
|
1119 User::Leave(KErrGeneral); |
|
1120 } |
|
1121 TReal32 vdop; |
|
1122 position->GetValue(EPositionFieldSatelliteVerticalDoP, |
|
1123 vdop); |
|
1124 if (vdop != KExpectedVDOP) |
|
1125 { |
|
1126 User::Leave(KErrGeneral); |
|
1127 } |
|
1128 |
|
1129 mustbetrue = position->IsFieldAvailable(EPositionFieldSatellitePositionDoP); |
|
1130 if (!mustbetrue) |
|
1131 { |
|
1132 User::Leave(KErrGeneral); |
|
1133 } |
|
1134 TReal32 pdop; |
|
1135 position->GetValue(EPositionFieldSatellitePositionDoP, |
|
1136 pdop); |
|
1137 if (pdop != KExpectedPDOP) |
|
1138 { |
|
1139 User::Leave(KErrGeneral); |
|
1140 } |
|
1141 |
|
1142 // from GSV |
|
1143 mustbetrue = position->IsFieldAvailable(EPositionFieldSatelliteNumInView); |
|
1144 if (!mustbetrue) |
|
1145 { |
|
1146 User::Leave(KErrGeneral); |
|
1147 } |
|
1148 TInt8 satinview; |
|
1149 position->GetValue(EPositionFieldSatelliteNumInView, |
|
1150 satinview); |
|
1151 if (satinview != KExpectedSatInView) |
|
1152 { |
|
1153 User::Leave(KErrGeneral); |
|
1154 } |
|
1155 |
|
1156 |
|
1157 CleanupStack::PopAndDestroy(position); // position |
|
1158 } |
|
1159 CleanupStack::PopAndDestroy(req); // requester |
|
1160 _LIT(KRequestGenericInfo, "Ended: **** Request generic info ****"); |
|
1161 INFO_PRINTF1(KRequestGenericInfo); |
|
1162 } |
|
1163 |
|
1164 // --------------------------------------------------------- |
|
1165 // CSimPsyNmeaPositionerStep::TestRequestBasicInfoL |
|
1166 // (other items were commented in a header). |
|
1167 // --------------------------------------------------------- |
|
1168 // |
|
1169 void CSimPsyNmeaPositionerStep::TestRequestBasicInfoL() |
|
1170 { |
|
1171 // correct NMEA file |
|
1172 FixSettingsForSimPSY(KNmeaSatelliteFile); |
|
1173 |
|
1174 const TInt KNORequests = 3; |
|
1175 CSimPsyMultiNmeaPosRequester* requester = CSimPsyMultiNmeaPosRequester::NewLC(); |
|
1176 |
|
1177 TInt status; |
|
1178 TTimeIntervalMicroSeconds requestTime; |
|
1179 |
|
1180 // expected values for basic info parsed from nmea.nme |
|
1181 // GGA |
|
1182 const TReal32 KExpectedAlt[KNORequests] = |
|
1183 {169.5F + 20.7F, 169.8F + 20.7F, 169.6F + 20.7F}; |
|
1184 // GSA |
|
1185 const TReal32 KPosUERE = 10.0; |
|
1186 const TReal32 KExpectedHDOP= 2.2F; |
|
1187 const TReal32 KExpectedHAcc = KPosUERE * KExpectedHDOP; |
|
1188 const TReal32 KExpectedVAcc = 1.5F * KPosUERE * KExpectedHDOP; |
|
1189 |
|
1190 for (TInt i = 0; i < KNORequests; i++) |
|
1191 { |
|
1192 TPositionInfo position = TPositionInfo(); |
|
1193 |
|
1194 requester->MakeRequests(&position); |
|
1195 requester->GetResult(status, requestTime); |
|
1196 CheckRequestResultL(status, position); |
|
1197 |
|
1198 if (!&position) |
|
1199 { |
|
1200 User::Leave(KErrGeneral); |
|
1201 } |
|
1202 |
|
1203 TPosition pos; |
|
1204 position.GetPosition(pos); |
|
1205 |
|
1206 TTime time = pos.Time(); |
|
1207 TDateTime dtime = time.DateTime(); |
|
1208 |
|
1209 if (pos.Altitude() != KExpectedAlt[i]) |
|
1210 { |
|
1211 User::Leave(KErrGeneral); |
|
1212 } |
|
1213 TTime now; |
|
1214 now.UniversalTime(); |
|
1215 TInt year = now.DateTime().Year(); |
|
1216 if (dtime.Year() != year) |
|
1217 { |
|
1218 User::Leave(KErrGeneral); |
|
1219 } |
|
1220 |
|
1221 // from GSA |
|
1222 if (pos.HorizontalAccuracy() != KExpectedHAcc) |
|
1223 { |
|
1224 User::Leave(KErrGeneral); |
|
1225 } |
|
1226 if (pos.VerticalAccuracy() != KExpectedVAcc) |
|
1227 { |
|
1228 User::Leave(KErrGeneral); |
|
1229 } |
|
1230 } |
|
1231 CleanupStack::PopAndDestroy(requester); // requester |
|
1232 _LIT(KRequestBasicInfo, "Ended: **** Request basic info ****"); |
|
1233 INFO_PRINTF1(KRequestBasicInfo); |
|
1234 } |
|
1235 |
|
1236 // --------------------------------------------------------- |
|
1237 // CSimPsyNmeaPositionerStep::TestRequestMagellanL |
|
1238 // (other items were commented in a header). |
|
1239 // --------------------------------------------------------- |
|
1240 // |
|
1241 void CSimPsyNmeaPositionerStep::TestRequestMagellanL() |
|
1242 { |
|
1243 // correct NMEA file |
|
1244 FixSettingsForSimPSY(KNmeaMagellanFile); |
|
1245 |
|
1246 const TInt KNORequests = 3; |
|
1247 CSimPsyMultiNmeaPosRequester* req = CSimPsyMultiNmeaPosRequester::NewLC(); |
|
1248 |
|
1249 TInt status; |
|
1250 TTimeIntervalMicroSeconds requestTime; |
|
1251 TRealX nan; |
|
1252 nan.SetNaN(); |
|
1253 |
|
1254 // expected values for satellite info parsed from KNmeaSatelliteFile |
|
1255 // RMC |
|
1256 const TInt KExpectedYear = 2001; |
|
1257 const TMonth KExpectedMonth = EMay; |
|
1258 const TInt KExpectedDay = 14; |
|
1259 const TInt KExpectedHour = 9; |
|
1260 const TInt KExpectedMin[KNORequests] = {24, 24, 24}; |
|
1261 const TInt KExpectedSec[KNORequests] = {38, 40, 42}; |
|
1262 const TInt KExpectedMSec[KNORequests] = {620000, 770000, 50000}; |
|
1263 const TReal32 KKnotsToMetrePerSecFactor = 1.852F / 3.6F; |
|
1264 const TReal32 KExpectedCourse = 0.0F; |
|
1265 const TReal32 KExpectedSpeed = KKnotsToMetrePerSecFactor * 0.0F; |
|
1266 // GSA |
|
1267 const TInt KExpectedSatUsed = 3; |
|
1268 const TInt KExpectedSatInView = 12; |
|
1269 // IDs of satellites used in solution |
|
1270 const TInt KExpectedUsedSatId[KExpectedSatUsed] = {18,15,17}; |
|
1271 const TReal32 KExpectedHDOP= 4.5F; |
|
1272 const TReal32 KExpectedVDOP= nan; |
|
1273 // GSV |
|
1274 // IDs of satellites in view |
|
1275 const TInt KExpectedInViewSatId[KExpectedSatInView] = {18,15,17,3,22,28,26,27,21,6,8,10}; |
|
1276 const TReal32 KExpectedElevation[KExpectedSatInView] = |
|
1277 {40,78,62,48,43,32,18,16,13,10,10,6}; |
|
1278 const TReal32 KExpectedAzimuth[KNORequests][KExpectedSatInView] = |
|
1279 { |
|
1280 {150,143,85,279,224,308,70,332,182,119,356,30}, |
|
1281 {150,143,85,279,224,308,70,332,182,119,356,30}, |
|
1282 {150,143,85,279,224,308,70,332,182,119,356,30} |
|
1283 }; |
|
1284 const TInt KExpectedSR[KNORequests][KExpectedSatInView] = |
|
1285 { |
|
1286 {49,54,53,49,47,46,44,44,0,0,0,0}, |
|
1287 {49,54,53,49,47,46,43,43,0,0,0,0}, |
|
1288 {49,54,53,49,47,46,44,42,0,0,0,0} |
|
1289 }; |
|
1290 |
|
1291 |
|
1292 for (TInt i = 0; i < KNORequests; i++) |
|
1293 { |
|
1294 TPositionSatelliteInfo position = TPositionSatelliteInfo(); |
|
1295 |
|
1296 req->MakeRequests(&position); |
|
1297 req->GetResult(status, requestTime); |
|
1298 |
|
1299 CheckRequestResultL(status, position); |
|
1300 |
|
1301 // check data from returned satellite-info object... |
|
1302 // from RMC |
|
1303 TTime sattime = position.SatelliteTime(); |
|
1304 TDateTime dtime = sattime.DateTime(); |
|
1305 TInt year = dtime.Year(); |
|
1306 TMonth month = dtime.Month(); |
|
1307 TInt day = dtime.Day(); |
|
1308 TInt hour = dtime.Hour(); |
|
1309 TInt min = dtime.Minute(); |
|
1310 TInt sec = dtime.Second(); |
|
1311 TInt msec = dtime.MicroSecond(); |
|
1312 |
|
1313 if (year != KExpectedYear) |
|
1314 { |
|
1315 User::Leave(KErrGeneral); |
|
1316 } |
|
1317 if (month != KExpectedMonth) |
|
1318 { |
|
1319 User::Leave(KErrGeneral); |
|
1320 } |
|
1321 if (day != KExpectedDay) |
|
1322 { |
|
1323 User::Leave(KErrGeneral); |
|
1324 } |
|
1325 if (hour != KExpectedHour) |
|
1326 { |
|
1327 User::Leave(KErrGeneral); |
|
1328 } |
|
1329 if (min != KExpectedMin[i]) |
|
1330 { |
|
1331 User::Leave(KErrGeneral); |
|
1332 } |
|
1333 if (sec != KExpectedSec[i]) |
|
1334 { |
|
1335 User::Leave(KErrGeneral); |
|
1336 } |
|
1337 if (msec != KExpectedMSec[i]) |
|
1338 { |
|
1339 User::Leave(KErrGeneral); |
|
1340 } |
|
1341 |
|
1342 TCourse course; |
|
1343 position.GetCourse(course); |
|
1344 |
|
1345 if (course.Speed() != KExpectedSpeed) |
|
1346 { |
|
1347 User::Leave(KErrGeneral); |
|
1348 } |
|
1349 if (course.Heading() != KExpectedCourse) |
|
1350 { |
|
1351 User::Leave(KErrGeneral); |
|
1352 } |
|
1353 |
|
1354 // from GSA |
|
1355 TInt satused = position.NumSatellitesUsed(); |
|
1356 TInt satinview = position.NumSatellitesInView(); |
|
1357 if (satused != KExpectedSatUsed) |
|
1358 { |
|
1359 User::Leave(KErrGeneral); |
|
1360 } |
|
1361 if (satinview != KExpectedSatInView) |
|
1362 { |
|
1363 User::Leave(KErrGeneral); |
|
1364 } |
|
1365 |
|
1366 TSatelliteData satdata; |
|
1367 TInt k = 0; |
|
1368 TInt j; |
|
1369 for (j = 0; j < satinview; j++) |
|
1370 { |
|
1371 TInt err = position.GetSatelliteData(j, satdata); |
|
1372 if (err != KErrNone) |
|
1373 { |
|
1374 User::Leave(KErrGeneral); |
|
1375 } |
|
1376 if (satdata.SatelliteId() == KExpectedUsedSatId[k] && satdata.IsUsed()) |
|
1377 { |
|
1378 k++; |
|
1379 } |
|
1380 } |
|
1381 if (k != satused) |
|
1382 { |
|
1383 User::Leave(KErrGeneral); // correct n.o Ids used for fix NOT present |
|
1384 } |
|
1385 |
|
1386 if (position.HorizontalDoP() != KExpectedHDOP) |
|
1387 { |
|
1388 User::Leave(KErrGeneral); |
|
1389 } |
|
1390 if (!Math::IsNaN(position.VerticalDoP())) |
|
1391 { |
|
1392 User::Leave(KErrGeneral); |
|
1393 } |
|
1394 |
|
1395 // from GSV |
|
1396 for (j = 0; j < satinview; j++) |
|
1397 { |
|
1398 TInt err = position.GetSatelliteData(j, satdata); |
|
1399 if (err != KErrNone) |
|
1400 { |
|
1401 User::Leave(KErrGeneral); |
|
1402 } |
|
1403 if (satdata.SatelliteId() != KExpectedInViewSatId[j]) |
|
1404 { |
|
1405 User::Leave(KErrGeneral); |
|
1406 } |
|
1407 if (satdata.Azimuth() != KExpectedAzimuth[i][j]) |
|
1408 { |
|
1409 User::Leave(KErrGeneral); |
|
1410 } |
|
1411 if (satdata.Elevation() != KExpectedElevation[j]) |
|
1412 { |
|
1413 User::Leave(KErrGeneral); |
|
1414 } |
|
1415 if (satdata.SignalStrength() != KExpectedSR[i][j]) |
|
1416 { |
|
1417 User::Leave(KErrGeneral); |
|
1418 } |
|
1419 } |
|
1420 } |
|
1421 |
|
1422 CleanupStack::PopAndDestroy(req); // requester |
|
1423 |
|
1424 // correct NMEA file |
|
1425 FixSettingsForSimPSY(KNmeaPdopMissingFile); |
|
1426 |
|
1427 // No pdop value in .nme file |
|
1428 req = CSimPsyMultiNmeaPosRequester::NewLC(); |
|
1429 for (TInt j = 0; j < KNORequests; j++) |
|
1430 { |
|
1431 HPositionGenericInfo* genPos = HPositionGenericInfo::NewL(); |
|
1432 CleanupStack::PushL(genPos); |
|
1433 |
|
1434 // GSA |
|
1435 genPos->SetRequestedField(EPositionFieldSatelliteNumUsed); |
|
1436 genPos->SetRequestedField(EPositionFieldSatelliteHorizontalDoP); |
|
1437 genPos->SetRequestedField(EPositionFieldSatelliteVerticalDoP); |
|
1438 genPos->SetRequestedField(EPositionFieldSatellitePositionDoP); |
|
1439 |
|
1440 req->MakeRequests(genPos); |
|
1441 req->GetResult(status, requestTime); |
|
1442 |
|
1443 CheckRequestResultL(status, *genPos); |
|
1444 |
|
1445 TReal32 vdop; |
|
1446 const TReal32 KExpectedVDOP= 0.9F; |
|
1447 genPos->GetValue(EPositionFieldSatelliteVerticalDoP, vdop); |
|
1448 if (vdop != KExpectedVDOP) |
|
1449 { |
|
1450 User::Leave(KErrGeneral); |
|
1451 } |
|
1452 TReal32 hdop; |
|
1453 const TReal32 KExpectedHDOP= 4.0F; |
|
1454 genPos->GetValue(EPositionFieldSatelliteHorizontalDoP, hdop); |
|
1455 if (hdop != KExpectedHDOP) |
|
1456 { |
|
1457 User::Leave(KErrGeneral); |
|
1458 } |
|
1459 |
|
1460 TReal32 pdop; |
|
1461 TReal expectedPDOP; |
|
1462 TInt err = Math::Sqrt(expectedPDOP, hdop * hdop + vdop * vdop); |
|
1463 User::LeaveIfError(err); |
|
1464 genPos->GetValue(EPositionFieldSatellitePositionDoP, pdop); |
|
1465 TReal32 expectedPDOPreal32 = TReal32(expectedPDOP); |
|
1466 if (TRealX(pdop) != TRealX(expectedPDOPreal32)) |
|
1467 { |
|
1468 User::Leave(KErrGeneral); |
|
1469 } |
|
1470 |
|
1471 CleanupStack::PopAndDestroy(genPos); |
|
1472 } |
|
1473 |
|
1474 CleanupStack::PopAndDestroy(req); // requester |
|
1475 _LIT(KRequestMagellan, "Ended: **** Request Magellan ****"); |
|
1476 INFO_PRINTF1(KRequestMagellan); |
|
1477 } |
|
1478 |
|
1479 // --------------------------------------------------------- |
|
1480 // CSimPsyNmeaPositionerStep::TestRequestPartialGenericInfoL |
|
1481 // (other items were commented in a header). |
|
1482 // --------------------------------------------------------- |
|
1483 // |
|
1484 void CSimPsyNmeaPositionerStep::TestRequestPartialGenericInfoL() |
|
1485 { |
|
1486 // correct NMEA file |
|
1487 FixSettingsForSimPSY(KNmeaSatelliteFile); |
|
1488 |
|
1489 const TInt KNORequests = 3; |
|
1490 CSimPsyMultiNmeaPosRequester* req = CSimPsyMultiNmeaPosRequester::NewLC(); |
|
1491 |
|
1492 TInt status; |
|
1493 TTimeIntervalMicroSeconds requestTime; |
|
1494 |
|
1495 // expected values for satellite info parsed from nmea.nme |
|
1496 // GGA |
|
1497 const TReal32 KExpectedWGS84Alt[KNORequests] = |
|
1498 {169.5F, 169.8F, 169.6F}; |
|
1499 //const TReal32 KExpectedGeodialSep = 20.7F; |
|
1500 // RMC |
|
1501 const TInt KExpectedYear = 2003; |
|
1502 const TMonth KExpectedMonth = EApril; |
|
1503 const TInt KExpectedDay = 1; |
|
1504 const TInt KExpectedHour = 14; |
|
1505 const TInt KExpectedMin[KNORequests] = {18, 19, 19}; |
|
1506 const TInt KExpectedSec[KNORequests] = {59, 1, 3}; |
|
1507 //const TReal32 KKnotsToMetrePerSecFactor = 1.852F / 3.6F; |
|
1508 const TReal32 KExpectedCourse = 360.0F; |
|
1509 //const TReal32 KExpectedSpeed = KKnotsToMetrePerSecFactor * 0.0F; |
|
1510 const TReal32 KExpectedMagCourse = 354.0F; |
|
1511 // GSA |
|
1512 const TInt KExpectedSatUsed = 6; |
|
1513 const TReal32 KExpectedPDOP= 3.5F; |
|
1514 const TReal32 KExpectedHDOP= 2.2F; |
|
1515 //const TReal32 KExpectedVDOP= 2.7F; |
|
1516 // GSV |
|
1517 const TInt8 KExpectedSatInView = 10; |
|
1518 |
|
1519 |
|
1520 for (TInt i = 0; i < KNORequests; i++) |
|
1521 { |
|
1522 HPositionGenericInfo* position = HPositionGenericInfo::NewLC(); |
|
1523 |
|
1524 // set requested fields.. |
|
1525 // GGA |
|
1526 position->SetRequestedField(EPositionFieldSatelliteSeaLevelAltitude); |
|
1527 |
|
1528 // RMC |
|
1529 position->SetRequestedField(EPositionFieldSatelliteTime); |
|
1530 position->SetRequestedField(EPositionFieldTrueCourse); |
|
1531 |
|
1532 position->SetRequestedField(EPositionFieldMagneticCourse); |
|
1533 // GSA |
|
1534 position->SetRequestedField(EPositionFieldSatelliteNumUsed); |
|
1535 position->SetRequestedField(EPositionFieldSatelliteHorizontalDoP); |
|
1536 position->SetRequestedField(EPositionFieldSatellitePositionDoP); |
|
1537 // GSV |
|
1538 position->SetRequestedField(EPositionFieldSatelliteNumInView); |
|
1539 |
|
1540 req->MakeRequests(position); |
|
1541 req->GetResult(status, requestTime); |
|
1542 |
|
1543 CheckRequestResultL(status, *position); |
|
1544 |
|
1545 // check data from returned generic-info object... |
|
1546 // from GGA |
|
1547 TBool mustbetrue = position->IsFieldAvailable(EPositionFieldSatelliteSeaLevelAltitude); |
|
1548 if (!mustbetrue) |
|
1549 { |
|
1550 User::Leave(KErrGeneral); |
|
1551 } |
|
1552 TReal32 wgs84alt; |
|
1553 position->GetValue(EPositionFieldSatelliteSeaLevelAltitude, |
|
1554 wgs84alt); |
|
1555 if (wgs84alt != KExpectedWGS84Alt[i]) |
|
1556 { |
|
1557 User::Leave(KErrGeneral); |
|
1558 } |
|
1559 |
|
1560 mustbetrue = position->IsFieldAvailable(EPositionFieldSatelliteGeoidalSeparation); |
|
1561 if (mustbetrue) |
|
1562 { |
|
1563 User::Leave(KErrGeneral); |
|
1564 } |
|
1565 |
|
1566 // from RMC |
|
1567 mustbetrue = position->IsFieldAvailable(EPositionFieldSatelliteTime); |
|
1568 if (!mustbetrue) |
|
1569 { |
|
1570 User::Leave(KErrGeneral); |
|
1571 } |
|
1572 TTime sattime; |
|
1573 position->GetValue(EPositionFieldSatelliteTime, |
|
1574 sattime); |
|
1575 TDateTime dtime = sattime.DateTime(); |
|
1576 TInt year = dtime.Year(); |
|
1577 TMonth month = dtime.Month(); |
|
1578 TInt day = dtime.Day(); |
|
1579 TInt hour = dtime.Hour(); |
|
1580 TInt min = dtime.Minute(); |
|
1581 TInt sec = dtime.Second(); |
|
1582 if (year != KExpectedYear) |
|
1583 { |
|
1584 User::Leave(KErrGeneral); |
|
1585 } |
|
1586 if (month != KExpectedMonth) |
|
1587 { |
|
1588 User::Leave(KErrGeneral); |
|
1589 } |
|
1590 if (day != KExpectedDay) |
|
1591 { |
|
1592 User::Leave(KErrGeneral); |
|
1593 } |
|
1594 if (hour != KExpectedHour) |
|
1595 { |
|
1596 User::Leave(KErrGeneral); |
|
1597 } |
|
1598 if (min != KExpectedMin[i]) |
|
1599 { |
|
1600 User::Leave(KErrGeneral); |
|
1601 } |
|
1602 if (sec != KExpectedSec[i]) |
|
1603 { |
|
1604 User::Leave(KErrGeneral); |
|
1605 } |
|
1606 |
|
1607 mustbetrue = position->IsFieldAvailable(EPositionFieldTrueCourse); |
|
1608 if (!mustbetrue) |
|
1609 { |
|
1610 User::Leave(KErrGeneral); |
|
1611 } |
|
1612 TReal32 trueCourse; |
|
1613 position->GetValue(EPositionFieldTrueCourse, |
|
1614 trueCourse); |
|
1615 if (trueCourse != KExpectedCourse) |
|
1616 { |
|
1617 User::Leave(KErrGeneral); |
|
1618 } |
|
1619 |
|
1620 mustbetrue = position->IsFieldAvailable(EPositionFieldHorizontalSpeed); |
|
1621 if (mustbetrue) |
|
1622 { |
|
1623 User::Leave(KErrGeneral); |
|
1624 } |
|
1625 |
|
1626 mustbetrue = position->IsFieldAvailable(EPositionFieldMagneticCourse); |
|
1627 if (!mustbetrue) |
|
1628 { |
|
1629 User::Leave(KErrGeneral); |
|
1630 } |
|
1631 TReal32 magCourse; |
|
1632 position->GetValue(EPositionFieldMagneticCourse, |
|
1633 magCourse); |
|
1634 if (magCourse != KExpectedMagCourse) |
|
1635 { |
|
1636 User::Leave(KErrGeneral); |
|
1637 } |
|
1638 |
|
1639 // from GSA |
|
1640 mustbetrue = position->IsFieldAvailable(EPositionFieldSatelliteNumUsed); |
|
1641 if (!mustbetrue) |
|
1642 { |
|
1643 User::Leave(KErrGeneral); |
|
1644 } |
|
1645 TInt8 numUsedSatellites; |
|
1646 position->GetValue(EPositionFieldSatelliteNumUsed, |
|
1647 numUsedSatellites); |
|
1648 if (numUsedSatellites != KExpectedSatUsed) |
|
1649 { |
|
1650 User::Leave(KErrGeneral); |
|
1651 } |
|
1652 |
|
1653 mustbetrue = position->IsFieldAvailable(EPositionFieldSatelliteHorizontalDoP); |
|
1654 if (!mustbetrue) |
|
1655 { |
|
1656 User::Leave(KErrGeneral); |
|
1657 } |
|
1658 TReal32 hdop; |
|
1659 position->GetValue(EPositionFieldSatelliteHorizontalDoP, |
|
1660 hdop); |
|
1661 if (hdop != KExpectedHDOP) |
|
1662 { |
|
1663 User::Leave(KErrGeneral); |
|
1664 } |
|
1665 |
|
1666 mustbetrue = position->IsFieldAvailable(EPositionFieldSatelliteVerticalDoP); |
|
1667 if (mustbetrue) |
|
1668 { |
|
1669 User::Leave(KErrGeneral); |
|
1670 } |
|
1671 |
|
1672 mustbetrue = position->IsFieldAvailable(EPositionFieldSatellitePositionDoP); |
|
1673 if (!mustbetrue) |
|
1674 { |
|
1675 User::Leave(KErrGeneral); |
|
1676 } |
|
1677 TReal32 pdop; |
|
1678 position->GetValue(EPositionFieldSatellitePositionDoP, |
|
1679 pdop); |
|
1680 if (pdop != KExpectedPDOP) |
|
1681 { |
|
1682 User::Leave(KErrGeneral); |
|
1683 } |
|
1684 |
|
1685 // from GSV |
|
1686 mustbetrue = position->IsFieldAvailable(EPositionFieldSatelliteNumInView); |
|
1687 if (!mustbetrue) |
|
1688 { |
|
1689 User::Leave(KErrGeneral); |
|
1690 } |
|
1691 TInt8 satinview; |
|
1692 position->GetValue(EPositionFieldSatelliteNumInView, |
|
1693 satinview); |
|
1694 if (satinview != KExpectedSatInView) |
|
1695 { |
|
1696 User::Leave(KErrGeneral); |
|
1697 } |
|
1698 |
|
1699 |
|
1700 CleanupStack::PopAndDestroy(position); // position |
|
1701 } |
|
1702 CleanupStack::PopAndDestroy(req); // requester |
|
1703 _LIT(KRequestPartialGenericInfo, "Ended: **** Request partial generic info ****"); |
|
1704 INFO_PRINTF1(KRequestPartialGenericInfo); |
|
1705 } |
|
1706 |
|
1707 // --------------------------------------------------------- |
|
1708 // CSimPsyNmeaPositionerStep::TestClearAndSetDefaultPositionDataL |
|
1709 // (other items were commented in a header). |
|
1710 // --------------------------------------------------------- |
|
1711 // |
|
1712 void CSimPsyNmeaPositionerStep::TestClearAndSetDefaultPositionDataL() |
|
1713 { |
|
1714 const TReal32 KExpectedMagCourse = 354.0F; |
|
1715 const TReal32 KKnotsToMetrePerSecFactor = 1.852F / 3.6F; |
|
1716 const TReal32 KExpectedSpeed = KKnotsToMetrePerSecFactor * 0.0F; |
|
1717 const TReal32 KExpectedHeading = 360; |
|
1718 |
|
1719 // correct NMEA file |
|
1720 FixSettingsForSimPSY(KNmeaSatelliteFile); |
|
1721 |
|
1722 CSimPsyMultiNmeaPosRequester* req = CSimPsyMultiNmeaPosRequester::NewLC(); |
|
1723 |
|
1724 TInt status; |
|
1725 TTimeIntervalMicroSeconds requestTime; |
|
1726 |
|
1727 // |
|
1728 // Make a request with a HPositionGenericInfo object |
|
1729 HPositionGenericInfo* position = HPositionGenericInfo::NewLC(); |
|
1730 TReal32 trueCourse = TReal32(30.00); |
|
1731 TInt err = position->SetValue(EPositionFieldTrueCourse, trueCourse); |
|
1732 // set position |
|
1733 TPosition pos; |
|
1734 TReal lat(66.6); |
|
1735 TReal lon(77.7); |
|
1736 TReal32 alt(100); |
|
1737 pos.SetCoordinate(lat, lon, alt); |
|
1738 pos.SetCurrentTime(); |
|
1739 position->SetPosition(pos); |
|
1740 |
|
1741 // make request |
|
1742 |
|
1743 position->SetRequestedField(EPositionFieldMagneticCourse); |
|
1744 req->MakeRequests(position); |
|
1745 req->GetResult(status, requestTime); |
|
1746 |
|
1747 CheckRequestResultL(status, *position); |
|
1748 if (status != KErrNone) |
|
1749 { |
|
1750 User::Leave(KErrGeneral); |
|
1751 } |
|
1752 |
|
1753 // Check data from returned generic-info object... |
|
1754 err = position->GetValue(EPositionFieldTrueCourse, trueCourse); |
|
1755 if (err != KErrNotFound) // value previously set should be cleared |
|
1756 { |
|
1757 User::Leave(KErrGeneral); |
|
1758 } |
|
1759 |
|
1760 position->GetPosition(pos); |
|
1761 TReal returnedLat = pos.Latitude(); |
|
1762 TReal returnedLon = pos.Longitude(); |
|
1763 TReal32 returnedAlt= pos.Altitude(); |
|
1764 |
|
1765 if (returnedLat == lat) |
|
1766 { |
|
1767 User::Leave(KErrGeneral); |
|
1768 } |
|
1769 if (returnedLon == lon) |
|
1770 { |
|
1771 User::Leave(KErrGeneral); |
|
1772 } |
|
1773 if (returnedAlt == alt) |
|
1774 { |
|
1775 User::Leave(KErrGeneral); |
|
1776 } |
|
1777 |
|
1778 TInt mustbetrue = position->IsFieldAvailable(EPositionFieldMagneticCourse); |
|
1779 if (!mustbetrue) |
|
1780 { |
|
1781 User::Leave(KErrGeneral); |
|
1782 } |
|
1783 TReal32 magCourse; |
|
1784 position->GetValue(EPositionFieldMagneticCourse, |
|
1785 magCourse); |
|
1786 if (magCourse != KExpectedMagCourse) |
|
1787 { |
|
1788 User::Leave(KErrGeneral); |
|
1789 } |
|
1790 CleanupStack::PopAndDestroy(position); |
|
1791 |
|
1792 // |
|
1793 // Make a request with a TPositionCourseInfo object |
|
1794 TPositionCourseInfo positionCourse = TPositionCourseInfo(); |
|
1795 |
|
1796 // set course |
|
1797 TCourse course; |
|
1798 TReal32 headingAccuracy(38); |
|
1799 course.SetHeadingAccuracy(headingAccuracy); |
|
1800 positionCourse.SetCourse(course); |
|
1801 |
|
1802 // make request |
|
1803 req->MakeRequests(&positionCourse); |
|
1804 req->GetResult(status, requestTime); |
|
1805 |
|
1806 CheckRequestResultL(status, positionCourse); |
|
1807 |
|
1808 // check data from returned course-info object |
|
1809 positionCourse.GetCourse(course); |
|
1810 TReal32 returnedHeadingAccuracy = course.HeadingAccuracy(); |
|
1811 |
|
1812 // TRealX nan; |
|
1813 // nan.SetNaN(); |
|
1814 if (!Math::IsNaN(returnedHeadingAccuracy)) |
|
1815 { |
|
1816 User::Leave(KErrGeneral); |
|
1817 } |
|
1818 if (course.Heading() != KExpectedHeading) |
|
1819 { |
|
1820 User::Leave(KErrGeneral); |
|
1821 } |
|
1822 if (course.Speed() != KExpectedSpeed) |
|
1823 { |
|
1824 User::Leave(KErrGeneral); |
|
1825 } |
|
1826 |
|
1827 // |
|
1828 // Make a request with a TPositionSatelliteInfo object |
|
1829 TPositionSatelliteInfo positionSatellite = TPositionSatelliteInfo(); |
|
1830 |
|
1831 // set sat data |
|
1832 TSatelliteData satData; |
|
1833 TInt satelliteId(26); |
|
1834 satData.SetSatelliteId(satelliteId); |
|
1835 satData.SetIsUsed(ETrue); |
|
1836 positionSatellite.AppendSatelliteData(satData); |
|
1837 |
|
1838 TCourse courseSat; |
|
1839 headingAccuracy = 85; |
|
1840 courseSat.SetHeadingAccuracy(headingAccuracy); |
|
1841 positionSatellite.SetCourse(course); |
|
1842 |
|
1843 // make request |
|
1844 req->MakeRequests(&positionSatellite); |
|
1845 req->GetResult(status, requestTime); |
|
1846 |
|
1847 CheckRequestResultL(status, positionSatellite); |
|
1848 |
|
1849 // check data from returned satellite-info object |
|
1850 positionSatellite.GetCourse(courseSat); |
|
1851 returnedHeadingAccuracy = courseSat.HeadingAccuracy(); |
|
1852 positionSatellite.GetSatelliteData(0, satData); |
|
1853 TInt returnedSatId = satData.SatelliteId(); |
|
1854 |
|
1855 if (!Math::IsNaN(returnedHeadingAccuracy)) |
|
1856 { |
|
1857 User::Leave(KErrGeneral); |
|
1858 } |
|
1859 if (course.Speed() != KExpectedSpeed) |
|
1860 { |
|
1861 User::Leave(KErrGeneral); |
|
1862 } |
|
1863 if (returnedSatId == satelliteId) |
|
1864 { |
|
1865 User::Leave(KErrGeneral); |
|
1866 } |
|
1867 |
|
1868 // |
|
1869 // Make a request with a TPositionInfo object |
|
1870 |
|
1871 TPositionInfo positionInfo = TPositionInfo(); |
|
1872 // set pos info |
|
1873 TPosition posInfo; |
|
1874 TReal latInfo(26.6); |
|
1875 TReal lonInfo(47.7); |
|
1876 TReal32 altInfo(300); |
|
1877 posInfo.SetCoordinate(latInfo, lonInfo, altInfo); |
|
1878 TUid datumId = {0x01010101}; |
|
1879 posInfo.SetDatum(datumId); |
|
1880 positionInfo.SetPosition(posInfo); |
|
1881 |
|
1882 // make request |
|
1883 req->MakeRequests(&positionInfo); |
|
1884 req->GetResult(status, requestTime); |
|
1885 |
|
1886 CheckRequestResultL(status, positionInfo); |
|
1887 |
|
1888 positionInfo.GetPosition(posInfo); |
|
1889 returnedLat = posInfo.Latitude(); |
|
1890 returnedLon = posInfo.Longitude(); |
|
1891 returnedAlt= posInfo.Altitude(); |
|
1892 TUid returnedDatumId = posInfo.Datum(); |
|
1893 |
|
1894 if (returnedLat == latInfo) |
|
1895 { |
|
1896 User::Leave(KErrGeneral); |
|
1897 } |
|
1898 if (returnedLon == lonInfo) |
|
1899 { |
|
1900 User::Leave(KErrGeneral); |
|
1901 } |
|
1902 if (returnedAlt == altInfo) |
|
1903 { |
|
1904 User::Leave(KErrGeneral); |
|
1905 } |
|
1906 if (returnedDatumId == datumId) |
|
1907 { |
|
1908 User::Leave(KErrGeneral); |
|
1909 } |
|
1910 |
|
1911 |
|
1912 CleanupStack::PopAndDestroy(req); // requester |
|
1913 _LIT(KRequestClearAndSetDefaultPositionData, "Ended: **** Test Clear Position Data ****"); |
|
1914 INFO_PRINTF1(KRequestClearAndSetDefaultPositionData); |
|
1915 } |
|
1916 |
|
1917 // --------------------------------------------------------- |
|
1918 // CSimPsyNmeaPositionerStep::TestPartialUpdateL |
|
1919 // (other items were commented in a header). |
|
1920 // --------------------------------------------------------- |
|
1921 // |
|
1922 void CSimPsyNmeaPositionerStep::TestPartialUpdateL() |
|
1923 { |
|
1924 FixSettingsForSimPSY(KNmeaPartialUpdateFile); |
|
1925 CSimPsyMultiNmeaPosRequester* requester = CSimPsyMultiNmeaPosRequester::NewLC(); |
|
1926 requester->SetPartialUpdateRestriction(ETrue); |
|
1927 |
|
1928 TInt status; |
|
1929 TTimeIntervalMicroSeconds requestTime; |
|
1930 |
|
1931 TInt KNrOfRequests = 10; |
|
1932 |
|
1933 for (TInt i = 0; i < KNrOfRequests; i++) |
|
1934 { |
|
1935 TPositionInfo position = TPositionInfo(); |
|
1936 requester->MakeRequests(&position); |
|
1937 requester->GetResult(status, requestTime); |
|
1938 |
|
1939 _LIT(KReq, "Request %d completed with %d."); |
|
1940 TBuf<128> buf; |
|
1941 buf.Format(KReq, i, status); |
|
1942 INFO_PRINTF1(buf); |
|
1943 RDebug::Print(buf); |
|
1944 |
|
1945 if (status == KPositionPartialUpdate && !IsPartialPosition(position) || |
|
1946 status != KPositionPartialUpdate && IsPartialPosition(position)) |
|
1947 { |
|
1948 User::Leave(KErrGeneral); |
|
1949 } |
|
1950 else if (status == KErrNone && IsPartialPosition(position)) |
|
1951 { |
|
1952 User::Leave(KErrGeneral); |
|
1953 } |
|
1954 |
|
1955 // Fix 0, 2 and 5 is partial |
|
1956 if (status == KPositionPartialUpdate && |
|
1957 i != 0 && i != 2 && i != 5) |
|
1958 { |
|
1959 User::Leave(KErrGeneral); |
|
1960 } |
|
1961 // Fix 1, 3, 4 and 6 more is full fixes |
|
1962 else if (status == KErrNone && |
|
1963 i != 1 && i != 3 && i != 4 && |
|
1964 i != 6 && i != 7 && i != 8 && i != 9) |
|
1965 { |
|
1966 User::Leave(KErrGeneral); |
|
1967 } |
|
1968 |
|
1969 } |
|
1970 CleanupStack::PopAndDestroy(requester); // requester |
|
1971 _LIT(KTestPartialUpdate, "Ended: **** Test Partial Update ****"); |
|
1972 INFO_PRINTF1(KTestPartialUpdate); |
|
1973 } |
|
1974 |
|
1975 // --------------------------------------------------------- |
|
1976 // CSimPsyNmeaPositionerStep::TestErrorSituationsL |
|
1977 // (other items were commented in a header). |
|
1978 // --------------------------------------------------------- |
|
1979 // |
|
1980 void CSimPsyNmeaPositionerStep::TestErrorSituationsL() |
|
1981 { |
|
1982 FixSettingsForSimPSY(KNmeaError1); |
|
1983 CSimPsyMultiNmeaPosRequester* req = CSimPsyMultiNmeaPosRequester::NewLC(); |
|
1984 |
|
1985 TInt status = KErrNone; |
|
1986 TTimeIntervalMicroSeconds requestTime; |
|
1987 |
|
1988 TInt KNrOfRequests = 5; |
|
1989 |
|
1990 req->SetRequesterWillCancelL(0, 4 * 1000000); // 4 seconds timeout |
|
1991 |
|
1992 for (TInt i = 0; i < KNrOfRequests; i++) |
|
1993 { |
|
1994 TPositionSatelliteInfo position = TPositionSatelliteInfo(); |
|
1995 req->MakeRequests(&position); |
|
1996 req->GetResult(status, requestTime); |
|
1997 |
|
1998 if (status != KErrCancel) |
|
1999 { |
|
2000 User::Leave(status); |
|
2001 } |
|
2002 |
|
2003 } |
|
2004 CleanupStack::PopAndDestroy(req); // req |
|
2005 |
|
2006 FixSettingsForSimPSY(KNmeaError2); |
|
2007 req = CSimPsyMultiNmeaPosRequester::NewLC(); |
|
2008 req->SetRequesterWillCancelL(0, 4 * 1000000); // 4 seconds timeout |
|
2009 |
|
2010 KNrOfRequests = 2; |
|
2011 |
|
2012 for (TInt j = 0; j < KNrOfRequests; j++) |
|
2013 { |
|
2014 TPositionSatelliteInfo position = TPositionSatelliteInfo(); |
|
2015 req->MakeRequests(&position); |
|
2016 req->GetResult(status, requestTime); |
|
2017 |
|
2018 if (status != KErrNone || |
|
2019 position.NumSatellitesInView() != 15 || |
|
2020 position.NumSatellitesUsed() != 4 || |
|
2021 position.HorizontalDoP() != 2.0 || |
|
2022 position.VerticalDoP() != 2.0) |
|
2023 { |
|
2024 User::Leave(KErrGeneral); |
|
2025 } |
|
2026 |
|
2027 } |
|
2028 CleanupStack::PopAndDestroy(req); // req |
|
2029 |
|
2030 // Check that correct fix is made when NMEA sentence has wrong checksum |
|
2031 FixSettingsForSimPSY(KNmeaError3); |
|
2032 req = CSimPsyMultiNmeaPosRequester::NewLC(); |
|
2033 |
|
2034 KNrOfRequests = 2; |
|
2035 |
|
2036 for (TInt k = 0; k < KNrOfRequests; k++) |
|
2037 { |
|
2038 TPositionInfo position = TPositionInfo(); |
|
2039 req->MakeRequests(&position); |
|
2040 req->GetResult(status, requestTime); |
|
2041 |
|
2042 TPosition pos; |
|
2043 position.GetPosition(pos); |
|
2044 |
|
2045 if (status != KErrNone) |
|
2046 { |
|
2047 User::Leave(KErrGeneral); |
|
2048 } |
|
2049 if (k == 1 && |
|
2050 pos.Altitude() != 200 && |
|
2051 pos.Latitude() != -6 && |
|
2052 pos.Longitude() != -61) |
|
2053 { |
|
2054 User::Leave(KErrGeneral); |
|
2055 } |
|
2056 } |
|
2057 CleanupStack::PopAndDestroy(req); // req |
|
2058 |
|
2059 // Add more error situations here is applicable |
|
2060 _LIT(KTestErrorSituations, "Ended: **** Test wrong situations ****"); |
|
2061 INFO_PRINTF1(KTestErrorSituations); |
|
2062 } |
|
2063 |
|
2064 // --------------------------------------------------------- |
|
2065 // CSimPsyNmeaPositionerStep::TestSpecialCasesL |
|
2066 // (other items were commented in a header). |
|
2067 // --------------------------------------------------------- |
|
2068 // |
|
2069 void CSimPsyNmeaPositionerStep::TestSpecialCasesL() |
|
2070 { |
|
2071 FixSettingsForSimPSY(KNmeaSpecialCase); |
|
2072 CSimPsyMultiNmeaPosRequester* req = CSimPsyMultiNmeaPosRequester::NewLC(); |
|
2073 |
|
2074 TInt status = KErrNone; |
|
2075 TTimeIntervalMicroSeconds requestTime; |
|
2076 |
|
2077 TInt KNrOfRequests = 4; |
|
2078 |
|
2079 for (TInt i = 0; i < KNrOfRequests; i++) |
|
2080 { |
|
2081 HPositionGenericInfo* position = HPositionGenericInfo::NewLC(); |
|
2082 User::LeaveIfError(position->SetRequestedField(EPositionFieldNMEASentences)); |
|
2083 |
|
2084 req->MakeRequests(position); |
|
2085 req->GetResult(status, requestTime); |
|
2086 |
|
2087 CheckRequestResultL(status, *position); |
|
2088 |
|
2089 TPosition pos; |
|
2090 position->GetPosition(pos); |
|
2091 |
|
2092 TUint8 sentences; |
|
2093 TInt err = KErrNone; |
|
2094 TPtrC8 nmeaString(NULL, 0); |
|
2095 |
|
2096 if (i == 0) |
|
2097 { |
|
2098 if (pos.Altitude() != 200) |
|
2099 { |
|
2100 User::Leave(KErrGeneral); |
|
2101 } |
|
2102 |
|
2103 err = position->GetValue(EPositionFieldNMEASentences, sentences); |
|
2104 User::LeaveIfError(err); |
|
2105 if (sentences != 7) |
|
2106 { |
|
2107 User::Leave(KErrGeneral); |
|
2108 } |
|
2109 |
|
2110 _LIT8(KExpectedFirstSentence, "$GPGLL,6459.86"); |
|
2111 User::LeaveIfError(position->GetValue(EPositionFieldNMEASentencesStart, nmeaString)); |
|
2112 if (nmeaString.Left(14).Compare(KExpectedFirstSentence) != 0) |
|
2113 { |
|
2114 _LIT(KError, "Expected ,$GPGLL,6459.86*, sentence at the beginning of the burst"); |
|
2115 LogErrorAndFail(KError); |
|
2116 } |
|
2117 } |
|
2118 if (i == 1) |
|
2119 { |
|
2120 if (!Math::IsNaN(pos.Altitude())) |
|
2121 { |
|
2122 User::Leave(KErrGeneral); |
|
2123 } |
|
2124 err = position->GetValue(EPositionFieldNMEASentences, sentences); |
|
2125 User::LeaveIfError(err); |
|
2126 if (sentences != 9) |
|
2127 { |
|
2128 User::Leave(KErrGeneral); |
|
2129 } |
|
2130 } |
|
2131 if (i == 2) |
|
2132 { |
|
2133 if (pos.Altitude() != 200) |
|
2134 { |
|
2135 User::Leave(KErrGeneral); |
|
2136 } |
|
2137 if (pos.Latitude() != -6) |
|
2138 { |
|
2139 User::Leave(KErrGeneral); |
|
2140 } |
|
2141 if (pos.Longitude() != -61) |
|
2142 { |
|
2143 User::Leave(KErrGeneral); |
|
2144 } |
|
2145 err = position->GetValue(EPositionFieldNMEASentences, sentences); |
|
2146 User::LeaveIfError(err); |
|
2147 if (sentences != 6) |
|
2148 { |
|
2149 User::Leave(KErrGeneral); |
|
2150 } |
|
2151 |
|
2152 _LIT8(KExpectedFirstSentence, "$GPGLL,6459.8250"); |
|
2153 User::LeaveIfError(position->GetValue(EPositionFieldNMEASentencesStart, nmeaString)); |
|
2154 if (nmeaString.Left(16).Compare(KExpectedFirstSentence) != 0) |
|
2155 { |
|
2156 _LIT(KError, "Expected ,$GPGLL,6459.8250*, sentence at the beginning of the burst"); |
|
2157 LogErrorAndFail(KError); |
|
2158 } |
|
2159 } |
|
2160 |
|
2161 CleanupStack::PopAndDestroy(position); // position |
|
2162 } |
|
2163 CleanupStack::PopAndDestroy(req); // req |
|
2164 _LIT(KTestSpecialCase, "Ended: **** Test Special Case ****"); |
|
2165 INFO_PRINTF1(KTestSpecialCase); |
|
2166 } |
|
2167 |
|
2168 |
|
2169 |
|
2170 |
|
2171 // --------------------------------------------------------- |
|
2172 // CSimPsyNmeaPositionerStep::CheckRequestResultL |
|
2173 // (other items were commented in a header). |
|
2174 // --------------------------------------------------------- |
|
2175 // |
|
2176 void CSimPsyNmeaPositionerStep::CheckRequestResultL( |
|
2177 TInt aStatus, TPositionInfo& aPosition) |
|
2178 { |
|
2179 _LIT(KReq, "Checking status: %d."); |
|
2180 TBuf<128> statusSuf; |
|
2181 statusSuf.Format(KReq, aStatus); |
|
2182 INFO_PRINTF1(statusSuf); |
|
2183 RDebug::Print(statusSuf); |
|
2184 |
|
2185 if (aStatus != KErrNone) |
|
2186 { |
|
2187 User::Leave(aStatus); |
|
2188 } |
|
2189 |
|
2190 TPosition position; |
|
2191 aPosition.GetPosition(position); |
|
2192 |
|
2193 TBuf<30> buf; |
|
2194 if (aPosition.ModuleId().iUid != KSimModuleId) |
|
2195 { |
|
2196 _LIT(KWrongUid, "Expected simulationpsy uid"); |
|
2197 LogErrorAndFail(KWrongUid); |
|
2198 } |
|
2199 if (aPosition.UpdateType() != EPositionUpdateGeneral) |
|
2200 { |
|
2201 _LIT(KWrongUpType, "Expected Update Type General"); |
|
2202 LogErrorAndFail(KWrongUpType); |
|
2203 } |
|
2204 |
|
2205 } |
|
2206 |
|
2207 // --------------------------------------------------------- |
|
2208 // CSimPsyNmeaPositionerStep::IsPartialPosition |
|
2209 // |
|
2210 // (other items were commented in a header). |
|
2211 // --------------------------------------------------------- |
|
2212 // |
|
2213 TBool CSimPsyNmeaPositionerStep::IsPartialPosition( |
|
2214 TPositionInfoBase& aPosInfo) |
|
2215 { |
|
2216 TPositionInfo& posInfo = static_cast<TPositionInfo&> (aPosInfo); |
|
2217 TPosition pos; |
|
2218 posInfo.GetPosition(pos); |
|
2219 |
|
2220 // Check if time is set |
|
2221 // Check if longitude is a number |
|
2222 // Check if latitude is a number |
|
2223 if (pos.Time().Int64() == 0 || |
|
2224 Math::IsNaN(TRealX(pos.Longitude())) || |
|
2225 Math::IsNaN(TRealX(pos.Latitude()))) |
|
2226 { |
|
2227 return ETrue; |
|
2228 } |
|
2229 |
|
2230 return EFalse; |
|
2231 } |
|
2232 |
|
2233 |
|
2234 // End of File |