|
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 |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // This is the class implementation for the configuration of the AGPS Hybrid Module |
|
15 // The main purpose of this test step is to allow flexible configurability of the AGps Hybrid Module |
|
16 // from the Test Harness. |
|
17 // Various configuration options are read from the ini files and sent to the AGps Hybrid Module through the TH channel. |
|
18 // The AGps Hybrid Module always acknowledges each configuration message (see ProcessAGpsResponseMessage() method below). |
|
19 // This test step has been written to understand '.ini' files containing sections such as [Config2] below: |
|
20 // [Config2] |
|
21 // agps_module_update_file = c:\testdata\configs\lbs_molr.ini |
|
22 // agps_module_multi_updates_opt = on |
|
23 // agps_module_assistance_data_opt= on |
|
24 // $update,1,2,49.2,NAN,NAN,2,3* |
|
25 // $update,1,2,49.2,NAN,NAN,2,3* |
|
26 // $update,1,2,49.2,3.5,50,2,3* |
|
27 // => Current module possible options are: |
|
28 // agps_module_multi_updates_opt = [ on | off ] |
|
29 // It sets the module to send multiple updates after Target Time. |
|
30 // - When this mode is "off" only one update is sent just after 'Target time' (that is, the next update item available |
|
31 // from the module's update array). |
|
32 // - When this mode is "on", the module sends N + 1 updates between 'Target time' and 'Max fix time' |
|
33 // (currently hardcoded -> N = 2). |
|
34 // The final update is the next update item available from the module's update array. |
|
35 // The module calculates the first N updates from the final update, these updates contain incomplete |
|
36 // positions (NAN longitude and latitude, ...). |
|
37 // Note:'Target time' specifies the time when the location update should be provided by the AGPS module. |
|
38 // 'Max fix time' specifies the time maximum time the module should spend calculating the current location. |
|
39 // agps_module_assistance_data_opt = [ on | off ] |
|
40 // Only applicable when in Preferred Terminal Mode. |
|
41 // - When this mode is "on", for each new location request the AGps Module may Request new Assistance Data |
|
42 // (if it has not been delivered already, sometimes assistance data is delivered to the module before it is requested). |
|
43 // - When this mode is off, the default RequestAssistanceData(EAssistanceDataNone) call will always be made. |
|
44 // agps_module_dynamic_ass_data_opt = [ on | off ] (off by default) |
|
45 // Switches between different assistance data delivery methods: |
|
46 // -> OFF - On the first RequestAssistanceData requests the assistance data aDataMask is always set to |
|
47 // the assistance data that it needs. However for all subsequent assistance data requests the |
|
48 // aDataMask will always be set to 0. This is the method used in all the hybrid tests. |
|
49 // -> ON - Here the module will always request any assistance data that it has not yet received. So on |
|
50 // the first assistanceData request the aDataMask is set to the assistance data it requires. On |
|
51 // subsequent assistance data requests it will re-request the assistance data that has not yet |
|
52 // been delivered. This is the method that should be used in SUPL tests. |
|
53 // agps_module_clear_all_opt = [ on | off ] |
|
54 // Sets all the possible module options to on. |
|
55 // agps_module_set_all_opt = [ on | off ] |
|
56 // Sets all the possible module options to off. |
|
57 // => $update command: |
|
58 // The $update entries in the ini files are used to populate the AGps Hybrid Module update array. |
|
59 // Note: The Module's update array contains the update items used to generate the updates sent to the AGps Manager. |
|
60 // The $update command syntax should be as follows: |
|
61 // $update,num_of_updates,[num_of_measurements],[latitude],[longitude],[altitude],[horz_accuracy],[vert_accuracy],[update_err]* |
|
62 // - where num_of_updates is the number of updates to add to the update array. For values greater than 1, each update |
|
63 // will contain the same data position and measurement data as defined by the reminder of the sentence. |
|
64 // - where num_of_measurements is the number of satellite measurements to define (see TPositionGpsMeasurementData). |
|
65 // If this value is 0 no measurement data is defined and only the position data is defined. |
|
66 // Values for the actual measurement data will be generated automatically. |
|
67 // - where latitude, longitude, altitude, horz_accuracy, vert_accuracy are used to define the values for the |
|
68 // TPositionInfo part of the TPositionSatelliteInfo. |
|
69 // - where update_err, is the error code to return to the manager for the update. If NOT defined the value will be KErrNone. |
|
70 // => Possible Enhancements: This test step might be enhanced later on to also additional functionality such as: |
|
71 // agps_module_update_error = -1 |
|
72 // agps_module_update_timeout = 5000000 |
|
73 // agps_module_multi_updates_opt = 2 // where 2 is the number of multi updates sent before |
|
74 // // the final update is sent prior to 'Max fix time' |
|
75 // |
|
76 // |
|
77 |
|
78 #include "ctlbsstepconfighybridmodule.h" |
|
79 |
|
80 #include <lbs/test/tlbsutils.h> |
|
81 |
|
82 |
|
83 _LIT(KUpdateFile, "agps_module_update_file"); |
|
84 _LIT(KClearAllOpt, "agps_module_clear_all_opt"); |
|
85 _LIT(KAssistanceDataOpt, "agps_module_assistance_data_opt"); |
|
86 _LIT(KMultiUpdateOpt, "agps_module_multi_updates_opt"); |
|
87 _LIT(KReqAssDatReqOpt, "agps_module_req_ass_data_req_opt"); |
|
88 _LIT(KSetAllOpt, "agps_module_set_all_opt"); |
|
89 _LIT(KSuplAssDataOpt, "agps_module_dynamic_ass_data_opt"); |
|
90 _LIT(KUpdateTimeout, "agps_module_update_timeout"); |
|
91 _LIT(KImmediateMeasurements, "agps_module_immediate_measurements"); |
|
92 _LIT(KOption_OFF, "off"); |
|
93 _LIT(KOption_ON, "on"); |
|
94 _LIT(KNoFileName, ""); |
|
95 |
|
96 |
|
97 /** |
|
98 * Constructor |
|
99 */ |
|
100 CT_LbsStep_ConfigHybridModule::CT_LbsStep_ConfigHybridModule(CT_LbsServer& aParent) : CT_LbsStep(aParent) |
|
101 { |
|
102 SetTestStepName(KLbsStep_ConfigHybridModule); |
|
103 } |
|
104 |
|
105 |
|
106 /** |
|
107 Static Constructor |
|
108 */ |
|
109 CT_LbsStep_ConfigHybridModule* CT_LbsStep_ConfigHybridModule::New(CT_LbsServer& aParent) |
|
110 { |
|
111 return new CT_LbsStep_ConfigHybridModule(aParent); |
|
112 // Note the lack of ELeave. |
|
113 // This means that having insufficient memory will return NULL; |
|
114 } |
|
115 |
|
116 /** |
|
117 * @return - TVerdict code |
|
118 * Override of base class virtual |
|
119 */ |
|
120 TVerdict CT_LbsStep_ConfigHybridModule::doTestStepPreambleL() |
|
121 { |
|
122 INFO_PRINTF1(_L("Test Preamble. CT_LbsStep_ConfigHybridModule")); |
|
123 |
|
124 // create the test channel handler |
|
125 iAGpsHandler = CT_LbsAGpsHandler::NewL(this); |
|
126 |
|
127 SetTestStepResult(EPass); |
|
128 return TestStepResult(); |
|
129 } |
|
130 |
|
131 /** |
|
132 * @return - TVerdict code |
|
133 * Override of base class virtual |
|
134 */ |
|
135 TVerdict CT_LbsStep_ConfigHybridModule::doTestStepPostambleL() |
|
136 { |
|
137 INFO_PRINTF1(_L("Test Postamble. CT_LbsStep_ConfigHybridModule")); |
|
138 |
|
139 delete iAGpsHandler; |
|
140 iAGpsHandler = NULL; |
|
141 |
|
142 return TestStepResult(); |
|
143 } |
|
144 |
|
145 /** |
|
146 * @return - TVerdict code |
|
147 * Override of base class pure virtual |
|
148 * Our implementation only gets called if the base class doTestStepPreambleL() did |
|
149 * not leave. That being the case, the current test result value will be EPass. |
|
150 */ |
|
151 TVerdict CT_LbsStep_ConfigHybridModule::doTestStepL() |
|
152 { |
|
153 INFO_PRINTF1(_L(">>CT_LbsStep_ConfigHybridModule::doTestStepL()")); // ?? |
|
154 |
|
155 if (TestStepResult() == EPass) |
|
156 { |
|
157 TPtrC configFileName; |
|
158 GetStringFromConfig(ConfigSection(), KUpdateFile, configFileName); |
|
159 if (configFileName != KNoFileName) |
|
160 { |
|
161 iConfigCtr++; |
|
162 iAGpsHandler->SendRequestUpdateInitMsg(configFileName, ConfigSection()); |
|
163 } |
|
164 |
|
165 TPtrC clearAllOpt; |
|
166 GetStringFromConfig(ConfigSection(), KClearAllOpt, clearAllOpt); |
|
167 if (clearAllOpt == KOption_ON) |
|
168 { |
|
169 iConfigCtr++; |
|
170 iAGpsHandler->SendRequestClearAllModuleOptions(); |
|
171 } |
|
172 |
|
173 TPtrC updateOpt; |
|
174 GetStringFromConfig(ConfigSection(), KMultiUpdateOpt, updateOpt); |
|
175 if (updateOpt == KOption_OFF) |
|
176 { |
|
177 iConfigCtr++; |
|
178 iAGpsHandler->SendRequestModuleOption(ELbsHybridModuleOptions_MultiUpdatesOn, EFalse); |
|
179 } |
|
180 else if (updateOpt == KOption_ON) |
|
181 { |
|
182 iConfigCtr++; |
|
183 iAGpsHandler->SendRequestModuleOption(ELbsHybridModuleOptions_MultiUpdatesOn, ETrue); |
|
184 } |
|
185 |
|
186 TPtrC assDataOpt; |
|
187 GetStringFromConfig(ConfigSection(), KAssistanceDataOpt, assDataOpt); |
|
188 if (assDataOpt == KOption_OFF) |
|
189 { |
|
190 iConfigCtr++; |
|
191 iAGpsHandler->SendRequestModuleOption(ELbsHybridModuleOptions_AssistanceDataOn, EFalse); |
|
192 } |
|
193 else if (assDataOpt == KOption_ON) |
|
194 { |
|
195 iConfigCtr++; |
|
196 iAGpsHandler->SendRequestModuleOption(ELbsHybridModuleOptions_AssistanceDataOn, ETrue); |
|
197 } |
|
198 |
|
199 |
|
200 TPtrC reqAssDataOpt; |
|
201 GetStringFromConfig(ConfigSection(), KReqAssDatReqOpt, reqAssDataOpt); |
|
202 if (reqAssDataOpt == KOption_OFF) |
|
203 { |
|
204 iConfigCtr++; |
|
205 iAGpsHandler->SendRequestModuleOption(ELbsHybridModuleOptions_DisableReqAssistData, EFalse); |
|
206 } |
|
207 else if (reqAssDataOpt == KOption_ON) |
|
208 { |
|
209 iConfigCtr++; |
|
210 iAGpsHandler->SendRequestModuleOption(ELbsHybridModuleOptions_DisableReqAssistData, ETrue); |
|
211 } |
|
212 |
|
213 |
|
214 TPtrC suplAssDataOpt; |
|
215 GetStringFromConfig(ConfigSection(), KSuplAssDataOpt, suplAssDataOpt); |
|
216 if (suplAssDataOpt == KOption_OFF) |
|
217 { |
|
218 iConfigCtr++; |
|
219 iAGpsHandler->SendRequestModuleOption(ELbsHybridModuleOptions_DynamicAssistanceData, EFalse); |
|
220 } |
|
221 else if (suplAssDataOpt == KOption_ON) |
|
222 { |
|
223 iConfigCtr++; |
|
224 iAGpsHandler->SendRequestModuleOption(ELbsHybridModuleOptions_DynamicAssistanceData, ETrue); |
|
225 } |
|
226 |
|
227 |
|
228 |
|
229 TPtrC setAllOpt; |
|
230 GetStringFromConfig(ConfigSection(), KSetAllOpt, setAllOpt); |
|
231 if (setAllOpt == KOption_ON) |
|
232 { |
|
233 iConfigCtr++; |
|
234 iAGpsHandler->SendRequestSetAllModuleOptions(); |
|
235 } |
|
236 TInt updateTimeout; |
|
237 if (GetIntFromConfig(ConfigSection(), KUpdateTimeout, updateTimeout)) |
|
238 { |
|
239 TTimeIntervalMicroSeconds timeoutVal(updateTimeout); |
|
240 |
|
241 iConfigCtr++; |
|
242 iAGpsHandler->SendRequestTimeOutMsg(timeoutVal); |
|
243 } |
|
244 |
|
245 TInt immediateMeasurements; |
|
246 if (GetIntFromConfig(ConfigSection(), KImmediateMeasurements, immediateMeasurements)) |
|
247 { |
|
248 iConfigCtr++; |
|
249 iAGpsHandler->SendImmediateMeasurementsMsg(immediateMeasurements); |
|
250 } |
|
251 // All the configuration requests sent, now start the active scheduler |
|
252 if (iConfigCtr) |
|
253 { |
|
254 CActiveScheduler::Start(); |
|
255 } |
|
256 } |
|
257 |
|
258 |
|
259 INFO_PRINTF1(_L("<<CT_LbsStep_ConfigHybridModule::doTestStepL()")); //?? |
|
260 |
|
261 return TestStepResult(); |
|
262 } |
|
263 |
|
264 |
|
265 void CT_LbsStep_ConfigHybridModule::ProcessAGpsResponseMessage(const TT_LbsAGpsResponseMsg::TModuleResponseType aResponse) |
|
266 { |
|
267 iConfigCtr--; |
|
268 |
|
269 if (TT_LbsAGpsResponseMsg::EModuleResponseOk == aResponse) |
|
270 { |
|
271 // If any of the previous responses has failed do not override the verdict |
|
272 if (iVerdict != EFail) |
|
273 { |
|
274 iVerdict = EPass; |
|
275 } |
|
276 } |
|
277 else |
|
278 { |
|
279 iVerdict = EFail; |
|
280 } |
|
281 |
|
282 if (!iConfigCtr) |
|
283 { |
|
284 SetTestStepResult(iVerdict); |
|
285 CActiveScheduler::Stop(); |
|
286 } |
|
287 } |