|
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 molr30Step.cpp |
|
20 @internalTechnology |
|
21 */ |
|
22 #include "molr30Step.h" |
|
23 #include "te_suplprotocolsuitedefs.h" |
|
24 |
|
25 /** |
|
26 Destructor |
|
27 */ |
|
28 Cmolr30Step::~Cmolr30Step() |
|
29 |
|
30 { |
|
31 } |
|
32 |
|
33 /** |
|
34 Constructor |
|
35 */ |
|
36 Cmolr30Step::Cmolr30Step() |
|
37 { |
|
38 SetTestStepName(Kmolr30Step); |
|
39 } |
|
40 |
|
41 /** |
|
42 @return - TVerdict code |
|
43 Override of base class virtual |
|
44 */ |
|
45 TVerdict Cmolr30Step::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 CMoLrStep1 test step. |
|
58 This test verifies that the SUPL Protocol Module correctly handles |
|
59 an MO-LR Self Locate Terminal Based sequence. Assistance data is |
|
60 partially delivered whith an RRLP assistance data message and then complemented |
|
61 with more assistance data received in an RRLP Measure Position Request. |
|
62 |
|
63 This test also ensures that Reference Location is one of the assistance data |
|
64 types requested by LBS after SUPL RESPONSE. The test verifies that a reference |
|
65 location is delivered to LBS if it is received from the network in the |
|
66 Reference Location assistance data type. |
|
67 |
|
68 @return TVerdict test result code |
|
69 */ |
|
70 TVerdict Cmolr30Step::doTestStepL() |
|
71 { |
|
72 |
|
73 INFO_PRINTF1(_L("\t********************************************************************")); |
|
74 INFO_PRINTF1(_L("\tMOLR times out waiting for SUPL END after SUPL POS session")); |
|
75 INFO_PRINTF1(_L("\t********************************************************************")); |
|
76 INFO_PRINTF1(_L("- START -")); |
|
77 // Initiate MO-LR |
|
78 TLbsNetSessionId sessionId1(TUid::Uid(0x87654321), 0x1111); |
|
79 TLbsNetPosRequestOptionsAssistance options1; |
|
80 options1.SetNewClientConnected(ETrue); |
|
81 TLbsNetPosRequestQuality quality1; |
|
82 options1.SetRequestQuality(quality1); |
|
83 TLbsAsistanceDataGroup dataRequestMask1 = EAssistanceDataBadSatList; |
|
84 TLbsAsistanceDataGroup dataRequestMask2 = EAssistanceDataReferenceLocation; |
|
85 // Request both sets of assitance data. They'll be delivered in different |
|
86 // SUPL POS messages later on in the test. |
|
87 TLbsAsistanceDataGroup dataRequestMask = dataRequestMask1|dataRequestMask2; |
|
88 options1.SetDataRequestMask(dataRequestMask); |
|
89 INFO_PRINTF1(_L("\tLBS -> RequestSelfLocation")); |
|
90 iModule->RequestSelfLocation(sessionId1, options1); |
|
91 |
|
92 // Check Connection Manager receives a request for connecting |
|
93 if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EConnectReq)) |
|
94 { |
|
95 SetTestStepResult(EFail); |
|
96 return TestStepResult(); |
|
97 } |
|
98 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t ConnectionRequest -> NET")); |
|
99 |
|
100 |
|
101 // Simulate the connection is up (inject that event) |
|
102 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t Connected <- NET")); |
|
103 iNetworkObserver->InjectConnectedIndication(iNetworkObserver->SessionId()); |
|
104 |
|
105 // Check Connection Manager receives a request to send a SUPL START |
|
106 if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESuplStartSendReq)) |
|
107 { |
|
108 SetTestStepResult(EFail); |
|
109 return TestStepResult(); |
|
110 } |
|
111 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL START -> NET")); |
|
112 |
|
113 // Inject a SUPL RESPONSE |
|
114 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL RESPONSE <- NET")); |
|
115 CSuplMessageBase* resp = BuildSuplResponseL(TPositionModuleInfo::ETechnologyTerminal | TPositionModuleInfo::ETechnologyAssisted); |
|
116 iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), resp); |
|
117 |
|
118 |
|
119 // Check gateway receives Location Request |
|
120 INFO_PRINTF1(_L("\tLBS <- ProcessLocationRequest()")); |
|
121 if (EFail == CheckGatewayCallbackL( |
|
122 CSuplGatewayObserver::EProcessLocationRequest) || |
|
123 MLbsNetworkProtocolObserver::EServiceSelfLocation != iGatewayObserver->LocType()) |
|
124 { |
|
125 SetTestStepResult(EFail); |
|
126 return TestStepResult(); |
|
127 } |
|
128 |
|
129 // LBS Requests assistance data |
|
130 INFO_PRINTF1(_L("\tLBS -> RequestAssistanceData ()")); |
|
131 TLbsNetSessionIdArray dummyIdArray; |
|
132 iModule->RequestAssistanceData(dataRequestMask, dummyIdArray); |
|
133 |
|
134 // Check Connection Manager receives a request to send a SUPL POS INIT |
|
135 // with the assistance data mask requested by the gateway |
|
136 if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplPosInitSendReq)) |
|
137 { |
|
138 SetTestStepResult(EFail); |
|
139 return TestStepResult(); |
|
140 } |
|
141 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS INIT -> NET")); |
|
142 |
|
143 // Inject a SUPL POS (RRLP ASSIST DATA) with some of the Assistance data requested |
|
144 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Assitance Data <- NET")); |
|
145 CSuplMessageBase* suplPos = BuildSuplPosAssitDataL(dataRequestMask2, ETrue); // ETrue = more assistance data underway |
|
146 iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), suplPos); |
|
147 |
|
148 // Check the Connection Manager receives a request to send a SUPL POS (ack to assistance data) |
|
149 if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplPosSendReq)) |
|
150 { |
|
151 SetTestStepResult(EFail); |
|
152 return TestStepResult(); |
|
153 } |
|
154 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Assistance Data Ack -> NET")); |
|
155 |
|
156 // Inject a SUPL POS (RRLP MEASURE POSITION REQUEST) wich carries |
|
157 // assistance data |
|
158 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Measure Position Request <- NET")); |
|
159 suplPos = BuildSuplPosRequestL(TPositionModuleInfo::ETechnologyTerminal | TPositionModuleInfo::ETechnologyAssisted, dataRequestMask1); |
|
160 iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), suplPos); |
|
161 |
|
162 |
|
163 // Check gateway receives the assistance data types contained in both SUPL POS messages |
|
164 // received earlier. |
|
165 if (EFail == CheckGatewayCallbackL(CSuplGatewayObserver::EProcessAssistanceData) || |
|
166 (dataRequestMask & iGatewayObserver->AssistanceDataSetMask() != dataRequestMask) ) |
|
167 { |
|
168 SetTestStepResult(EFail); |
|
169 return TestStepResult(); |
|
170 } |
|
171 |
|
172 // Ref Loc has been requested. Make sure it's been notified (the callback mechanism does |
|
173 // not work well because EProcessAssistanceData overwrites EProcessLocationUpdate as they |
|
174 // happen in the same RunL of the SUPL Protocol). Instead, a flag has to be checked after |
|
175 // having received EProcessAssistanceData above |
|
176 if (!iGatewayObserver->IsRefLocNotified()) |
|
177 { |
|
178 SetTestStepResult(EFail); |
|
179 return TestStepResult(); |
|
180 } |
|
181 |
|
182 // Reference Location is reported before Assistance Data...if we got this far, |
|
183 // both ref loc and assist data have been notified: |
|
184 INFO_PRINTF1(_L("\tLBS <- ProcessLocationUpdate(Reference Location)")); |
|
185 INFO_PRINTF1(_L("\tLBS <- ProcessAssistanceData()")); |
|
186 |
|
187 |
|
188 // Check gateway receives a location request (due to the RRLP Measure Position Request) |
|
189 // |
|
190 INFO_PRINTF1(_L("\tLBS <- ProcessLocationRequest()")); |
|
191 if (EFail == CheckGatewayCallbackL( |
|
192 CSuplGatewayObserver::EProcessLocationRequest) || |
|
193 MLbsNetworkProtocolObserver::EServiceSelfLocation != iGatewayObserver->LocType()) |
|
194 { |
|
195 SetTestStepResult(EFail); |
|
196 return TestStepResult(); |
|
197 } |
|
198 |
|
199 // Fake LBS sending results (position) to SPM |
|
200 INFO_PRINTF1(_L("\tLBS -> RespondLocationRequest")); |
|
201 TReal64 latitude = 10; |
|
202 TReal64 longitude = 0; |
|
203 TReal32 HorAccuracy = 10; |
|
204 TPositionInfo mobilePosInfo; |
|
205 TTime utcTime; |
|
206 utcTime.UniversalTime(); |
|
207 TCoordinate coor(latitude,longitude); |
|
208 TPosition mobilePos(TLocality(coor,HorAccuracy),utcTime); |
|
209 mobilePosInfo.SetPosition(mobilePos); |
|
210 iModule->RespondLocationRequest(sessionId1,KErrNone,mobilePosInfo); |
|
211 |
|
212 |
|
213 // Check the Connection Manager receives a request to send a SUPL POS (RRLP MEASURE POSITION RESPONSE) |
|
214 // |
|
215 if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplPosSendReq)) |
|
216 { |
|
217 SetTestStepResult(EFail); |
|
218 return TestStepResult(); |
|
219 } |
|
220 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Measure Position Response -> NET")); |
|
221 |
|
222 // ********* DONNOT Inject a SUPL END (from SUPL server) ************* |
|
223 // This will test that the 10 second timer goes off due to inactivity after |
|
224 // sending the last SUPL POS message. |
|
225 // The SUPL Protocol Module will send a SUPL END and close the connection. |
|
226 // ******************************************************************** |
|
227 |
|
228 // Check the Connection Manager receives a request to send a SUPL END |
|
229 if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplEndSendReq)) |
|
230 { |
|
231 SetTestStepResult(EFail); |
|
232 return TestStepResult(); |
|
233 } |
|
234 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL END -> NET")); |
|
235 |
|
236 |
|
237 // Check gateway session completed |
|
238 if (EFail == CheckGatewayCallbackL( |
|
239 CSuplGatewayObserver::EProcessSessionComplete)) |
|
240 { |
|
241 SetTestStepResult(EFail); |
|
242 return TestStepResult(); |
|
243 } |
|
244 INFO_PRINTF1(_L("\tLBS <- ProcessSessionComplete")); |
|
245 |
|
246 // Check Connection Manager receives a disconnection request |
|
247 if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EDisconnectReq)) |
|
248 { |
|
249 SetTestStepResult(EFail); |
|
250 return TestStepResult(); |
|
251 } |
|
252 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t DisconnectRequest -> NET")); |
|
253 |
|
254 // Check if more observer activity takes place |
|
255 if (iGatewayObserver->IsMoreObserverActivity() || |
|
256 iNetworkObserver->IsMoreObserverActivity()) |
|
257 { |
|
258 SetTestStepResult(EFail); |
|
259 return TestStepResult(); |
|
260 } |
|
261 INFO_PRINTF1(_L("- END -")); |
|
262 |
|
263 SetTestStepResult(EPass); |
|
264 return TestStepResult(); |
|
265 } |
|
266 |
|
267 |
|
268 /** |
|
269 * @return - TVerdict code |
|
270 * Override of base class virtual |
|
271 */ |
|
272 TVerdict Cmolr30Step::doTestStepPostambleL() |
|
273 { |
|
274 delete iModule; |
|
275 |
|
276 // Call base class method for post test actions |
|
277 CTe_suplprotocolSuiteStepBase::doTestStepPostambleL(); |
|
278 return TestStepResult(); |
|
279 } |