|
1 // Copyright (c) 2007-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 // This is the class implementation for the Module Information Tests |
|
15 // EPOC includes.sue |
|
16 // |
|
17 // |
|
18 |
|
19 // LBS includes. |
|
20 #include <lbssatellite.h> |
|
21 #include <lbs/lbsnetprotocolbase.h> |
|
22 #include <lbs/lbsassistancedatabuilderset.h> |
|
23 #include <e32math.h> |
|
24 #include <lbs/lbsloccommon.h> |
|
25 #include <lbs/lbsx3p.h> |
|
26 #include <lbs/lbsnetprotocolbase.h> |
|
27 #include <lbs/lbslocdatasourceclasstypes.h> |
|
28 #include <lbs/lbslocdatasourcegpsbase.h> |
|
29 #include <e32property.h> |
|
30 #include <lbserrors.h> |
|
31 #include "lbsnetinternalapi.h" |
|
32 #include "LbsInternalInterface.h" |
|
33 #include "LbsExtendModuleInfo.h" |
|
34 #include "lbsdevloggermacros.h" |
|
35 |
|
36 // LBS test includes. |
|
37 #include "ctlbsx3presetassistance.h" |
|
38 #include <lbs/test/tlbsutils.h> |
|
39 #include "argutils.h" |
|
40 |
|
41 #include <lbs/test/activeyield.h> |
|
42 |
|
43 const TInt KTimeOut = 30*1000*1000; |
|
44 const TInt KAdviceSystemStatusTimeout = 40*1000*1000; |
|
45 const TInt KTransmitTimeOut = 50*1000*1000; |
|
46 const TInt KSmallTimeOut = 3*1000*1000; |
|
47 const TInt KTimeoutWaitingForResetAssistanceData = 2 * 1000 * 1000; |
|
48 |
|
49 /** |
|
50 Static Constructor |
|
51 */ |
|
52 CT_LbsX3PResetAssistance* CT_LbsX3PResetAssistance::New(CT_LbsHybridX3PServer& aParent) |
|
53 { |
|
54 // Note the lack of ELeave. |
|
55 // This means that having insufficient memory will return NULL; |
|
56 CT_LbsX3PResetAssistance* testStep = new CT_LbsX3PResetAssistance(aParent); |
|
57 if (testStep) |
|
58 { |
|
59 TInt err = KErrNone; |
|
60 |
|
61 TRAP(err, testStep->ConstructL()); |
|
62 if (err) |
|
63 { |
|
64 delete testStep; |
|
65 testStep = NULL; |
|
66 } |
|
67 } |
|
68 return testStep; |
|
69 } |
|
70 |
|
71 |
|
72 /** |
|
73 * Constructor |
|
74 */ |
|
75 CT_LbsX3PResetAssistance::CT_LbsX3PResetAssistance(CT_LbsHybridX3PServer& aParent) |
|
76 : CT_LbsHybridX3PStep(aParent), iProxy(NULL), |
|
77 iNetworkMethod(ENetworkMethodInvalid), |
|
78 iPlannedPositionOriginator(EPositionOriginatorUnkown), |
|
79 iNetRequestRejected(EFalse), |
|
80 iAdminGpsMode(CLbsAdmin::EGpsModeUnknown) |
|
81 { |
|
82 SetTestStepName(KLbsX3PResetAssistance); |
|
83 } |
|
84 |
|
85 |
|
86 void CT_LbsX3PResetAssistance::ConstructL() |
|
87 { |
|
88 // Create the base class objects. |
|
89 CT_LbsHybridX3PStep::ConstructL(); |
|
90 User::LeaveIfError(iServer.Connect()); |
|
91 User::LeaveIfError(iTransmitter.Open(iServer)); |
|
92 } |
|
93 |
|
94 /** |
|
95 * Destructor |
|
96 */ |
|
97 CT_LbsX3PResetAssistance::~CT_LbsX3PResetAssistance() |
|
98 { |
|
99 iTransmitter.Close(); |
|
100 iServer.Close(); |
|
101 } |
|
102 |
|
103 TVerdict CT_LbsX3PResetAssistance::doTestStepPreambleL() |
|
104 { |
|
105 INFO_PRINTF1(_L(">>CT_LbsX3PResetAssistance::doTestStepPreambleL()")); |
|
106 CT_LbsHybridX3PStep::doTestStepPreambleL(); |
|
107 iNetworkExpectsMeasurements = EFalse; |
|
108 iNetworkExpectsPositions = EFalse; |
|
109 |
|
110 // Get the GPS mode set in the Admin |
|
111 CLbsAdmin* admin = CLbsAdmin::NewL(); |
|
112 CleanupStack::PushL(admin); |
|
113 |
|
114 TESTL(KErrNone == admin->Get(KLbsSettingRoamingGpsMode, iAdminGpsMode)); |
|
115 CleanupStack::PopAndDestroy(admin); |
|
116 |
|
117 // Set the network step |
|
118 iNetworkMethod = ENetworkMethodInvalid; |
|
119 |
|
120 SetTestStepResult(EPass); |
|
121 T_LbsUtils utils; |
|
122 |
|
123 // Get the Network Method |
|
124 _LIT(KNetworkMethod, "NetworkMethod"); |
|
125 TInt networkMethodInt; |
|
126 if(GetIntFromConfig(ConfigSection(), KNetworkMethod, networkMethodInt)) |
|
127 { |
|
128 iNetworkMethod = static_cast<TChosenNetworkMethod>(networkMethodInt); |
|
129 TEST(iNetworkMethod != ENetworkMethodInvalid); |
|
130 } |
|
131 else |
|
132 { |
|
133 INFO_PRINTF1(_L("CT_LbsX3PResetAssistance::doTestStepPreambleL() - FAILED: no network method configured")); |
|
134 TEST(EFalse); |
|
135 } |
|
136 |
|
137 // Is network method supported by module? |
|
138 TPositionModuleInfoExtended::TDeviceGpsModeCapabilities deviceCapabilities; |
|
139 TInt err = LbsModuleInfo::GetDeviceCapabilities(KLbsGpsLocManagerUid, deviceCapabilities); |
|
140 if((!(deviceCapabilities & TPositionModuleInfoExtended::EDeviceGpsModeTerminalAssisted)) && (!(deviceCapabilities & TPositionModuleInfoExtended::EDeviceGpsModeSimultaneousTATB))) |
|
141 { |
|
142 if(iNetworkMethod == ETerminalAssistedNetworkMethod) |
|
143 { |
|
144 iNetRequestRejected = ETrue; |
|
145 } |
|
146 } |
|
147 if((!(deviceCapabilities & TPositionModuleInfoExtended::EDeviceGpsModeTerminalBased)) && (!(deviceCapabilities & TPositionModuleInfoExtended::EDeviceGpsModeSimultaneousTATB))) |
|
148 { |
|
149 if(iNetworkMethod == ETerminalBasedNetworkMethod) |
|
150 { |
|
151 iNetRequestRejected = ETrue; |
|
152 } |
|
153 } |
|
154 |
|
155 // Get the position originator |
|
156 _LIT(KPositionOriginator, "PositionOriginator"); |
|
157 TInt positionOriginatorInt; |
|
158 if(GetIntFromConfig(ConfigSection(), KPositionOriginator, positionOriginatorInt)) |
|
159 { |
|
160 iPlannedPositionOriginator = static_cast<TPlannedPositionOriginator>(positionOriginatorInt); |
|
161 TEST(iPlannedPositionOriginator != EPositionOriginatorUnkown); |
|
162 } |
|
163 else |
|
164 { |
|
165 INFO_PRINTF1(_L("CT_LbsX3PResetAssistance::doTestStepPreambleL() - FAILED: no position originator configured")); |
|
166 TEST(EFalse); |
|
167 } |
|
168 |
|
169 // Get the step for sending reset |
|
170 _LIT(KStepForSendingReset, "StepForReset"); |
|
171 TInt stepForResetInt; |
|
172 if(GetIntFromConfig(ConfigSection(), KStepForSendingReset, stepForResetInt)) |
|
173 { |
|
174 iStepForSendingReset = static_cast<TNetworkStep>(stepForResetInt); |
|
175 TEST(iStepForSendingReset >= EInitial && iStepForSendingReset <= EAfterSessionClose); |
|
176 } |
|
177 else |
|
178 { |
|
179 INFO_PRINTF1(_L("CT_LbsMTLRResetAssistance::doTestStepPreambleL() - FAILED: no step for sending reset configured")); |
|
180 TEST(EFalse); |
|
181 } |
|
182 |
|
183 // Get the warm up option |
|
184 _LIT(KWarmUpModule, "WarmUpModule"); |
|
185 TInt warmUpModuleInt; |
|
186 if(GetIntFromConfig(ConfigSection(), KWarmUpModule, warmUpModuleInt)) |
|
187 { |
|
188 iWarmUpModule = warmUpModuleInt == 0 ? EFalse : ETrue; |
|
189 } |
|
190 else |
|
191 { |
|
192 iWarmUpModule = EFalse; |
|
193 } |
|
194 |
|
195 // Get the warm up option |
|
196 _LIT(KResetMark, "ResetMask"); |
|
197 TInt resetMask; |
|
198 if(!GetIntFromConfig(ConfigSection(), KResetMark, resetMask)) |
|
199 { |
|
200 resetMask = 0xFFFFFFFF; |
|
201 } |
|
202 iResetMask = resetMask; |
|
203 |
|
204 iProxy = CNetProtocolProxy::NewL(); |
|
205 |
|
206 return TestStepResult(); |
|
207 } |
|
208 |
|
209 TVerdict CT_LbsX3PResetAssistance::doTestStepPostambleL() |
|
210 { |
|
211 INFO_PRINTF1(_L(">>CT_LbsX3PResetAssistance::doTestStepPostambleL()")); |
|
212 iNetworkExpectsMeasurements = EFalse; |
|
213 iNetworkExpectsPositions = EFalse; |
|
214 iNetworkMethod = ENetworkMethodInvalid; |
|
215 iPlannedPositionOriginator = EPositionOriginatorUnkown; |
|
216 delete iProxy; |
|
217 iProxy = NULL; |
|
218 CT_LbsHybridX3PStep::doTestStepPostambleL(); |
|
219 return TestStepResult(); |
|
220 } |
|
221 |
|
222 TVerdict CT_LbsX3PResetAssistance::doTestStepL() |
|
223 { |
|
224 INFO_PRINTF1(_L("CT_LbsX3PResetAssistance::doTestStepL()")); |
|
225 // Stop the test if the preamble failed |
|
226 TESTL(TestStepResult() == EPass); |
|
227 |
|
228 // >> AdviceSystemStatus(ESystemStatusNone) |
|
229 TESTL(iProxy->WaitForResponse(KAdviceSystemStatusTimeout) == ENetMsgGetCurrentCapabilitiesResponse); |
|
230 INFO_PRINTF1(_L(">>>>>>>>>>>>>>>>>>>>>>>>>>> AdviceSystemStatus(ESystemStatusNone)")); |
|
231 CLbsNetworkProtocolBase::TLbsSystemStatus getStatus; |
|
232 TInt cleanupCnt; |
|
233 cleanupCnt = iProxy->GetArgsLC(ENetMsgGetCurrentCapabilitiesResponse, &getStatus); |
|
234 TESTL(getStatus == CLbsNetworkProtocolBase::ESystemStatusNone); |
|
235 CleanupStack::PopAndDestroy(cleanupCnt); |
|
236 |
|
237 TBool moduleWarmedUp(EFalse); |
|
238 TBool expectExtraRequestForAssistanceData(EFalse); |
|
239 do |
|
240 { |
|
241 iState = EInitializing; |
|
242 if(moduleWarmedUp) |
|
243 { |
|
244 iWarmUpModule = EFalse; |
|
245 } |
|
246 |
|
247 if(!iWarmUpModule && iStepForSendingReset == EBeforeSession) |
|
248 { |
|
249 SendResetAssistanceDataL(); |
|
250 } |
|
251 |
|
252 //Initiate X3P start |
|
253 // >> TransmitPosition() from App |
|
254 _LIT(KThirdParty,"+4407825255981"); |
|
255 const TInt KPriority=6; |
|
256 TLbsTransmitPositionOptions options(static_cast<TTimeIntervalMicroSeconds>(KTransmitTimeOut)); |
|
257 iTransmitter.SetTransmitOptions(options); |
|
258 INFO_PRINTF1(_L(" (App) TransmitPosition()")); |
|
259 CTransmitServerWatcher *pWatch = CTransmitServerWatcher::NewLC(iTransmitter, this); |
|
260 pWatch->IssueTransmitPosition(KThirdParty, KPriority); |
|
261 |
|
262 // RequestTransmitLocation() at PM |
|
263 TESTL(iProxy->WaitForResponse(KTimeOut) == ENetMsgRequestTransmitLocation); |
|
264 INFO_PRINTF1(_L(">>>>>>>>>>>>>>>>>>>>>>>>>>> RequestTransmitLocation()")); |
|
265 TBufC16<14> thirdParty(KThirdParty); |
|
266 TPtr16 ptr = thirdParty.Des(); |
|
267 HBufC16* getThirdParty = NULL; |
|
268 TLbsNetSessionId* getSessionId = NULL; |
|
269 TInt getPriority(0); |
|
270 cleanupCnt = iProxy->GetArgsLC(ENetMsgRequestTransmitLocation, &getSessionId, &getThirdParty, &getPriority); |
|
271 TESTL(ptr.Compare(*getThirdParty)==KErrNone); |
|
272 TESTL(getPriority == KPriority); |
|
273 iSessionId = *getSessionId; //session ID is initialised by LBS |
|
274 CleanupStack::PopAndDestroy(cleanupCnt); |
|
275 |
|
276 if(!iWarmUpModule && iStepForSendingReset == EBeginningOfSession) |
|
277 { |
|
278 SendResetAssistanceDataL(); |
|
279 } |
|
280 |
|
281 // << ProcessStatusUpdate(EServiceTransmitThirdParty) |
|
282 INFO_PRINTF1(_L("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ProcessStatusUpdate(EServiceTransmitThirdParty)")); |
|
283 MLbsNetworkProtocolObserver::TLbsNetProtocolService service = MLbsNetworkProtocolObserver::EServiceTransmitThirdParty; |
|
284 iProxy->CallL(ENetMsgProcessStatusUpdate, &service); |
|
285 //End Initiate |
|
286 |
|
287 //Reference Position Notification Start |
|
288 // << ProcessLocationUpdate(refpos) |
|
289 TPositionInfo refPosInfo; |
|
290 INFO_PRINTF1(_L("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ProcessLocationUpdate(Ref Pos)")); |
|
291 refPosInfo = ArgUtils::ReferencePositionInfo(); |
|
292 iProxy->CallL(ENetMsgProcessLocationUpdate, &iSessionId, &refPosInfo); |
|
293 //Reference Position Notification End |
|
294 |
|
295 //Assistance Data Notification Start |
|
296 // ProcessAssistanceData() |
|
297 TInt getReason = KErrNone; |
|
298 TLbsAsistanceDataGroup dataRequestMask = EAssistanceDataReferenceTime; |
|
299 RLbsAssistanceDataBuilderSet assistanceData; |
|
300 ArgUtils::PopulateLC(assistanceData); |
|
301 INFO_PRINTF1(_L("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ProcessAssistanceData(EAssistanceDataReferenceTime)")); |
|
302 iProxy->CallL(ENetMsgProcessAssistanceData, &dataRequestMask, &assistanceData, &getReason); |
|
303 CleanupStack::PopAndDestroy(&assistanceData); |
|
304 // Assistance Data Notification End |
|
305 |
|
306 if(!iWarmUpModule && iStepForSendingReset == EAfterAssistanceData) |
|
307 { |
|
308 expectExtraRequestForAssistanceData = SendResetAssistanceDataL(); |
|
309 } |
|
310 |
|
311 // Network Location Request Start |
|
312 // ProcessLocationRequest() |
|
313 const TBool emergency(EFalse); |
|
314 TLbsNetPosRequestQuality quality = ArgUtils::QualityAlpha2(); |
|
315 TLbsNetPosRequestMethod method = RequestNetworkMethod(); |
|
316 INFO_PRINTF1(_L("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ProcessLocationRequest(QualityAlpha2)")); |
|
317 iProxy->CallL(ENetMsgProcessLocationRequest, &iSessionId, &emergency, &service, &quality, &method); |
|
318 // Network Location Request Stop |
|
319 |
|
320 //Start the timer |
|
321 TTime timerStart; |
|
322 timerStart.HomeTime(); |
|
323 |
|
324 TLbsAsistanceDataGroup getDataGroup; |
|
325 TInt reason = KErrNone; |
|
326 |
|
327 // Module should ask for assistance data if mode supported |
|
328 if(!iNetRequestRejected) |
|
329 { |
|
330 // RequestAssistanceData(0) |
|
331 TESTL(iProxy->WaitForResponse(KSmallTimeOut) == ENetMsgRequestAssistanceData); |
|
332 cleanupCnt = iProxy->GetArgsLC(ENetMsgRequestAssistanceData, &getDataGroup); |
|
333 if(!expectExtraRequestForAssistanceData || (iNetworkMethod == EAutonomousNetworkMethod && !iWarmUpModule)) |
|
334 { |
|
335 INFO_PRINTF1(_L("&>>>>>>>>>>>>>>>>>>>>>>>>>>> RequestAssistanceData(0)")); |
|
336 TESTL(getDataGroup == EAssistanceDataNone); |
|
337 } |
|
338 else |
|
339 { |
|
340 expectExtraRequestForAssistanceData = EFalse; |
|
341 INFO_PRINTF1(_L(">>>>>>>>>>>>>>>>>>>>>>>>>>> RequestAssistanceData(EAssistanceDataReferenceTime)")); |
|
342 TESTL(getDataGroup == EAssistanceDataReferenceTime); |
|
343 // << ProcessAssistanceData(EAssistanceDataReferenceTime) |
|
344 TLbsAsistanceDataGroup dataRequestMask = EAssistanceDataReferenceTime; |
|
345 RLbsAssistanceDataBuilderSet assistanceData; |
|
346 ArgUtils::PopulateLC(assistanceData); |
|
347 reason = KErrNone; |
|
348 INFO_PRINTF1(_L("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ProcessAssistanceData(EAssistanceDataReferenceTime)")); |
|
349 iProxy->CallL(ENetMsgProcessAssistanceData, &dataRequestMask, &assistanceData, &reason); |
|
350 CleanupStack::PopAndDestroy(&assistanceData); |
|
351 } |
|
352 CleanupStack::PopAndDestroy(cleanupCnt); |
|
353 } |
|
354 |
|
355 // need to yield to scheduler here to allow gps mode notifications and ref pos notification to happen |
|
356 CheckForObserverEventTestsL(KTimeOut, *this); |
|
357 INFO_PRINTF1(_L(" Got Ref Pos")); |
|
358 |
|
359 DecideWhatNetworkReceives(); |
|
360 //Find the time elapsed from timer |
|
361 TTimeIntervalMicroSeconds microseconds; |
|
362 TTime timerStop; |
|
363 timerStop.HomeTime(); |
|
364 microseconds = timerStop.MicroSecondsFrom(timerStart); |
|
365 TInt64 timeElapsed = microseconds.Int64(); |
|
366 |
|
367 /*** NRH's Alpha2 timer expires; should get a response now ***/ |
|
368 //Test that we do not get response before alpha2 has expired |
|
369 TInt delta = 0.5*1000*1000; // 0.5s |
|
370 getSessionId = NULL; |
|
371 getReason = KErrNone; |
|
372 TPositionSatelliteInfo* getPositionInfo = NULL; |
|
373 TPositionGpsMeasurementInfo* getMeasurementInfo = NULL; |
|
374 if(iNetRequestRejected) // network has asked for an unsupported gps mode |
|
375 { |
|
376 // we may get an error response _before_ alpha2 timer expires |
|
377 TESTL(iProxy->WaitForResponse(KAlpha2Timeout-timeElapsed+delta) == ENetMsgRespondLocationRequest); |
|
378 INFO_PRINTF1(_L(">>>>>>>>>>>>>>>>>>>>>>>>>>> RespondLocationRequest")); |
|
379 cleanupCnt = iProxy->GetArgsLC(ENetMsgRespondLocationRequest, &getSessionId, &getReason, &getPositionInfo); |
|
380 TEST(getReason==KErrNotSupported); |
|
381 INFO_PRINTF2(_L(" RespondLocationRequest reason = %x"), getReason); |
|
382 CleanupStack::PopAndDestroy(cleanupCnt); |
|
383 } |
|
384 else |
|
385 { |
|
386 // The measurements: |
|
387 if(iNetworkExpectsMeasurements) // If network expecting measurements, they will come first |
|
388 { |
|
389 getSessionId = NULL; |
|
390 getReason = KErrNone; |
|
391 getMeasurementInfo = NULL; |
|
392 // Should not get a response before Alpha2 timer expires: |
|
393 TESTL(iProxy->WaitForResponse(KAlpha2Timeout-timeElapsed-delta) == ENetMsgTimeoutExpired); |
|
394 INFO_PRINTF1(_L(" No RespondLocationRequest before Alpha2 timer expired")); |
|
395 TESTL(iProxy->WaitForResponse(2*delta) == ENetMsgRespondLocationRequest); |
|
396 INFO_PRINTF1(_L(">>>>>>>>>>>>>>>>>>>>>>>>>>> RespondLocationRequest(meas)")); |
|
397 cleanupCnt = iProxy->GetArgsLC(ENetMsgRespondLocationRequest, &getSessionId, &getReason, &getMeasurementInfo); |
|
398 TESTL(getSessionId->SessionNum() == iSessionId.SessionNum()); |
|
399 if(getReason != KErrNone) |
|
400 { |
|
401 INFO_PRINTF2(_L("getReason = 0x%x"), getReason); |
|
402 } |
|
403 TESTL(getReason==KErrNone); |
|
404 TESTL(getMeasurementInfo->PositionClassType() == EPositionGpsMeasurementInfoClass); |
|
405 CleanupStack::PopAndDestroy(cleanupCnt); |
|
406 |
|
407 if(!iWarmUpModule && iStepForSendingReset == EAfterMeasurements) |
|
408 { |
|
409 expectExtraRequestForAssistanceData = SendResetAssistanceDataL(); |
|
410 } |
|
411 |
|
412 // Make another request from the network |
|
413 INFO_PRINTF1(_L("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ProcessLocationRequest(Quality)")); |
|
414 quality = ArgUtils::Quality(); |
|
415 iProxy->CallL(ENetMsgProcessLocationRequest, &iSessionId, &emergency, &service, &quality, &method); |
|
416 |
|
417 // module will request assistance data again (mask 0) |
|
418 // >> RequestAssistanceData(0) |
|
419 TESTL(iProxy->WaitForResponse(KSmallTimeOut) == ENetMsgRequestAssistanceData); |
|
420 INFO_PRINTF1(_L(">>>>>>>>>>>>>>>>>>>>>>>>>>> RequestAssistanceData(0)")); |
|
421 cleanupCnt = iProxy->GetArgsLC(ENetMsgRequestAssistanceData, &getDataGroup); |
|
422 if(!expectExtraRequestForAssistanceData || (iNetworkMethod == EAutonomousNetworkMethod && !iWarmUpModule)) |
|
423 { |
|
424 INFO_PRINTF1(_L(">> RequestAssistanceData(0)")); |
|
425 TESTL(getDataGroup == EAssistanceDataNone); |
|
426 } |
|
427 else |
|
428 { |
|
429 expectExtraRequestForAssistanceData = EFalse; |
|
430 INFO_PRINTF1(_L(">> RequestAssistanceData(EAssistanceDataReferenceTime)")); |
|
431 TESTL(getDataGroup == EAssistanceDataReferenceTime); |
|
432 // << ProcessAssistanceData(EAssistanceDataReferenceTime) |
|
433 TLbsAsistanceDataGroup dataRequestMask = EAssistanceDataReferenceTime; |
|
434 RLbsAssistanceDataBuilderSet assistanceData; |
|
435 ArgUtils::PopulateLC(assistanceData); |
|
436 reason = KErrNone; |
|
437 INFO_PRINTF1(_L("<< ProcessAssistanceData(EAssistanceDataReferenceTime)")); |
|
438 iProxy->CallL(ENetMsgProcessAssistanceData, &dataRequestMask, &assistanceData, &reason); |
|
439 CleanupStack::PopAndDestroy(&assistanceData); |
|
440 } |
|
441 CleanupStack::PopAndDestroy(cleanupCnt); |
|
442 |
|
443 // >> RespondLocationRequest() |
|
444 TESTL(iProxy->WaitForResponse(KTTimeout + delta) == ENetMsgRespondLocationRequest); |
|
445 INFO_PRINTF1(_L(">>>>>>>>>>>>>>>>>>>>>>>>>>> RespondLocationRequest(meas)")); |
|
446 getSessionId = NULL; |
|
447 getReason = KErrNone; |
|
448 getMeasurementInfo = NULL; |
|
449 cleanupCnt = iProxy->GetArgsLC(ENetMsgRespondLocationRequest, &getSessionId, &getReason, &getMeasurementInfo); |
|
450 |
|
451 // Check it is measurement |
|
452 TESTL(getMeasurementInfo->PositionClassType() == EPositionGpsMeasurementInfoClass); |
|
453 TESTL(getSessionId->SessionNum() == iSessionId.SessionNum()); |
|
454 TESTL(getReason == KErrNone); |
|
455 CleanupStack::PopAndDestroy(cleanupCnt); |
|
456 |
|
457 if(iPlannedPositionOriginator == EPositionOriginatorModule) |
|
458 { // if hybrid need to do one more request (which will result in module returning gps position) |
|
459 // << ProcessLocationRequest(SessionId, HybridMode, t) |
|
460 INFO_PRINTF1(_L("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ProcessLocationRequest(SessionId, HybridMode, t)")); |
|
461 iProxy->CallL(ENetMsgProcessLocationRequest, &iSessionId, &emergency, &service, &quality, &method); |
|
462 |
|
463 // >> RequestAssistanceData(0) |
|
464 INFO_PRINTF1(_L(">>>>>>>>>>>>>>>>>>>>>>>>>>> RequestAssistanceData(0)")); |
|
465 TESTL(iProxy->WaitForResponse(KTimeOut) == ENetMsgRequestAssistanceData); |
|
466 cleanupCnt = iProxy->GetArgsLC(ENetMsgRequestAssistanceData, &getDataGroup); |
|
467 TESTL(getDataGroup == EAssistanceDataNone); |
|
468 CleanupStack::PopAndDestroy(cleanupCnt); |
|
469 } |
|
470 } |
|
471 |
|
472 // The final position: |
|
473 if(iPlannedPositionOriginator == EPositionOriginatorModule) |
|
474 { |
|
475 // The module should return the position |
|
476 ASSERT(iNetworkExpectsPositions); |
|
477 INFO_PRINTF1(_L(" Network expecting position")); |
|
478 // >> RespondLocationRequest() - first measurement, second position. |
|
479 TESTL(iProxy->WaitForResponse(KTTimeout + delta) == ENetMsgRespondLocationRequest); |
|
480 INFO_PRINTF1(_L(">>>>>>>>>>>>>>>>>>>>>>>>>>> RespondLocationRequest(gpspos)")); |
|
481 getPositionInfo = NULL; |
|
482 getSessionId = NULL; |
|
483 getReason = KErrNone; |
|
484 cleanupCnt = iProxy->GetArgsLC(ENetMsgRespondLocationRequest, &getSessionId, &getReason, &getPositionInfo); |
|
485 // check it is a position |
|
486 TESTL(getPositionInfo->PositionClassType() == (EPositionInfoClass|EPositionCourseInfoClass|EPositionSatelliteInfoClass)); |
|
487 TESTL(getSessionId->SessionNum() == iSessionId.SessionNum()); |
|
488 TESTL(getReason == KErrNone); |
|
489 // Test position is the same as in the ini file data fed to the GPS module |
|
490 // $update,1,0,49.2,3.5,50,20,20* |
|
491 TPosition gpsPos; |
|
492 getPositionInfo->GetPosition(gpsPos); |
|
493 TESTL(gpsPos.Latitude()==49.2 && gpsPos.Longitude()==3.5 && gpsPos.Altitude()==50 && gpsPos.HorizontalAccuracy()==20 && gpsPos.VerticalAccuracy()==20); |
|
494 CleanupStack::PopAndDestroy(cleanupCnt); |
|
495 |
|
496 if(!iWarmUpModule && iStepForSendingReset == EAfterPosition) |
|
497 { |
|
498 SendResetAssistanceDataL(); |
|
499 } |
|
500 |
|
501 // << ProcessLocationUpdate(SessionId, FinalNetworkPosition) |
|
502 // Return modules' position as FinalNetworkPosition |
|
503 TPositionInfo gpsPosInfo; |
|
504 gpsPosInfo.SetPosition(gpsPos); |
|
505 gpsPosInfo.SetUpdateType(EPositionUpdateGeneral); |
|
506 gpsPosInfo.SetPositionMode(TPositionModuleInfo::ETechnologyTerminal | TPositionModuleInfo::ETechnologyAssisted); |
|
507 gpsPosInfo.SetPositionModeReason(EPositionModeReasonNone); |
|
508 INFO_PRINTF1(_L("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ProcessLocationUpdate(SessionId, FinalNetworkPosition)")); |
|
509 iProxy->CallL(ENetMsgProcessLocationUpdate, &iSessionId, &gpsPosInfo); |
|
510 } |
|
511 else if(iPlannedPositionOriginator == EPositionOriginatorNetwork) |
|
512 { |
|
513 // The network should return the position |
|
514 TPositionInfo positionInfo = ArgUtils::AccurateNetworkPositionInfo(); |
|
515 // << ProcessLocationUpdate(SessionId, FinalNetworkPosition) |
|
516 // Return FinalNetworkPosition |
|
517 INFO_PRINTF1(_L("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ProcessLocationUpdate(SessionId, FinalNetworkPosition)")); |
|
518 iProxy->CallL(ENetMsgProcessLocationUpdate, &iSessionId, &positionInfo); |
|
519 } |
|
520 } |
|
521 |
|
522 // Session Complete Start |
|
523 if(iNetRequestRejected) |
|
524 { |
|
525 reason = KErrNotSupported; |
|
526 } |
|
527 else |
|
528 { |
|
529 reason = KErrNone; |
|
530 } |
|
531 INFO_PRINTF1(_L("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ProcessSessionComplete()")); |
|
532 iProxy->CallL(ENetMsgProcessSessionComplete, &iSessionId, &reason); |
|
533 |
|
534 if(!iWarmUpModule && iStepForSendingReset == EAfterSessionClose) |
|
535 { |
|
536 SendResetAssistanceDataL(); |
|
537 } |
|
538 |
|
539 MLbsNetworkProtocolObserver::TLbsNetProtocolServiceMask activeServiceMask = MLbsNetworkProtocolObserver::EServiceNone; |
|
540 INFO_PRINTF1(_L("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ProcessStatusUpdate(EServiceNone)")); |
|
541 iProxy->CallL(ENetMsgProcessStatusUpdate, &activeServiceMask); |
|
542 // Session Complete Stop |
|
543 |
|
544 // need to yield to scheduler here to allow gps mode notifications and transmit pos notification to happen |
|
545 CheckForObserverEventTestsL(KTimeOut, *this); |
|
546 INFO_PRINTF1(_L(" Got Transmitted Pos")); |
|
547 |
|
548 // Done. Now cleanup... |
|
549 CleanupStack::PopAndDestroy(pWatch); |
|
550 moduleWarmedUp = ETrue; |
|
551 } while(iWarmUpModule); |
|
552 |
|
553 return TestStepResult(); |
|
554 } |
|
555 |
|
556 |
|
557 TLbsNetPosRequestMethod CT_LbsX3PResetAssistance::RequestNetworkMethod() |
|
558 /** |
|
559 This method will chose the appropiate method requested by the network, depending |
|
560 on the test settings |
|
561 |
|
562 @return The network method |
|
563 */ |
|
564 { |
|
565 |
|
566 TLbsNetPosRequestMethod method; |
|
567 if(iWarmUpModule) |
|
568 { // warm up in TB |
|
569 iNetworkExpectsPositions = ETrue; |
|
570 method = ArgUtils::RequestTerminalBasedMethod(); |
|
571 return method; |
|
572 } |
|
573 |
|
574 switch(iNetworkMethod) |
|
575 { |
|
576 case ETerminalBasedNetworkMethod: |
|
577 { |
|
578 iNetworkExpectsPositions = ETrue; |
|
579 method = ArgUtils::RequestTerminalBasedMethod(); |
|
580 break; |
|
581 } |
|
582 case ETerminalBasedTerminalAssistedNetworkMethod: |
|
583 { |
|
584 iNetworkExpectsMeasurements = ETrue; |
|
585 iNetworkExpectsPositions = ETrue; |
|
586 method = ArgUtils::RequestHybridMethod(); |
|
587 break; |
|
588 } |
|
589 case ETerminalAssistedNetworkMethod: |
|
590 { |
|
591 iNetworkExpectsMeasurements = ETrue; |
|
592 method = ArgUtils::RequestTAPMethod(); |
|
593 break; |
|
594 } |
|
595 case ETerminalAssistedTerminalBasedNetworkMethod: |
|
596 { |
|
597 iNetworkExpectsMeasurements = ETrue; |
|
598 iNetworkExpectsPositions = ETrue; |
|
599 method = ArgUtils::RequestTerminalAssistedAndTerminalBasedMethod(); |
|
600 break; |
|
601 } |
|
602 case EAutonomousNetworkMethod: |
|
603 { |
|
604 iNetworkExpectsPositions = ETrue; |
|
605 method = ArgUtils::RequestAutonomousMethod(); |
|
606 break; |
|
607 } |
|
608 case ENetworkMethodNotSet: |
|
609 { |
|
610 //we should set mode according to default admin |
|
611 TEST(iAdminGpsMode != CLbsAdmin::EGpsModeUnknown); |
|
612 switch(iAdminGpsMode) |
|
613 { |
|
614 case CLbsAdmin::EGpsPreferTerminalBased: |
|
615 { |
|
616 iNetworkExpectsPositions = ETrue; |
|
617 break; |
|
618 } |
|
619 case CLbsAdmin::EGpsPreferTerminalAssisted: |
|
620 case CLbsAdmin::EGpsAlwaysTerminalAssisted: |
|
621 { |
|
622 iNetworkExpectsMeasurements = ETrue; |
|
623 break; |
|
624 } |
|
625 case CLbsAdmin::EGpsAutonomous: // test framework doesn't currently support this |
|
626 default: |
|
627 { |
|
628 User::Invariant(); |
|
629 } |
|
630 } |
|
631 method = ArgUtils::RequestUnspecifiedMethod(); |
|
632 break; |
|
633 } |
|
634 default: |
|
635 { |
|
636 User::Invariant(); |
|
637 } |
|
638 } |
|
639 return method; |
|
640 } |
|
641 |
|
642 |
|
643 void CT_LbsX3PResetAssistance::DecideWhatNetworkReceives() |
|
644 /** |
|
645 This method checks what the module was finally set to and decides if the network |
|
646 should expect measuments, or positions |
|
647 */ |
|
648 { |
|
649 TLbsGpsOptionsArray options; |
|
650 TPckg<TLbsGpsOptionsArray> pckgOptions(options); |
|
651 TEST(KErrNone == RProperty::Get(KUidSystemCategory, ELbsTestAGpsModuleModeChanges, pckgOptions)); |
|
652 |
|
653 if(options.ClassType() & ELbsGpsOptionsArrayClass) |
|
654 { |
|
655 if(options.NumOptionItems() > 1) |
|
656 { |
|
657 // don't change anything (from what was set in RequestNetworkMethod()), the module is running in hybrid |
|
658 return; |
|
659 } |
|
660 } |
|
661 switch(options.GpsMode()) |
|
662 { |
|
663 case CLbsAdmin::EGpsAutonomous: |
|
664 { |
|
665 iNetworkExpectsPositions = EFalse; |
|
666 iNetworkExpectsMeasurements = EFalse; |
|
667 break; |
|
668 } |
|
669 case CLbsAdmin::EGpsPreferTerminalBased: |
|
670 case CLbsAdmin::EGpsAlwaysTerminalBased: |
|
671 { |
|
672 iNetworkExpectsMeasurements = EFalse; |
|
673 break; |
|
674 } |
|
675 case CLbsAdmin::EGpsPreferTerminalAssisted: |
|
676 case CLbsAdmin::EGpsAlwaysTerminalAssisted: |
|
677 { |
|
678 iNetworkExpectsPositions = EFalse; |
|
679 break; |
|
680 } |
|
681 default: |
|
682 { |
|
683 // change nothing |
|
684 } |
|
685 return; |
|
686 } |
|
687 } |
|
688 |
|
689 void CT_LbsX3PResetAssistance::OnTransmitRefPosition(TInt32 aErr, const TPositionInfoBase& /* aPosInfo */) |
|
690 { |
|
691 TESTL(aErr==KErrNone); |
|
692 ReturnToTestStep(); |
|
693 } |
|
694 |
|
695 void CT_LbsX3PResetAssistance::OnTransmitPosition(TInt32 aErr, const TPositionInfoBase& /* aPosInfo */) |
|
696 { |
|
697 if(iNetRequestRejected) |
|
698 { |
|
699 TESTL(aErr==KErrNotSupported); |
|
700 } |
|
701 else |
|
702 { |
|
703 // TO DO - verify technology type is as expected? |
|
704 TESTL(aErr==KErrNone); |
|
705 } |
|
706 |
|
707 ReturnToTestStep(); |
|
708 } |
|
709 |
|
710 TBool CT_LbsX3PResetAssistance::SendResetAssistanceDataL() |
|
711 { |
|
712 // First make sure that no reset of assistance data has been received by the GPS module |
|
713 RProperty resetAssistanceDataReceivedProperty; |
|
714 User::LeaveIfError(resetAssistanceDataReceivedProperty.Attach(KUidSystemCategory, ELbsTestAGpsModuleResetAssistanceDataFlag)); |
|
715 TInt resetReceivedStatus; |
|
716 TInt err = resetAssistanceDataReceivedProperty.Get(resetReceivedStatus); |
|
717 TESTL(err == KErrNone || err == KErrNotFound); |
|
718 if(err == KErrNone) |
|
719 { |
|
720 TESTL(resetReceivedStatus == ELbsTestAGpsResetAssistanceDataNotReceived); |
|
721 } |
|
722 |
|
723 // << ProcessAssistanceData(KPositionAssistanceDataReset) |
|
724 RLbsAssistanceDataBuilderSet assistanceData; |
|
725 CleanupClosePushL(assistanceData); |
|
726 assistanceData.OpenL(); |
|
727 TInt reason = KPositionAssistanceDataReset; |
|
728 INFO_PRINTF1(_L("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ProcessAssistanceData(KPositionAssistanceDataReset)")); |
|
729 iProxy->CallL(ENetMsgProcessAssistanceData, &iResetMask, &assistanceData, &reason); |
|
730 CleanupStack::PopAndDestroy(&assistanceData); |
|
731 |
|
732 // Now check the the module receives and verifies the ResetAssistanceData |
|
733 err = resetAssistanceDataReceivedProperty.Get(resetReceivedStatus); |
|
734 TESTL(err == KErrNone || err == KErrNotFound); |
|
735 if(err == KErrNotFound || resetReceivedStatus != ELbsTestAGpsResetAssistanceDataReceived) |
|
736 { |
|
737 RTimer timeout; |
|
738 timeout.CreateLocal(); |
|
739 CleanupClosePushL(timeout); |
|
740 |
|
741 TRequestStatus statTime = KRequestPending, |
|
742 statProp = KRequestPending; |
|
743 timeout.After(statTime, KTimeoutWaitingForResetAssistanceData); |
|
744 resetAssistanceDataReceivedProperty.Subscribe(statProp); |
|
745 User::WaitForRequest(statProp, statTime); |
|
746 |
|
747 if(KRequestPending == statProp.Int()) |
|
748 { |
|
749 resetAssistanceDataReceivedProperty.Cancel(); |
|
750 err = KErrTimedOut; |
|
751 } |
|
752 else |
|
753 { |
|
754 err = KErrNone; |
|
755 timeout.Cancel(); |
|
756 } |
|
757 |
|
758 User::WaitForRequest(statProp, statTime); // Coz the one that didn't signal earlier has |
|
759 // just been completed with KErrCancel, and |
|
760 // we want to avoid the otherwise inevitable |
|
761 // stray signal in any (nested) schedulers. |
|
762 if(err == KErrNone) |
|
763 { |
|
764 err = resetAssistanceDataReceivedProperty.Get(resetReceivedStatus); |
|
765 } |
|
766 CleanupStack::PopAndDestroy(&timeout); |
|
767 TESTL(err == KErrNone && resetReceivedStatus == ELbsTestAGpsResetAssistanceDataReceived); |
|
768 } |
|
769 // Reset the status on the property |
|
770 err = resetAssistanceDataReceivedProperty.Set(ELbsTestAGpsResetAssistanceDataNotReceived); |
|
771 TESTL(err == KErrNone); |
|
772 if((iResetMask & EAssistanceDataReferenceTime) != 0) |
|
773 { |
|
774 return ETrue; |
|
775 } |
|
776 else |
|
777 { |
|
778 return EFalse; |
|
779 } |
|
780 } |