|
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 mtlr23Step.cpp |
|
20 @internalTechnology |
|
21 */ |
|
22 #include "mtlr23Step.h" |
|
23 #include "te_suplprotocolsuitedefs.h" |
|
24 |
|
25 /** |
|
26 Destructor |
|
27 */ |
|
28 Cmtlr23Step::~Cmtlr23Step() |
|
29 |
|
30 { |
|
31 } |
|
32 |
|
33 /** |
|
34 Constructor |
|
35 */ |
|
36 Cmtlr23Step::Cmtlr23Step() |
|
37 { |
|
38 SetTestStepName(Kmtlr23Step); |
|
39 } |
|
40 |
|
41 /** |
|
42 @return - TVerdict code |
|
43 Override of base class virtual |
|
44 */ |
|
45 TVerdict Cmtlr23Step::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 Cmtlr23Step test step. |
|
62 This test verifies that the SUPL Protocol Module correctly handles |
|
63 an MT-LR Network requested Locate Terminal Based sequence (assistance data |
|
64 delivered via an RRLP payload). |
|
65 |
|
66 @return TVerdict test result code |
|
67 */ |
|
68 TVerdict Cmtlr23Step::doTestStepL() |
|
69 { |
|
70 INFO_PRINTF1(_L("\t********************************************************************")); |
|
71 INFO_PRINTF1(_L("\tMTLR - LBS requests Assistance Data before connection is established)")); |
|
72 INFO_PRINTF1(_L("\t********************************************************************")); |
|
73 INFO_PRINTF1(_L("- START -")); |
|
74 |
|
75 // Initiate MT-LR |
|
76 // Generate received SUPL INIT message (test message content #0) |
|
77 TPtr8 messagePtr(iReceiveBuffer.Des()); |
|
78 TInt err = iSuplInitGenerator->GenerateSuplInitL(0, messagePtr); |
|
79 if (err != KErrNone) |
|
80 { |
|
81 SetTestStepResult(EFail); |
|
82 return TestStepResult(); |
|
83 } |
|
84 |
|
85 // Inject SUPL INIT using the SUPL Push API |
|
86 INFO_PRINTF1(_L("\tLBS (SuplPush) -> OnSuplInit()")); |
|
87 TLbsSuplPushRequestId reqId = 12345; |
|
88 TPtrC8 message(messagePtr); |
|
89 iSuplPush->SuplInit(reqId, message, 0); |
|
90 |
|
91 // Check Gateway receives a Privacy request and Location Request |
|
92 INFO_PRINTF1(_L("\tLBS <- ProcessLocationRequest()")); |
|
93 if (EFail == CheckGatewayCallbackL(CSuplGatewayObserver::EProcessLocationRequest) || |
|
94 !iGatewayObserver->IsPrivReqReceived() || |
|
95 MLbsNetworkProtocolObserver::EServiceMobileTerminated != iGatewayObserver->LocType() ) |
|
96 { |
|
97 SetTestStepResult(EFail); |
|
98 return TestStepResult(); |
|
99 } |
|
100 |
|
101 // Wait a couple of seconds for user instructions |
|
102 INFO_PRINTF1(_L("...user taking a couple of seconds for privacy response")); |
|
103 if (iGatewayObserver->IsMoreObserverActivity() || |
|
104 iNetworkObserver->IsMoreObserverActivity()) |
|
105 { |
|
106 SetTestStepResult(EFail); |
|
107 return TestStepResult(); |
|
108 } |
|
109 |
|
110 // LBS delivers privacy response |
|
111 INFO_PRINTF1(_L("\tLBS -> PrivacyResponse (EPrivacyResponseAccepted)")); |
|
112 CLbsNetworkProtocolBase::TLbsPrivacyResponse privacyResponse = CLbsNetworkProtocolBase::EPrivacyResponseAccepted; |
|
113 iModule->RespondPrivacyRequest(iGatewayObserver->SessionIdValue(), privacyResponse, 0); |
|
114 |
|
115 // Check Connection Manager receives a request for connecting |
|
116 if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EConnectReq)) |
|
117 { |
|
118 SetTestStepResult(EFail); |
|
119 return TestStepResult(); |
|
120 } |
|
121 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t ConnectionRequest -> NET")); |
|
122 |
|
123 // **************** Assistance data are requested by LBS before the connection is up ************ |
|
124 // ************************************************************************************************** |
|
125 // LBS Requests assistance data |
|
126 INFO_PRINTF1(_L("\tLBS -> RequestAssistanceData ()")); |
|
127 TLbsAsistanceDataGroup dataRequestMask1 = EAssistanceDataBadSatList; |
|
128 TLbsNetSessionIdArray dummyIdArray; |
|
129 iModule->RequestAssistanceData(dataRequestMask1, dummyIdArray); |
|
130 |
|
131 // Wait a couple of seconds for connection activation |
|
132 INFO_PRINTF1(_L("...connection taking a couple of seconds to activate")); |
|
133 if (iGatewayObserver->IsMoreObserverActivity() || |
|
134 iNetworkObserver->IsMoreObserverActivity()) |
|
135 { |
|
136 SetTestStepResult(EFail); |
|
137 return TestStepResult(); |
|
138 } |
|
139 |
|
140 // Simulate the connection is up (inject that event) |
|
141 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t Connected <- NET")); |
|
142 iNetworkObserver->InjectConnectedIndication(iNetworkObserver->SessionId()); |
|
143 |
|
144 // Check Connection Manager receives a request to send a SUPL POS INIT |
|
145 // with the assistance data mask requested by the gateway |
|
146 if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplPosInitSendReq)) |
|
147 { |
|
148 SetTestStepResult(EFail); |
|
149 return TestStepResult(); |
|
150 } |
|
151 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS INIT -> NET")); |
|
152 |
|
153 // Inject a SUPL POS with some of the Assistance data requested |
|
154 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Assitance Data <- NET")); |
|
155 CSuplMessageBase* suplPos = BuildSuplPosAssitDataL(EAssistanceDataAquisitionAssistance|EAssistanceDataBadSatList, EFalse); |
|
156 iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), suplPos); |
|
157 |
|
158 |
|
159 |
|
160 // Check gateway receives the assistance data types requested. |
|
161 INFO_PRINTF1(_L("\tLBS <- ProcessAssistanceData()")); |
|
162 if (EFail == CheckGatewayCallbackL( |
|
163 CSuplGatewayObserver::EProcessAssistanceData) || |
|
164 (dataRequestMask1 & iGatewayObserver->AssistanceDataSetMask() != dataRequestMask1)) |
|
165 { |
|
166 SetTestStepResult(EFail); |
|
167 return TestStepResult(); |
|
168 } |
|
169 |
|
170 // Check the Connection Manager receives a request to send a SUPL POS (ack to assistance data) |
|
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 Assistance Data Ack -> NET")); |
|
177 |
|
178 |
|
179 // Inject a SUPL END (without position) |
|
180 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL END <- NET")); |
|
181 CSuplMessageBase* suplEnd = BuildSuplEndL(EFalse); |
|
182 iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), suplEnd); |
|
183 |
|
184 // Check gateway session completed |
|
185 if (EFail == CheckGatewayCallbackL( |
|
186 CSuplGatewayObserver::EProcessSessionComplete)) |
|
187 { |
|
188 SetTestStepResult(EFail); |
|
189 return TestStepResult(); |
|
190 } |
|
191 INFO_PRINTF1(_L("\tLBS <- ProcessSessionComplete")); |
|
192 |
|
193 // Check Connection Manager receives a disconnection request |
|
194 if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EDisconnectReq)) |
|
195 { |
|
196 SetTestStepResult(EFail); |
|
197 return TestStepResult(); |
|
198 } |
|
199 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t DisconnectRequest -> NET")); |
|
200 |
|
201 // Check if more observer activity takes place |
|
202 if (iGatewayObserver->IsMoreObserverActivity() || |
|
203 iNetworkObserver->IsMoreObserverActivity()) |
|
204 { |
|
205 SetTestStepResult(EFail); |
|
206 return TestStepResult(); |
|
207 } |
|
208 INFO_PRINTF1(_L("- END -")); |
|
209 |
|
210 SetTestStepResult(EPass); |
|
211 return TestStepResult(); |
|
212 |
|
213 } |
|
214 |
|
215 |
|
216 /** |
|
217 * @return - TVerdict code |
|
218 * Override of base class virtual |
|
219 */ |
|
220 TVerdict Cmtlr23Step::doTestStepPostambleL() |
|
221 { |
|
222 delete iModule; |
|
223 |
|
224 delete iSuplPush; |
|
225 delete iSuplInitGenerator; |
|
226 |
|
227 // Call base class method for post test actions |
|
228 CTe_suplprotocolSuiteStepBase::doTestStepPostambleL(); |
|
229 return TestStepResult(); |
|
230 } |
|
231 |
|
232 |
|
233 /** |
|
234 Overrides the pure virtual MTe_LbsSuplSmsTriggerSenderObserver::OnMessageSent. |
|
235 Receives the result of the message sending. |
|
236 |
|
237 @param aError [In] The error code or KErrNone if successful. |
|
238 |
|
239 @see MTe_LbsSuplSmsTriggerSenderObserver::OnMessageSent |
|
240 @see CTe_LbsSuplSmsTriggerSender::SendMessage |
|
241 */ |
|
242 void Cmtlr23Step::OnSuplInitComplete(TLbsSuplPushChannel /*aChannel*/, TLbsSuplPushRequestId /*aReqId*/, TInt aError, TInt /*aReserved*/) |
|
243 { |
|
244 iSmsSendError = aError; |
|
245 if (iSmsSendError != KErrNone) |
|
246 { |
|
247 User::Invariant(); |
|
248 } |
|
249 } |
|
250 |