748
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
872
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
748
|
6 |
* which accompanies this distribution, and is available
|
872
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
748
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
#ifndef __CT_LBS_CLIENT_PERIODIC_TESTER_H__
|
|
21 |
#define __CT_LBS_CLIENT_PERIODIC_TESTER_H__
|
|
22 |
|
|
23 |
// INCLUDES
|
|
24 |
#include <e32base.h>
|
|
25 |
#include <e32std.h>
|
|
26 |
|
|
27 |
#include "Lbs.h"
|
|
28 |
|
|
29 |
// CONSTANTS
|
|
30 |
|
|
31 |
#ifdef __WINS__
|
|
32 |
const TInt KToleratedEarliness = 400000; //0.4 s
|
|
33 |
#endif
|
|
34 |
|
|
35 |
const TInt KTracePeriod = 10;
|
|
36 |
|
|
37 |
// FORWARD DECLARATIONS
|
|
38 |
class CT_LbsClientLog;
|
|
39 |
|
|
40 |
// CLASS DECLARATION
|
|
41 |
|
|
42 |
/**
|
|
43 |
* Helper class for periodic update tests
|
|
44 |
*
|
|
45 |
*/
|
|
46 |
class CT_LbsClientPeriodicTester : public CActive
|
|
47 |
{
|
|
48 |
public: // Constructors and destructor
|
|
49 |
|
|
50 |
/**
|
|
51 |
* Two-phased constructor.
|
|
52 |
*/
|
|
53 |
static CT_LbsClientPeriodicTester* NewL(
|
|
54 |
/* IN */ TTimeIntervalMicroSeconds aInterval,
|
|
55 |
/* IN */ const TDesC& aSericeName,
|
|
56 |
/* IN */ CT_LbsClientLog* aLog,
|
|
57 |
/* IN */ TUid aUid,
|
|
58 |
/* IN */ TInt aNumberOfRuns
|
|
59 |
);
|
|
60 |
|
|
61 |
/**
|
|
62 |
* Destructor.
|
|
63 |
*/
|
|
64 |
virtual ~CT_LbsClientPeriodicTester();
|
|
65 |
|
|
66 |
public: // New functions
|
|
67 |
|
|
68 |
/**
|
|
69 |
* Requests notification from positioner and set the active flag true.
|
|
70 |
*/
|
|
71 |
void RequestNotification();
|
|
72 |
|
|
73 |
/**
|
|
74 |
* Changes current test parameters. Can only be called when previous test is completed
|
|
75 |
*/
|
|
76 |
void ChangeTestParametersL(
|
|
77 |
/* IN */ TTimeIntervalMicroSeconds aInterval,
|
|
78 |
/* IN */ TInt aNumberOfRuns
|
|
79 |
);
|
|
80 |
|
|
81 |
/**
|
|
82 |
* Changes name in requestor information.
|
|
83 |
*/
|
|
84 |
void ChangeRequestorInformation(
|
|
85 |
/* IN */ const TDesC& aServiceName
|
|
86 |
);
|
|
87 |
|
|
88 |
/**
|
|
89 |
* Closes the positioner
|
|
90 |
*/
|
|
91 |
void ClosePositioner();
|
|
92 |
|
|
93 |
/**
|
|
94 |
* Opens the positioner
|
|
95 |
*/
|
|
96 |
void OpenPositionerL(
|
|
97 |
/* IN */ const TDesC& aServiceName
|
|
98 |
);
|
|
99 |
|
|
100 |
/**
|
|
101 |
* Sets the maxage parameter in position update options
|
|
102 |
*/
|
|
103 |
void SetMaxAgeL(
|
|
104 |
/* IN */ TTimeIntervalMicroSeconds aInterval
|
|
105 |
);
|
|
106 |
|
|
107 |
/**
|
|
108 |
* Sets the partial update parameter in position update options
|
|
109 |
*/
|
|
110 |
void SetPartialUpdateL(
|
|
111 |
/* IN */ TBool aUpdateOption
|
|
112 |
);
|
|
113 |
|
|
114 |
/**
|
|
115 |
* Sets the timeout parameter in position update options
|
|
116 |
*/
|
|
117 |
void SetTimeOutL(
|
|
118 |
/* IN */ TTimeIntervalMicroSeconds aInterval
|
|
119 |
);
|
|
120 |
|
|
121 |
/**
|
|
122 |
* Changes the update interval before the previous interval has completed one time
|
|
123 |
*/
|
|
124 |
void SetChangeParametersPrematurely(
|
|
125 |
/* IN */ TBool aCondition
|
|
126 |
);
|
|
127 |
|
|
128 |
/**
|
|
129 |
* A way to determine if any error has happened.
|
|
130 |
*/
|
|
131 |
TBool IsCompletedOK();
|
|
132 |
|
|
133 |
/**
|
|
134 |
* Get errorcode if error has occurred.
|
|
135 |
*/
|
|
136 |
TInt GetError();
|
|
137 |
|
|
138 |
/**
|
|
139 |
* Cancels periodic requests from EPos Server
|
|
140 |
*/
|
|
141 |
void CancelRequest();
|
|
142 |
|
|
143 |
/**
|
|
144 |
* Returns the position from the latest notift position request
|
|
145 |
*/
|
|
146 |
void GetPosition(TPositionInfo& aPosInfo);
|
|
147 |
|
|
148 |
|
|
149 |
public: // Functions from CActive
|
|
150 |
|
|
151 |
/**
|
|
152 |
* From CActive Service completed request.
|
|
153 |
* Defined as pure virtual by CActive;
|
|
154 |
* implementation provided by this class,
|
|
155 |
*/
|
|
156 |
void RunL();
|
|
157 |
|
|
158 |
/**
|
|
159 |
* From CActive Cancel request.
|
|
160 |
* Defined as pure virtual by CActive;
|
|
161 |
* implementation provided by this class.
|
|
162 |
*/
|
|
163 |
TInt RunError(TInt aError);
|
|
164 |
|
|
165 |
/**
|
|
166 |
* From CActive Cancel request.
|
|
167 |
* Defined as pure virtual by CActive;
|
|
168 |
* implementation provided by this class.
|
|
169 |
*/
|
|
170 |
void DoCancel();
|
|
171 |
|
|
172 |
private:
|
|
173 |
|
|
174 |
/**
|
|
175 |
* C++ default constructor.
|
|
176 |
*/
|
|
177 |
CT_LbsClientPeriodicTester();
|
|
178 |
|
|
179 |
/**
|
|
180 |
* By default Symbian 2nd phase constructor is private.
|
|
181 |
*/
|
|
182 |
void ConstructL(
|
|
183 |
/* IN */ TTimeIntervalMicroSeconds aInterval,
|
|
184 |
/* IN */ const TDesC& aServiceName,
|
|
185 |
/* IN */ CT_LbsClientLog* aLog,
|
|
186 |
/* IN */ TUid aUid,
|
|
187 |
/* IN */ TInt aNumberOfRuns
|
|
188 |
);
|
|
189 |
|
|
190 |
/**
|
|
191 |
* Evaluates condition, logs and leaves if false.
|
|
192 |
*/
|
|
193 |
void AssertTrueL(
|
|
194 |
/* IN */ TBool aCondition,
|
|
195 |
/* IN */ const TDesC& aErrorMsg,
|
|
196 |
/* IN */ TInt aErrorCode
|
|
197 |
);
|
|
198 |
|
|
199 |
|
|
200 |
private: // Data
|
|
201 |
// EPos server instance
|
|
202 |
RPositionServer iPosServer;
|
|
203 |
|
|
204 |
// Positioner instance
|
|
205 |
RPositioner iPositioner;
|
|
206 |
|
|
207 |
// Position information to be sent with NotifyPositionUpdate
|
|
208 |
TPositionInfo iPositionInfo;
|
|
209 |
|
|
210 |
// Number of periodic updates to request
|
|
211 |
TInt iNumberOfUpdates;
|
|
212 |
|
|
213 |
// Number of periodic updates received
|
|
214 |
TInt iNumberOfRuns;
|
|
215 |
|
|
216 |
// Tells if the test is going to end prematurely with a chage of update interval
|
|
217 |
TBool iPrematureChangeOfParameters;
|
|
218 |
|
|
219 |
// Tells if the outstanding request is going to be canceled
|
|
220 |
TBool iCancelRequest;
|
|
221 |
|
|
222 |
// Tells if the outstanding request has been canceled
|
|
223 |
TBool iCanceledRequest;
|
|
224 |
|
|
225 |
// Tells if to write messages to log
|
|
226 |
TBool iWriteToLog;
|
|
227 |
|
|
228 |
// The time for when the most recent position update was received
|
|
229 |
TTime iRecentTime;
|
|
230 |
|
|
231 |
// The interval to request position updates between
|
|
232 |
TTimeIntervalMicroSeconds iInterval;
|
|
233 |
|
|
234 |
// Test log
|
|
235 |
CT_LbsClientLog* iLog;
|
|
236 |
|
|
237 |
// The name of the positioner
|
|
238 |
TBuf<100> iName;
|
|
239 |
|
|
240 |
// The uid of the positioner
|
|
241 |
TUid iUid;
|
|
242 |
|
|
243 |
//Error indication
|
|
244 |
TBool iError;
|
|
245 |
|
|
246 |
//Error indication
|
|
247 |
TInt iErrorCode;
|
|
248 |
|
|
249 |
};
|
|
250 |
|
|
251 |
#endif // __CT_LBS_CLIENT_PERIODIC_TESTER_H__
|
|
252 |
|
|
253 |
// End of File
|