|
1 // Copyright (c) 2008-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 // Example CTestStep derived implementation |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file molr23Step.cpp |
|
20 @internalTechnology |
|
21 */ |
|
22 #include "molr23Step.h" |
|
23 #include "te_suplprotocolsuitedefs.h" |
|
24 |
|
25 /** |
|
26 Destructor |
|
27 */ |
|
28 Cmolr23Step::~Cmolr23Step() |
|
29 |
|
30 { |
|
31 } |
|
32 |
|
33 /** |
|
34 Constructor |
|
35 */ |
|
36 Cmolr23Step::Cmolr23Step() |
|
37 { |
|
38 SetTestStepName(Kmolr23Step); |
|
39 } |
|
40 |
|
41 /** |
|
42 @return - TVerdict code |
|
43 Override of base class virtual |
|
44 */ |
|
45 TVerdict Cmolr23Step::doTestStepPreambleL() |
|
46 { |
|
47 // Call base class method for pre test actions |
|
48 CTe_suplprotocolSuiteStepBase::doTestStepPreambleL(); |
|
49 |
|
50 TLbsNetProtocolModuleParams param(*iGatewayObserver); |
|
51 iModule = CSuplGatewayInterface::NewL(reinterpret_cast<TAny*>(¶m)); |
|
52 |
|
53 return TestStepResult(); |
|
54 } |
|
55 |
|
56 |
|
57 /** Perform CMoLrStep23 test step. |
|
58 This test verifies that the SUPL Protocol Module correctly handles |
|
59 a request for additional assistance data sent from LBS after a change |
|
60 from Terminal Based to Terminal Assisted during the SUPL POS RRLP |
|
61 session. |
|
62 |
|
63 This test also checks some aspects of assistance data handling: |
|
64 |
|
65 1.- Assistance data types already made available to LBS but requested |
|
66 again by LBS will not be requested from the network. |
|
67 2.- Assistance data types not supported by LBS (e.g. DgpsCorrections) |
|
68 are not requested from the network |
|
69 3.- Assistance data types requested from the network but not reported |
|
70 by the network result in an assistance data error notification being |
|
71 sent to LBS. |
|
72 |
|
73 @return TVerdict test result code |
|
74 */ |
|
75 TVerdict Cmolr23Step::doTestStepL() |
|
76 { |
|
77 |
|
78 INFO_PRINTF1(_L("\t********************************************************************")); |
|
79 INFO_PRINTF1(_L("\tMOLR basic procedure - Additional RRLP Assistance Data Requested")); |
|
80 INFO_PRINTF1(_L("\t********************************************************************")); |
|
81 INFO_PRINTF1(_L("- START -")); |
|
82 // Initiate MO-LR |
|
83 TLbsNetSessionId sessionId1(TUid::Uid(0x87654323), 0x1111); |
|
84 TLbsNetPosRequestOptionsAssistance options1; |
|
85 options1.SetNewClientConnected(ETrue); |
|
86 TLbsNetPosRequestQuality quality1; |
|
87 options1.SetRequestQuality(quality1); |
|
88 TLbsAsistanceDataGroup dataRequestMask1 = EAssistanceDataBadSatList; |
|
89 TLbsAsistanceDataGroup dataRequestMask2 = EAssistanceDataReferenceLocation; |
|
90 // Request both sets of assitance data. They'll be delivered in different |
|
91 // SUPL POS messages later on in the test. |
|
92 TLbsAsistanceDataGroup dataRequestMask = dataRequestMask1|dataRequestMask2; |
|
93 options1.SetDataRequestMask(dataRequestMask); |
|
94 INFO_PRINTF1(_L("\tLBS -> RequestSelfLocation")); |
|
95 iModule->RequestSelfLocation(sessionId1, options1); |
|
96 |
|
97 // Check Connection Manager receives a request for connecting |
|
98 if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EConnectReq)) |
|
99 { |
|
100 SetTestStepResult(EFail); |
|
101 return TestStepResult(); |
|
102 } |
|
103 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t ConnectionRequest -> NET")); |
|
104 |
|
105 |
|
106 // Simulate the connection is up (inject that event) |
|
107 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t Connected <- NET")); |
|
108 iNetworkObserver->InjectConnectedIndication(iNetworkObserver->SessionId()); |
|
109 |
|
110 // Check Connection Manager receives a request to send a SUPL START |
|
111 if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESuplStartSendReq)) |
|
112 { |
|
113 SetTestStepResult(EFail); |
|
114 return TestStepResult(); |
|
115 } |
|
116 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL START -> NET")); |
|
117 |
|
118 // Inject a SUPL RESPONSE |
|
119 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL RESPONSE <- NET")); |
|
120 CSuplMessageBase* resp = BuildSuplResponseL(TPositionModuleInfo::ETechnologyTerminal | TPositionModuleInfo::ETechnologyAssisted); |
|
121 iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), resp); |
|
122 |
|
123 // Check gateway receives Location Request |
|
124 INFO_PRINTF1(_L("\tLBS <- ProcessLocationRequest()")); |
|
125 if (EFail == CheckGatewayCallbackL( |
|
126 CSuplGatewayObserver::EProcessLocationRequest) || |
|
127 MLbsNetworkProtocolObserver::EServiceSelfLocation != iGatewayObserver->LocType()) |
|
128 { |
|
129 SetTestStepResult(EFail); |
|
130 return TestStepResult(); |
|
131 } |
|
132 |
|
133 // LBS Requests assistance data |
|
134 INFO_PRINTF1(_L("\tLBS -> RequestAssistanceData ()")); |
|
135 TLbsNetSessionIdArray dummyIdArray; |
|
136 iModule->RequestAssistanceData(dataRequestMask, dummyIdArray); |
|
137 |
|
138 // Check Connection Manager receives a request to send a SUPL POS INIT |
|
139 // with the assistance data mask requested by the gateway |
|
140 if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplPosInitSendReq)) |
|
141 { |
|
142 SetTestStepResult(EFail); |
|
143 return TestStepResult(); |
|
144 } |
|
145 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS INIT -> NET")); |
|
146 |
|
147 // Inject a SUPL POS (RRLP ASSIST DATA) with some of the Assistance data requested |
|
148 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Assitance Data <- NET")); |
|
149 CSuplMessageBase* suplPos = BuildSuplPosAssitDataL(dataRequestMask2, ETrue); // ETrue = more assistance data underway |
|
150 iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), suplPos); |
|
151 |
|
152 // Check the Connection Manager receives a request to send a SUPL POS (ack to assistance data) |
|
153 if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplPosSendReq)) |
|
154 { |
|
155 SetTestStepResult(EFail); |
|
156 return TestStepResult(); |
|
157 } |
|
158 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Assistance Data Ack -> NET")); |
|
159 |
|
160 // Inject a SUPL POS (RRLP MEASURE POSITION REQUEST) wich carries |
|
161 // assistance data. |
|
162 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Measure Position Request <- NET")); |
|
163 suplPos = BuildSuplPosRequestL(TPositionModuleInfo::ETechnologyNetwork | TPositionModuleInfo::ETechnologyAssisted, dataRequestMask1); |
|
164 iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), suplPos); |
|
165 |
|
166 |
|
167 // Gateway receives reference location and then assistance data |
|
168 // (it happens in the same callback; errors checked separetely below) |
|
169 if (EFail == CheckGatewayCallbackL(CSuplGatewayObserver::EProcessAssistanceData) || |
|
170 (dataRequestMask & iGatewayObserver->AssistanceDataSetMask() != dataRequestMask)) |
|
171 { |
|
172 SetTestStepResult(EFail); |
|
173 return TestStepResult(); |
|
174 } |
|
175 |
|
176 // Ref Loc has been requested. Make sure it's been notified (the callback mechanism does |
|
177 // not work well because EProcessAssistanceData overwrites EProcessLocationUpdate as they |
|
178 // happen in the same RunL of the SUPL Protocol). Instead, a flag has to be checked after |
|
179 // having received EProcessAssistanceData above |
|
180 if (!iGatewayObserver->IsRefLocNotified()) |
|
181 { |
|
182 SetTestStepResult(EFail); |
|
183 return TestStepResult(); |
|
184 } |
|
185 |
|
186 // Reference Location is reported before Assistance Data...if we got this far, |
|
187 // both ref loc and assist data have been notified: |
|
188 INFO_PRINTF1(_L("\tLBS <- ProcessLocationUpdate(Reference Location)")); |
|
189 INFO_PRINTF1(_L("\tLBS <- ProcessAssistanceData()")); |
|
190 |
|
191 // Check gateway receives a location request (due to the RRLP Measure Position Request) |
|
192 // |
|
193 if (EFail == CheckGatewayCallbackL( |
|
194 CSuplGatewayObserver::EProcessLocationRequest) || |
|
195 MLbsNetworkProtocolObserver::EServiceSelfLocation != iGatewayObserver->LocType()) |
|
196 { |
|
197 SetTestStepResult(EFail); |
|
198 return TestStepResult(); |
|
199 } |
|
200 |
|
201 // **************************************************************************************** |
|
202 // Fake LBS requires additional assistance data after receiving the location request above. |
|
203 // **************************************************************************************** |
|
204 |
|
205 // In addition to AquisitionAssistance and ReferenceTime, LBS requests again the same assistance data |
|
206 // it just got (datamask1 and datamask2) and also the unsupported DgpsCorrections. Only |
|
207 // AcquisitionAssistance and EAssistanceDataReferenceTime should end up being requested from the |
|
208 // network in the RRLP Measure Position response. |
|
209 INFO_PRINTF1(_L("\tLBS -> RequestAssistanceData ()")); |
|
210 TLbsAssistanceDataGroup newDataMask = EAssistanceDataAquisitionAssistance | EAssistanceDataReferenceTime | EAssistanceDataDgpsCorrections; |
|
211 dataRequestMask = dataRequestMask1|dataRequestMask2|newDataMask; |
|
212 iModule->RequestAssistanceData(dataRequestMask, dummyIdArray); |
|
213 |
|
214 |
|
215 // Check that the Gateway Observer has been notified synchronously of an error |
|
216 // due to assistance data type EAssistanceDataDgpsCorrections not being supported |
|
217 // |
|
218 INFO_PRINTF1(_L("\tLBS <- ProcessAssistanceData(EAssistanceDataDgpsCorrections, KErrArgument)")); |
|
219 if (EFail == CheckGatewayCallbackL(CSuplGatewayObserver::EProcessAssistanceData) || |
|
220 (KErrArgument != iGatewayObserver->AssistanceDataError()) || |
|
221 (EAssistanceDataDgpsCorrections & iGatewayObserver->AssistanceDataErrorMask() != EAssistanceDataDgpsCorrections) ) |
|
222 { |
|
223 SetTestStepResult(EFail); |
|
224 return TestStepResult(); |
|
225 } |
|
226 |
|
227 // Check the Connection Manager receives a request to send a SUPL POS (RRLP MEASURE POSITION RESPONSE) |
|
228 // The RRLP Measure Position Response Message should request assistance data types |
|
229 // EAssistanceDataAquisitionAssistance and EAssistanceDataReferenceTime only. |
|
230 // |
|
231 if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplPosSendReq) || |
|
232 (CSuplPosPayload::ERrlpMeasurePositionResp != iNetworkObserver->RrlpMessageType()) || |
|
233 ((EAssistanceDataAquisitionAssistance | EAssistanceDataReferenceTime) != iNetworkObserver->AssistDataReq())) |
|
234 { |
|
235 SetTestStepResult(EFail); |
|
236 return TestStepResult(); |
|
237 } |
|
238 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Measure Position Response -> NET")); |
|
239 |
|
240 |
|
241 // Inject a SUPL POS (RRLP MEASURE POSITION REQUEST) wich carries |
|
242 // assistance data. It only carries one of the assistance data types |
|
243 // previously requested (EAssistanceDataAquisitionAssistance) |
|
244 // |
|
245 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Measure Position Request <- NET")); |
|
246 suplPos = BuildSuplPosRequestL(TPositionModuleInfo::ETechnologyTerminal | TPositionModuleInfo::ETechnologyAssisted, EAssistanceDataAquisitionAssistance); |
|
247 iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), suplPos); |
|
248 |
|
249 |
|
250 // Check gateway receives the assistance data of type EAssistanceDataAquisitionAssistance |
|
251 // Check that gateway receives an assistance data error reporting missing assistance data |
|
252 // type EAssistanceDataReferenceTime (both are sent almost simultaneously so they have to |
|
253 // be checked in the same callback) |
|
254 INFO_PRINTF1(_L("\tLBS <- ProcessAssistanceData(EAssistanceDataReferenceTime, KErrNotFound)")); |
|
255 INFO_PRINTF1(_L("\tLBS <- ProcessAssistanceData(EAssistanceDataAquisitionAssistance, KErrNone)")); |
|
256 if (EFail == CheckGatewayCallbackL(CSuplGatewayObserver::EProcessAssistanceData) || |
|
257 (EAssistanceDataAquisitionAssistance & iGatewayObserver->AssistanceDataSetMask() != EAssistanceDataAquisitionAssistance) || |
|
258 (EAssistanceDataReferenceTime & iGatewayObserver->AssistanceDataErrorMask() != EAssistanceDataReferenceTime) || |
|
259 (KErrNotFound != iGatewayObserver->AssistanceDataError()) ) |
|
260 { |
|
261 SetTestStepResult(EFail); |
|
262 return TestStepResult(); |
|
263 } |
|
264 |
|
265 // Check gateway receives a location request (due to the RRLP Measure Position Request) |
|
266 // |
|
267 INFO_PRINTF1(_L("\tLBS <- ProcessLocationRequest()")); |
|
268 if (EFail == CheckGatewayCallbackL( |
|
269 CSuplGatewayObserver::EProcessLocationRequest) || |
|
270 MLbsNetworkProtocolObserver::EServiceSelfLocation != iGatewayObserver->LocType()) |
|
271 { |
|
272 SetTestStepResult(EFail); |
|
273 return TestStepResult(); |
|
274 } |
|
275 |
|
276 // Fake LBS sending results (position) to SPM |
|
277 INFO_PRINTF1(_L("\tLBS -> RespondLocationRequest")); |
|
278 TReal64 latitude = 10; |
|
279 TReal64 longitude = 0; |
|
280 TReal32 HorAccuracy = 10; |
|
281 TPositionInfo mobilePosInfo; |
|
282 TTime utcTime; |
|
283 utcTime.UniversalTime(); |
|
284 TCoordinate coor(latitude,longitude); |
|
285 TPosition mobilePos(TLocality(coor,HorAccuracy),utcTime); |
|
286 mobilePosInfo.SetPosition(mobilePos); |
|
287 iModule->RespondLocationRequest(sessionId1,KErrNone,mobilePosInfo); |
|
288 |
|
289 |
|
290 // Check the Connection Manager receives a request to send a SUPL POS (RRLP MEASURE POSITION RESPONSE) |
|
291 // |
|
292 if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplPosSendReq)) |
|
293 { |
|
294 SetTestStepResult(EFail); |
|
295 return TestStepResult(); |
|
296 } |
|
297 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Measure Position Response -> NET")); |
|
298 |
|
299 // Inject a SUPL END (without position) |
|
300 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL END <- NET")); |
|
301 CSuplMessageBase* suplEnd = BuildSuplEndL(EFalse); // EFalse means no position |
|
302 iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), suplEnd); |
|
303 |
|
304 // Check gateway session completed |
|
305 if (EFail == CheckGatewayCallbackL( |
|
306 CSuplGatewayObserver::EProcessSessionComplete)) |
|
307 { |
|
308 SetTestStepResult(EFail); |
|
309 return TestStepResult(); |
|
310 } |
|
311 INFO_PRINTF1(_L("\tLBS <- ProcessSessionComplete")); |
|
312 |
|
313 // Check Connection Manager receives a disconnection request |
|
314 if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EDisconnectReq)) |
|
315 { |
|
316 SetTestStepResult(EFail); |
|
317 return TestStepResult(); |
|
318 } |
|
319 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t DisconnectRequest -> NET")); |
|
320 |
|
321 // Check if more observer activity takes place |
|
322 if (iGatewayObserver->IsMoreObserverActivity() || |
|
323 iNetworkObserver->IsMoreObserverActivity()) |
|
324 { |
|
325 SetTestStepResult(EFail); |
|
326 return TestStepResult(); |
|
327 } |
|
328 INFO_PRINTF1(_L("- END -")); |
|
329 |
|
330 SetTestStepResult(EPass); |
|
331 return TestStepResult(); |
|
332 |
|
333 } |
|
334 |
|
335 |
|
336 /** |
|
337 * @return - TVerdict code |
|
338 * Override of base class virtual |
|
339 */ |
|
340 TVerdict Cmolr23Step::doTestStepPostambleL() |
|
341 { |
|
342 delete iModule; |
|
343 |
|
344 // Call base class method for post test actions |
|
345 CTe_suplprotocolSuiteStepBase::doTestStepPostambleL(); |
|
346 return TestStepResult(); |
|
347 } |