|
1 // Copyright (c) 2006-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 // @file ctlbsassdatastepcanceltracking.cpp |
|
15 // This is the class implementation for the Module Information Tests |
|
16 // EPOC includes. |
|
17 // |
|
18 // |
|
19 |
|
20 // LBS includes. |
|
21 #include <lbs.h> |
|
22 #include <lbs/lbsnetcommon.h> |
|
23 #include <lbssatellite.h> |
|
24 #include <lbs/lbsnetprotocolbase.h> |
|
25 #include <lbs/lbsassistancedatabuilderset.h> |
|
26 #include <e32math.h> |
|
27 |
|
28 // LBS test includes. |
|
29 #include "ctlbsconflictstepcanceltracking.h" |
|
30 #include <lbs/test/tlbsutils.h> |
|
31 |
|
32 |
|
33 /** Test case development notes |
|
34 =========================== |
|
35 |
|
36 It was decided to aid readablity each test class shall only support a single test case. |
|
37 This canceltracking has been produced to show how a typical conflict test case should be coded. |
|
38 |
|
39 |
|
40 Net Sim and Sequence Events |
|
41 --------------------------- |
|
42 Every test case implementation will use the ctlbsconflictstep class which supports Net Sim |
|
43 interactions and a way to ensure Net Sim events and client completion events have a occured |
|
44 in the correct order. An array is used to hold the expected sequence event values, and a second |
|
45 array contains the actual events produced during the test. Once the test moves into the EWaiting |
|
46 state typically after all the client requests have been made, the event arrays are compared to |
|
47 ensure the correct events were given. |
|
48 |
|
49 To set the expected sequence events populate the array in the SetExpectedSeq() function. |
|
50 |
|
51 |
|
52 Async wappers |
|
53 ------------- |
|
54 Each Lbs client async request is wappared in a active object class, to allow a number of |
|
55 outstanding async requests during the test. Any async calls you wish to make should also |
|
56 be wrapped in the same way, see CT_LbsDoX3P and CT_LbsDoPosUpdate for canceltrackings. |
|
57 These classes are constructed in the test class ConstructL, and maybe started or cancelled |
|
58 during the test at any point. |
|
59 |
|
60 |
|
61 Verify Position Information |
|
62 --------------------------- |
|
63 A test should verify each client call which expected a location to be returned. The |
|
64 location data should be validation to ensure it's correct. See VerifyPosInfos. |
|
65 */ |
|
66 |
|
67 |
|
68 /** |
|
69 Static Constructor |
|
70 */ |
|
71 CT_LbsConflictStep_canceltracking* CT_LbsConflictStep_canceltracking::New(CT_LbsConflictServer& aParent) |
|
72 { |
|
73 // Note the lack of ELeave. |
|
74 // This means that having insufficient memory will return NULL; |
|
75 CT_LbsConflictStep_canceltracking* testStep = new CT_LbsConflictStep_canceltracking(aParent); |
|
76 if (testStep) |
|
77 { |
|
78 TInt err = KErrNone; |
|
79 |
|
80 TRAP(err, testStep->ConstructL()); |
|
81 if (err) |
|
82 { |
|
83 delete testStep; |
|
84 testStep = NULL; |
|
85 } |
|
86 } |
|
87 return testStep; |
|
88 } |
|
89 |
|
90 |
|
91 /** |
|
92 * Constructor |
|
93 */ |
|
94 CT_LbsConflictStep_canceltracking::CT_LbsConflictStep_canceltracking(CT_LbsConflictServer& aParent) : CT_LbsConflictStep(aParent) |
|
95 { |
|
96 SetTestStepName(KLbsConflictStep_canceltracking); |
|
97 } |
|
98 |
|
99 |
|
100 void CT_LbsConflictStep_canceltracking::ConstructL() |
|
101 { |
|
102 // Create the base class objects. |
|
103 CT_LbsConflictStep::ConstructL(); |
|
104 |
|
105 // Self locate async wrapper. |
|
106 iDoPosUpdate = CT_LbsDoPosUpdate::NewL(this); |
|
107 |
|
108 // X3P async wrapper. |
|
109 iDoX3P = CT_LbsDoX3P::NewL(this); |
|
110 } |
|
111 |
|
112 |
|
113 /** |
|
114 * Destructor |
|
115 */ |
|
116 CT_LbsConflictStep_canceltracking::~CT_LbsConflictStep_canceltracking() |
|
117 { |
|
118 |
|
119 iDoPosUpdate->Cancel(); |
|
120 delete iDoPosUpdate; |
|
121 |
|
122 iDoX3P->Cancel(); |
|
123 delete iDoX3P; |
|
124 } |
|
125 |
|
126 |
|
127 /** Called at the start of the test... |
|
128 |
|
129 Each test case MUST implement this. |
|
130 |
|
131 The table below describes the expcted order that the callbacks should be called |
|
132 during the test. |
|
133 |
|
134 Note that the tests deliberateley do NOT check the order that the client requests |
|
135 are completed. This is because the delivery order is not guaranteed by LBS. |
|
136 The tests will check that all client requests are completed with the correct error |
|
137 code and position at the end of the test. |
|
138 */ |
|
139 void CT_LbsConflictStep_canceltracking::SetExpectedSeq() |
|
140 { |
|
141 // Self locate MOLR (iState = ERegPosUpdate) |
|
142 SetVerifySeqEvent(ESelf_MOLR_NetSim_Got_NotifyRegisterLcsMoLr); // --> To Net |
|
143 SetVerifySeqEvent(ESelf_MOLR_NetSim_Got_NotifyMeasurementControlLocation); // --> To Net |
|
144 |
|
145 switch (iTestCaseId) |
|
146 { |
|
147 case 11: |
|
148 { |
|
149 SetVerifySeqEvent(ESelf_MOLR_NetSim_Got_NotifyMeasurementReportLocation); // --> To Net |
|
150 SetVerifySeqEvent(ESelf_MOLR_NetSim_Got_NotifyFacilityLcsMoLrResult); // --> To Net |
|
151 break; |
|
152 } |
|
153 case 12: |
|
154 { |
|
155 SetVerifySeqEvent(ESelf_MOLR_NetSim_Got_NotifyMeasurementReportControlFailure); // --> To Net |
|
156 break; |
|
157 } |
|
158 } |
|
159 |
|
160 SetVerifySeqEvent(ESelf_MOLR_NetSim_Got_NotifyReleaseLcsMoLr); // --> To Net |
|
161 |
|
162 // followed by a X3P MOLR (after X3P register iState = ERegX3P), |
|
163 SetVerifySeqEvent(EX3P_TIMER_MOLR_NetSim_Got_NotifyRegisterLcsMoLr); // --> To Net |
|
164 // now iState = ERegX3P from ERegPosUpdate, |
|
165 |
|
166 SetVerifySeqEvent(EX3P_TIMER_MOLR_NetSim_Got_NotifyMeasurementControlLocation); // <-- From Net |
|
167 SetVerifySeqEvent(EX3P_TIMER_MOLR_NetSim_Got_NotifyMeasurementReportLocation); // --> To Net |
|
168 SetVerifySeqEvent(EX3P_TIMER_MOLR_NetSim_Got_NotifyFacilityLcsMoLrResult); // <-- From Net |
|
169 // but test fails bercause not yet implemented in LBS! |
|
170 SetVerifySeqEvent(EX3P_TIMER_MOLR_NetSim_Got_NotifyReleaseLcsMoLr); // --> To Net |
|
171 |
|
172 // (after X3P release iState = EWaiting). |
|
173 |
|
174 SetVerifyAdhocEvent(EClient_Got_PosUpdate_Complete); |
|
175 SetVerifyAdhocEvent(EClient_Got_X3P_Complete); |
|
176 |
|
177 } |
|
178 |
|
179 |
|
180 |
|
181 /** Called at the end of the test to verify the correct position data has been returned to the |
|
182 client. |
|
183 |
|
184 Each test case SHOULD implement a version of this. |
|
185 */ |
|
186 void CT_LbsConflictStep_canceltracking::VerifyPosInfos() |
|
187 { |
|
188 T_LbsUtils utils; |
|
189 RPointerArray<TAny>& verifyPosInfoArr = iParent.iSharedData->iVerifyPosInfoArr; |
|
190 RPointerArray<TAny>& currPosInfoArr = iParent.iSharedData->iCurrentPosInfoArr; |
|
191 TPositionInfo* currPosInfo; |
|
192 |
|
193 // Verify both the self locate and X3P MOLR position information. |
|
194 |
|
195 // Verify entry 0 for the self locate. We expect a position containing NaNs. |
|
196 currPosInfo = reinterpret_cast<TPositionInfo*>(currPosInfoArr[0]); |
|
197 TPosition pos; |
|
198 currPosInfo->GetPosition(pos); |
|
199 if (!Math::IsNaN(pos.Latitude())) |
|
200 { |
|
201 INFO_PRINTF1(_L("Failed test, Position does not contain NANs")); |
|
202 |
|
203 SetTestStepResult(EFail); |
|
204 } |
|
205 if (!Math::IsNaN(pos.Longitude())) |
|
206 { |
|
207 INFO_PRINTF1(_L("Failed test, Position does not contain NANs")); |
|
208 |
|
209 SetTestStepResult(EFail); |
|
210 } |
|
211 |
|
212 // Verify entry 1 for the X3P. We expect a real location value, compare using the data |
|
213 // sent to the test APGS module. |
|
214 TPositionInfo* verifyPosInfo = reinterpret_cast<TPositionInfo*>(verifyPosInfoArr[0]); |
|
215 currPosInfo = reinterpret_cast<TPositionInfo*>(currPosInfoArr[1]); |
|
216 if (!utils.Compare_PosInfo(*verifyPosInfo, *currPosInfo)) |
|
217 { |
|
218 INFO_PRINTF1(_L("Failed test, X3P position incorrect.")); |
|
219 SetTestStepResult(EFail); |
|
220 } |
|
221 } |
|
222 |
|
223 |
|
224 /** A standard TEF test case doTestStepL, this SHOULD only support a single test case. |
|
225 |
|
226 Typically the function will look much like this. |
|
227 */ |
|
228 TVerdict CT_LbsConflictStep_canceltracking::doTestStepL() |
|
229 { |
|
230 // Generic test step used to test the LBS Client Notify position update API. |
|
231 INFO_PRINTF1(_L(">>CT_LbsConflictStep_canceltracking::doTestStepL()")); |
|
232 |
|
233 if (TestStepResult() == EPass) |
|
234 { |
|
235 GetIntFromConfig(ConfigSection(), KTestCaseId, iTestCaseId); |
|
236 |
|
237 // Setup the expected sequence events for the test. |
|
238 SetExpectedSeq(); |
|
239 |
|
240 // Open and setup net sim. |
|
241 OpenNetSim(this); |
|
242 |
|
243 // Kick off the test abort and keep alive timers. |
|
244 TTimeIntervalMicroSeconds32 abortInterval(KLbsAbortPeriod); |
|
245 TTimeIntervalMicroSeconds32 keepAliveInterval(KLbsKeepAlivePeriod); |
|
246 |
|
247 iAbortTimer->SetTimer(abortInterval); |
|
248 iKeepAliveTimer->SetTimer(keepAliveInterval); |
|
249 |
|
250 // Kick off test. |
|
251 CActiveScheduler::Start(); |
|
252 |
|
253 // Verify location data. |
|
254 VerifyPosInfos(); |
|
255 |
|
256 // Clean up. |
|
257 CloseNetSim(); |
|
258 } |
|
259 |
|
260 INFO_PRINTF1(_L("<<CT_LbsConflictStep_canceltracking::doTestStepL()")); |
|
261 |
|
262 return TestStepResult(); |
|
263 } |
|
264 |
|
265 |
|
266 /** NetSim callbacks given for a MoLr, which we invoke as a result of the notify position update. |
|
267 */ |
|
268 void CT_LbsConflictStep_canceltracking::Connected() |
|
269 { |
|
270 // Call base implementation. |
|
271 CT_LbsConflictStep::Connected(); |
|
272 |
|
273 // Kick off first pos update. |
|
274 |
|
275 // Create a posinfo and store in our shared array for later verification. |
|
276 RPointerArray<TAny>& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr; |
|
277 TPositionInfo* posInfo = new(ELeave) TPositionInfo(); |
|
278 |
|
279 T_LbsUtils utils; |
|
280 utils.ResetAndDestroy_PosInfoArr(posInfoArr); // Clear previous entries before new entry is appended. |
|
281 |
|
282 posInfoArr.Append(posInfo); |
|
283 |
|
284 switch (iTestCaseId) |
|
285 { |
|
286 case 10: |
|
287 case 11: |
|
288 case 12: |
|
289 { |
|
290 |
|
291 //ExitEmergencyState(); |
|
292 |
|
293 TPositionUpdateOptions optsA; |
|
294 // old TTimeIntervalMicroSeconds interval = 30 * 1000000; // tracking! |
|
295 TTimeIntervalMicroSeconds interval = 4 * 1000000; // tracking! |
|
296 |
|
297 optsA.SetUpdateInterval(interval); |
|
298 |
|
299 |
|
300 TPositionUpdateOptions tempOpts; |
|
301 // set a fairly long interval (1 minute) to ensure the 2nd request doesn't complete too quicky: |
|
302 tempOpts.SetUpdateInterval(4*1000000); |
|
303 tempOpts.SetUpdateTimeOut(30*1000000); |
|
304 //iPositioner.SetUpdateOptions(tempOpts); |
|
305 //iPositioner.GetUpdateOptions(tempOpts); |
|
306 |
|
307 iDoPosUpdate->SetOptions(tempOpts); |
|
308 //iDoPosUpdate->GetOptions(tempOpts); |
|
309 break; |
|
310 } |
|
311 } |
|
312 |
|
313 INFO_PRINTF1(_L("Start first tracking NPUD")); |
|
314 iDoPosUpdate->StartL(*posInfo); |
|
315 iState = EReqPosUpdate; |
|
316 |
|
317 |
|
318 |
|
319 } |
|
320 |
|
321 |
|
322 void CT_LbsConflictStep_canceltracking::Disconnected() |
|
323 { |
|
324 // Call base implementation. |
|
325 CT_LbsConflictStep::Disconnected(); |
|
326 } |
|
327 |
|
328 |
|
329 void CT_LbsConflictStep_canceltracking::NotifyRegisterLcsMoLr(const TDesC& aData) |
|
330 { |
|
331 // Determine and record the sequence event. A blank aData indicates a self locate |
|
332 // MOLR, otherwise we have a X3P MOLR. Also the current test state indicates which |
|
333 // type MOLR is being carried out. |
|
334 if (aData != KNullDesC) |
|
335 { |
|
336 INFO_PRINTF1(_L("Got - X3P MOLR - NetSim Notify Register Lcs MoLr - Event.")); |
|
337 SetCurrentSeqEvent(EX3P_TIMER_MOLR_NetSim_Got_NotifyRegisterLcsMoLr); |
|
338 |
|
339 if (iTestCaseId == 13) |
|
340 { |
|
341 |
|
342 if (aData.Compare(KTransmitTimerDestination)) |
|
343 { |
|
344 INFO_PRINTF1(_L("Failed test, bad X3P register data.")); |
|
345 SetTestStepResult(EFail); |
|
346 } |
|
347 } |
|
348 else |
|
349 { |
|
350 |
|
351 |
|
352 // Verify telephone number. |
|
353 if (aData.Compare(KTransmitTimerDestination)) |
|
354 { |
|
355 INFO_PRINTF1(_L("Failed test, bad X3P register data.")); |
|
356 SetTestStepResult(EFail); |
|
357 } |
|
358 } |
|
359 |
|
360 // Mark as started now it has, to ensure the self MOLR are not recorded incorrectly. |
|
361 iState = EReqX3P; |
|
362 } |
|
363 |
|
364 else if ((aData == KNullDesC) && (iState == EReqPosUpdate)) |
|
365 { |
|
366 INFO_PRINTF1(_L("Got - Self MOLR - NetSim Notify Register Lcs MoLr - Event.")); |
|
367 SetCurrentSeqEvent(ESelf_MOLR_NetSim_Got_NotifyRegisterLcsMoLr); |
|
368 } |
|
369 |
|
370 } |
|
371 |
|
372 |
|
373 void CT_LbsConflictStep_canceltracking::NotifyReleaseLcsMoLr(TInt aReason) |
|
374 { |
|
375 TInt expectedErr = KErrNone; |
|
376 |
|
377 // Determine and set sequence event. |
|
378 |
|
379 if (iDoX3PPushWhenMoLrReleased) |
|
380 { |
|
381 INFO_PRINTF1(_L("self MOLR - NetSim Notify Release Lcs MoLr - Event.")); |
|
382 |
|
383 iDoX3PPushWhenMoLrReleased = EFalse; |
|
384 // Start X3P. |
|
385 TLbsTransmitPositionOptions transOpts; |
|
386 |
|
387 |
|
388 iDoX3P->SetOptions(transOpts); // Set timeout value to 0, to disable the timeout. |
|
389 |
|
390 // now make a conflict occur by doing a high priority X3P |
|
391 // the next (second) NPUD should be completed with KErrHighPriorityRec |
|
392 iKErrHighPriorityRecExpected = ETrue; |
|
393 |
|
394 RPointerArray<TAny>& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr; |
|
395 TPositionInfo* posInfo = new(ELeave) TPositionInfo(); |
|
396 posInfoArr.Append(posInfo); |
|
397 |
|
398 INFO_PRINTF1(_L("Do a X3P Push to conflict with current tracking self locate")); |
|
399 |
|
400 iDoX3P->StartL(KTransmitPushDestination, KTransmitPushPriority, *posInfo); |
|
401 posInfo = new(ELeave) TPositionInfo(); |
|
402 posInfoArr.Append(posInfo); |
|
403 |
|
404 iKErrHighPriorityRecExpected = ETrue; // the next NPUD should fail as we are doing X3P PUSH |
|
405 |
|
406 INFO_PRINTF1(_L("Start second tracking NPUD")); |
|
407 iDoPosUpdate->StartL(*posInfo); |
|
408 |
|
409 |
|
410 } |
|
411 else |
|
412 if (iState == EReqPosUpdate) |
|
413 { |
|
414 INFO_PRINTF1(_L("Got - Self MOLR - NetSim Notify Release Lcs MoLr - Event.")); |
|
415 SetCurrentSeqEvent(ESelf_MOLR_NetSim_Got_NotifyReleaseLcsMoLr); |
|
416 |
|
417 if (iTestCaseId == 14) |
|
418 { |
|
419 expectedErr = KErrPositionHighPriorityReceive; |
|
420 } |
|
421 else if (iTestCaseId == 12) |
|
422 { |
|
423 expectedErr = KErrCancel; |
|
424 } |
|
425 else |
|
426 { |
|
427 expectedErr = KErrNone; |
|
428 } |
|
429 } |
|
430 else if(iState == EReqX3P) |
|
431 { |
|
432 INFO_PRINTF1(_L("Got - X3P MOLR - NetSim Notify Release Lcs MoLr - Event.")); |
|
433 SetCurrentSeqEvent(EX3P_TIMER_MOLR_NetSim_Got_NotifyReleaseLcsMoLr); |
|
434 expectedErr = KErrNone; |
|
435 iState = EWaiting; // End of test. |
|
436 } |
|
437 |
|
438 // Verify reason code. |
|
439 if (aReason != expectedErr) |
|
440 { |
|
441 INFO_PRINTF2(_L("Failed test, bad release reason %d."), aReason); |
|
442 SetTestStepResult(EFail); |
|
443 } |
|
444 } |
|
445 |
|
446 |
|
447 void CT_LbsConflictStep_canceltracking::NotifyMeasurementControlLocation(const TPositionInfo& aPosition, |
|
448 const RLbsAssistanceDataBuilderSet& aData, |
|
449 const TLbsNetPosRequestQuality& aQuality) |
|
450 { |
|
451 T_LbsUtils utils; |
|
452 TInt err; |
|
453 |
|
454 // Determine and record sequence event. |
|
455 if (iState == EReqPosUpdate) |
|
456 { |
|
457 INFO_PRINTF1(_L("Got - Self MOLR - NetSim Notify Measurement Control Location - Event.")); |
|
458 SetCurrentSeqEvent(ESelf_MOLR_NetSim_Got_NotifyMeasurementControlLocation); |
|
459 } |
|
460 |
|
461 else if(iState == EReqX3P) |
|
462 { |
|
463 INFO_PRINTF1(_L("Got - X3P MOLR - NetSim Notify Measurement Control Location - Event.")); |
|
464 SetCurrentSeqEvent(EX3P_TIMER_MOLR_NetSim_Got_NotifyMeasurementControlLocation); |
|
465 } |
|
466 |
|
467 |
|
468 // Verify the reference position. |
|
469 TPositionInfo verifyRefPosInfo; |
|
470 |
|
471 verifyRefPosInfo.SetPosition(iRefPos); |
|
472 if (!utils.Compare_PosInfo(verifyRefPosInfo, aPosition)) |
|
473 { |
|
474 INFO_PRINTF1(_L("Failed test, position incorrect.")); |
|
475 SetTestStepResult(EFail); |
|
476 } |
|
477 |
|
478 |
|
479 // Verify the assistance data. |
|
480 RLbsAssistanceDataBuilderSet& data = const_cast<RLbsAssistanceDataBuilderSet&>(aData); |
|
481 RUEPositioningGpsReferenceTimeBuilder* refTimeBuilder = NULL; |
|
482 |
|
483 data.GetDataBuilder(refTimeBuilder); |
|
484 |
|
485 // Create a reader from the builder's data to allow us to verify the actual |
|
486 // assistance data. |
|
487 RUEPositioningGpsReferenceTimeReader refTimeReader; |
|
488 |
|
489 TRAP(err, refTimeReader.OpenL()); |
|
490 if (err == KErrNone) |
|
491 { |
|
492 refTimeReader.DataBuffer() = refTimeBuilder->DataBuffer(); |
|
493 |
|
494 if (!utils.VerifySimpleAssistanceData(refTimeReader)) |
|
495 { |
|
496 INFO_PRINTF1(_L("Failed test, assistance data incorrect.")); |
|
497 SetTestStepResult(EFail); |
|
498 } |
|
499 refTimeReader.Close(); |
|
500 } |
|
501 |
|
502 else |
|
503 { |
|
504 INFO_PRINTF2(_L("Failed test, assistance data reader err %d."), err); |
|
505 SetTestStepResult(EFail); |
|
506 } |
|
507 |
|
508 |
|
509 // TODO: Check if we can verify aQuality in any way. |
|
510 (void)aQuality; |
|
511 } |
|
512 |
|
513 |
|
514 void CT_LbsConflictStep_canceltracking::NotifyReleaseLcsLocationNotification(const CLbsNetworkProtocolBase::TLbsPrivacyResponse& aResult) |
|
515 { |
|
516 (void)aResult; |
|
517 |
|
518 // Unexpected callback for this test record the sequence event to fail test. |
|
519 if (iState == EReqPosUpdate) |
|
520 { |
|
521 INFO_PRINTF1(_L("Got - Self MOLR - NetSim Notify Release Lcs Location Notification - Event.")); |
|
522 SetCurrentSeqEvent(ESelf_MOLR_NetSim_Got_NotifyReleaseLcsLocationNotification); |
|
523 } |
|
524 |
|
525 else |
|
526 { |
|
527 INFO_PRINTF1(_L("Got - X3P MOLR - NetSim Notify Release Lcs Location Notification - Event.")); |
|
528 SetCurrentSeqEvent(ESelf_MOLR_NetSim_Got_NotifyReleaseLcsLocationNotification); |
|
529 } |
|
530 } |
|
531 |
|
532 |
|
533 void CT_LbsConflictStep_canceltracking::NotifyFacilityLcsMoLrResult(TInt aReason, const TPositionInfo& aPosition) |
|
534 { |
|
535 if (iState == EReqPosUpdate) |
|
536 { |
|
537 INFO_PRINTF1(_L("Got - Self MOLR - NetSim Notify Facility Lcs MoLr Result - Event.")); |
|
538 SetCurrentSeqEvent(ESelf_MOLR_NetSim_Got_NotifyFacilityLcsMoLrResult); |
|
539 } |
|
540 else |
|
541 { |
|
542 INFO_PRINTF1(_L("Got - Self MOLR - NetSim Notify Facility Lcs MoLr Result - Event.")); |
|
543 SetCurrentSeqEvent(EX3P_TIMER_MOLR_NetSim_Got_NotifyFacilityLcsMoLrResult); |
|
544 } |
|
545 |
|
546 // Verify reason code.. |
|
547 if (aReason != KErrNone) |
|
548 { |
|
549 INFO_PRINTF2(_L("Failed test, bad release reason %d."), aReason); |
|
550 SetTestStepResult(EFail); |
|
551 } |
|
552 |
|
553 // Verify the real position returned from the network, this will be the same position |
|
554 // we sent to the network as the result of the MO-LR, thus use the entry given by |
|
555 // the test module. |
|
556 T_LbsUtils utils; |
|
557 RPointerArray<TAny>& verifyPosInfoArr = iParent.iSharedData->iVerifyPosInfoArr; |
|
558 TPositionInfo* verifyRealPosInfo = reinterpret_cast<TPositionInfo*>(verifyPosInfoArr[0]); |
|
559 |
|
560 if (!utils.Compare_PosInfo(*verifyRealPosInfo, aPosition)) |
|
561 { |
|
562 INFO_PRINTF1(_L("Failed test, position incorrect.")); |
|
563 SetTestStepResult(EFail); |
|
564 } |
|
565 } |
|
566 |
|
567 |
|
568 void CT_LbsConflictStep_canceltracking::NotifyMeasurementReportLocation(const TPositionInfo& aPosition) |
|
569 { |
|
570 // Determine and record sequence event. |
|
571 if (iState == EReqPosUpdate) |
|
572 { |
|
573 INFO_PRINTF1(_L("Got - Self MOLR - NetSim Notify Measurement Report - Event.")); |
|
574 SetCurrentSeqEvent(ESelf_MOLR_NetSim_Got_NotifyMeasurementReportLocation); |
|
575 } |
|
576 |
|
577 else if(iState == EReqX3P) |
|
578 { |
|
579 INFO_PRINTF1(_L("Got - X3P MOLR - NetSim Notify Measurement Report - Event.")); |
|
580 SetCurrentSeqEvent(EX3P_TIMER_MOLR_NetSim_Got_NotifyMeasurementReportLocation); |
|
581 } |
|
582 |
|
583 |
|
584 // Verify the real position given to the network, this will be the same position |
|
585 // returned as the result of the MO-LR, thus use the entry given by |
|
586 // the test module. |
|
587 T_LbsUtils utils; |
|
588 RPointerArray<TAny>& verifyPosInfoArr = iParent.iSharedData->iVerifyPosInfoArr; |
|
589 TPositionInfo* verifyRealPosInfo = reinterpret_cast<TPositionInfo*>(verifyPosInfoArr[0]); |
|
590 |
|
591 if (!utils.Compare_PosInfo(*verifyRealPosInfo, aPosition)) |
|
592 { |
|
593 INFO_PRINTF1(_L("Failed test, position incorrect.")); |
|
594 SetTestStepResult(EFail); |
|
595 } |
|
596 } |
|
597 |
|
598 |
|
599 void CT_LbsConflictStep_canceltracking::NotifyMeasurementReportRequestMoreAssistanceData(const TLbsAssistanceDataGroup& aFilter) |
|
600 { |
|
601 (void)aFilter; |
|
602 |
|
603 // Unexpected callback for this test, record the sequence event to fail test. |
|
604 if (iState == EReqPosUpdate) |
|
605 { |
|
606 INFO_PRINTF1(_L("Got - Self MOLR - NetSim Notify Measurement Report Request More Assistance Data - Event.")); |
|
607 SetCurrentSeqEvent(ESelf_MOLR_NetSim_Got_NotifyMeasurementReportRequestMoreAssistanceData); |
|
608 } |
|
609 |
|
610 else |
|
611 { |
|
612 INFO_PRINTF1(_L("Got - X3P(PUSH) MOLR - NetSim Notify Measurement Report Request More Assistance Data - Event.")); |
|
613 SetCurrentSeqEvent(EX3P_TIMER_MOLR_NetSim_Got_NotifyMeasurementReportRequestMoreAssistanceData); |
|
614 } |
|
615 } |
|
616 |
|
617 |
|
618 void CT_LbsConflictStep_canceltracking::NotifyMeasurementReportControlFailure(TInt aReason) |
|
619 { |
|
620 if (iState == EReqPosUpdate) |
|
621 { |
|
622 INFO_PRINTF2(_L("Got - Self MOLR - Net Sim Notify Measurement Report Control Failure - Event. Reason = %d"), aReason); |
|
623 SetCurrentSeqEvent(ESelf_MOLR_NetSim_Got_NotifyMeasurementReportControlFailure); |
|
624 } |
|
625 |
|
626 else |
|
627 { |
|
628 INFO_PRINTF2(_L("Got - X3P MOLR(PUSH) - Net Sim Notify Measurement Report Control Failure - Event. Reason = %d"), aReason); |
|
629 SetCurrentSeqEvent(EX3P_TIMER_MOLR_NetSim_Got_NotifyMeasurementReportControlFailure); |
|
630 } |
|
631 |
|
632 TInt expectedErr = KErrNone; |
|
633 if (iTestCaseId == 12) |
|
634 { |
|
635 expectedErr = KErrCancel; |
|
636 } |
|
637 |
|
638 // Verify reason code. |
|
639 if (aReason != expectedErr) |
|
640 { |
|
641 INFO_PRINTF2(_L("Failed test, bad control failure reason %d."), aReason); |
|
642 SetTestStepResult(EFail); |
|
643 } |
|
644 |
|
645 |
|
646 } |
|
647 |
|
648 |
|
649 /** Notify position update callback. |
|
650 |
|
651 The notify position update has completed. |
|
652 */ |
|
653 void CT_LbsConflictStep_canceltracking::MT_LbsDoPosUpdateCallback(TRequestStatus& aStatus) |
|
654 { |
|
655 INFO_PRINTF1(_L("Got - Client Notify Update Complete - Callback Event.")); |
|
656 SetCurrentSeqEvent(EClient_Got_PosUpdate_Complete); |
|
657 |
|
658 if (iKErrServerBusyExpected) |
|
659 { |
|
660 iKErrServerBusyExpected = EFalse; |
|
661 if (KErrServerBusy == aStatus.Int()) |
|
662 { |
|
663 INFO_PRINTF1(_L("KErrServerBusy as expected")); |
|
664 } |
|
665 else |
|
666 { |
|
667 INFO_PRINTF2(_L("Failed test, expected pos update result KErrServerBusy but got err = %d."), aStatus.Int()); |
|
668 SetTestStepResult(EFail); |
|
669 } |
|
670 } |
|
671 else |
|
672 if (iKErrHighPriorityRecExpected) |
|
673 { |
|
674 iKErrHighPriorityRecExpected = EFalse; |
|
675 if (KErrPositionHighPriorityReceive == aStatus.Int()) |
|
676 { |
|
677 INFO_PRINTF1(_L("KErrPositionHighPriorityReceive as expected")); |
|
678 } |
|
679 else |
|
680 { |
|
681 INFO_PRINTF2(_L("Failed test, expected pos update result KErrorHighPriorityReceived but got err = %d."), aStatus.Int()); |
|
682 SetTestStepResult(EFail); |
|
683 } |
|
684 } |
|
685 else |
|
686 if (iCancelSubState) |
|
687 { |
|
688 iCancelSubState = EFalse; |
|
689 // should be KErrCancel after a cancel |
|
690 if (KErrCancel == aStatus.Int()) |
|
691 { |
|
692 INFO_PRINTF1(_L("KErrCancel as expected")); |
|
693 |
|
694 //iState = EReqX3P; |
|
695 // Create a posinfo and store in our shared array for later verification. |
|
696 RPointerArray<TAny>& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr; |
|
697 TPositionInfo* posInfo = new(ELeave) TPositionInfo(); |
|
698 |
|
699 posInfoArr.Append(posInfo); |
|
700 |
|
701 // Start TIMER X3P. |
|
702 TLbsTransmitPositionOptions transOpts; |
|
703 |
|
704 iDoX3P->SetOptions(transOpts); // Set timeout value to 0, to disable the timeout. |
|
705 INFO_PRINTF1(_L("Start X3P(TIMER)")); |
|
706 iDoX3P->StartL(KTransmitTimerDestination, KTransmitTimerPriority, *posInfo); |
|
707 |
|
708 } |
|
709 else |
|
710 { |
|
711 INFO_PRINTF2(_L("Failed test, pos update result err = %d."), aStatus.Int()); |
|
712 SetTestStepResult(EFail); |
|
713 |
|
714 } |
|
715 |
|
716 } |
|
717 else if (iState == EReqPosUpdate) |
|
718 { |
|
719 // no need to check posItion here! |
|
720 |
|
721 // Create a posinfo and store in our shared array for later verification. |
|
722 RPointerArray<TAny>& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr; |
|
723 TPositionInfo* posInfo = new(ELeave) TPositionInfo(); |
|
724 |
|
725 T_LbsUtils utils; |
|
726 utils.ResetAndDestroy_PosInfoArr(posInfoArr); // Clear previous entries before new entry is appended. |
|
727 |
|
728 posInfoArr.Append(posInfo); |
|
729 |
|
730 switch (iTestCaseId) |
|
731 { |
|
732 case 10: |
|
733 { |
|
734 INFO_PRINTF1(_L("Start second tracking NPUD")); |
|
735 iDoPosUpdate->StartL(*posInfo); |
|
736 |
|
737 INFO_PRINTF1(_L("Cancel tracking NPUD stops tracking!")); |
|
738 iDoPosUpdate->CancelRequest(); // stops tracking! |
|
739 iCancelSubState = ETrue; |
|
740 break; |
|
741 } |
|
742 |
|
743 case 11: |
|
744 { |
|
745 TPositionUpdateOptions optsA; |
|
746 TTimeIntervalMicroSeconds interval = 0; // stops tracking! |
|
747 optsA.SetUpdateInterval(interval); |
|
748 INFO_PRINTF1(_L("Tracking Interval = 0 stops tracking!")); |
|
749 iDoPosUpdate->SetOptions(optsA); |
|
750 |
|
751 RPointerArray<TAny>& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr; |
|
752 TPositionInfo* posInfo = new(ELeave) TPositionInfo(); |
|
753 |
|
754 posInfoArr.Append(posInfo); |
|
755 |
|
756 // Start X3P. |
|
757 TLbsTransmitPositionOptions transOpts; |
|
758 |
|
759 iDoX3P->SetOptions(transOpts); // Set timeout value to 0, to disable the timeout. |
|
760 INFO_PRINTF1(_L("Start X3P(TIMER)")); |
|
761 |
|
762 |
|
763 iDoX3P->StartL(KTransmitTimerDestination, KTransmitTimerPriority, *posInfo); |
|
764 |
|
765 break; |
|
766 } |
|
767 case 12: |
|
768 { |
|
769 INFO_PRINTF1(_L("ClosePositioner - stops tracking!")); |
|
770 |
|
771 RPointerArray<TAny>& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr; |
|
772 TPositionInfo* posInfo = new(ELeave) TPositionInfo(); |
|
773 posInfoArr.Append(posInfo); |
|
774 |
|
775 iDoPosUpdate->ClosePositioner(); // stops tracking! |
|
776 |
|
777 // Start X3P. |
|
778 TLbsTransmitPositionOptions transOpts; |
|
779 |
|
780 iDoX3P->SetOptions(transOpts); // Set timeout value to 0, to disable the timeout. |
|
781 |
|
782 // JCM: Note that low priority X3P should be queued and never return KErrServerBusy! |
|
783 // JCM: with the delay below the X3P succeeds! |
|
784 //INFO_PRINTF1(_L("Wait 5 seconds!!!!!!!!!!!!!!!!")); |
|
785 //User::After(5000000); |
|
786 //INFO_PRINTF1(_L("Start X3P(TIMER)")); |
|
787 |
|
788 iDoX3P->StartL(KTransmitTimerDestination, KTransmitTimerPriority, *posInfo); |
|
789 |
|
790 break; |
|
791 } |
|
792 |
|
793 } |
|
794 } |
|
795 } |
|
796 |
|
797 |
|
798 /** X3P transmit callback. |
|
799 |
|
800 The X3P transmit request has completed. |
|
801 */ |
|
802 void CT_LbsConflictStep_canceltracking::MT_LbsDoX3PCallback(TInt aTransmitId, TRequestStatus& aStatus) |
|
803 { |
|
804 (void)aTransmitId; |
|
805 |
|
806 INFO_PRINTF1(_L("Got - Client X3P Complete - Callback Event.")); |
|
807 SetCurrentSeqEvent(EClient_Got_X3P_Complete); |
|
808 |
|
809 |
|
810 if (KErrNone != aStatus.Int()) |
|
811 { |
|
812 INFO_PRINTF2(_L("Failed test, X3P transmit request err = %d."), aStatus.Int()); |
|
813 SetTestStepResult(EFail); |
|
814 //iState = EWaiting; |
|
815 } |
|
816 else |
|
817 { |
|
818 INFO_PRINTF2(_L("Test Passed, err = %d."), aStatus.Int()); |
|
819 //iState = EReqX3P; |
|
820 } |
|
821 |
|
822 } |
|
823 |
|
824 |