|
1 // Copyright (c) 2006-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 // @file tlbsutils.h |
|
15 // This is the header file which contains the common utility functions |
|
16 // |
|
17 // |
|
18 |
|
19 |
|
20 |
|
21 /** |
|
22 @file |
|
23 @internalTechnology |
|
24 @test |
|
25 */ |
|
26 |
|
27 #ifndef __T_LBS_UTILS_H__ |
|
28 #define __T_LBS_UTILS_H__ |
|
29 |
|
30 |
|
31 // Epoc includes |
|
32 #include <e32cmn.h> |
|
33 |
|
34 // LBS includes |
|
35 #include <lbs.h> |
|
36 #include <lbscommon.h> |
|
37 #include <lbspositioninfo.h> |
|
38 #include <lbs/lbsassistancereferencetime.h> |
|
39 #include <lbsclasstypes.h> |
|
40 #include <lbs/lbsadmin.h> |
|
41 #include <lbssatellite.h> |
|
42 #include <lbs/lbsgpsmeasurement.h> |
|
43 #include <lbs/lbslocdatasourcegpsbase.h> |
|
44 |
|
45 // Forward Declaration |
|
46 |
|
47 // Includes for Log Comparison |
|
48 #include <lbs/lbslogevent.h> |
|
49 #include <lbs/lbsselflocatelogevent.h> |
|
50 #include <lbs/lbsexternallocatelogevent.h> |
|
51 #include <lbs/lbstransmitlocationlogevent.h> |
|
52 #include <lbs/lbsnetworklocatelogevent.h> |
|
53 #include <lbs/lbsassistancedatalogevent.h> |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 // Property Keys |
|
59 enum TLbsTestPropertyKeys |
|
60 { |
|
61 ELbsTestAGpsModuleIn = 1301, |
|
62 ELbsTestAGpsModuleOut = 2301, |
|
63 ELbsTestClockPluginOut = 3301, |
|
64 ELbsTestAGpsModuleModeChanges = 4301, |
|
65 ELbsTestAGpsModuleResetAssistanceDataFlag = 5301 |
|
66 }; |
|
67 |
|
68 enum KLbsTestAGpsModuleResetAssistanceDataStates |
|
69 { |
|
70 ELbsTestAGpsResetAssistanceDataNotReceived, |
|
71 ELbsTestAGpsResetAssistanceDataReceived |
|
72 }; |
|
73 |
|
74 |
|
75 const TInt KMaxModuleDataBusIniFileName = 100; |
|
76 |
|
77 // assistance data providers: |
|
78 const TInt KSimpleAssistanceDataProviderPluginUidValue = 0x10281D77; |
|
79 const TInt KSuplAssistanceDataProviderPluginUidValue = 0x1028225B; |
|
80 |
|
81 |
|
82 /** Update structure to hold both measurement and position (location) information. |
|
83 */ |
|
84 class TLbsModuleUpdateItem |
|
85 { |
|
86 public: |
|
87 IMPORT_C TLbsModuleUpdateItem(); |
|
88 |
|
89 IMPORT_C const TPositionSatelliteInfo& Position() const; |
|
90 IMPORT_C const TPositionGpsMeasurementInfo& Measurement() const; |
|
91 IMPORT_C TInt Error() const; |
|
92 IMPORT_C TInt Delay() const; |
|
93 |
|
94 IMPORT_C void SetPosition(const TPositionSatelliteInfo& aReport); |
|
95 IMPORT_C void SetMeasurement(const TPositionGpsMeasurementInfo& aMeasurement); |
|
96 IMPORT_C void SetError(TInt aError); |
|
97 IMPORT_C void SetDelay(TInt aDelay); |
|
98 |
|
99 |
|
100 protected: |
|
101 TPositionSatelliteInfo iPosition; |
|
102 TPositionGpsMeasurementInfo iMeasurement; |
|
103 TInt iError; |
|
104 TInt iDelay; |
|
105 }; |
|
106 |
|
107 |
|
108 |
|
109 // Passing data to test module. |
|
110 class TModuleDataIn |
|
111 { |
|
112 public: |
|
113 /** Supported request types. */ |
|
114 enum TModuleRequestType |
|
115 { |
|
116 EModuleRequestConfig, |
|
117 EModuleRequestEventKickOff, |
|
118 EModuleRequestTestMode, |
|
119 EModuleRequestTimeOut, |
|
120 EModuleRequestError, |
|
121 EModuleRequestTimeStampOffset, |
|
122 EModuleRequestOptionsChangeReportMode |
|
123 }; |
|
124 TModuleRequestType iRequestType; |
|
125 |
|
126 |
|
127 /** Config request data. */ |
|
128 TBuf<KMaxModuleDataBusIniFileName> iConfigFileName; |
|
129 TBuf<40> iConfigSection; // bug if you make it bigger, more data we add, we get a -9 buf overflow on the property read |
|
130 |
|
131 |
|
132 /** Event kick off request data. */ |
|
133 enum _TKickOffEventType |
|
134 { |
|
135 EKickOffEventTypeDevice=0x01, |
|
136 EKickOffEventTypeDataQuality=0x02 |
|
137 }; |
|
138 typedef TUint TKickOffEventType; |
|
139 TKickOffEventType iKickOffEventType; |
|
140 |
|
141 |
|
142 /** Assistance event data. */ |
|
143 enum TAssDataEventType |
|
144 { |
|
145 EAssDataEventExpectSingle, |
|
146 EAssDataEventExpectMultiple |
|
147 }; |
|
148 TAssDataEventType iAssDataEventType; |
|
149 |
|
150 |
|
151 /** Module test mode. */ |
|
152 enum TTestMode |
|
153 { |
|
154 EModuleTestModeAssDataOff, |
|
155 EModuleTestModeAssDataOn, |
|
156 EModuleTestModeAssDataOn_TimeStamp, |
|
157 EModuleTestModeAssDataOn_Cancel_Stage1, |
|
158 EModuleTestModeAssDataOn_Cancel_Stage2, |
|
159 EModuleTestModeAssDataOn_Unsolicited, |
|
160 EModuleTestModeAssDataOn_NoNetwork, |
|
161 EModuleTestModeAssDataOn_DataNotAvailable, |
|
162 EModuleTestModeAssDataOn_SomeDataNotAvailable, |
|
163 EModuleTestModeAssDataOn_InvalidDataRequest, |
|
164 EModuleTestModeAssDataOn_InvalidDataGet, |
|
165 EModuleTestModeAssDataOn_EarlyPosUpdates |
|
166 }; |
|
167 TTestMode iAssDataTestMode; |
|
168 |
|
169 enum TGpsOptionsChangeReportMode |
|
170 { |
|
171 EGpsModuleDoReportOptionsChange, |
|
172 EGpsModuleDoNotReportOptionsChange, |
|
173 }; |
|
174 TGpsOptionsChangeReportMode iOptionsChangeReportMode; |
|
175 |
|
176 /** Module time out. */ |
|
177 TTimeIntervalMicroSeconds iTimeOut; |
|
178 |
|
179 /** Module Error Code */ |
|
180 TInt iError; |
|
181 |
|
182 /** Used to alter the time stamp of the posinfo. */ |
|
183 TTimeIntervalMicroSeconds iTimeStampOffset; |
|
184 }; |
|
185 |
|
186 |
|
187 // Retriving data from the test module. |
|
188 class TModuleDataOut |
|
189 { |
|
190 public: |
|
191 |
|
192 enum TModuleRequestType |
|
193 { |
|
194 EModuleResponse, |
|
195 EModuleGpsMode, |
|
196 }; |
|
197 TModuleRequestType iRequestType; |
|
198 |
|
199 enum TModuleResponseType |
|
200 { |
|
201 EModuleResponseOk, |
|
202 EModuleAssDataRequestedOk, |
|
203 EModuleAssDataOk, |
|
204 EModuleAssDataCancelledOk, // may not be possible to verify from within module, hence may remove |
|
205 EModuleStartupOk, |
|
206 EModuleShutdownOk, |
|
207 EModuleErr /** Set if any of the above failed. */ |
|
208 }; |
|
209 |
|
210 TModuleResponseType iResponse; |
|
211 CLbsAdmin::TGpsMode iGpsMode; /** Used to retrive GPS mode from the module. */ |
|
212 }; |
|
213 |
|
214 |
|
215 // Retriving data from the test clock plugin. |
|
216 class TClockPluginDataOut |
|
217 { |
|
218 public: |
|
219 enum TClockPluginResponseType |
|
220 { |
|
221 EClockPluginResponseOk, |
|
222 EClockPluginErr /** Set if any of the above failed. */ |
|
223 }; |
|
224 |
|
225 TClockPluginResponseType iResponse; |
|
226 }; |
|
227 |
|
228 |
|
229 |
|
230 // Assistance Data Simple Provider Default values. |
|
231 const TUint KAssistanceData_RefTime_Week = 12; |
|
232 const TUint KAssistanceData_RefTime_Tow1MSec = 567; |
|
233 |
|
234 // Module Info values |
|
235 /* |
|
236 * the A-GPS value are from testproduct\agpsmodule\group\xtestmodule.ini |
|
237 * most the AGPS module module info are the same as the LbsLocDataSourcePlugins\sirf\group\sirfdatasource.ini |
|
238 * except "Module name", "Version", "ClassesSupported", "DataSourceId" |
|
239 */ |
|
240 //Module ID |
|
241 #define APGS_MODINFO_MODULE_ID 271064388 |
|
242 #define NETWORK_MODINFO_MODULE_ID 271064387 |
|
243 //Module name |
|
244 #define AGPS_MODINFO_MOD_NAME _L("TEST_Loc_AGPS_Module") |
|
245 #define NETWORK_MODINFO_MOD_NAME _L("NetLocManager") |
|
246 // |
|
247 #define AGPS_MODINFO_IS_AVAILABLE (ETrue) |
|
248 #define NETWORK_MODINFO_IS_AVAILABLE (ETrue) |
|
249 //Technology type |
|
250 #define AGPS_MODINFO_TECHNOLOGY_TYPE (TPositionModuleInfo::TTechnologyType(TPositionModuleInfo::ETechnologyTerminal | \ |
|
251 TPositionModuleInfo::ETechnologyAssisted)) |
|
252 #define NETWORK_MODINFO_TECHNOLOGY_TYPE (TPositionModuleInfo::TTechnologyType(TPositionModuleInfo::ETechnologyNetwork)) |
|
253 //version |
|
254 #define AGPS_MODINFO_VERSION (TVersion(1,2,3)) |
|
255 #define NETWORK_MODINFO_VERSION (TVersion(0,1,1)) |
|
256 //device location |
|
257 #define AGPS_MODINFO_DEVICE_LOCATION (TPositionModuleInfo::TDeviceLocation(TPositionModuleInfo::EDeviceInternal)) |
|
258 #define NETWORK_MODINFO_DEVICE_LOCATION (TPositionModuleInfo::TDeviceLocation(TPositionModuleInfo::EDeviceExternal)) |
|
259 //capabilities |
|
260 #define AGPS_MODINFO_CAPABILITIES (TPositionModuleInfo::TCapabilities(TPositionModuleInfo::ECapabilityHorizontal | \ |
|
261 TPositionModuleInfo::ECapabilityVertical | \ |
|
262 TPositionModuleInfo::ECapabilitySpeed | \ |
|
263 TPositionModuleInfo::ECapabilityDirection | \ |
|
264 TPositionModuleInfo::ECapabilitySatellite)) |
|
265 #define NETWORK_MODINFO_CAPABILITIES (TPositionModuleInfo::TCapabilities(TPositionModuleInfo::ECapabilityHorizontal| \ |
|
266 TPositionModuleInfo::ECapabilityVertical | \ |
|
267 TPositionModuleInfo::ECapabilitySpeed | \ |
|
268 TPositionModuleInfo::ECapabilityDirection)) |
|
269 //classes supported |
|
270 #define AGPS_MODINFO_CLASSES_SUPPORTED_POSITION_FAMILY (EPositionInfoClass|EPositionGenericInfoClass| \ |
|
271 EPositionCourseInfoClass|EPositionSatelliteInfoClass) |
|
272 #define NETWORK_MODINFO_CLASSES_SUPPORTED_POSITION_FAMILY (EPositionInfoClass|EPositionGenericInfoClass| \ |
|
273 EPositionCourseInfoClass|EPositionSatelliteInfoClass) |
|
274 //time to first fix |
|
275 #define AGPS_MODINFO_TIME_TO_FIRST_FIX (TTimeIntervalMicroSeconds(90000000)) |
|
276 #define NETWORK_MODINFO_TIME_TO_FIRST_FIX (TTimeIntervalMicroSeconds(20000000)) |
|
277 //time to next fix |
|
278 #define AGPS_MODINFO_TIME_TO_NEXT_FIX (TTimeIntervalMicroSeconds(1000000)) |
|
279 #define NETWORK_MODINFO_TIME_TO_NEXT_FIX (TTimeIntervalMicroSeconds(20000000)) |
|
280 //horizontal accuracy |
|
281 #define AGPS_MODINFO_HORIZONTAL_ACCURACY 5.4f |
|
282 #define NETWORK_MODINFO_HORIZONTAL_ACCURACY 100.0f |
|
283 //vertical accuracy |
|
284 #define AGPS_MODINFO_VERTICAL_ACCURACY 5.4f |
|
285 #define NETWORK_MODINFO_VERTICAL_ACCURACY 100.0f |
|
286 //cost indication |
|
287 #define AGPS_MODINFO_COST_INDICATOR (TPositionQuality::ECostPossible) |
|
288 #define NETWORK_MODINFO_COST_INDICATOR (TPositionQuality::ECostCharge) |
|
289 //power consumption |
|
290 #define AGPS_MODINFO_POWER_CONSUMPTION (TPositionQuality::EPowerLow) |
|
291 #define NETWORK_MODINFO_POWER_CONSUMPTION (TPositionQuality::EPowerLow) |
|
292 |
|
293 /** |
|
294 Current LBS system has two positioning module: A-GPS and Network Loc manager |
|
295 This value might be changed if more positioning modules are added in the future |
|
296 */ |
|
297 #define MAX_POSITIONING_MODULES 2 |
|
298 |
|
299 class TCTClientDetails |
|
300 { |
|
301 public: |
|
302 inline TCTClientDetails() |
|
303 : iSessionIdDelay(0), iSessionStepDelay(0), iCancelRequest(EFalse), iSessionIdCancel(0), iSessionStepCancel(0), iNumberOfNPUDs(1), iUpdateOptions(0) |
|
304 {} |
|
305 public: |
|
306 TInt iSessionIdDelay; |
|
307 TInt iSessionStepDelay; |
|
308 TBool iCancelRequest; |
|
309 TInt iSessionIdCancel; |
|
310 TInt iSessionStepCancel; |
|
311 TInt iNumberOfNPUDs; |
|
312 TPositionUpdateOptions iUpdateOptions; |
|
313 }; |
|
314 |
|
315 // Implements a class to contain the utility functions. |
|
316 class T_LbsUtils |
|
317 { |
|
318 public: |
|
319 enum TComparisonAccuracyType |
|
320 { |
|
321 ERoughAccuracy, EExactAccuracy |
|
322 }; |
|
323 |
|
324 IMPORT_C T_LbsUtils(); |
|
325 IMPORT_C ~T_LbsUtils(); |
|
326 |
|
327 IMPORT_C void CreateTestPropertiesL(); |
|
328 // |
|
329 IMPORT_C void GetConfigured_ModuleInfoL(const TDesC& aConfigFileName, const TDesC& aConfigSection, TPositionModuleInfo& aModInfo); |
|
330 |
|
331 IMPORT_C void GetConfigured_PosInfosL(const TDesC& aConfigFileName, const TDesC& aConfigSection, RPointerArray<TAny>& aPosInfoArr); |
|
332 IMPORT_C void GetConfigured_UpdateArrayL(const TDesC& aConfigFileName, const TDesC& aConfigSection, RPointerArray<TLbsModuleUpdateItem>& aUpdateArr); |
|
333 IMPORT_C void GetConfigured_ModuleStatusL(const TDesC& aConfigFileName, const TDesC& aConfigSection, TPositionModuleStatus& aModuleStatus); |
|
334 IMPORT_C void GetConfigured_ModuleUpdateOptionsL(const TDesC& aConfigFileName, const TDesC& aConfigSection, TPositionUpdateOptions& aUpdateOpts); |
|
335 IMPORT_C void GetConfigured_ClientDetailsL(const TDesC& aConfigFileName, const TDesC& aConfigSection, |
|
336 RArray<TCTClientDetails>& aClientDetailsArray); |
|
337 |
|
338 IMPORT_C void GetExpected_ModuleModes(const TDesC& aConfigFileName, const TDesC& aConfigSection, RPointerArray<TLbsGpsOptions>& aModuleModes); |
|
339 |
|
340 IMPORT_C void NotifyModuleOfConfigChangeL(const TModuleDataIn& aModuleDataIn); |
|
341 IMPORT_C void WaitForModuleToRequestAssistanceDataL(); |
|
342 |
|
343 IMPORT_C TBool Compare_PosInfo(const TPositionInfoBase& aPosInfoSideA, const TPositionInfoBase& aPosInfoSideB); |
|
344 IMPORT_C TBool Compare_PosInfo(const TPositionInfoBase& aPosInfoSideA, const TPositionInfoBase& aPosInfoSideB, TComparisonAccuracyType aCmpAccuracy); |
|
345 |
|
346 IMPORT_C TBool Compare_PosInfoArr(RPointerArray<TAny>& aPosInfoArrSideA, RPointerArray<TAny>& aPosInfoArrSideB); |
|
347 IMPORT_C TBool Compare_PosInfoArr(RPointerArray<TAny>& aPosInfoArrSideA, RPointerArray<TAny>& aPosInfoArrSideB, TComparisonAccuracyType aCmpAccuracy); |
|
348 |
|
349 IMPORT_C void ResetAndDestroy_PosInfoArr(RPointerArray<TAny>& aPosInfoArr); |
|
350 |
|
351 IMPORT_C TPositionModuleId GetNetworkModuleIdL(RPositionServer& aServer); |
|
352 IMPORT_C TPositionModuleId GetAGpsModuleIdL(RPositionServer& aServer); |
|
353 IMPORT_C TPositionModuleId GetBadModuleId(); |
|
354 |
|
355 IMPORT_C TBool Compare_ModuleInfo(TPositionModuleInfo& aModInfoSideA, TPositionModuleInfo& aModInfoSideB); |
|
356 IMPORT_C TBool Compare_PositionQuality(TPositionQuality& aQualitySideA, TPositionQuality& aQualitySideB); |
|
357 IMPORT_C TBool Compare_ModuleStatus(TPositionModuleStatus& aModStatusSideA, TPositionModuleStatus& aModStatusSideB); |
|
358 IMPORT_C TBool Compare_ModuleUpdateOptions(TPositionUpdateOptions& aModUpdateOptsSideA, TPositionUpdateOptions& aModUpdateOptsSideB); |
|
359 IMPORT_C TBool Verify_PositionIsValid(TPositionInfo& aPosInfo); |
|
360 |
|
361 // Assistance data functions |
|
362 // IMPORT_C void CreateSimpleAssistanceData(/*TLbsAssistanceDataGroup aDataMask, RDataReaderRootBase& aGpsRefTimeReader*/); |
|
363 IMPORT_C TBool VerifySimpleAssistanceData(RUEPositioningGpsReferenceTimeReader& aGpsRefTimeReader); |
|
364 IMPORT_C void Create_ModuleInfoL(TPositionModuleId aModuleId, TPositionModuleInfo& aModInfo); |
|
365 |
|
366 |
|
367 IMPORT_C TBool Compare_LogBase(const CLbsLogEvent& aLogEventSideA, const CLbsLogEvent& aLogEventSideB); |
|
368 IMPORT_C TBool Compare_SelfLocateLog(const CLbsSelfLocateLogEvent& aSelfLocateLogSideA, const CLbsSelfLocateLogEvent& aSelfLocateLogB); |
|
369 IMPORT_C TBool Compare_NetworkLocateLog(const CLbsNetworkLocateLogEvent& aNetworkLocateLogSideA, const CLbsNetworkLocateLogEvent& aNetworkLocateLogB); |
|
370 IMPORT_C TBool Compare_ExternalLocateLog(const CLbsExternalLocateLogEvent& aExternalLocateLogSideA, const CLbsExternalLocateLogEvent& aExternalLocateLogSideB); |
|
371 IMPORT_C TBool Compare_TransmitLocationLog(const CLbsTransmitLocationLogEvent& aX3PLogSideA, const CLbsTransmitLocationLogEvent& aX3PLogSideB); |
|
372 IMPORT_C TBool Compare_AssistanceDataLog(const CLbsAssistanceDataLogEvent& aAssistanceDataLogSideA, const CLbsAssistanceDataLogEvent& aAssistanceDataLogSideB); |
|
373 |
|
374 // Needed to compare destinations within TransmitLocation Logs |
|
375 TBool Compare_Destinations(TDesC16& aDestinationFromRealLog, TDesC16& aDestinationFromExpectedLog); |
|
376 |
|
377 |
|
378 IMPORT_C TInt SupportedType(const TUint32& aType, const TInt& aSize); |
|
379 IMPORT_C TInt CopyPositionTypes(TPositionInfoBase& aTo, const TPositionInfoBase& aFrom); |
|
380 |
|
381 private: |
|
382 TInt GetModIdByTechnology(RPositionServer& aServer, TPositionModuleInfo::TTechnologyType aTechnologyType, TPositionModuleId& aModuleId); |
|
383 // Needed to compare external locate logs. |
|
384 TBool Compare_ExternalRequestPrivacyRequestParams(const TLbsLoggingPrivacyRequestParams& aLogPrivacyRequestParamsSideA, const TLbsLoggingPrivacyRequestParams& aLogPrivacyRequestParamsSideB); |
|
385 TBool Compare_ExternalRequestPrivacyResponseParams(const TLbsLoggingPrivacyResponseParams& aExternalRequestPrivacyResponseSideA, const TLbsLoggingPrivacyResponseParams& aExternalRequestPrivacyResponseSideB); |
|
386 TBool Compare_ExternalRequestInfo(const TLbsExternalRequestInfo& aExternalRequestInfoSideA, const TLbsExternalRequestInfo& aExternalRequestInfoSideB); |
|
387 TBool Compare_ExternalRequestPrivacy(const TLbsNetPosRequestPrivacy& aExternalRequestPrivacySideA, const TLbsNetPosRequestPrivacy& aExternalRequestPrivacySideB); |
|
388 }; |
|
389 |
|
390 |
|
391 /** Possible set of Module options. |
|
392 Held by AGps Hybrid module as bits in a 32 bitmap. |
|
393 */ |
|
394 enum TLbsHybridModuleOptions |
|
395 { |
|
396 EHybridModuleOptions_ClearAll = 0x0000, |
|
397 ELbsHybridModuleOptions_AssistanceDataOn = 0x0001, |
|
398 ELbsHybridModuleOptions_MultiUpdatesOn = 0x0002, |
|
399 ELbsHybridModuleOptions_DisableReqAssistData = 0x0004, |
|
400 ELbsHybridModuleOptions_DynamicAssistanceData = 0x008, //Assistance Data delivery variant used in SUPL tests |
|
401 ELbsHybridModuleOptions_SetAll = 0x000F |
|
402 }; |
|
403 |
|
404 #endif //__T_LBS_UTILS_H__ |