96 // Create Network Protocol Proxy |
99 // Create Network Protocol Proxy |
97 CNetProtocolProxy* proxy = CNetProtocolProxy::NewL(); |
100 CNetProtocolProxy* proxy = CNetProtocolProxy::NewL(); |
98 CleanupStack::PushL(proxy); |
101 CleanupStack::PushL(proxy); |
99 |
102 |
100 // >> AdviceSystemStatus(0) - GetCurrentCapabilitiesResponse |
103 // >> AdviceSystemStatus(0) - GetCurrentCapabilitiesResponse |
101 TESTL(proxy->WaitForResponse(KTimeOut) == ENetMsgGetCurrentCapabilitiesResponse); |
104 result = proxy->WaitForResponse(KTimeOut); |
|
105 INFO_PRINTF3(_L("expecting ENetMsgGetCurrentCapabilitiesResponse(%d) got %d"),ENetMsgGetCurrentCapabilitiesResponse, result ); |
|
106 TESTL(result == ENetMsgGetCurrentCapabilitiesResponse); |
|
107 |
102 CLbsNetworkProtocolBase::TLbsSystemStatus status; |
108 CLbsNetworkProtocolBase::TLbsSystemStatus status; |
103 TInt cleanupCnt; |
109 TInt cleanupCnt; |
104 cleanupCnt = proxy->GetArgsLC(ENetMsgGetCurrentCapabilitiesResponse, &status); |
110 cleanupCnt = proxy->GetArgsLC(ENetMsgGetCurrentCapabilitiesResponse, &status); |
105 TESTL(status == CLbsNetworkProtocolBase::ESystemStatusNone); |
111 TESTL(status == CLbsNetworkProtocolBase::ESystemStatusNone); |
106 CleanupStack::PopAndDestroy(cleanupCnt); |
112 CleanupStack::PopAndDestroy(cleanupCnt); |
135 pWatch = CPosServerWatcher::NewLC(pos, *this); |
141 pWatch = CPosServerWatcher::NewLC(pos, *this); |
136 // Request a self-locate MoLr. |
142 // Request a self-locate MoLr. |
137 pWatch->IssueNotifyPositionUpdate(); |
143 pWatch->IssueNotifyPositionUpdate(); |
138 |
144 |
139 // >> RequestSelfLocation() |
145 // >> RequestSelfLocation() |
140 TESTL(proxy->WaitForResponse(KTimeOut) == ENetMsgRequestSelfLocation); |
146 //TESTL(proxy->WaitForResponse(KTimeOut) == ENetMsgRequestSelfLocation); |
141 |
147 result = proxy->WaitForResponse(KTimeOut); |
|
148 INFO_PRINTF3(_L("expecting ENetMsgRequestSelfLocation(%d) got %d"),ENetMsgRequestSelfLocation, result ); |
|
149 |
|
150 TESTL(result == ENetMsgRequestSelfLocation); |
|
151 |
|
152 |
142 // Process the response. |
153 // Process the response. |
143 TLbsNetSessionId* sessionId = NULL; |
154 TLbsNetSessionId* sessionId = NULL; |
144 TLbsNetPosRequestOptionsAssistance* opts = NULL; |
155 TLbsNetPosRequestOptionsAssistance* opts = NULL; |
145 TInt cleanupCnt; |
156 TInt cleanupCnt; |
146 |
157 |
223 |
236 |
224 // Request a self-locate MoLr. |
237 // Request a self-locate MoLr. |
225 pWatch->IssueNotifyPositionUpdate(); |
238 pWatch->IssueNotifyPositionUpdate(); |
226 |
239 |
227 // >> RequestSelfLocation() |
240 // >> RequestSelfLocation() |
228 TESTL(proxy->WaitForResponse(KTimeOut) == ENetMsgRequestSelfLocation); |
241 |
|
242 result = proxy->WaitForResponse(KTimeOut); |
|
243 INFO_PRINTF3(_L("expecting ENetMsgRequestSelfLocation(%d) got %d"),ENetMsgRequestSelfLocation, result ); |
|
244 TESTL(result == ENetMsgRequestSelfLocation); |
229 |
245 |
230 // Process the response. |
246 // Process the response. |
231 TLbsNetSessionId* sessionId = NULL; |
247 TLbsNetSessionId* sessionId = NULL; |
232 TLbsNetPosRequestOptionsAssistance* opts = NULL; |
248 TLbsNetPosRequestOptionsAssistance* opts = NULL; |
233 TInt cleanupCnt; |
249 TInt cleanupCnt; |
283 |
299 |
284 // Now that the hybrid/alpha2 has been requested, record current time to verify alpha2 timer expires correctly. |
300 // Now that the hybrid/alpha2 has been requested, record current time to verify alpha2 timer expires correctly. |
285 TTime startTime; |
301 TTime startTime; |
286 startTime.HomeTime(); |
302 startTime.HomeTime(); |
287 |
303 |
288 // >> RequestAssistanceData(0) |
|
289 TESTL(proxy->WaitForResponse(KTimeOut) == ENetMsgRequestAssistanceData); |
|
290 cleanupCnt = proxy->GetArgsLC(ENetMsgRequestAssistanceData, &dataMask); |
|
291 TESTL(dataMask == EAssistanceDataNone); |
|
292 CleanupStack::PopAndDestroy(cleanupCnt); |
|
293 |
|
294 // << NotifyPositionUpdate() |
304 // << NotifyPositionUpdate() |
295 pWatch->IssueNotifyPositionUpdate(); |
305 pWatch->IssueNotifyPositionUpdate(); |
296 |
306 |
297 // >> RequestAssistanceData(0) |
|
298 TESTL(proxy->WaitForResponse(KTimeOut) == ENetMsgRequestAssistanceData); |
|
299 cleanupCnt = proxy->GetArgsLC(ENetMsgRequestAssistanceData, &dataMask); |
|
300 TESTL(dataMask == EAssistanceDataNone); |
|
301 CleanupStack::PopAndDestroy(cleanupCnt); |
|
302 // Determine the value to take off the alpha2 value. This is required because we had to wait for the assistance data response. |
307 // Determine the value to take off the alpha2 value. This is required because we had to wait for the assistance data response. |
303 TTimeIntervalMicroSeconds microseconds; |
308 TTimeIntervalMicroSeconds microseconds; |
304 TTime stopTime; |
309 TTime stopTime; |
305 stopTime.HomeTime(); |
310 stopTime.HomeTime(); |
306 microseconds = stopTime.MicroSecondsFrom(startTime); |
311 microseconds = stopTime.MicroSecondsFrom(startTime); |
307 TInt64 timeElapsed = microseconds.Int64(); |
312 TInt64 timeElapsed = microseconds.Int64(); |
308 TInt delta = 2 * 1000 * 1000; // 2 secs. |
313 TInt delta = 2 * 1000 * 1000; // 2 secs. |
309 |
314 |
310 // >> RespondLocationRequest() |
315 // >> RespondLocationRequest() |
311 TESTL(proxy->WaitForResponse(ArgUtils::Alpha2() - timeElapsed - delta) == ENetMsgTimeoutExpired); |
316 result = proxy->WaitForResponse(ArgUtils::Alpha2() - timeElapsed - delta,ENetMsgRequestAssistanceData); |
|
317 INFO_PRINTF3(_L("expecting ENetMsgTimeoutExpired(%d) got %d"),ENetMsgTimeoutExpired, result ); |
|
318 TESTL(result == ENetMsgTimeoutExpired); |
312 |
319 |
313 // Wait for and process the response. |
320 // Wait for and process the response. |
314 TESTL(proxy->WaitForResponse(2 * delta) == ENetMsgRespondLocationRequest); // DONT get because the measurement data bus has not been created... |
321 result = proxy->WaitForResponse(2 * delta,ENetMsgRequestAssistanceData); |
|
322 INFO_PRINTF3(_L("expecting ENetMsgRespondLocationRequest(%d) got %d"),ENetMsgRespondLocationRequest, result ); |
|
323 TESTL(result == ENetMsgRespondLocationRequest); // DONT get because the measurement data bus has not been created... |
315 |
324 |
316 sessionId = NULL; |
325 sessionId = NULL; |
317 TPositionGpsMeasurementInfo* measurementInfo = NULL; |
326 TPositionGpsMeasurementInfo* measurementInfo = NULL; |
318 cleanupCnt = proxy->GetArgsLC(ENetMsgRespondLocationRequest, &sessionId, &reason, &measurementInfo); |
327 cleanupCnt = proxy->GetArgsLC(ENetMsgRespondLocationRequest, &sessionId, &reason, &measurementInfo); |
319 TESTL(sessionId->SessionNum() == iSessionId.SessionNum()); |
328 TESTL(sessionId->SessionNum() == iSessionId.SessionNum()); |
320 TESTL(reason == KErrNone); |
329 TESTL(reason == KErrNone); |
321 CleanupStack::PopAndDestroy(cleanupCnt);//sessionId, measurementInfo |
330 CleanupStack::PopAndDestroy(cleanupCnt);//sessionId, measurementInfo |
322 |
331 |
323 // Recv -> RequestAssistanceData - we get an extra msg as the result of the A-GPS manager re-issueing a location request when it's |
|
324 // max fix time timer expries. |
|
325 TESTL(proxy->WaitForResponse(KTimeOut) == ENetMsgRequestAssistanceData); |
|
326 cleanupCnt = proxy->GetArgsLC(ENetMsgRequestAssistanceData, &dataMask); |
|
327 TESTL(dataMask == EAssistanceDataNone); |
|
328 CleanupStack::PopAndDestroy(cleanupCnt); |
|
329 const TInt t = 8 * 1000 * 1000; // 8 secs. |
332 const TInt t = 8 * 1000 * 1000; // 8 secs. |
330 quality.SetMaxFixTime(t); |
333 quality.SetMaxFixTime(t); |
331 |
334 |
332 TPositionExtendedSatelliteInfo* positionInfo = NULL; |
335 TPositionExtendedSatelliteInfo* positionInfo = NULL; |
333 //TPositionInfo* positionInfo = NULL; |
336 //TPositionInfo* positionInfo = NULL; |
335 for (TInt i = 0; i < KN; i++) |
338 for (TInt i = 0; i < KN; i++) |
336 { |
339 { |
337 // << ProcessLocationRequest(SessionId, HybridMode, t) |
340 // << ProcessLocationRequest(SessionId, HybridMode, t) |
338 proxy->CallL(ENetMsgProcessLocationRequest, &iSessionId, &emergency, &service, &quality, &method); |
341 proxy->CallL(ENetMsgProcessLocationRequest, &iSessionId, &emergency, &service, &quality, &method); |
339 |
342 |
340 // >> RequestAssistanceData(0) |
|
341 TESTL(proxy->WaitForResponse(KTimeOut) == ENetMsgRequestAssistanceData); |
|
342 cleanupCnt = proxy->GetArgsLC(ENetMsgRequestAssistanceData, &dataMask); |
|
343 TESTL(dataMask == EAssistanceDataNone); |
|
344 CleanupStack::PopAndDestroy(cleanupCnt); |
|
345 |
|
346 // >> RespondLocationRequest() - first measurement, second position. |
343 // >> RespondLocationRequest() - first measurement, second position. |
347 TESTL(proxy->WaitForResponse(t + delta) == ENetMsgRespondLocationRequest); |
344 result = proxy->WaitForResponse(t + delta,ENetMsgRequestAssistanceData); |
|
345 INFO_PRINTF3(_L("expecting ENetMsgRespondLocationRequest(%d) got %d"),ENetMsgRespondLocationRequest, result ); |
|
346 TESTL(result == ENetMsgRespondLocationRequest); |
348 |
347 |
349 sessionId = NULL; |
348 sessionId = NULL; |
350 |
349 |
351 // Expect measurement first time. |
350 // Expect measurement first time. |
352 if (i < (KN-1)) |
351 if (i < (KN-1)) |
354 measurementInfo = NULL; |
353 measurementInfo = NULL; |
355 cleanupCnt = proxy->GetArgsLC(ENetMsgRespondLocationRequest, &sessionId, &reason, &measurementInfo); |
354 cleanupCnt = proxy->GetArgsLC(ENetMsgRespondLocationRequest, &sessionId, &reason, &measurementInfo); |
356 |
355 |
357 // Check it is measurement |
356 // Check it is measurement |
358 TESTL(measurementInfo->PositionClassType() == EPositionGpsMeasurementInfoClass); |
357 TESTL(measurementInfo->PositionClassType() == EPositionGpsMeasurementInfoClass); |
359 |
|
360 // >> RequestAssistanceData - we get an extra msg as the result of the A-GPS manager re-issueing a location request when it's |
|
361 // max fix time timer expries. |
|
362 TESTL(proxy->WaitForResponse(KTimeOut) == ENetMsgRequestAssistanceData); |
|
363 |
|
364 cleanupCnt += proxy->GetArgsLC(ENetMsgRequestAssistanceData, &dataMask); |
|
365 |
|
366 TESTL(dataMask == EAssistanceDataNone); |
|
367 TESTL(sessionId->SessionNum() == iSessionId.SessionNum()); |
358 TESTL(sessionId->SessionNum() == iSessionId.SessionNum()); |
368 TESTL(reason == KErrNone); |
359 TESTL(reason == KErrNone); |
369 } |
360 } |
370 |
361 |
371 // Expect position second time. |
362 // Expect position second time. |