|
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 // |
|
15 |
|
16 /** |
|
17 @file etel1Step.cpp |
|
18 @internalTechnology |
|
19 */ |
|
20 |
|
21 #include <simtsy.h> |
|
22 #include "lbsdevloggermacros.h" |
|
23 |
|
24 #include "etel1Step.h" |
|
25 #include "lbssystemcontroller.h" |
|
26 |
|
27 |
|
28 const TInt KInitializationTimeout = 1000000; //1 sec |
|
29 |
|
30 CEtel1Step::CEtel1Step() |
|
31 { |
|
32 SetTestStepName(KEtel1Step); |
|
33 } |
|
34 |
|
35 CEtel1Step::~CEtel1Step() |
|
36 { |
|
37 } |
|
38 |
|
39 /** |
|
40 * @return - TVerdict code |
|
41 * Override of base class virtual |
|
42 */ |
|
43 TVerdict CEtel1Step::doTestStepPreambleL() |
|
44 { |
|
45 LBSLOG(ELogP1,"CEtel1Step::doTestStepPreambleL - Start"); |
|
46 |
|
47 RLbsSystemController lbsSysController; |
|
48 lbsSysController.OpenL(KLbsSuplTestUid); |
|
49 //Start the LBS sub-system if it is not running |
|
50 if(lbsSysController.RequestSystemStartup()!= ELbsStartupSuccess) |
|
51 { |
|
52 lbsSysController.Close(); |
|
53 User::Leave(KErrNotReady); |
|
54 } |
|
55 |
|
56 //We do not need Lbs to be running - not to interfere with our tests |
|
57 User::LeaveIfError(lbsSysController.RequestCompleteCloseDown()); |
|
58 |
|
59 lbsSysController.Close(); |
|
60 |
|
61 // Call base class method for pre test actions |
|
62 CTe_suplprotocolSuiteStepBase::doTestStepPreambleL(); |
|
63 |
|
64 TLbsNetProtocolModuleParams param(*iGatewayObserver); |
|
65 iModule = CSuplGatewayInterface::NewL(reinterpret_cast<TAny*>(¶m)); |
|
66 |
|
67 iSchedulerWait = new(ELeave) CActiveSchedulerWait; |
|
68 iTimer = CLbsCallbackTimer::NewL(*this); |
|
69 |
|
70 //Start active scheduler for a while to complete the async initialization calls |
|
71 iTimer->EventAfter(TTimeIntervalMicroSeconds32(KInitializationTimeout), 0); |
|
72 iSchedulerWait->Start(); |
|
73 |
|
74 LBSLOG(ELogP1,"CEtel1Step::doTestStepPreambleL - End"); |
|
75 return TestStepResult(); |
|
76 } |
|
77 |
|
78 |
|
79 /** Perform etel0Step test step. |
|
80 This test verifies that the SUPL Protocol Module correctly handles the etel network information such as |
|
81 Mobile Country Code, Mobile Network Code, cell id, timing advance, IMSI. |
|
82 @return TVerdict test result code |
|
83 */ |
|
84 TVerdict CEtel1Step::doTestStepL() |
|
85 { |
|
86 LBSLOG(ELogP1,"CEtel1Step::doTestStepL - Start"); |
|
87 |
|
88 TLbsHostSettingsId settingsId; |
|
89 TLbsHostSettingsSupl settings; |
|
90 CLbsHostSettingsStore* hostStore = CLbsHostSettingsStore::NewL(KLbsHostSettingsSuplStoreId); |
|
91 CleanupStack::PushL(hostStore); |
|
92 |
|
93 User::LeaveIfError(hostStore->RewindHostSettings()); |
|
94 |
|
95 while(hostStore->GetNextHostSettings(settings, settingsId)==KErrNone) |
|
96 { |
|
97 User::LeaveIfError(hostStore->DeleteHostSettings(settingsId)); |
|
98 } |
|
99 CleanupStack::PopAndDestroy(); |
|
100 |
|
101 INFO_PRINTF1(_L("\t********************************************************************")); |
|
102 INFO_PRINTF1(_L("\tTest of ETEL params on MOLR")); |
|
103 INFO_PRINTF1(_L("\t********************************************************************")); |
|
104 INFO_PRINTF1(_L("- START -")); |
|
105 |
|
106 // Make the request a tracking one |
|
107 INFO_PRINTF1(_L("\tLBS -> AdviceSystemStatus (Tracking ON)")); |
|
108 iModule->AdviceSystemStatus(CLbsNetworkProtocolBase::ESystemStatusClientTracking); |
|
109 |
|
110 // Initiate MO-LR |
|
111 TLbsNetSessionId sessionId1(TUid::Uid(0x87654321), 0x1111); |
|
112 TLbsNetPosRequestOptionsAssistance options1; |
|
113 options1.SetNewClientConnected(ETrue); |
|
114 TLbsNetPosRequestQuality quality1; |
|
115 options1.SetRequestQuality(quality1); |
|
116 TLbsAsistanceDataGroup dataRequestMask1 = EAssistanceDataBadSatList; |
|
117 options1.SetDataRequestMask(dataRequestMask1); |
|
118 INFO_PRINTF1(_L("\tLBS -> RequestSelfLocation")); |
|
119 iModule->RequestSelfLocation(sessionId1, options1); |
|
120 |
|
121 // Check Connection Manager receives a request for connecting |
|
122 if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EConnectReq)) |
|
123 { |
|
124 SetTestStepResult(EFail); |
|
125 return TestStepResult(); |
|
126 } |
|
127 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t ConnectionRequest -> NET")); |
|
128 |
|
129 settingsId = iNetworkObserver->HostSettingsId(); |
|
130 hostStore = CLbsHostSettingsStore::NewL(KLbsHostSettingsSuplStoreId); |
|
131 CleanupStack::PushL(hostStore); |
|
132 |
|
133 // Get the host settings |
|
134 User::LeaveIfError(hostStore->GetHostSettings(settingsId, settings)); |
|
135 CleanupStack::PopAndDestroy(); |
|
136 |
|
137 TLbsHostNameAddress hostAddr; |
|
138 settings.GetHostNameAddress(hostAddr); |
|
139 |
|
140 _LIT8(KHslpAddresFormat, "h-slp.mnc%03d.mcc%03d.pub.3gppnetwork.org"); |
|
141 TLbsHostNameAddress expectedAddr; |
|
142 |
|
143 TInt mcc = 0; |
|
144 GetIntFromConfig(ConfigSection(), _L("MCC"), mcc); |
|
145 |
|
146 TInt mnc = 0; |
|
147 GetIntFromConfig(ConfigSection(), _L("MNC"), mnc); |
|
148 |
|
149 expectedAddr.Format(KHslpAddresFormat, mnc, mcc); |
|
150 |
|
151 if(hostAddr!=expectedAddr) |
|
152 { |
|
153 // give a warning of what went wrong |
|
154 TBuf<64> expected16; |
|
155 expected16.Copy(expectedAddr); |
|
156 TBuf16<64> actual16; |
|
157 actual16.Copy(hostAddr); |
|
158 INFO_PRINTF3(_L("address expected %S, found was %S\n"), &expected16, &actual16); |
|
159 |
|
160 SetTestStepResult(EFail); |
|
161 return TestStepResult(); |
|
162 } |
|
163 |
|
164 // Simulate the connection is up (inject that event) |
|
165 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t Connected <- NET")); |
|
166 iNetworkObserver->InjectConnectedIndication(iNetworkObserver->SessionId()); |
|
167 |
|
168 // Check Connection Manager receives a request to send a SUPL START |
|
169 if(EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESuplStartSendReq)) |
|
170 { |
|
171 SetTestStepResult(EFail); |
|
172 return TestStepResult(); |
|
173 } |
|
174 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL START -> NET")); |
|
175 |
|
176 // Inject a SUPL RESPONSE |
|
177 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL RESPONSE <- NET")); |
|
178 CSuplMessageBase* resp = BuildSuplResponseL(TPositionModuleInfo::ETechnologyTerminal | TPositionModuleInfo::ETechnologyAssisted); |
|
179 iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), resp); |
|
180 |
|
181 // Check gateway receives Location Request |
|
182 INFO_PRINTF1(_L("\tLBS <- ProcessLocationRequest()")); |
|
183 if (EFail == CheckGatewayCallbackL( |
|
184 CSuplGatewayObserver::EProcessLocationRequest) || |
|
185 MLbsNetworkProtocolObserver::EServiceSelfLocation != iGatewayObserver->LocType()) |
|
186 { |
|
187 SetTestStepResult(EFail); |
|
188 return TestStepResult(); |
|
189 } |
|
190 |
|
191 // LBS Requests assistance data |
|
192 INFO_PRINTF1(_L("\tLBS -> RequestAssistanceData ()")); |
|
193 TLbsNetSessionIdArray dummyIdArray; |
|
194 iModule->RequestAssistanceData(dataRequestMask1, dummyIdArray); |
|
195 |
|
196 // Check Connection Manager receives a request to send a SUPL POS INIT |
|
197 // with the assistance data mask requested by the gateway |
|
198 User::LeaveIfNull(iNetworkObserver); |
|
199 |
|
200 // Wait for network observer callback |
|
201 iNetworkObserver->WaitForCallBack(); |
|
202 |
|
203 // Check that callback matches the expected type |
|
204 if((CSuplNetworkTestObserver::ESendSuplPosInitSendReq != iNetworkObserver->CallBackResult()) || |
|
205 !iNetworkObserver->WasObserverCalled()) |
|
206 { |
|
207 SetTestStepResult(EFail); |
|
208 } |
|
209 |
|
210 ResetNetworkObserverL(); |
|
211 |
|
212 // Inject a SUPL END (with position) |
|
213 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL END <- NET")); |
|
214 CSuplMessageBase* suplEnd = BuildSuplEndL(ETrue); |
|
215 |
|
216 iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), suplEnd); |
|
217 |
|
218 // Check gateway receives Location Update |
|
219 INFO_PRINTF1(_L("\tLBS <- ProcessLocationUpdate()")); |
|
220 if (EFail == CheckGatewayCallbackL( |
|
221 CSuplGatewayObserver::EProcessLocationUpdate)) |
|
222 { |
|
223 SetTestStepResult(EFail); |
|
224 return TestStepResult(); |
|
225 } |
|
226 |
|
227 // Check gateway receives a session complete indication |
|
228 if (EFail == CheckGatewayCallbackL( |
|
229 CSuplGatewayObserver::EProcessSessionComplete)) |
|
230 { |
|
231 SetTestStepResult(EFail); |
|
232 return TestStepResult(); |
|
233 } |
|
234 INFO_PRINTF1(_L("\tLBS <- ProcessSessionComplete")); |
|
235 |
|
236 INFO_PRINTF1(_L("\tLBS -> AdviceSystemStatus (Tracking OFF)")); |
|
237 iModule->AdviceSystemStatus(CLbsNetworkProtocolBase::ESystemStatusNone); |
|
238 |
|
239 // Check Connection Manager receives a disconnection request |
|
240 if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EDisconnectReq)) |
|
241 { |
|
242 SetTestStepResult(EFail); |
|
243 return TestStepResult(); |
|
244 } |
|
245 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t DisconnectRequest -> NET")); |
|
246 |
|
247 // Check if more observer activity takes place |
|
248 if (iGatewayObserver->IsMoreObserverActivity() || |
|
249 iNetworkObserver->IsMoreObserverActivity()) |
|
250 { |
|
251 SetTestStepResult(EFail); |
|
252 return TestStepResult(); |
|
253 } |
|
254 INFO_PRINTF1(_L("- END -")); |
|
255 |
|
256 SetTestStepResult(EPass); |
|
257 |
|
258 LBSLOG(ELogP1,"CEtel0Step::doTestStepL - End"); |
|
259 return TestStepResult(); |
|
260 } |
|
261 |
|
262 TVerdict CEtel1Step::doTestStepPostambleL() |
|
263 { |
|
264 LBSLOG(ELogP1,"CEtel1Step::doTestStepPostambleL - Start"); |
|
265 |
|
266 |
|
267 //Clear the repository that keeps the host settings |
|
268 CRepository* rep = CRepository::NewL(KLbsHostSettingsSuplStoreId); |
|
269 rep->Reset(); |
|
270 delete rep; |
|
271 |
|
272 delete iModule; |
|
273 iModule=0; |
|
274 |
|
275 delete iTimer; |
|
276 iTimer=0; |
|
277 |
|
278 delete iSchedulerWait; |
|
279 iSchedulerWait = 0; |
|
280 |
|
281 CTe_suplprotocolSuiteStepBase::doTestStepPostambleL(); |
|
282 LBSLOG(ELogP1,"CEtel1Step::doTestStepPostambleL - End"); |
|
283 return TestStepResult(); |
|
284 } |
|
285 |
|
286 void CEtel1Step::OnTimerEventL(TInt /*aTimerId*/) |
|
287 { |
|
288 iSchedulerWait->AsyncStop(); |
|
289 } |
|
290 |
|
291 TInt CEtel1Step::OnTimerError(TInt /*aTimerId*/, TInt /*aError*/) |
|
292 { |
|
293 iSchedulerWait->AsyncStop(); |
|
294 return KErrNone; |
|
295 } |
|
296 |
|
297 |