748
|
1 |
// Copyright (c) 2002-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 the License "Symbian Foundation License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
//
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
// INCLUDE FILES
|
|
19 |
#include "ctlbsclientpostp195.h"
|
|
20 |
#include <LbsPositionInfo.h>
|
|
21 |
#include <Lbs.h>
|
|
22 |
#include <LbsCommon.h>
|
|
23 |
#include <LbsRequestor.h>
|
|
24 |
|
|
25 |
// ================= MEMBER FUNCTIONS =======================
|
|
26 |
|
|
27 |
// ---------------------------------------------------------
|
|
28 |
// Constructor.
|
|
29 |
// ---------------------------------------------------------
|
|
30 |
CT_LbsClientPosTp195::CT_LbsClientPosTp195(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent)
|
|
31 |
{
|
|
32 |
_LIT(KTestName, "TP195 - Periodic Updates, Slow PSY");
|
|
33 |
SetTestStepName(KTestName);
|
|
34 |
}
|
|
35 |
|
|
36 |
// ---------------------------------------------------------
|
|
37 |
// Destructor.
|
|
38 |
// ---------------------------------------------------------
|
|
39 |
CT_LbsClientPosTp195::~CT_LbsClientPosTp195()
|
|
40 |
{
|
|
41 |
}
|
|
42 |
|
|
43 |
// ---------------------------------------------------------
|
|
44 |
// CT_LbsClientPosTp195::StartL
|
|
45 |
//
|
|
46 |
// (other items were commented in a header).
|
|
47 |
// ---------------------------------------------------------
|
|
48 |
//
|
|
49 |
void CT_LbsClientPosTp195::StartL()
|
|
50 |
{
|
|
51 |
SetupPsyL(iUidTestPsy3);
|
|
52 |
|
|
53 |
TInt numberOfRuns = 5;
|
|
54 |
TTimeIntervalMicroSeconds interval = TTimeIntervalMicroSeconds(2000000);
|
|
55 |
const TInt slowPsyUpdate = 4000000;
|
|
56 |
|
|
57 |
#ifdef __WINS__
|
|
58 |
const TInt KErrorInterval = 2500000;
|
|
59 |
#else
|
|
60 |
const TInt KErrorInterval = 500000;
|
|
61 |
#endif
|
|
62 |
|
|
63 |
|
|
64 |
RPositionServer posServer;
|
|
65 |
CleanupClosePushL(posServer);
|
|
66 |
RPositioner positioner;
|
|
67 |
CleanupClosePushL(positioner);
|
|
68 |
TPositionInfo positionInfo = TPositionInfo();
|
|
69 |
|
|
70 |
_LIT(KConnectErr, "Error when connecing to EPos server, %d");
|
|
71 |
TInt err = posServer.Connect();
|
|
72 |
AssertTrueL(err == KErrNone, KConnectErr, err);
|
|
73 |
|
|
74 |
_LIT(KOpenErr, "Error when opening positioner, %d");
|
|
75 |
err = positioner.Open(posServer, iUidTestPsy3);
|
|
76 |
AssertTrueL(err == KErrNone, KOpenErr, err);
|
|
77 |
|
|
78 |
TPositionUpdateOptions posOption;
|
|
79 |
posOption.SetUpdateInterval(interval);
|
|
80 |
|
|
81 |
_LIT(KUpdateErr, "Error when setting update interval, %d");
|
|
82 |
err = positioner.SetUpdateOptions(posOption);
|
|
83 |
AssertTrueL(err == KErrNone, KUpdateErr, err);
|
|
84 |
|
|
85 |
_LIT(KService ,"Service");
|
|
86 |
positioner.SetRequestor(CRequestor::ERequestorService,
|
|
87 |
CRequestor::EFormatApplication, KService);
|
|
88 |
|
|
89 |
//do a couple of request and check the times between requests.
|
|
90 |
|
|
91 |
TTime now, startTime;
|
|
92 |
TTimeIntervalMicroSeconds requestTime;
|
|
93 |
_LIT(KErrorRequest, "Error in request");
|
|
94 |
TRequestStatus status;
|
|
95 |
TInt64 reqTime;
|
|
96 |
|
|
97 |
for (TInt i = 0; i < numberOfRuns; i++)
|
|
98 |
{
|
|
99 |
startTime.UniversalTime();
|
|
100 |
positioner.NotifyPositionUpdate(positionInfo, status);
|
|
101 |
User::WaitForRequest(status);
|
|
102 |
err = status.Int();
|
|
103 |
AssertTrueL(err == KErrNone, KErrorRequest, err);
|
|
104 |
now.UniversalTime();
|
|
105 |
requestTime = now.MicroSecondsFrom(startTime);
|
|
106 |
_LIT(KError, "Request time, %d microsecs.");
|
|
107 |
TBuf<100> buf;
|
|
108 |
reqTime = requestTime.Int64();
|
|
109 |
buf.Format(KError, reqTime);
|
|
110 |
INFO_PRINTF1(buf);
|
|
111 |
if (i != 0)
|
|
112 |
{
|
|
113 |
//check that the time is ok, by accepting an error interval
|
|
114 |
TInt var1 = 2000000 + slowPsyUpdate + KErrorInterval;
|
|
115 |
TInt var2 = 2000000 + (slowPsyUpdate - KErrorInterval);
|
|
116 |
if (reqTime > var1 || reqTime < var2)
|
|
117 |
{
|
|
118 |
_LIT(KErrorInterval, "The update is not within valid range");
|
|
119 |
LogErrorAndLeaveL(KErrorInterval);
|
|
120 |
}
|
|
121 |
}
|
|
122 |
}
|
|
123 |
|
|
124 |
CleanupStack::PopAndDestroy(&positioner);
|
|
125 |
CleanupStack::PopAndDestroy(&posServer);
|
|
126 |
|
|
127 |
}
|
|
128 |
|
|
129 |
// End of File
|