748
|
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
|
872
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
748
|
5 |
// which accompanies this distribution, and is available
|
872
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
748
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// @file ctlbsclientstep_tracking.cpp
|
|
15 |
// This is the class implementation for the Tracking Tests
|
|
16 |
//
|
|
17 |
//
|
|
18 |
|
|
19 |
#include "ctlbsclientsteptracking.h"
|
|
20 |
|
|
21 |
#include <lbs.h>
|
|
22 |
#include <lbssatellite.h>
|
|
23 |
|
|
24 |
#include "tlbsutils.h"
|
|
25 |
#include "ctlbsasyncwaiter.h"
|
|
26 |
|
|
27 |
|
|
28 |
/**
|
|
29 |
* Construction.
|
|
30 |
*/
|
|
31 |
CT_LbsClientStep_Tracking* CT_LbsClientStep_Tracking::New(CT_LbsClientServer& aParent)
|
|
32 |
{
|
|
33 |
// Note the lack of ELeave.
|
|
34 |
// This means that having insufficient memory will return NULL;
|
|
35 |
CT_LbsClientStep_Tracking* testStep = new CT_LbsClientStep_Tracking(aParent);
|
|
36 |
if (testStep)
|
|
37 |
{
|
|
38 |
TInt err = KErrNone;
|
|
39 |
|
|
40 |
TRAP(err, testStep->ConstructL());
|
|
41 |
if (err)
|
|
42 |
{
|
|
43 |
delete testStep;
|
|
44 |
testStep = NULL;
|
|
45 |
}
|
|
46 |
}
|
|
47 |
|
|
48 |
return testStep;
|
|
49 |
}
|
|
50 |
|
|
51 |
|
|
52 |
CT_LbsClientStep_Tracking::CT_LbsClientStep_Tracking(CT_LbsClientServer& aParent) : CT_LbsClientStep(aParent),
|
|
53 |
iVerifyInterval(ETrue), iExpectedErr(KErrNone), iUpdateIndex(0)
|
|
54 |
{
|
|
55 |
SetTestStepName(KLbsClientStep_Tracking);
|
|
56 |
}
|
|
57 |
|
|
58 |
|
|
59 |
void CT_LbsClientStep_Tracking::ConstructL()
|
|
60 |
{
|
|
61 |
// Setup netsim.
|
|
62 |
User::LeaveIfError(OpenNetSim());
|
|
63 |
|
|
64 |
// Connect server.
|
|
65 |
User::LeaveIfError(iServer.Connect());
|
|
66 |
|
|
67 |
// Open positioner.
|
|
68 |
User::LeaveIfError(iPositioner.Open(iServer));
|
|
69 |
}
|
|
70 |
|
|
71 |
|
|
72 |
/**
|
|
73 |
* Destructor
|
|
74 |
*/
|
|
75 |
CT_LbsClientStep_Tracking::~CT_LbsClientStep_Tracking()
|
|
76 |
{
|
|
77 |
iPositioner.Close();
|
|
78 |
iServer.Close();
|
|
79 |
CloseNetSim();
|
|
80 |
}
|
|
81 |
|
|
82 |
|
|
83 |
const TTimeIntervalMicroSeconds KTimestampMargin = 500000; //+/-0.5s
|
|
84 |
|
|
85 |
TBool CT_LbsClientStep_Tracking::VerifyFirstPosTime(const TTime& aTimeRequested, const TPositionInfo& aPosInfo, const TPositionUpdateOptions& aUpdateOpts)
|
|
86 |
{
|
|
87 |
TTime timeReceived, timeStamp;
|
|
88 |
TPosition pos;
|
|
89 |
|
|
90 |
TInt64 maxtime;
|
|
91 |
maxtime = aUpdateOpts.UpdateTimeOut().Int64();
|
|
92 |
if(!maxtime)
|
|
93 |
{
|
|
94 |
#pragma message("TO DO: CT_LbsClientStep_Tracking::VerifyFirstPosTime - Update when moduleinfo supported")
|
|
95 |
const TTimeIntervalMicroSeconds ttff = 90*1000000; // TO DO - this should be retrieved from the module info (currently hardcoded in locserver too)
|
|
96 |
maxtime = ttff.Int64();
|
|
97 |
}
|
|
98 |
|
|
99 |
// get current time
|
|
100 |
timeReceived.UniversalTime();
|
|
101 |
|
|
102 |
// get the position data:
|
|
103 |
aPosInfo.GetPosition(pos);
|
|
104 |
|
|
105 |
INFO_PRINTF1(_L("First position received at: "));
|
|
106 |
INFO_PRINTF4(_L("%d/%d/%d"), timeReceived.DateTime().Day() + 1, timeReceived.DateTime().Month() + 1, timeReceived.DateTime().Year());
|
|
107 |
INFO_PRINTF5(_L("at %d :%d :%d :%d"), timeReceived.DateTime().Hour(), timeReceived.DateTime().Minute(), timeReceived.DateTime().Second(), timeReceived.DateTime().MicroSecond());
|
|
108 |
|
|
109 |
timeStamp = pos.Time();
|
|
110 |
INFO_PRINTF1(_L("First position timeStamp: "));
|
|
111 |
INFO_PRINTF4(_L("%d/%d/%d"), timeStamp.DateTime().Day() + 1, timeStamp.DateTime().Month() + 1, timeStamp.DateTime().Year());
|
|
112 |
INFO_PRINTF5(_L("at %d :%d :%d :%d"), timeStamp.DateTime().Hour(), timeStamp.DateTime().Minute(), timeStamp.DateTime().Second(), timeStamp.DateTime().MicroSecond());
|
|
113 |
|
|
114 |
TInt64 timediff;
|
|
115 |
timediff = timeReceived.Int64() - aTimeRequested.Int64();
|
|
116 |
|
|
117 |
// *first* position received can arrive 'immediately' and up to timeout, or maxtimetofirstfix if timeout not specified
|
|
118 |
if(timediff > maxtime)
|
|
119 |
{
|
|
120 |
INFO_PRINTF1(_L("Failed: First Position received outside time range"));
|
|
121 |
return FALSE;
|
|
122 |
}
|
|
123 |
else
|
|
124 |
{
|
|
125 |
return TRUE;
|
|
126 |
}
|
|
127 |
}
|
|
128 |
|
|
129 |
|
|
130 |
/**
|
|
131 |
aPosCount - which position in a set of periodic positions this is (first position = 0)
|
|
132 |
*/
|
|
133 |
TBool CT_LbsClientStep_Tracking::VerifyPosTime(const TTime& aTimeFirstPosStamped, const TPositionUpdateOptions& aUpdateOpts, TPositionInfo& aPosInfo, TInt aPosCount)
|
|
134 |
{
|
|
135 |
TTime timeReceived, timeStamp;
|
|
136 |
TPosition pos;
|
|
137 |
TInt64 interval = aUpdateOpts.UpdateInterval().Int64();
|
|
138 |
TTimeIntervalMicroSeconds timeout;
|
|
139 |
timeout = aUpdateOpts.UpdateTimeOut().Int64();
|
|
140 |
|
|
141 |
// should call different function for first position:
|
|
142 |
__ASSERT_ALWAYS(aPosCount > 0, User::Panic(_L("Update options test"), KErrArgument));
|
|
143 |
|
|
144 |
// get current time
|
|
145 |
timeReceived.UniversalTime();
|
|
146 |
|
|
147 |
// get the position data:
|
|
148 |
aPosInfo.GetPosition(pos);
|
|
149 |
|
|
150 |
INFO_PRINTF1(_L("Position received at: "));
|
|
151 |
INFO_PRINTF4(_L("%d/%d/%d"), timeReceived.DateTime().Day() + 1, timeReceived.DateTime().Month() + 1, timeReceived.DateTime().Year());
|
|
152 |
INFO_PRINTF5(_L("at %d :%d :%d :%d"), timeReceived.DateTime().Hour(), timeReceived.DateTime().Minute(), timeReceived.DateTime().Second(), timeReceived.DateTime().MicroSecond());
|
|
153 |
|
|
154 |
timeStamp = pos.Time();
|
|
155 |
INFO_PRINTF1(_L("Position timeStamp: "));
|
|
156 |
INFO_PRINTF4(_L("%d/%d/%d"), timeStamp.DateTime().Day() + 1, timeStamp.DateTime().Month() + 1, timeStamp.DateTime().Year());
|
|
157 |
INFO_PRINTF5(_L("at %d :%d :%d :%d"), timeStamp.DateTime().Hour(), timeStamp.DateTime().Minute(), timeStamp.DateTime().Second(), timeStamp.DateTime().MicroSecond());
|
|
158 |
|
|
159 |
TTime windowstart = aTimeFirstPosStamped + static_cast<TTimeIntervalMicroSeconds>(aPosCount * interval) - KTimestampMargin;
|
|
160 |
TTime windowend = windowstart + timeout + KTimestampMargin;
|
|
161 |
|
|
162 |
INFO_PRINTF1(_L("valid window start: "));
|
|
163 |
INFO_PRINTF4(_L("%d/%d/%d"), windowstart.DateTime().Day() + 1, windowstart.DateTime().Month() + 1, windowstart.DateTime().Year());
|
|
164 |
INFO_PRINTF5(_L("at %d :%d :%d :%d"), windowstart.DateTime().Hour(), windowstart.DateTime().Minute(), windowstart.DateTime().Second(), windowstart.DateTime().MicroSecond());
|
|
165 |
|
|
166 |
if(timeStamp < windowstart && timeReceived < windowstart)
|
|
167 |
{
|
|
168 |
INFO_PRINTF1(_L("Failed: Position received outside time range"));
|
|
169 |
return FALSE;
|
|
170 |
}
|
|
171 |
if(timeout.Int64() && (timeStamp > windowend || timeReceived > windowend))
|
|
172 |
{
|
|
173 |
INFO_PRINTF1(_L("valid window end: "));
|
|
174 |
INFO_PRINTF4(_L("%d/%d/%d"), windowend.DateTime().Day() + 1, windowend.DateTime().Month() + 1, windowend.DateTime().Year());
|
|
175 |
INFO_PRINTF5(_L("at %d :%d :%d :%d"), windowend.DateTime().Hour(), windowend.DateTime().Minute(), windowend.DateTime().Second(), windowend.DateTime().MicroSecond());
|
|
176 |
|
|
177 |
return FALSE;
|
|
178 |
}
|
|
179 |
else
|
|
180 |
{
|
|
181 |
return TRUE;
|
|
182 |
}
|
|
183 |
}
|
|
184 |
|
|
185 |
|
|
186 |
/**
|
|
187 |
* @return - TVerdict code
|
|
188 |
* Override of base class pure virtual
|
|
189 |
* Our implementation only gets called if the base class doTestStepPreambleL() did
|
|
190 |
* not leave. That being the case, the current test result value will be EPass.
|
|
191 |
*/
|
|
192 |
TVerdict CT_LbsClientStep_Tracking::doTestStepL()
|
|
193 |
{
|
|
194 |
// Generic test step used to test the LBS SetUpdateOptions API.
|
|
195 |
INFO_PRINTF1(_L(">>CT_LbsClientStep_Tracking::doTestStepL()"));
|
|
196 |
|
|
197 |
if (TestStepResult()==EPass)
|
|
198 |
{
|
|
199 |
// Determine the test case id.
|
|
200 |
TInt testCaseId;
|
|
201 |
if (GetIntFromConfig(ConfigSection(), KTestCaseId, testCaseId))
|
|
202 |
{
|
|
203 |
// Set the update options.
|
|
204 |
T_LbsUtils utils;
|
|
205 |
TPtrC configFileName;
|
|
206 |
_LIT(KUpdateOptionsFile, "agps_module_update_file");
|
|
207 |
|
|
208 |
GetStringFromConfig(ConfigSection(), KUpdateOptionsFile, configFileName);
|
|
209 |
|
|
210 |
utils.GetConfigured_ModuleUpdateOptionsL(configFileName, ConfigSection(), iUpdateOpts);
|
|
211 |
iPositioner.SetUpdateOptions(iUpdateOpts);
|
|
212 |
|
|
213 |
// count the number of updates from the .ini file
|
|
214 |
RPointerArray<TLbsModuleUpdateItem> posInfoArray;
|
|
215 |
utils.GetConfigured_UpdateArrayL(configFileName, ConfigSection(), posInfoArray);
|
|
216 |
TInt numOfPosInfos = posInfoArray.Count();
|
|
217 |
posInfoArray.ResetAndDestroy();
|
|
218 |
|
|
219 |
// Perfom test.
|
|
220 |
TInt err = KErrNone;
|
|
221 |
TPosition pos;
|
|
222 |
TTime timeFirstStamped;
|
|
223 |
TTime timeRequested;
|
|
224 |
iUpdateWindowIndex = 0;
|
|
225 |
if(testCaseId == 8)
|
|
226 |
{
|
|
227 |
iCheckIfSameAsPreviousPosition = ETrue;
|
|
228 |
}
|
|
229 |
else
|
|
230 |
{
|
|
231 |
iCheckIfSameAsPreviousPosition = EFalse;
|
|
232 |
}
|
|
233 |
|
|
234 |
|
|
235 |
for (iUpdateIndex = 0 ; iUpdateIndex < numOfPosInfos; iUpdateIndex++)
|
|
236 |
{
|
|
237 |
// Get and log current time.
|
|
238 |
timeRequested.UniversalTime();
|
|
239 |
INFO_PRINTF1(_L("Position requested at: "));
|
|
240 |
INFO_PRINTF4(_L("%d/%d/%d"), timeRequested.DateTime().Day() + 1, timeRequested.DateTime().Month() + 1, timeRequested.DateTime().Year());
|
|
241 |
INFO_PRINTF5(_L("at %d :%d :%d :%d"), timeRequested.DateTime().Hour(), timeRequested.DateTime().Minute(), timeRequested.DateTime().Second(), timeRequested.DateTime().MicroSecond());
|
|
242 |
|
|
243 |
// Do request to position update.
|
|
244 |
err = DoNotifyUpdateL(iPosInfo);
|
|
245 |
|
|
246 |
iPosInfo.GetPosition(pos);
|
|
247 |
|
|
248 |
// First update, ref pos, KErrNone.
|
|
249 |
if (iUpdateIndex == 0)
|
|
250 |
{
|
|
251 |
// Verify time taken for first update.
|
|
252 |
timeFirstStamped = pos.Time(); // Need to remember the time we received this update.
|
|
253 |
if(!VerifyFirstPosTime(timeRequested, iPosInfo, iUpdateOpts))
|
|
254 |
{
|
|
255 |
SetTestStepResult(EFail);
|
|
256 |
}
|
|
257 |
|
|
258 |
// Verify reference position.
|
|
259 |
TPositionInfo verifyRefPosInfo;
|
|
260 |
|
|
261 |
verifyRefPosInfo.SetPosition(iRefPos);
|
|
262 |
if (!utils.Compare_PosInfo(verifyRefPosInfo, iPosInfo))
|
|
263 |
{
|
|
264 |
INFO_PRINTF1(_L("Failed test, reference position incorrect."));
|
|
265 |
SetTestStepResult(EFail);
|
|
266 |
}
|
|
267 |
|
|
268 |
// Expected error.
|
|
269 |
iExpectedErr = KErrNone;
|
|
270 |
|
|
271 |
// Expect to verify interval time, for other updates.
|
|
272 |
iVerifyInterval = ETrue;
|
|
273 |
iPreviousPos = iPosInfo;
|
|
274 |
}
|
|
275 |
|
|
276 |
// Remaining updates.
|
|
277 |
else
|
|
278 |
{
|
|
279 |
// Increment the expected time interval 'window' the update is expected to arrive in
|
|
280 |
iUpdateWindowIndex++;
|
|
281 |
|
|
282 |
// Determine expected err, and any special test actions.
|
|
283 |
switch (iUpdateIndex)
|
|
284 |
{
|
|
285 |
// Second update, gps accurate, KErrNone, after n * intervals.
|
|
286 |
case 1:
|
|
287 |
{
|
|
288 |
iExpectedErr = KErrNone;
|
|
289 |
|
|
290 |
if(testCaseId == 7)
|
|
291 |
{
|
|
292 |
DoInterval_TestCaseId_07();
|
|
293 |
}
|
|
294 |
else if(testCaseId == 8)
|
|
295 |
{
|
|
296 |
DoInterval_TestCaseId_08();
|
|
297 |
}
|
|
298 |
else
|
|
299 |
{
|
|
300 |
// Got the first accurate gps update, switch on partial updates.
|
|
301 |
iUpdateOpts.SetAcceptPartialUpdates(ETrue);
|
|
302 |
iPositioner.SetUpdateOptions(iUpdateOpts);
|
|
303 |
}
|
|
304 |
|
|
305 |
break;
|
|
306 |
}
|
|
307 |
|
|
308 |
// Remaining updates as per test case.
|
|
309 |
default:
|
|
310 |
{
|
|
311 |
switch (testCaseId)
|
|
312 |
{
|
|
313 |
// Test case LBS-Tracking-001
|
|
314 |
case 1:
|
|
315 |
{
|
|
316 |
DoInterval_TestCaseId_01();
|
|
317 |
|
|
318 |
break;
|
|
319 |
}
|
|
320 |
|
|
321 |
// Test case LBS-Tracking-002
|
|
322 |
case 2:
|
|
323 |
{
|
|
324 |
DoInterval_TestCaseId_02();
|
|
325 |
|
|
326 |
break;
|
|
327 |
}
|
|
328 |
|
|
329 |
// Test case LBS-Tracking-003
|
|
330 |
case 3:
|
|
331 |
{
|
|
332 |
DoInterval_TestCaseId_03();
|
|
333 |
|
|
334 |
break;
|
|
335 |
}
|
|
336 |
|
|
337 |
// Test case LBS-Tracking-004
|
|
338 |
case 4:
|
|
339 |
{
|
|
340 |
DoInterval_TestCaseId_04();
|
|
341 |
|
|
342 |
break;
|
|
343 |
}
|
|
344 |
|
|
345 |
// Test case LBS-Tracking-005
|
|
346 |
case 5:
|
|
347 |
{
|
|
348 |
DoInterval_TestCaseId_05();
|
|
349 |
|
|
350 |
break;
|
|
351 |
}
|
|
352 |
|
|
353 |
// Test case LBS-Tracking-006
|
|
354 |
case 6:
|
|
355 |
{
|
|
356 |
DoInterval_TestCaseId_06();
|
|
357 |
|
|
358 |
break;
|
|
359 |
}
|
|
360 |
|
|
361 |
// Test case LBS-Tracking-007
|
|
362 |
case 7:
|
|
363 |
{
|
|
364 |
DoInterval_TestCaseId_07();
|
|
365 |
|
|
366 |
break;
|
|
367 |
}
|
|
368 |
|
|
369 |
// Test case LBS-Tracking-008
|
|
370 |
case 8:
|
|
371 |
{
|
|
372 |
DoInterval_TestCaseId_08();
|
|
373 |
|
|
374 |
break;
|
|
375 |
}
|
|
376 |
}
|
|
377 |
}
|
|
378 |
break;
|
|
379 |
}
|
|
380 |
|
|
381 |
// Verify correct interval for update, if required.
|
|
382 |
if (iVerifyInterval)
|
|
383 |
{
|
|
384 |
if(!VerifyPosTime(timeFirstStamped, iUpdateOpts, iPosInfo, iUpdateWindowIndex))
|
|
385 |
{
|
|
386 |
INFO_PRINTF1(_L("Failed: Position received outside time range"));
|
|
387 |
SetTestStepResult(EFail);
|
|
388 |
}
|
|
389 |
}
|
|
390 |
|
|
391 |
if(iCheckIfSameAsPreviousPosition)
|
|
392 |
{
|
|
393 |
if(iSameAsPreviousPos && !utils.Compare_PosInfo(iPreviousPos, iPosInfo))
|
|
394 |
{
|
|
395 |
INFO_PRINTF1(_L("Failed test, position different from previous, when it should be same."));
|
|
396 |
SetTestStepResult(EFail);
|
|
397 |
}
|
|
398 |
if(!iSameAsPreviousPos && utils.Compare_PosInfo(iPreviousPos, iPosInfo))
|
|
399 |
{
|
|
400 |
INFO_PRINTF1(_L("Failed test, position same as previous, when it should be different."));
|
|
401 |
SetTestStepResult(EFail);
|
|
402 |
}
|
|
403 |
}
|
|
404 |
iPreviousPos = iPosInfo;
|
|
405 |
}
|
|
406 |
|
|
407 |
// Verify err.
|
|
408 |
if (err != iExpectedErr)
|
|
409 |
{
|
|
410 |
SetTestStepResult(EFail);
|
|
411 |
}
|
|
412 |
}
|
|
413 |
|
|
414 |
}
|
|
415 |
|
|
416 |
}
|
|
417 |
|
|
418 |
INFO_PRINTF1(_L("<<CT_LbsClientStep_Tracking::doTestStepL()"));
|
|
419 |
|
|
420 |
return TestStepResult();
|
|
421 |
}
|
|
422 |
|
|
423 |
|
|
424 |
// Test 1 - expected updates
|
|
425 |
//
|
|
426 |
// Ref pos, KErrNone, before interval
|
|
427 |
// Gps pos (accurate), KErrNone, after n * intervals
|
|
428 |
// Gps pos (accurate), KErrNone, after interval
|
|
429 |
// Gps pos (partial), KPositionPartialUpdate, after interval
|
|
430 |
//
|
|
431 |
void CT_LbsClientStep_Tracking::DoInterval_TestCaseId_01()
|
|
432 |
{
|
|
433 |
|
|
434 |
switch (iUpdateIndex)
|
|
435 |
{
|
|
436 |
case 2: // Third update, gps accurate, KErrNone.
|
|
437 |
{
|
|
438 |
iExpectedErr = KErrNone;
|
|
439 |
|
|
440 |
break;
|
|
441 |
}
|
|
442 |
|
|
443 |
case 3: // Last update, gps inaccurate, KPositionPartialUpdate.
|
|
444 |
{
|
|
445 |
iExpectedErr = KPositionPartialUpdate;
|
|
446 |
|
|
447 |
break;
|
|
448 |
}
|
|
449 |
}
|
|
450 |
}
|
|
451 |
|
|
452 |
|
|
453 |
// Test 2 - expected updates
|
|
454 |
//
|
|
455 |
// Ref pos, KErrNone, before interval
|
|
456 |
// Gps pos (accurate), KErrNone, after n * intervals
|
|
457 |
// Gps pos (accurate), KErrNone, after interval
|
|
458 |
// Gps pos (accurate), KErrNone, after interval
|
|
459 |
//
|
|
460 |
void CT_LbsClientStep_Tracking::DoInterval_TestCaseId_02()
|
|
461 |
{
|
|
462 |
|
|
463 |
switch (iUpdateIndex)
|
|
464 |
{
|
|
465 |
case 2: // Third update, gps accurate, KErrNone.
|
|
466 |
case 3: // Last update, gps accurate, KErrNone.
|
|
467 |
{
|
|
468 |
iExpectedErr = KErrNone;
|
|
469 |
|
|
470 |
break;
|
|
471 |
}
|
|
472 |
}
|
|
473 |
}
|
|
474 |
|
|
475 |
|
|
476 |
// Test 3 - expected updates
|
|
477 |
//
|
|
478 |
// Ref pos, KErrNone, before interval
|
|
479 |
// Gps pos (accurate), KErrNone, after n * intervals
|
|
480 |
// Gps pos (NAN), KPositionPartialUpdate, after interval
|
|
481 |
// Gps pos (NAN), KPositionPartialUpdate, after interval
|
|
482 |
//
|
|
483 |
void CT_LbsClientStep_Tracking::DoInterval_TestCaseId_03()
|
|
484 |
{
|
|
485 |
|
|
486 |
switch (iUpdateIndex)
|
|
487 |
{
|
|
488 |
case 2: // Third update, gps NAN, KPositionPartialUpdate.
|
|
489 |
case 3: // Last update, gps NAN, KPositionPartialUpdate.
|
|
490 |
{
|
|
491 |
iExpectedErr = KPositionPartialUpdate;
|
|
492 |
|
|
493 |
break;
|
|
494 |
}
|
|
495 |
}
|
|
496 |
}
|
|
497 |
|
|
498 |
|
|
499 |
// Test 4 - expected updates
|
|
500 |
//
|
|
501 |
// Ref pos, KErrNone, before interval
|
|
502 |
// Gps pos (accurate), KErrNone, after n * intervals
|
|
503 |
// Gps pos (inaccurate), KPositionPartialUpdate, after interval
|
|
504 |
// Gps pos (inaccurate), KPositionPartialUpdate, after interval
|
|
505 |
//
|
|
506 |
void CT_LbsClientStep_Tracking::DoInterval_TestCaseId_04()
|
|
507 |
{
|
|
508 |
|
|
509 |
switch (iUpdateIndex)
|
|
510 |
{
|
|
511 |
case 2: // Third update, gps accurate, KPositionPartialUpdate.
|
|
512 |
case 3: // Last update, gps inaccurate, KPositionPartialUpdate.
|
|
513 |
{
|
|
514 |
iExpectedErr = KPositionPartialUpdate;
|
|
515 |
|
|
516 |
break;
|
|
517 |
}
|
|
518 |
}
|
|
519 |
}
|
|
520 |
|
|
521 |
|
|
522 |
// Test 5 - expected updates
|
|
523 |
//
|
|
524 |
// Ref pos, KErrNone, before interval
|
|
525 |
// Gps pos (accurate), KErrNone, after n * intervals
|
|
526 |
// Gps pos (accurate), KErrNonee, after interval
|
|
527 |
// Gps pos (not delivered), KErrTimedOut, after interval
|
|
528 |
//
|
|
529 |
void CT_LbsClientStep_Tracking::DoInterval_TestCaseId_05()
|
|
530 |
{
|
|
531 |
|
|
532 |
switch (iUpdateIndex)
|
|
533 |
{
|
|
534 |
case 2: // Third update, gps accurate, KErrNone.
|
|
535 |
{
|
|
536 |
iExpectedErr = KErrNone;
|
|
537 |
|
|
538 |
// Send timeout to the A-GPS hybrid module - we expect further updates to timeout.
|
|
539 |
TTimeIntervalMicroSeconds timeOutVal(40000000);
|
|
540 |
|
|
541 |
ConfigureModuleTimeOut(timeOutVal);
|
|
542 |
|
|
543 |
break;
|
|
544 |
}
|
|
545 |
|
|
546 |
case 3: // Last update, gps inaccurate, KPositionPartialUpdate.
|
|
547 |
{
|
|
548 |
iExpectedErr = KErrTimedOut;
|
|
549 |
iVerifyInterval = EFalse;
|
|
550 |
|
|
551 |
// Reset the timeout in the A-GPS module.
|
|
552 |
TTimeIntervalMicroSeconds timeOutVal(0);
|
|
553 |
ConfigureModuleTimeOut(timeOutVal);
|
|
554 |
break;
|
|
555 |
}
|
|
556 |
}
|
|
557 |
}
|
|
558 |
|
|
559 |
// Test 6 - expected updates
|
|
560 |
//
|
|
561 |
// Ref pos, KErrNone, before interval
|
|
562 |
// Gps pos (accurate), KErrNone, after n * intervals
|
|
563 |
// Gps pos (inaccurate), KPositionPartialUpdate, after interval
|
|
564 |
// Gps pos (NAN), KPositionQualityLoss, before interval (because of futile udpate)
|
|
565 |
// Gps pos (inaccurate), KPositionPartialUpdate, after interval
|
|
566 |
//
|
|
567 |
void CT_LbsClientStep_Tracking::DoInterval_TestCaseId_06()
|
|
568 |
{
|
|
569 |
|
|
570 |
switch (iUpdateIndex)
|
|
571 |
{
|
|
572 |
case 2: // Third update, gps inaccurate, KPositionPartialUpdate.
|
|
573 |
{
|
|
574 |
iExpectedErr = KPositionPartialUpdate;
|
|
575 |
break;
|
|
576 |
}
|
|
577 |
|
|
578 |
case 3: // Fourth update, gps NAN, KPositionQualityLoss.
|
|
579 |
{
|
|
580 |
iExpectedErr = KPositionQualityLoss;
|
|
581 |
|
|
582 |
// This update should have happened before the next expected
|
|
583 |
// interval window (because it's a futile update from the
|
|
584 |
// GPS module), so it will be in the previous 'window'
|
|
585 |
iUpdateWindowIndex--;
|
|
586 |
break;
|
|
587 |
}
|
|
588 |
|
|
589 |
case 4: // Last update, gps inaccurate, KPositionPartialUpdate.
|
|
590 |
{
|
|
591 |
iExpectedErr = KPositionPartialUpdate;
|
|
592 |
break;
|
|
593 |
}
|
|
594 |
}
|
|
595 |
}
|
|
596 |
|
|
597 |
// Test 7 - expected updates
|
|
598 |
//
|
|
599 |
// Ref pos, KErrNone, before interval
|
|
600 |
// Gps pos (accurate), KErrNone, after n * intervals
|
|
601 |
// Gps pos (inaccurate), KPositionQualityLoss, after timeout
|
|
602 |
//
|
|
603 |
void CT_LbsClientStep_Tracking::DoInterval_TestCaseId_07()
|
|
604 |
{
|
|
605 |
switch (iUpdateIndex)
|
|
606 |
{
|
|
607 |
case 1:
|
|
608 |
{
|
|
609 |
iExpectedErr = KErrNone;
|
|
610 |
break;
|
|
611 |
}
|
|
612 |
case 2:
|
|
613 |
{
|
|
614 |
iVerifyInterval = EFalse;
|
|
615 |
iExpectedErr = KPositionQualityLoss;
|
|
616 |
break;
|
|
617 |
}
|
|
618 |
}
|
|
619 |
}
|
|
620 |
|
|
621 |
void CT_LbsClientStep_Tracking::DoInterval_TestCaseId_08()
|
|
622 |
{
|
|
623 |
iExpectedErr = KErrNone;
|
|
624 |
switch (iUpdateIndex)
|
|
625 |
{
|
|
626 |
case 1:
|
|
627 |
case 3:
|
|
628 |
{
|
|
629 |
iSameAsPreviousPos = EFalse;
|
|
630 |
break;
|
|
631 |
}
|
|
632 |
case 2:
|
|
633 |
{
|
|
634 |
iSameAsPreviousPos = ETrue;
|
|
635 |
break;
|
|
636 |
}
|
|
637 |
}
|
|
638 |
}
|
|
639 |
|
|
640 |
// A-GPS hybrid module configuration function.
|
|
641 |
void CT_LbsClientStep_Tracking::ConfigureModuleTimeOut(TTimeIntervalMicroSeconds& aTimeOut)
|
|
642 |
{
|
|
643 |
CT_LbsAGpsHandler* modHandler;
|
|
644 |
modHandler = CT_LbsAGpsHandler::NewL(this);
|
|
645 |
|
|
646 |
// Send timeout request.
|
|
647 |
modHandler->SendRequestTimeOutMsg(aTimeOut);
|
|
648 |
|
|
649 |
// Wait for response from module.
|
|
650 |
CActiveScheduler::Start();
|
|
651 |
|
|
652 |
delete modHandler;
|
|
653 |
}
|
|
654 |
|
|
655 |
|
|
656 |
// Response back from A-GPS hybrid module to notify the test it has got the timeout request.
|
|
657 |
void CT_LbsClientStep_Tracking::ProcessAGpsResponseMessage(const TT_LbsAGpsResponseMsg::TModuleResponseType aResponse)
|
|
658 |
{
|
|
659 |
if (TT_LbsAGpsResponseMsg::EModuleResponseOk != aResponse)
|
|
660 |
{
|
|
661 |
// fail test could not config module!
|
|
662 |
INFO_PRINTF2(_L("Unable to configure hybrid module, err %d."), aResponse);
|
|
663 |
SetTestStepResult(EFail);
|
|
664 |
}
|
|
665 |
|
|
666 |
// Return back to test.
|
|
667 |
CActiveScheduler::Stop();
|
|
668 |
}
|