|
1 // Copyright (c) 2005-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 mtlr6Step.cpp |
|
20 @internalTechnology |
|
21 */ |
|
22 #include "mtlr6Step.h" |
|
23 #include "te_suplprotocolsuitedefs.h" |
|
24 |
|
25 /** |
|
26 Destructor |
|
27 */ |
|
28 Cmtlr6Step::~Cmtlr6Step() |
|
29 |
|
30 { |
|
31 } |
|
32 |
|
33 /** |
|
34 Constructor |
|
35 */ |
|
36 Cmtlr6Step::Cmtlr6Step() |
|
37 { |
|
38 SetTestStepName(Kmtlr6Step); |
|
39 } |
|
40 |
|
41 /** |
|
42 @return - TVerdict code |
|
43 Override of base class virtual |
|
44 */ |
|
45 TVerdict Cmtlr6Step::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 // components for generating incoming SMS SUPL INIT |
|
54 iSuplPush = CLbsSuplPush::NewL(ELbsSuplPushChannelSMS, *this); |
|
55 iSuplInitGenerator = CSuplInitGenerator::NewL(); |
|
56 |
|
57 return TestStepResult(); |
|
58 } |
|
59 |
|
60 |
|
61 /** Perform Cmtlr6Step test step. |
|
62 |
|
63 This test verifies that the SUPL Protocol Module correctly handles |
|
64 an MT-LR Network requested Locate Terminal Based sequence |
|
65 |
|
66 In this case the assistance data is delivered via the Rrlp Measure Position |
|
67 Request message (ie no Rrlp Assistance Data message is delivered). |
|
68 |
|
69 LBS requests further assistance data. |
|
70 |
|
71 @return TVerdict test result code |
|
72 */ |
|
73 TVerdict Cmtlr6Step::doTestStepL() |
|
74 { |
|
75 INFO_PRINTF1(_L("\t********************************************************************")); |
|
76 INFO_PRINTF1(_L("\tMTLR basic procedure - Assistance data in Measure Position Request")); |
|
77 INFO_PRINTF1(_L("\t********************************************************************")); |
|
78 INFO_PRINTF1(_L("- START -")); |
|
79 |
|
80 // Initiate MT-LR |
|
81 // Generate received SUPL INIT message (test message content #0) |
|
82 TPtr8 messagePtr(iReceiveBuffer.Des()); |
|
83 TInt err = iSuplInitGenerator->GenerateSuplInitL(0, messagePtr); |
|
84 if (err != KErrNone) |
|
85 { |
|
86 SetTestStepResult(EFail); |
|
87 return TestStepResult(); |
|
88 } |
|
89 |
|
90 // Inject SUPL INIT using the SUPL Push API |
|
91 INFO_PRINTF1(_L("\tLBS (SuplPush) -> OnSuplInit()")); |
|
92 TLbsSuplPushRequestId reqId = 12345; |
|
93 TPtrC8 message(messagePtr); |
|
94 iSuplPush->SuplInit(reqId, message, 0); |
|
95 |
|
96 // Check Gateway receives a Privacy request and Location Request |
|
97 INFO_PRINTF1(_L("\tLBS <- ProcessLocationRequest()")); |
|
98 if (EFail == CheckGatewayCallbackL(CSuplGatewayObserver::EProcessLocationRequest) || |
|
99 !iGatewayObserver->IsPrivReqReceived() || |
|
100 MLbsNetworkProtocolObserver::EServiceMobileTerminated != iGatewayObserver->LocType() ) |
|
101 { |
|
102 SetTestStepResult(EFail); |
|
103 return TestStepResult(); |
|
104 } |
|
105 |
|
106 // LBS delivers privacy response |
|
107 INFO_PRINTF1(_L("\tLBS -> RespondPrivacyRequest ()")); |
|
108 CLbsNetworkProtocolBase::TLbsPrivacyResponse privacyResponse = CLbsNetworkProtocolBase::EPrivacyResponseAccepted; |
|
109 iModule->RespondPrivacyRequest(iGatewayObserver->SessionIdValue(), privacyResponse, 0); |
|
110 |
|
111 // Check Connection Manager receives a request for connecting |
|
112 if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EConnectReq)) |
|
113 { |
|
114 SetTestStepResult(EFail); |
|
115 return TestStepResult(); |
|
116 } |
|
117 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t ConnectionRequest -> NET")); |
|
118 |
|
119 // Simulate the connection is up (inject that event) |
|
120 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t Connected <- NET")); |
|
121 iNetworkObserver->InjectConnectedIndication(iNetworkObserver->SessionId()); |
|
122 |
|
123 // LBS Requests assistance data |
|
124 INFO_PRINTF1(_L("\tLBS -> RequestAssistanceData ()")); |
|
125 TLbsAsistanceDataGroup dataRequestMask1 = EAssistanceDataBadSatList; |
|
126 TLbsNetSessionIdArray dummyIdArray; |
|
127 iModule->RequestAssistanceData(dataRequestMask1, dummyIdArray); |
|
128 |
|
129 |
|
130 // Check Connection Manager receives a request to send a SUPL POS INIT |
|
131 // with the assistance data mask requested by the gateway |
|
132 if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplPosInitSendReq)) |
|
133 { |
|
134 SetTestStepResult(EFail); |
|
135 return TestStepResult(); |
|
136 } |
|
137 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS INIT -> NET")); |
|
138 |
|
139 // Inject a SUPL POS (RRLP Measure Position Request) - with requested assistance data |
|
140 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Measure Position Request <- NET")); |
|
141 CSuplMessageBase* suplPos = BuildSuplPosRequestL(TPositionModuleInfo::ETechnologyTerminal | TPositionModuleInfo::ETechnologyAssisted, dataRequestMask1); |
|
142 iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), suplPos); |
|
143 |
|
144 |
|
145 // Check gateway receives the assistance data types requested. |
|
146 INFO_PRINTF1(_L("\tLBS <- ProcessAssistanceData()")); |
|
147 if (EFail == CheckGatewayCallbackL( |
|
148 CSuplGatewayObserver::EProcessAssistanceData) || |
|
149 (dataRequestMask1 & iGatewayObserver->AssistanceDataSetMask() != dataRequestMask1)) |
|
150 { |
|
151 SetTestStepResult(EFail); |
|
152 return TestStepResult(); |
|
153 } |
|
154 |
|
155 // Check gateway receives a location request (due to the RRLP Measure Position Request) |
|
156 INFO_PRINTF1(_L("\tLBS <- ProcessLocationRequest()")); |
|
157 if (EFail == CheckGatewayCallbackL(CSuplGatewayObserver::EProcessLocationRequest) || |
|
158 MLbsNetworkProtocolObserver::EServiceMobileTerminated != iGatewayObserver->LocType()) |
|
159 { |
|
160 SetTestStepResult(EFail); |
|
161 return TestStepResult(); |
|
162 } |
|
163 |
|
164 // LBS Requests further assistance data |
|
165 INFO_PRINTF1(_L("\tLBS -> RequestAssistanceData ()")); |
|
166 TLbsAsistanceDataGroup dataRequestMask2 = EAssistanceDataAquisitionAssistance; |
|
167 iModule->RequestAssistanceData(dataRequestMask2, dummyIdArray); |
|
168 |
|
169 |
|
170 // Check the Connection Manager receives a request to send a SUPL POS (RRLP Measure Position Response) |
|
171 if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplPosSendReq)) |
|
172 { |
|
173 SetTestStepResult(EFail); |
|
174 return TestStepResult(); |
|
175 } |
|
176 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Measure Position Response -> NET")); |
|
177 |
|
178 |
|
179 // Inject a SUPL POS (RRLP Measure Position Request) - with requested assistance data |
|
180 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Measure Position Request <- NET")); |
|
181 suplPos = BuildSuplPosRequestL(TPositionModuleInfo::ETechnologyTerminal | TPositionModuleInfo::ETechnologyAssisted, dataRequestMask2); |
|
182 iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), suplPos); |
|
183 |
|
184 |
|
185 // Check gateway receives the assistance data types requested. |
|
186 INFO_PRINTF1(_L("\tLBS <- ProcessAssistanceData()")); |
|
187 if (EFail == CheckGatewayCallbackL( |
|
188 CSuplGatewayObserver::EProcessAssistanceData) || |
|
189 (iGatewayObserver->AssistanceDataSetMask() != dataRequestMask2)) |
|
190 { |
|
191 SetTestStepResult(EFail); |
|
192 return TestStepResult(); |
|
193 } |
|
194 |
|
195 |
|
196 // Check gateway receives a location request (due to the RRLP Measure Position Request) |
|
197 INFO_PRINTF1(_L("\tLBS <- ProcessLocationRequest()")); |
|
198 if (EFail == CheckGatewayCallbackL(CSuplGatewayObserver::EProcessLocationRequest) || |
|
199 MLbsNetworkProtocolObserver::EServiceMobileTerminated != iGatewayObserver->LocType()) |
|
200 { |
|
201 SetTestStepResult(EFail); |
|
202 return TestStepResult(); |
|
203 } |
|
204 |
|
205 |
|
206 // Fake LBS sending results (position) to SPM |
|
207 INFO_PRINTF1(_L("\tLBS -> RespondLocationRequest")); |
|
208 TReal64 latitude = 10; |
|
209 TReal64 longitude = 0; |
|
210 TReal32 HorAccuracy = 10; |
|
211 TPositionInfo mobilePosInfo; |
|
212 TTime utcTime; |
|
213 utcTime.UniversalTime(); |
|
214 TCoordinate coor(latitude,longitude); |
|
215 TPosition mobilePos(TLocality(coor,HorAccuracy),utcTime); |
|
216 mobilePosInfo.SetPosition(mobilePos); |
|
217 iModule->RespondLocationRequest(iGatewayObserver->SessionIdValue(),KErrNone,mobilePosInfo); |
|
218 |
|
219 |
|
220 // Check the Connection Manager receives a request to send a SUPL POS (RRLP Measure Position Response) |
|
221 if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplPosSendReq)) |
|
222 { |
|
223 SetTestStepResult(EFail); |
|
224 return TestStepResult(); |
|
225 } |
|
226 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Measure Position Response -> NET")); |
|
227 |
|
228 |
|
229 // Inject a SUPL END (without position) |
|
230 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL END <- NET")); |
|
231 CSuplMessageBase* suplEnd = BuildSuplEndL(EFalse); |
|
232 iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), suplEnd); |
|
233 |
|
234 // Check gateway session completed |
|
235 if (EFail == CheckGatewayCallbackL( |
|
236 CSuplGatewayObserver::EProcessSessionComplete)) |
|
237 { |
|
238 SetTestStepResult(EFail); |
|
239 return TestStepResult(); |
|
240 } |
|
241 INFO_PRINTF1(_L("\tLBS <- ProcessSessionComplete")); |
|
242 |
|
243 // Check Connection Manager receives a disconnection request |
|
244 if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EDisconnectReq)) |
|
245 { |
|
246 SetTestStepResult(EFail); |
|
247 return TestStepResult(); |
|
248 } |
|
249 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t DisconnectRequest -> NET")); |
|
250 |
|
251 // Check if more observer activity takes place |
|
252 if (iGatewayObserver->IsMoreObserverActivity() || |
|
253 iNetworkObserver->IsMoreObserverActivity()) |
|
254 { |
|
255 SetTestStepResult(EFail); |
|
256 return TestStepResult(); |
|
257 } |
|
258 INFO_PRINTF1(_L("- END -")); |
|
259 |
|
260 SetTestStepResult(EPass); |
|
261 return TestStepResult(); |
|
262 |
|
263 } |
|
264 |
|
265 |
|
266 /** |
|
267 * @return - TVerdict code |
|
268 * Override of base class virtual |
|
269 */ |
|
270 TVerdict Cmtlr6Step::doTestStepPostambleL() |
|
271 { |
|
272 delete iModule; |
|
273 |
|
274 delete iSuplPush; |
|
275 delete iSuplInitGenerator; |
|
276 |
|
277 // Call base class method for post test actions |
|
278 CTe_suplprotocolSuiteStepBase::doTestStepPostambleL(); |
|
279 return TestStepResult(); |
|
280 } |
|
281 |
|
282 |
|
283 /** |
|
284 Overrides the pure virtual MLbsSuplPushObserver::OnSuplInitComplete. |
|
285 Receives the result of the message sending. |
|
286 |
|
287 @param aError [In] The error code or KErrNone if successful. |
|
288 |
|
289 @see MTe_LbsSuplSmsTriggerSenderObserver::OnMessageSent |
|
290 @see CTe_LbsSuplSmsTriggerSender::SendMessage |
|
291 */ |
|
292 void Cmtlr6Step::OnSuplInitComplete(TLbsSuplPushChannel /*aChannel*/, TLbsSuplPushRequestId /*aReqId*/, TInt aError, TInt /*aReserved*/) |
|
293 { |
|
294 iSmsSendError = aError; |
|
295 if (iSmsSendError != KErrNone) |
|
296 { |
|
297 User::Invariant(); |
|
298 } |
|
299 } |
|
300 |