|
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 |
|
18 /** |
|
19 @file base class for CTSY component tests |
|
20 */ |
|
21 #include <ctsy/ltsy/mltsydispatchphoneinterface.h> |
|
22 #include <ctsy/ltsy/mltsydispatchsecurityinterface.h> |
|
23 #include <ctsy/ltsy/mltsydispatchsiminterface.h> |
|
24 #include <ctsy/ltsy/mltsydispatchcallcontrolinterface.h> |
|
25 #include <ctsy/ltsy/mltsydispatchpacketservicesinterface.h> |
|
26 |
|
27 #include "cctsycomponenttestbase.h" |
|
28 |
|
29 #include <etel.h> |
|
30 #include <etelmm.h> |
|
31 #include <et_clsvr.h> |
|
32 #include <pcktcs.h> |
|
33 #include <ctsy/mmtsy_names.h> |
|
34 #include <ctsy/serviceapi/mmtsy_ipcdefs.h> |
|
35 #include <ctsy/serviceapi/gsmerror.h> |
|
36 #include <ctsy/serviceapi/cmmutility.h> |
|
37 |
|
38 #include <test/tmockltsydata.h> |
|
39 #include "mockltsyindicatorids.h" |
|
40 #include "testconstants.h" |
|
41 |
|
42 _LIT(KMmTsyWithDispatcherModuleName, "phonetsywithdispatcher"); |
|
43 |
|
44 /** |
|
45 To push a CleanupItem ont the cleanupstack to close the phone |
|
46 */ |
|
47 void CCtsyComponentTestBase::Cleanup(TAny* self) |
|
48 { |
|
49 static_cast<CCtsyComponentTestBase*>(self)->DoCleanup(); |
|
50 } |
|
51 |
|
52 /** |
|
53 Close the Phone a the server connection |
|
54 */ |
|
55 void CCtsyComponentTestBase::DoCleanup() |
|
56 { |
|
57 iPhone.Close(); |
|
58 |
|
59 TBool hasWaitingExpect; |
|
60 TBool hasPendingComplete; |
|
61 TBool hasError; |
|
62 iMockLTSY.GetStatus(hasWaitingExpect,hasPendingComplete,hasError); |
|
63 |
|
64 if (hasWaitingExpect || hasPendingComplete || hasError) |
|
65 { |
|
66 TBuf<255> log; |
|
67 do { |
|
68 iMockLTSY.GetNextLogLine(log); |
|
69 INFO_PRINTF1(log); |
|
70 } |
|
71 while(log.Length() > 0); |
|
72 } |
|
73 |
|
74 ASSERT_FALSE(hasWaitingExpect); |
|
75 ASSERT_FALSE(hasPendingComplete); |
|
76 ASSERT_FALSE(hasError); |
|
77 |
|
78 iMockLTSY.Close(); |
|
79 |
|
80 TInt ret = iTelServer.UnloadPhoneModule(KMmTsyWithDispatcherModuleName); |
|
81 if (ret != KErrNone) |
|
82 { |
|
83 INFO_PRINTF1(_L("Failed to unload phone module")); |
|
84 } |
|
85 iTelServer.Close(); |
|
86 } |
|
87 |
|
88 /** |
|
89 Assert MockLtsy Terminated all handlings without errors |
|
90 */ |
|
91 void CCtsyComponentTestBase::AssertMockLtsyStatusL() |
|
92 { |
|
93 TBool hasWaitingExpect; |
|
94 TBool hasPendingComplete; |
|
95 TBool hasError; |
|
96 iMockLTSY.GetStatus(hasWaitingExpect,hasPendingComplete,hasError); |
|
97 if (hasWaitingExpect || hasPendingComplete) |
|
98 { |
|
99 ERR_PRINTF1(_L("MockLTsy still have pending/waiting events!")); |
|
100 } |
|
101 if (hasWaitingExpect || hasPendingComplete || hasError) |
|
102 { |
|
103 TBuf<255> log; |
|
104 do { |
|
105 iMockLTSY.GetNextLogLine(log); |
|
106 INFO_PRINTF1(log); |
|
107 } |
|
108 while(log.Length() > 0); |
|
109 User::Leave(KErrTEFUnitFail); // Fail the test |
|
110 } |
|
111 } |
|
112 |
|
113 /** |
|
114 * Waits until the MockLTSY queued events is empty |
|
115 * Note that in some cases an outstanding completion may occur after the call to iMockLTSY.NotifyTerminated() |
|
116 * but before the User::WaitForRequest() causing a hung test. In this case the solution is to set up the NotifyTerminated() |
|
117 * before the ETel call that generates the expect/context switch which causes the complete, and only then the WaitForRequest(). |
|
118 */ |
|
119 |
|
120 void CCtsyComponentTestBase::WaitForMockLTSYTerminated() |
|
121 { |
|
122 TRequestStatus reqStatusTerminated; |
|
123 iMockLTSY.NotifyTerminated(reqStatusTerminated); |
|
124 User::WaitForRequest(reqStatusTerminated); |
|
125 ASSERT_EQUALS(KErrNone, reqStatusTerminated.Int()); |
|
126 } |
|
127 |
|
128 |
|
129 /** |
|
130 Open Server session |
|
131 */ |
|
132 void CCtsyComponentTestBase::OpenEtelServerL(TExtendedErrorClient aSetExtendedErrorClient) |
|
133 { |
|
134 TInt ret = iTelServer.Connect(); |
|
135 |
|
136 if (ret != KErrNone) |
|
137 { |
|
138 INFO_PRINTF1(_L("Failed connect phone")); |
|
139 User::Leave(ret); |
|
140 } |
|
141 ret = iTelServer.LoadPhoneModule(KMmTsyWithDispatcherModuleName); |
|
142 |
|
143 if (ret != KErrNone) |
|
144 { |
|
145 INFO_PRINTF1(_L("Failed load phone module")); |
|
146 iTelServer.Close(); |
|
147 User::Leave(ret); |
|
148 } |
|
149 |
|
150 if(aSetExtendedErrorClient == EUseExtendedError) |
|
151 { |
|
152 iTelServer.SetExtendedErrorGranularity( RTelServer::EErrorExtended ); |
|
153 } |
|
154 } |
|
155 |
|
156 void CCtsyComponentTestBase::OpenPhoneNegativeL(TInt aMode) |
|
157 { |
|
158 RMobilePhone::TMobilePhoneServiceTableV1 simServiceTable; |
|
159 simServiceTable.iServices1To8 = 0xFF; |
|
160 simServiceTable.iServices9To16 = 0xFF; |
|
161 simServiceTable.iServices17To24= 0xFF; |
|
162 simServiceTable.iServices25To32= 0xFF; |
|
163 simServiceTable.iServices33To40= 0xFF; |
|
164 simServiceTable.iServices41To48= 0xFF; |
|
165 simServiceTable.iServices49To56= 0xFF; |
|
166 |
|
167 RBuf8 data; |
|
168 CleanupClosePushL(data); |
|
169 |
|
170 TInt err = iPhone.Open(iTelServer,KMmTsyPhoneName); |
|
171 ASSERT_EQUALS(KErrNone, err); |
|
172 |
|
173 //open SMS messaging session |
|
174 RMobileSmsMessaging sms; |
|
175 err = sms.Open(iPhone); |
|
176 ASSERT_EQUALS(KErrNone, err); |
|
177 |
|
178 TRequestStatus modemDetectedStatus; |
|
179 RPhone::TModemDetection modemDetection; |
|
180 iPhone.NotifyModemDetected(modemDetectedStatus,modemDetection); |
|
181 |
|
182 err=iMockLTSY.Connect(); |
|
183 ASSERT_EQUALS(KErrNone, err); |
|
184 TRequestStatus mockLtsyStatus; |
|
185 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
186 |
|
187 TRfStateInfo rfstatus = ERfsStateInfoNormal; |
|
188 TMockLtsyData1<TRfStateInfo> rfstatdata(rfstatus); |
|
189 rfstatdata.SerialiseL(data); |
|
190 iMockLTSY.CompleteL(MLtsyDispatchPhoneBootNotifyModemStatusReady::KLtsyDispatchPhoneBootNotifyModemStatusReadyApiId,KErrNone, data, 1); |
|
191 |
|
192 // EMobilePhoneGetNetworkRegistrationStatus |
|
193 iMockLTSY.ExpectL(MLtsyDispatchPhoneGetNetworkRegistrationStatus::KLtsyDispatchPhoneGetNetworkRegistrationStatusApiId); |
|
194 RMobilePhone::TMobilePhoneRegistrationStatus regStatus = RMobilePhone::ERegisteredOnHomeNetwork; |
|
195 TMockLtsyData1<RMobilePhone::TMobilePhoneRegistrationStatus> retNetRegStatusData(regStatus); |
|
196 data.Close(); |
|
197 retNetRegStatusData.SerialiseL(data); |
|
198 iMockLTSY.CompleteL(MLtsyDispatchPhoneGetNetworkRegistrationStatus::KLtsyDispatchPhoneGetNetworkRegistrationStatusApiId,KErrNone,data, 0); |
|
199 |
|
200 // EMmTsyBootNotifySimStatusReadyIPC |
|
201 iMockLTSY.ExpectL(MLtsyDispatchPhoneBootNotifySimStatusReady::KLtsyDispatchPhoneBootNotifySimStatusReadyApiId); |
|
202 iMockLTSY.CompleteL(MLtsyDispatchPhoneBootNotifySimStatusReady::KLtsyDispatchPhoneBootNotifySimStatusReadyApiId,KErrNone,0); |
|
203 |
|
204 // Prepare MockLtsy for the internal getters of the network information |
|
205 DriverPrepInternalGettersMockLtsyL(); |
|
206 |
|
207 // EMobilePhoneGetHomeNetwork |
|
208 data.Close(); |
|
209 iMockLTSY.ExpectL(MLtsyDispatchPhoneGetHomeNetwork::KLtsyDispatchPhoneGetHomeNetworkApiId); |
|
210 RMobilePhone::TMobilePhoneNetworkInfoV5 homeNetwork; |
|
211 homeNetwork.iMode = RMobilePhone::ENetworkModeWcdma; |
|
212 homeNetwork.iStatus = RMobilePhone::ENetworkStatusCurrent; |
|
213 homeNetwork.iBandInfo = RMobilePhone::EBandUnknown; |
|
214 homeNetwork.iCountryCode = _L("234"); |
|
215 homeNetwork.iCdmaSID = _L(""); |
|
216 homeNetwork.iAnalogSID = _L(""); |
|
217 homeNetwork.iNetworkId = _L("23499"); |
|
218 homeNetwork.iDisplayTag = _L("symbian"); |
|
219 homeNetwork.iShortName = _L("symbian"); |
|
220 homeNetwork.iLongName = _L("symbian mobile"); |
|
221 homeNetwork.iAccess = RMobilePhone::ENetworkAccessUtran; |
|
222 homeNetwork.iEgprsAvailableIndicator = ETrue; |
|
223 homeNetwork.iHsdpaAvailableIndicator = ETrue; |
|
224 TMockLtsyData1<RMobilePhone::TMobilePhoneNetworkInfoV5> homeNetworkData(homeNetwork); |
|
225 homeNetworkData.SerialiseL(data); |
|
226 iMockLTSY.CompleteL(MLtsyDispatchPhoneGetHomeNetwork::KLtsyDispatchPhoneGetHomeNetworkApiId,KErrNone,data,0); |
|
227 |
|
228 // EMmTsySecurityGetPin1DisableSupportedIPC |
|
229 if (aMode != MLtsyDispatchSecurityGetPin1DisableSupported::KLtsyDispatchSecurityGetPin1DisableSupportedApiId) |
|
230 { |
|
231 iMockLTSY.ExpectL(MLtsyDispatchSecurityGetPin1DisableSupported::KLtsyDispatchSecurityGetPin1DisableSupportedApiId); |
|
232 TBool pin1DisableSupport = ETrue; |
|
233 TMockLtsyData1<TBool> pin1DisableSupportData(pin1DisableSupport); |
|
234 data.Close(); |
|
235 pin1DisableSupportData.SerialiseL(data); |
|
236 iMockLTSY.CompleteL(MLtsyDispatchSecurityGetPin1DisableSupported::KLtsyDispatchSecurityGetPin1DisableSupportedApiId,KErrNone,data,0); |
|
237 } |
|
238 |
|
239 //EMmTsySimRefreshRegisterIPC |
|
240 if (aMode != MLtsyDispatchPhoneSimRefreshRegister::KLtsyDispatchPhoneSimRefreshRegisterApiId) |
|
241 { |
|
242 TUint16 refreshFileList = KCacheAdn | KCacheFdn | KCacheServiceTable | KCacheALSline; |
|
243 TMockLtsyData1<TUint16> refreshFileListData(refreshFileList); |
|
244 data.Close(); |
|
245 refreshFileListData.SerialiseL(data); |
|
246 iMockLTSY.ExpectL(MLtsyDispatchPhoneSimRefreshRegister::KLtsyDispatchPhoneSimRefreshRegisterApiId,data); |
|
247 iMockLTSY.CompleteL(MLtsyDispatchPhoneSimRefreshRegister::KLtsyDispatchPhoneSimRefreshRegisterApiId,KErrNone); |
|
248 } |
|
249 |
|
250 //EMobilePhoneGetServiceTable |
|
251 if (aMode != MLtsyDispatchSimGetServiceTable::KLtsyDispatchSimGetServiceTableApiId) |
|
252 { |
|
253 RMobilePhone::TMobilePhoneServiceTable serviceTable = RMobilePhone::ESIMServiceTable; |
|
254 TMockLtsyData1<RMobilePhone::TMobilePhoneServiceTable> serviceTableData(serviceTable); |
|
255 data.Close(); |
|
256 serviceTableData.SerialiseL(data); |
|
257 iMockLTSY.ExpectL(MLtsyDispatchSimGetServiceTable::KLtsyDispatchSimGetServiceTableApiId, data); |
|
258 |
|
259 TMockLtsyData1<RMobilePhone::TMobilePhoneServiceTableV1> serviceTableResultData(simServiceTable); |
|
260 data.Close(); |
|
261 serviceTableResultData.SerialiseL(data); |
|
262 iMockLTSY.CompleteL(MLtsyDispatchSimGetServiceTable::KLtsyDispatchSimGetServiceTableApiId,KErrNone,data); |
|
263 } |
|
264 |
|
265 // EMobilePhoneGetALSLine |
|
266 if (aMode != MLtsyDispatchCallControlGetActiveAlsLine::KLtsyDispatchCallControlGetActiveAlsLineApiId) |
|
267 { |
|
268 iMockLTSY.ExpectL(MLtsyDispatchCallControlGetActiveAlsLine::KLtsyDispatchCallControlGetActiveAlsLineApiId); |
|
269 RMobilePhone::TMobilePhoneALSLine alsLine = RMobilePhone::EAlternateLinePrimary; |
|
270 TMockLtsyData1<RMobilePhone::TMobilePhoneALSLine> alsLineData(alsLine); |
|
271 data.Close(); |
|
272 alsLineData.SerialiseL(data); |
|
273 iMockLTSY.CompleteL(MLtsyDispatchCallControlGetActiveAlsLine::KLtsyDispatchCallControlGetActiveAlsLineApiId,KErrNone,data,0); |
|
274 } |
|
275 |
|
276 // ECustomGetIccCallForwardingStatusIPC |
|
277 if (aMode != MLtsyDispatchCallControlGetCallForwardingIndicator::KLtsyDispatchCallControlGetCallForwardingIndicatorApiId) |
|
278 { |
|
279 iMockLTSY.ExpectL(MLtsyDispatchCallControlGetCallForwardingIndicator::KLtsyDispatchCallControlGetCallForwardingIndicatorApiId); |
|
280 |
|
281 RMobilePhone::TMobilePhoneCFUIndicatorV6 indicator; |
|
282 indicator.iMultipleSubscriberProfileID = RMobilePhone::KProfileIdentityTwo; |
|
283 indicator.iIndicator = RMobilePhone::KCFUIndicatorVoice; |
|
284 indicator.iCFNumber.iNumberPlan = RMobilePhone::ETelexNumberPlan; |
|
285 indicator.iCFNumber.iTypeOfNumber = RMobilePhone::ENationalNumber; |
|
286 _LIT(KTelNumber, "012345678"); |
|
287 indicator.iCFNumber.iTelNumber = KTelNumber; |
|
288 TMockLtsyData1<RMobilePhone::TMobilePhoneCFUIndicatorV6> indicatorData(indicator); |
|
289 data.Close(); |
|
290 indicatorData.SerialiseL(data); |
|
291 iMockLTSY.CompleteL(MLtsyDispatchCallControlGetCallForwardingIndicator::KLtsyDispatchCallControlGetCallForwardingIndicatorApiId,KErrNone,data,0); |
|
292 } |
|
293 |
|
294 // EMobilePhoneGetIccMessageWaitingIndicators |
|
295 if (aMode != MLtsyDispatchSimGetIccMessageWaitingIndicators::KLtsyDispatchSimGetIccMessageWaitingIndicatorsApiId) |
|
296 { |
|
297 iMockLTSY.ExpectL(MLtsyDispatchSimGetIccMessageWaitingIndicators::KLtsyDispatchSimGetIccMessageWaitingIndicatorsApiId); |
|
298 |
|
299 RMobilePhone::TMobilePhoneMessageWaitingV1 expectedMessageIndicators; |
|
300 TMockLtsyData1<RMobilePhone::TMobilePhoneMessageWaitingV1> |
|
301 indicatorsData(expectedMessageIndicators); |
|
302 data.Close(); |
|
303 indicatorsData.SerialiseL(data); |
|
304 iMockLTSY.CompleteL(MLtsyDispatchSimGetIccMessageWaitingIndicators::KLtsyDispatchSimGetIccMessageWaitingIndicatorsApiId, KErrNone, data); |
|
305 } |
|
306 |
|
307 if (aMode != MLtsyDispatchCallControlGetAlsPpSupport::KLtsyDispatchCallControlGetAlsPpSupportApiId) |
|
308 { |
|
309 iMockLTSY.ExpectL(MLtsyDispatchCallControlGetAlsPpSupport::KLtsyDispatchCallControlGetAlsPpSupportApiId); |
|
310 |
|
311 RMmCustomAPI::TAlsSupport alsSupport = RMmCustomAPI::EAlsSupportOff; |
|
312 TMockLtsyData1<RMmCustomAPI::TAlsSupport> alsLtsyData1(alsSupport); |
|
313 data.Close(); |
|
314 alsLtsyData1.SerialiseL(data); |
|
315 iMockLTSY.CompleteL(MLtsyDispatchCallControlGetAlsPpSupport::KLtsyDispatchCallControlGetAlsPpSupportApiId, KErrNone, data); |
|
316 } |
|
317 |
|
318 if (aMode != MLtsyDispatchCallControlGetAlsPpSupport::KLtsyDispatchCallControlGetAlsPpSupportApiId) |
|
319 { |
|
320 iMockLTSY.ExpectL(MLtsyDispatchSimGetCustomerServiceProfile::KLtsyDispatchSimGetCustomerServiceProfileApiId); |
|
321 |
|
322 // Prepare data for the mockLtsy's CompleteL |
|
323 RMobilePhone::TMobilePhoneCspFileV1 cspComp; |
|
324 cspComp.iCallOfferingServices = 0x01; |
|
325 cspComp.iCallRestrictionServices = 0x02; |
|
326 cspComp.iOtherSuppServices = 0x03; |
|
327 cspComp.iCallCompletionServices = 0x04; |
|
328 cspComp.iTeleservices = 0x05; |
|
329 cspComp.iCphsTeleservices = 0x06; |
|
330 cspComp.iCphsFeatures = 0x07; |
|
331 cspComp.iNumberIdentServices = 0x08; |
|
332 cspComp.iPhase2PlusServices = 0x09; |
|
333 cspComp.iValueAddedServices = 0x0A; |
|
334 TMockLtsyData1<RMobilePhone::TMobilePhoneCspFileV1> cspCompData(cspComp); |
|
335 data.Close(); |
|
336 cspCompData.SerialiseL(data); |
|
337 iMockLTSY.CompleteL(MLtsyDispatchSimGetCustomerServiceProfile::KLtsyDispatchSimGetCustomerServiceProfileApiId, KErrNone, data); |
|
338 } |
|
339 |
|
340 iMockLTSY.CompleteL(KMockLtsyDispatchSecurityBootNotifySecurityReadyIndId, KErrNone); |
|
341 |
|
342 User::WaitForRequest(mockLtsyStatus); |
|
343 |
|
344 CleanupStack::PopAndDestroy(1); // data |
|
345 } |
|
346 |
|
347 /** |
|
348 Standard function to open the phone up to the end of the boot sequence |
|
349 */ |
|
350 void CCtsyComponentTestBase::OpenPhoneL() |
|
351 { |
|
352 RMobilePhone::TMobilePhoneServiceTableV1 simServiceTable; |
|
353 simServiceTable.iServices1To8 = 0xFF; |
|
354 simServiceTable.iServices9To16 = 0xFF; |
|
355 simServiceTable.iServices17To24= 0xFF; |
|
356 simServiceTable.iServices25To32= 0xFF; |
|
357 simServiceTable.iServices33To40= 0xFF; |
|
358 simServiceTable.iServices41To48= 0xFF; |
|
359 simServiceTable.iServices49To56= 0xFF; |
|
360 |
|
361 OpenPhoneL(simServiceTable); |
|
362 } |
|
363 |
|
364 void CCtsyComponentTestBase::OpenPhoneL(RMobilePhone::TMobilePhoneServiceTableV1& aSimServiceTable) |
|
365 { |
|
366 RBuf8 data; |
|
367 CleanupClosePushL(data); |
|
368 |
|
369 TInt err = iPhone.Open(iTelServer,KMmTsyPhoneName); |
|
370 ASSERT_EQUALS(KErrNone, err); |
|
371 |
|
372 //open SMS messaging session |
|
373 RMobileSmsMessaging sms; |
|
374 err = sms.Open(iPhone); |
|
375 ASSERT_EQUALS(KErrNone, err); |
|
376 |
|
377 //open ADN phonebook |
|
378 RMobilePhoneBookStore pbFdn; |
|
379 // err = pbFdn.Open(iPhone, KETelIccAdnPhoneBook); |
|
380 // ASSERT_EQUALS(KErrNone, err); |
|
381 |
|
382 //open FDN phonebook |
|
383 RMobilePhoneBookStore pbAdn; |
|
384 // err = pbAdn.Open(iPhone, KETelIccFdnPhoneBook); |
|
385 // ASSERT_EQUALS(KErrNone, err); |
|
386 |
|
387 TRequestStatus modemDetectedStatus; |
|
388 RPhone::TModemDetection modemDetection; |
|
389 iPhone.NotifyModemDetected(modemDetectedStatus,modemDetection); |
|
390 |
|
391 |
|
392 |
|
393 err=iMockLTSY.Connect(); |
|
394 ASSERT_EQUALS(KErrNone, err); |
|
395 TRequestStatus mockLtsyStatus; |
|
396 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
397 |
|
398 |
|
399 |
|
400 |
|
401 // EMmTsyBootNotifyModemStatusReadyIPC |
|
402 //iMockLTSY.ExpectL(KLtsyDispatchPhoneBootNotifyModemStatusReadyId); |
|
403 |
|
404 TRfStateInfo rfstatus = ERfsStateInfoNormal; |
|
405 TMockLtsyData1<TRfStateInfo> rfstatdata(rfstatus); |
|
406 rfstatdata.SerialiseL(data); |
|
407 iMockLTSY.CompleteL(MLtsyDispatchPhoneBootNotifyModemStatusReady::KLtsyDispatchPhoneBootNotifyModemStatusReadyApiId,KErrNone, data, 1); |
|
408 |
|
409 // EMobilePhoneGetNetworkRegistrationStatus |
|
410 iMockLTSY.ExpectL(MLtsyDispatchPhoneGetNetworkRegistrationStatus::KLtsyDispatchPhoneGetNetworkRegistrationStatusApiId); |
|
411 RMobilePhone::TMobilePhoneRegistrationStatus regStatus = RMobilePhone::ERegisteredOnHomeNetwork; |
|
412 TMockLtsyData1<RMobilePhone::TMobilePhoneRegistrationStatus> retNetRegStatusData(regStatus); |
|
413 data.Close(); |
|
414 retNetRegStatusData.SerialiseL(data); |
|
415 iMockLTSY.CompleteL(MLtsyDispatchPhoneGetNetworkRegistrationStatus::KLtsyDispatchPhoneGetNetworkRegistrationStatusApiId,KErrNone,data, 0); |
|
416 |
|
417 // EMmTsyBootNotifySimStatusReadyIPC |
|
418 iMockLTSY.ExpectL(MLtsyDispatchPhoneBootNotifySimStatusReady::KLtsyDispatchPhoneBootNotifySimStatusReadyApiId); |
|
419 iMockLTSY.CompleteL(MLtsyDispatchPhoneBootNotifySimStatusReady::KLtsyDispatchPhoneBootNotifySimStatusReadyApiId,KErrNone,0); |
|
420 |
|
421 // Prepare MockLtsy for the internal getters of the network information |
|
422 DriverPrepInternalGettersMockLtsyL(); |
|
423 |
|
424 // EMobilePhoneGetHomeNetwork |
|
425 data.Close(); |
|
426 iMockLTSY.ExpectL(MLtsyDispatchPhoneGetHomeNetwork::KLtsyDispatchPhoneGetHomeNetworkApiId); |
|
427 RMobilePhone::TMobilePhoneNetworkInfoV5 homeNetwork; |
|
428 homeNetwork.iMode = RMobilePhone::ENetworkModeWcdma; |
|
429 homeNetwork.iStatus = RMobilePhone::ENetworkStatusCurrent; |
|
430 homeNetwork.iBandInfo = RMobilePhone::EBandUnknown; |
|
431 homeNetwork.iCountryCode = _L("234"); |
|
432 homeNetwork.iCdmaSID = _L(""); |
|
433 homeNetwork.iAnalogSID = _L(""); |
|
434 homeNetwork.iNetworkId = _L("23499"); |
|
435 homeNetwork.iDisplayTag = _L("symbian"); |
|
436 homeNetwork.iShortName = _L("symbian"); |
|
437 homeNetwork.iLongName = _L("symbian mobile"); |
|
438 homeNetwork.iAccess = RMobilePhone::ENetworkAccessUtran; |
|
439 homeNetwork.iEgprsAvailableIndicator = ETrue; |
|
440 homeNetwork.iHsdpaAvailableIndicator = ETrue; |
|
441 TMockLtsyData1<RMobilePhone::TMobilePhoneNetworkInfoV5> homeNetworkData(homeNetwork); |
|
442 homeNetworkData.SerialiseL(data); |
|
443 iMockLTSY.CompleteL(MLtsyDispatchPhoneGetHomeNetwork::KLtsyDispatchPhoneGetHomeNetworkApiId,KErrNone,data,0); |
|
444 |
|
445 // EMmTsySecurityGetPin1DisableSupportedIPC |
|
446 iMockLTSY.ExpectL(MLtsyDispatchSecurityGetPin1DisableSupported::KLtsyDispatchSecurityGetPin1DisableSupportedApiId); |
|
447 TBool pin1DisableSupport = ETrue; |
|
448 TMockLtsyData1<TBool> pin1DisableSupportData(pin1DisableSupport); |
|
449 data.Close(); |
|
450 pin1DisableSupportData.SerialiseL(data); |
|
451 iMockLTSY.CompleteL(MLtsyDispatchSecurityGetPin1DisableSupported::KLtsyDispatchSecurityGetPin1DisableSupportedApiId,KErrNone,data,0); |
|
452 |
|
453 //EMmTsySimRefreshRegisterIPC |
|
454 TUint16 refreshFileList = KCacheAdn | KCacheFdn | KCacheServiceTable | KCacheALSline; |
|
455 TMockLtsyData1<TUint16> refreshFileListData(refreshFileList); |
|
456 data.Close(); |
|
457 refreshFileListData.SerialiseL(data); |
|
458 iMockLTSY.ExpectL(MLtsyDispatchPhoneSimRefreshRegister::KLtsyDispatchPhoneSimRefreshRegisterApiId,data); |
|
459 iMockLTSY.CompleteL(MLtsyDispatchPhoneSimRefreshRegister::KLtsyDispatchPhoneSimRefreshRegisterApiId,KErrNone); |
|
460 |
|
461 //EMobilePhoneGetServiceTable |
|
462 RMobilePhone::TMobilePhoneServiceTable serviceTable = RMobilePhone::ESIMServiceTable; |
|
463 TMockLtsyData1<RMobilePhone::TMobilePhoneServiceTable> serviceTableData(serviceTable); |
|
464 data.Close(); |
|
465 serviceTableData.SerialiseL(data); |
|
466 iMockLTSY.ExpectL(MLtsyDispatchSimGetServiceTable::KLtsyDispatchSimGetServiceTableApiId, data); |
|
467 |
|
468 TMockLtsyData1<RMobilePhone::TMobilePhoneServiceTableV1> serviceTableResultData(aSimServiceTable); |
|
469 data.Close(); |
|
470 serviceTableResultData.SerialiseL(data); |
|
471 iMockLTSY.CompleteL(MLtsyDispatchSimGetServiceTable::KLtsyDispatchSimGetServiceTableApiId,KErrNone,data); |
|
472 |
|
473 // EMobilePhoneGetALSLine |
|
474 iMockLTSY.ExpectL(MLtsyDispatchCallControlGetActiveAlsLine::KLtsyDispatchCallControlGetActiveAlsLineApiId); |
|
475 |
|
476 RMobilePhone::TMobilePhoneALSLine alsLine = RMobilePhone::EAlternateLinePrimary; |
|
477 TMockLtsyData1<RMobilePhone::TMobilePhoneALSLine> alsLineData(alsLine); |
|
478 data.Close(); |
|
479 alsLineData.SerialiseL(data); |
|
480 iMockLTSY.CompleteL(MLtsyDispatchCallControlGetActiveAlsLine::KLtsyDispatchCallControlGetActiveAlsLineApiId,KErrNone,data,0); |
|
481 |
|
482 // ECustomGetIccCallForwardingStatusIPC |
|
483 iMockLTSY.ExpectL(MLtsyDispatchCallControlGetCallForwardingIndicator::KLtsyDispatchCallControlGetCallForwardingIndicatorApiId); |
|
484 |
|
485 RMobilePhone::TMobilePhoneCFUIndicatorV6 indicator; |
|
486 indicator.iMultipleSubscriberProfileID = RMobilePhone::KProfileIdentityTwo; |
|
487 indicator.iIndicator = RMobilePhone::KCFUIndicatorVoice; |
|
488 indicator.iCFNumber.iNumberPlan = RMobilePhone::ETelexNumberPlan; |
|
489 indicator.iCFNumber.iTypeOfNumber = RMobilePhone::ENationalNumber; |
|
490 _LIT(KTelNumber, "012345678"); |
|
491 indicator.iCFNumber.iTelNumber = KTelNumber; |
|
492 TMockLtsyData1<RMobilePhone::TMobilePhoneCFUIndicatorV6> indicatorData(indicator); |
|
493 data.Close(); |
|
494 indicatorData.SerialiseL(data); |
|
495 iMockLTSY.CompleteL(MLtsyDispatchCallControlGetCallForwardingIndicator::KLtsyDispatchCallControlGetCallForwardingIndicatorApiId,KErrNone,data,0); |
|
496 |
|
497 |
|
498 // EMobilePhoneGetIccMessageWaitingIndicators |
|
499 iMockLTSY.ExpectL(MLtsyDispatchSimGetIccMessageWaitingIndicators::KLtsyDispatchSimGetIccMessageWaitingIndicatorsApiId); |
|
500 |
|
501 RMobilePhone::TMobilePhoneMessageWaitingV1 expectedMessageIndicators; |
|
502 TMockLtsyData1<RMobilePhone::TMobilePhoneMessageWaitingV1> |
|
503 indicatorsData(expectedMessageIndicators); |
|
504 data.Close(); |
|
505 indicatorsData.SerialiseL(data); |
|
506 iMockLTSY.CompleteL(MLtsyDispatchSimGetIccMessageWaitingIndicators::KLtsyDispatchSimGetIccMessageWaitingIndicatorsApiId, KErrNone, data); |
|
507 |
|
508 iMockLTSY.ExpectL(MLtsyDispatchCallControlGetAlsPpSupport::KLtsyDispatchCallControlGetAlsPpSupportApiId); |
|
509 |
|
510 RMmCustomAPI::TAlsSupport alsSupport = RMmCustomAPI::EAlsSupportOff; |
|
511 TMockLtsyData1<RMmCustomAPI::TAlsSupport> alsLtsyData1(alsSupport); |
|
512 data.Close(); |
|
513 alsLtsyData1.SerialiseL(data); |
|
514 iMockLTSY.CompleteL(MLtsyDispatchCallControlGetAlsPpSupport::KLtsyDispatchCallControlGetAlsPpSupportApiId, KErrNone, data); |
|
515 |
|
516 iMockLTSY.ExpectL(MLtsyDispatchSimGetCustomerServiceProfile::KLtsyDispatchSimGetCustomerServiceProfileApiId); |
|
517 |
|
518 // Prepare data for the mockLtsy's CompleteL |
|
519 RMobilePhone::TMobilePhoneCspFileV1 cspComp; |
|
520 cspComp.iCallOfferingServices = 0x01; |
|
521 cspComp.iCallRestrictionServices = 0x02; |
|
522 cspComp.iOtherSuppServices = 0x03; |
|
523 cspComp.iCallCompletionServices = 0x04; |
|
524 cspComp.iTeleservices = 0x05; |
|
525 cspComp.iCphsTeleservices = 0x06; |
|
526 cspComp.iCphsFeatures = 0x07; |
|
527 cspComp.iNumberIdentServices = 0x08; |
|
528 cspComp.iPhase2PlusServices = 0x09; |
|
529 cspComp.iValueAddedServices = 0x0A; |
|
530 TMockLtsyData1<RMobilePhone::TMobilePhoneCspFileV1> cspCompData(cspComp); |
|
531 data.Close(); |
|
532 cspCompData.SerialiseL(data); |
|
533 iMockLTSY.CompleteL(MLtsyDispatchSimGetCustomerServiceProfile::KLtsyDispatchSimGetCustomerServiceProfileApiId, KErrNone, data); |
|
534 |
|
535 iMockLTSY.CompleteL(KMockLtsyDispatchSecurityBootNotifySecurityReadyIndId, KErrNone); |
|
536 |
|
537 User::WaitForRequest(mockLtsyStatus); |
|
538 |
|
539 CleanupStack::PopAndDestroy(1); // data |
|
540 |
|
541 } |
|
542 |
|
543 void CCtsyComponentTestBase::OpenCustomApiLC(RMmCustomAPI& aCustomAPI) |
|
544 { |
|
545 TRequestStatus reqStatus; |
|
546 |
|
547 iMockLTSY.NotifyTerminated(reqStatus); |
|
548 |
|
549 RBuf8 data; |
|
550 CleanupClosePushL(data); |
|
551 |
|
552 iMockLTSY.ExpectL(MLtsyDispatchCallControlGetCallForwardingIndicator::KLtsyDispatchCallControlGetCallForwardingIndicatorApiId); |
|
553 RMobilePhone::TMobilePhoneCFUIndicatorV6 indicator; |
|
554 indicator.iMultipleSubscriberProfileID = RMobilePhone::KProfileIdentityTwo; |
|
555 indicator.iIndicator = RMobilePhone::KCFUIndicatorVoice; |
|
556 indicator.iCFNumber.iNumberPlan = RMobilePhone::ETelexNumberPlan; |
|
557 indicator.iCFNumber.iTypeOfNumber = RMobilePhone::ENationalNumber; |
|
558 _LIT(KTelNumber, "012345678"); |
|
559 indicator.iCFNumber.iTelNumber = KTelNumber; |
|
560 TMockLtsyData1<RMobilePhone::TMobilePhoneCFUIndicatorV6> indicatorData(indicator); |
|
561 indicatorData.SerialiseL(data); |
|
562 iMockLTSY.CompleteL(MLtsyDispatchCallControlGetCallForwardingIndicator::KLtsyDispatchCallControlGetCallForwardingIndicatorApiId,KErrNone,data,0); |
|
563 CleanupStack::PopAndDestroy(&data); |
|
564 |
|
565 CleanupClosePushL(aCustomAPI); |
|
566 TInt ret = aCustomAPI.Open(iPhone); |
|
567 ASSERT_EQUALS(KErrNone, ret); |
|
568 User::WaitForRequest(reqStatus); |
|
569 ASSERT_EQUALS(KErrNone, reqStatus.Int()); |
|
570 AssertMockLtsyStatusL(); |
|
571 } |
|
572 |
|
573 |
|
574 void CCtsyComponentTestBase::OpenPacketServiceLC(RPacketService& aPacketService, RPacketService::TStatus aPacketServiceStatus) |
|
575 { |
|
576 TRequestStatus reqStatus; |
|
577 iMockLTSY.NotifyTerminated(reqStatus); |
|
578 |
|
579 RBuf8 data; |
|
580 CleanupClosePushL(data); |
|
581 |
|
582 iMockLTSY.ExpectL(MLtsyDispatchPacketServicesGetStaticCapabilities::KLtsyDispatchPacketServicesGetStaticCapabilitiesApiId); |
|
583 iMockLTSY.ExpectL(MLtsyDispatchPacketServicesGetStatus::KLtsyDispatchPacketServicesGetStatusApiId); |
|
584 iMockLTSY.ExpectL(MLtsyDispatchPacketServicesGetMaxNoMonitoredServiceLists::KLtsyDispatchPacketServicesGetMaxNoMonitoredServiceListsApiId); |
|
585 iMockLTSY.ExpectL(MLtsyDispatchPacketServicesGetMaxNoActiveServices::KLtsyDispatchPacketServicesGetMaxNoActiveServicesApiId); |
|
586 |
|
587 TUint staticCapabilities |
|
588 = RPacketService::KCapsSuspendSupported |
|
589 | RPacketService::KCapsNetworkAvailabilitySupported |
|
590 | RPacketService::KCapsSetDefaultContextSupported |
|
591 | RPacketService::KCapsChangeAttachModeSupported |
|
592 | RPacketService::KCapsGetDataTransferredSupported |
|
593 | RPacketService::KCapsPreferredBearerSupported |
|
594 | RPacketService::KCapsPdpDataCompSupported |
|
595 | RPacketService::KCapsPdpHeaderCompSupported |
|
596 | RPacketService::KCapsMSClassSupported |
|
597 | RPacketService::KCapsNotifyMSClassSupported; |
|
598 |
|
599 TMockLtsyData1<TUint> packetServiceStaticCapabilities(staticCapabilities); |
|
600 packetServiceStaticCapabilities.SerialiseL(data); |
|
601 iMockLTSY.CompleteL(MLtsyDispatchPacketServicesGetStaticCapabilities::KLtsyDispatchPacketServicesGetStaticCapabilitiesApiId, KErrNone, data); |
|
602 data.Close(); |
|
603 |
|
604 TBool resumed = EFalse; // Flag indicating whether packet service has been resumed from suspended state. |
|
605 TMockLtsyData2<RPacketService::TStatus, TBool> packetServiceStatusData(aPacketServiceStatus, resumed); |
|
606 packetServiceStatusData.SerialiseL(data); |
|
607 iMockLTSY.CompleteL(MLtsyDispatchPacketServicesGetStatus::KLtsyDispatchPacketServicesGetStatusApiId, KErrNone, data); |
|
608 data.Close(); |
|
609 |
|
610 TInt maxNoMonitoredServiceLists = 32; |
|
611 TMockLtsyData1<TInt> maxNoMonitoredServiceListsData(maxNoMonitoredServiceLists); |
|
612 maxNoMonitoredServiceListsData.SerialiseL(data); |
|
613 iMockLTSY.CompleteL(MLtsyDispatchPacketServicesGetMaxNoMonitoredServiceLists::KLtsyDispatchPacketServicesGetMaxNoMonitoredServiceListsApiId, KErrNone, data); |
|
614 data.Close(); |
|
615 |
|
616 TInt maxNoActiveServices = 64; |
|
617 TMockLtsyData1<TInt> maxNoActiveServicesData(maxNoActiveServices); |
|
618 maxNoActiveServicesData.SerialiseL(data); |
|
619 iMockLTSY.CompleteL(MLtsyDispatchPacketServicesGetMaxNoActiveServices::KLtsyDispatchPacketServicesGetMaxNoActiveServicesApiId, KErrNone, data); |
|
620 CleanupStack::PopAndDestroy(&data); |
|
621 |
|
622 CleanupClosePushL(aPacketService); |
|
623 ASSERT_EQUALS(aPacketService.Open(iPhone),KErrNone); |
|
624 |
|
625 User::WaitForRequest(reqStatus); |
|
626 ASSERT_EQUALS(reqStatus.Int(),KErrNone); |
|
627 AssertMockLtsyStatusL(); |
|
628 |
|
629 |
|
630 //check the capabilities |
|
631 TUint caps = 0; |
|
632 ASSERT_EQUALS(aPacketService.GetStaticCaps(caps,RPacketContext::EPdpTypeIPv4),KErrNone); |
|
633 ASSERT_EQUALS(caps,staticCapabilities); |
|
634 |
|
635 //check the max no monitored service lists |
|
636 |
|
637 TInt count = 0; |
|
638 TInt maxAllowed = 0; |
|
639 aPacketService.EnumerateMbmsMonitorServiceList(reqStatus,count,maxAllowed); |
|
640 User::WaitForRequest(reqStatus); |
|
641 ASSERT_EQUALS(reqStatus.Int(),KErrNone); |
|
642 ASSERT_EQUALS(maxAllowed,maxNoMonitoredServiceLists); |
|
643 ASSERT_EQUALS(count,0); |
|
644 } |
|
645 |
|
646 /** |
|
647 Context activation |
|
648 @param aContextName context name |
|
649 */ |
|
650 |
|
651 TInt CCtsyComponentTestBase::SetContextActiveL(TInfoName& aContextName) |
|
652 { |
|
653 RBuf8 data; |
|
654 CleanupClosePushL(data); |
|
655 |
|
656 //data for CompleteL |
|
657 TContextMisc completeMisc; |
|
658 completeMisc.iStatus = RPacketContext::EStatusActive; |
|
659 TMockLtsyData2 <TInfoName, TContextMisc> |
|
660 ltsyData1(aContextName, completeMisc); |
|
661 ltsyData1.SerialiseL(data); |
|
662 |
|
663 TRequestStatus mockLtsyStatus; |
|
664 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
665 //send completion |
|
666 iMockLTSY.CompleteL(KMockLtsyDispatchPacketServicesNotifyPdpContextStatusChangeIndId, KErrNone, data); |
|
667 // wait for completion |
|
668 User::WaitForRequest(mockLtsyStatus); |
|
669 |
|
670 CleanupStack::PopAndDestroy(1); // data |
|
671 |
|
672 return mockLtsyStatus.Int(); |
|
673 } |
|
674 |
|
675 /** |
|
676 Sends ExpectL and CompleteL commands to MockLtsy for getters of various network information. |
|
677 These getters are internal to the CtsyDispatcher. |
|
678 This method should be called immediately after the CompleteL for KLtsyDispatchPhoneBootNotifyModemStatusReadyApiId, |
|
679 since these getters are triggered on the CtsyDispacther receiving a BootNotifyModemStatusReady indication. |
|
680 */ |
|
681 void CCtsyComponentTestBase::DriverPrepInternalGettersMockLtsyL() |
|
682 { |
|
683 RBuf8 data; |
|
684 CleanupClosePushL(data); |
|
685 |
|
686 //TRequestStatus mockLtsyStatus; |
|
687 |
|
688 // |
|
689 // Prepare MockLtsy for processing a getter for CurrentNetworkInfo |
|
690 // |
|
691 iMockLTSY.ExpectL(MLtsyDispatchPhoneGetCurrentNetworkInfo::KLtsyDispatchPhoneGetCurrentNetworkInfoApiId); |
|
692 |
|
693 // Prepare the KLtsyDispatchPhoneGetCurrentNetworkInfoApiId data for CompleteL |
|
694 RMobilePhone::TMobilePhoneNetworkInfoV5 networkInfoComplete; |
|
695 |
|
696 // V5 |
|
697 networkInfoComplete.iEgprsAvailableIndicator = KEgprsAvailable; |
|
698 networkInfoComplete.iHsdpaAvailableIndicator = KHsdpaAvailable; |
|
699 // V2 |
|
700 networkInfoComplete.iAccess = KAccess; |
|
701 // V1 |
|
702 networkInfoComplete.iMode = KMode; |
|
703 networkInfoComplete.iStatus = KStatus; |
|
704 networkInfoComplete.iBandInfo = KBandInfo; |
|
705 networkInfoComplete.iCountryCode = KCountryCode; |
|
706 networkInfoComplete.iCdmaSID = KCdmaSID; |
|
707 networkInfoComplete.iAnalogSID = KAnalogSID; |
|
708 networkInfoComplete.iNetworkId = KNetworkId; |
|
709 networkInfoComplete.iDisplayTag = KDisplayTag; |
|
710 networkInfoComplete.iShortName = KShortName; |
|
711 networkInfoComplete.iLongName = KLongName; |
|
712 |
|
713 RMobilePhone::TMobilePhoneLocationAreaV1 locationAreaComplete; |
|
714 locationAreaComplete.iAreaKnown = KAreaKnown; |
|
715 locationAreaComplete.iLocationAreaCode = KLocationAreaCode; |
|
716 locationAreaComplete.iCellId = KCellId; |
|
717 |
|
718 TMockLtsyData2<RMobilePhone::TMobilePhoneNetworkInfoV5, |
|
719 RMobilePhone::TMobilePhoneLocationAreaV1> mockCNCData2(networkInfoComplete, locationAreaComplete); |
|
720 |
|
721 data.Close(); |
|
722 mockCNCData2.SerialiseL(data); |
|
723 iMockLTSY.CompleteL(MLtsyDispatchPhoneGetCurrentNetworkInfo::KLtsyDispatchPhoneGetCurrentNetworkInfoApiId, KErrNone, data); |
|
724 |
|
725 // |
|
726 // Prepare MockLtsy for processing a getter for NetworkModeChange |
|
727 // |
|
728 iMockLTSY.ExpectL(MLtsyDispatchPhoneGetNetworkMode::KLtsyDispatchPhoneGetNetworkModeApiId); |
|
729 |
|
730 // Prepare the KLtsyDispatchPhoneGetNetworkModeApiId data for CompleteL |
|
731 RMobilePhone::TMobilePhoneNetworkMode networkModeComplete; |
|
732 networkModeComplete = KNetworkMode; |
|
733 |
|
734 TMockLtsyData1<RMobilePhone::TMobilePhoneNetworkMode> mockNMCData1(networkModeComplete); |
|
735 |
|
736 data.Close(); |
|
737 mockNMCData1.SerialiseL(data); |
|
738 iMockLTSY.CompleteL(MLtsyDispatchPhoneGetNetworkMode::KLtsyDispatchPhoneGetNetworkModeApiId, KErrNone, data); |
|
739 |
|
740 // |
|
741 // Prepare MockLtsy for processing a getter for NitzInfoChange |
|
742 // |
|
743 iMockLTSY.ExpectL(MLtsyDispatchPhoneGetNitzInfo::KLtsyDispatchPhoneGetNitzInfoApiId); |
|
744 RMobilePhone::TMobilePhoneNITZ nitzComplete(2008, EMay, 12, 11, 59, 0, 0); |
|
745 nitzComplete.iShortNetworkId = KShortName; |
|
746 nitzComplete.iLongNetworkId = KLongName; |
|
747 nitzComplete.iNitzFieldsUsed = KNitzFieldsUsed; |
|
748 nitzComplete.iTimeZone = KTimeZone; |
|
749 nitzComplete.iDST = KDst; |
|
750 |
|
751 TMockLtsyData1<RMobilePhone::TMobilePhoneNITZ> mockNitzData1(nitzComplete); |
|
752 data.Close(); |
|
753 mockNitzData1.SerialiseL(data); |
|
754 iMockLTSY.CompleteL(MLtsyDispatchPhoneGetNitzInfo::KLtsyDispatchPhoneGetNitzInfoApiId, KErrNone, data); |
|
755 |
|
756 // |
|
757 // Prepare MockLtsy for processing a getter for SignalStrengthChange |
|
758 // |
|
759 iMockLTSY.ExpectL(MLtsyDispatchPhoneGetSignalStrength::KLtsyDispatchPhoneGetSignalStrengthApiId); |
|
760 TInt32 signalStrengthComplete(KSignalStrength); |
|
761 TInt8 barComplete(KBar); |
|
762 TMockLtsyData2<TInt32, TInt8> mockSigSthData2(signalStrengthComplete, barComplete); |
|
763 data.Close(); |
|
764 mockSigSthData2.SerialiseL(data); |
|
765 iMockLTSY.CompleteL(MLtsyDispatchPhoneGetSignalStrength::KLtsyDispatchPhoneGetSignalStrengthApiId, KErrNone, data); |
|
766 |
|
767 // |
|
768 // Prepare MockLtsy for processing a getter for BatteryInfoChange |
|
769 // |
|
770 iMockLTSY.ExpectL(MLtsyDispatchPhoneGetBatteryInfo::KLtsyDispatchPhoneGetBatteryInfoApiId); |
|
771 RMobilePhone::TMobilePhoneBatteryInfoV1 battInfo; |
|
772 battInfo.iChargeLevel = KBatteryChargeLevel; |
|
773 battInfo.iStatus = KBatteryStatus; |
|
774 |
|
775 TMockLtsyData1<RMobilePhone::TMobilePhoneBatteryInfoV1> mockBattInfoData1(battInfo); |
|
776 data.Close(); |
|
777 mockBattInfoData1.SerialiseL(data); |
|
778 iMockLTSY.CompleteL(MLtsyDispatchPhoneGetBatteryInfo::KLtsyDispatchPhoneGetBatteryInfoApiId, KErrNone, data); |
|
779 |
|
780 data.Close(); |
|
781 //AssertMockLtsyStatusL(); |
|
782 CleanupStack::PopAndDestroy(); // data |
|
783 } |
|
784 |
|
785 TInt CCtsyComponentTestBase::OpenLineAndCallL( |
|
786 RMobileLine& aMobileLine, RMobileCall& aMobileCall, RMobilePhone::TMobileService aMode) |
|
787 { |
|
788 TInt ret = KErrGeneral; |
|
789 |
|
790 if (aMode == RMobilePhone::EVoiceService) |
|
791 { |
|
792 ret = aMobileLine.Open(iPhone, KMmTsyVoice1LineName); |
|
793 } |
|
794 else if (aMode == RMobilePhone::EAuxVoiceService) |
|
795 { |
|
796 ret = aMobileLine.Open(iPhone, KMmTsyVoice2LineName); |
|
797 } |
|
798 else |
|
799 { |
|
800 ret = aMobileLine.Open(iPhone, KMmTsyDataLineName); |
|
801 } |
|
802 |
|
803 if (ret != KErrNone) |
|
804 { |
|
805 return ret; |
|
806 } |
|
807 |
|
808 _LIT(KDoubleColon, "::"); |
|
809 TName name; |
|
810 name = KMmTsyPhoneName; |
|
811 name.Append(KDoubleColon); |
|
812 if (aMode == RMobilePhone::EVoiceService) |
|
813 { |
|
814 name.Append(KMmTsyVoice1LineName); |
|
815 } |
|
816 else if (aMode == RMobilePhone::EAuxVoiceService) |
|
817 { |
|
818 name.Append(KMmTsyVoice2LineName); |
|
819 } |
|
820 else |
|
821 { |
|
822 name.Append(KMmTsyDataLineName); |
|
823 } |
|
824 name.Append(KDoubleColon); |
|
825 |
|
826 ret = aMobileCall.OpenNewCall(aMobileLine, name); |
|
827 |
|
828 return ret; |
|
829 } // CCtsyComponentTestBase::OpenLineAndCallL |
|
830 |
|
831 |
|
832 void CCtsyComponentTestBase::DriverExpectDialCallRequestL( |
|
833 TInt aCallId, RMobilePhone::TMobileService aMode, TInt aDialError, |
|
834 TBool aIsIsvCall, TBool aIsSimOriginated, TBool aPerformFdnCheck) |
|
835 { |
|
836 RBuf8 data; |
|
837 CleanupClosePushL(data); |
|
838 |
|
839 RMobilePhone::TMobileAddress dialledParty; |
|
840 dialledParty.iNumberPlan = RMobilePhone::EUnknownNumberingPlan; |
|
841 dialledParty.iTypeOfNumber = RMobilePhone::EUnknownNumber; |
|
842 dialledParty.iTelNumber = KPhoneNumber; |
|
843 |
|
844 if (aMode == RMobilePhone::EVoiceService || aMode == RMobilePhone::EAuxVoiceService) |
|
845 { |
|
846 RMobilePhone::TMobilePhoneALSLine line = RMobilePhone::EAlternateLinePrimary; |
|
847 |
|
848 if (aMode == RMobilePhone::EAuxVoiceService) |
|
849 { |
|
850 line = RMobilePhone::EAlternateLineAuxiliary; |
|
851 } |
|
852 |
|
853 RMobileCall::TMobileCallParamsV1 callParams; |
|
854 RMobileCall::TMobileCallParamsV1Pckg callParamsPckg(callParams); |
|
855 callParams.iIdRestrict = RMobileCall::ESendMyId; |
|
856 |
|
857 if (aIsIsvCall) |
|
858 { |
|
859 callParams.iAutoRedial = EFalse; |
|
860 RMobileCall::TMobileCallCugV1 cug; |
|
861 callParams.iCug = cug; |
|
862 } |
|
863 else |
|
864 { |
|
865 callParams.iAutoRedial = ETrue; |
|
866 } |
|
867 RMobileCall::TCallParamOrigin callOrigin = aIsSimOriginated ? RMobileCall::EOriginatorSIM : RMobileCall::EOriginatorEtelClient; |
|
868 |
|
869 TMockLtsyData6<RMobilePhone::TMobilePhoneALSLine, RMobilePhone::TMobileAddress, |
|
870 RMobileCall::TMobileCallParamsV1, TBool, RMobileCall::TCallParamOrigin, TBool> |
|
871 dialData (line, dialledParty, callParams, aIsIsvCall, callOrigin, aPerformFdnCheck); |
|
872 dialData.SerialiseL(data); |
|
873 iMockLTSY.ExpectL(MLtsyDispatchCallControlDialVoice::KLtsyDispatchCallControlDialVoiceApiId, data); |
|
874 TMockLtsyCallData0 dialData2(aCallId, aMode); // Mode not actually used |
|
875 data.Close(); |
|
876 dialData2.SerialiseL(data); |
|
877 iMockLTSY.CompleteL(MLtsyDispatchCallControlDialVoice::KLtsyDispatchCallControlDialVoiceApiId, aDialError, data); |
|
878 } |
|
879 else |
|
880 { |
|
881 RMobileCall::TMobileDataCallParamsV1 callParams; |
|
882 callParams.iAckTimer = 3; |
|
883 callParams.iAutoRedial = ETrue; |
|
884 callParams.iInterval = 4; |
|
885 callParams.iCug.iCugIndex = 0xFFFF; |
|
886 callParams.iService = RMobileCall::EServiceDataCircuitAsync; |
|
887 |
|
888 TMockLtsyData3<RMobilePhone::TMobileAddress, RMobileCall::TMobileDataCallParamsV1, TBool> |
|
889 dialData(dialledParty, callParams, aPerformFdnCheck); |
|
890 dialData.SerialiseL(data); |
|
891 iMockLTSY.ExpectL(MLtsyDispatchCallControlDialData::KLtsyDispatchCallControlDialDataApiId, data); |
|
892 |
|
893 TMockLtsyCallData0 dialData2(aCallId, aMode); // Mode not actually used |
|
894 data.Close(); |
|
895 dialData2.SerialiseL(data); |
|
896 iMockLTSY.CompleteL(MLtsyDispatchCallControlDialData::KLtsyDispatchCallControlDialDataApiId, aDialError, data); |
|
897 } |
|
898 |
|
899 data.Close(); |
|
900 CleanupStack::PopAndDestroy(1, &data); |
|
901 } // CCtsyComponentTestBase::DriverExpectDialCallRequestL |
|
902 |
|
903 |
|
904 void CCtsyComponentTestBase::DriverCompleteGetMobileCallInfoL(TInt aCallId, RMobilePhone::TMobileService aService) |
|
905 { |
|
906 _LIT(KPhoneNumber, "12345"); |
|
907 |
|
908 RBuf8 data; |
|
909 CleanupClosePushL(data); |
|
910 |
|
911 RMobileCall::TMobileCallInfoV1 callInfo; |
|
912 callInfo.iCallId = aCallId; |
|
913 callInfo.iDialledParty.iTelNumber.Copy(KPhoneNumber); |
|
914 callInfo.iService = aService; |
|
915 callInfo.iEmergency = EFalse; |
|
916 callInfo.iRemoteParty.iCallingName = KNullDesC; |
|
917 callInfo.iRemoteParty.iRemoteIdStatus = RMobileCall::ERemoteIdentityAvailable; |
|
918 callInfo.iRemoteParty.iRemoteNumber.iTelNumber = KPhoneNumber; |
|
919 callInfo.iRemoteParty.iRemoteNumber.iNumberPlan = RMobilePhone::EUnknownNumberingPlan; |
|
920 callInfo.iRemoteParty.iRemoteNumber.iTypeOfNumber = RMobilePhone::EUnknownNumber; |
|
921 callInfo.iForwarded = EFalse; |
|
922 callInfo.iValid = RMobileCall::KCallDialledParty | RMobileCall::KCallRemoteParty; |
|
923 |
|
924 TMockLtsyData1<RMobileCall::TMobileCallInfoV1> callInfoData(callInfo); |
|
925 callInfoData.SerialiseL(data); |
|
926 |
|
927 iMockLTSY.CompleteL(KMockLtsyDispatchCallControlNotifyCallInfoChangeIndId, KErrNone, data); |
|
928 |
|
929 data.Close(); |
|
930 CleanupStack::PopAndDestroy(&data); |
|
931 } // CCtsyComponentTestBase::DriverCompleteGetMobileCallInfoL |
|
932 |
|
933 /** |
|
934 * Queues notifications EStatusDialling -> EStatusConnecting -> EStatusConnected |
|
935 * for the specified call. |
|
936 */ |
|
937 void CCtsyComponentTestBase::DriverCompleteSuccessfulDialNotificationsL(TInt aCallId) |
|
938 { |
|
939 RArray<RMobileCall::TMobileCallStatus> arrayCallStatus; |
|
940 CleanupClosePushL(arrayCallStatus); |
|
941 |
|
942 arrayCallStatus.AppendL(RMobileCall::EStatusDialling); |
|
943 arrayCallStatus.AppendL(RMobileCall::EStatusConnecting); |
|
944 arrayCallStatus.AppendL(RMobileCall::EStatusConnected); |
|
945 |
|
946 DriverCompleteCallStatusChangeNotificationsL(arrayCallStatus, aCallId, KErrNone); |
|
947 |
|
948 arrayCallStatus.Close(); |
|
949 |
|
950 CleanupStack::PopAndDestroy(1, &arrayCallStatus); |
|
951 } // CCtsyComponentTestBase::CompleteSuccessfulDialNotifications |
|
952 |
|
953 /** |
|
954 * @param aExtraDelay The delay required to send to CompleteL. 0 means use default. |
|
955 */ |
|
956 void CCtsyComponentTestBase::DriverCompleteCallStatusChangeNotificationsL( |
|
957 RArray<RMobileCall::TMobileCallStatus>& aStatuses, TInt aCallId, TInt aNotifyError, |
|
958 TInt aExtraDelay) |
|
959 { |
|
960 RBuf8 data; |
|
961 CleanupClosePushL(data); |
|
962 |
|
963 for (TInt i = 0; i < aStatuses.Count(); i++) |
|
964 { |
|
965 RMobileCall::TMobileCallStatus callStatus = aStatuses[i]; |
|
966 |
|
967 // Complete KLtsyDispatchCallControlNotifyCallStatusChangeApiId |
|
968 TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockCallData( |
|
969 aCallId, RMobilePhone::EServiceUnspecified, callStatus); |
|
970 data.Close(); |
|
971 mockCallData.SerialiseL(data); |
|
972 if (aExtraDelay == 0) |
|
973 { |
|
974 iMockLTSY.CompleteL(KMockLtsyDispatchCallControlNotifyCallStatusChangeIndId, aNotifyError, data); |
|
975 } |
|
976 else |
|
977 { |
|
978 iMockLTSY.CompleteL(KMockLtsyDispatchCallControlNotifyCallStatusChangeIndId, aNotifyError, data, aExtraDelay); |
|
979 } |
|
980 } |
|
981 |
|
982 data.Close(); |
|
983 CleanupStack::PopAndDestroy(1, &data); |
|
984 } // CCtsyComponentTestBase::DriverCompleteCallStatusChangeNotificationsL |
|
985 |
|
986 void CCtsyComponentTestBase::DriverDialCallL(TInt aCallId, RMobilePhone::TMobileService aMode, TBool aIsIsvCall, TBool aIsSimOriginated, TBool aPerformFdnCheck) |
|
987 { |
|
988 DriverExpectDialCallRequestL(aCallId, aMode, KErrNone, aIsIsvCall, aIsSimOriginated, aPerformFdnCheck); |
|
989 DriverCompleteGetMobileCallInfoL(aCallId, aMode); |
|
990 DriverCompleteSuccessfulDialNotificationsL(aCallId); |
|
991 |
|
992 if (aMode == RMobilePhone::ECircuitDataService) |
|
993 { |
|
994 // In a data call, complete dial explicitly |
|
995 RBuf8 data; |
|
996 CleanupClosePushL(data); |
|
997 |
|
998 TMockLtsyCallData0 dialData2(aCallId, aMode); // Mode not actually used |
|
999 data.Close(); |
|
1000 dialData2.SerialiseL(data); |
|
1001 iMockLTSY.CompleteL(MLtsyDispatchCallControlDialData::KLtsyDispatchCallControlDialDataApiId, KErrNone, data); |
|
1002 |
|
1003 CleanupStack::PopAndDestroy(&data); |
|
1004 } |
|
1005 |
|
1006 } // CCtsyComponentTestBase::DriverDialCallL |
|
1007 |
|
1008 /** |
|
1009 * Queues notifications EStatusDisconnecting -> EStatusIdle |
|
1010 * for the specified call for disconnecting a call without inband or |
|
1011 * EStatusDisconnectingWithInband -> EStatusIdle otherwise. |
|
1012 * |
|
1013 * @param aExtraDelay Delay to be passed to CompleteL. 0 means use default MockSY delay. |
|
1014 * @param aCallHasDuration ETrue if the call has been connected. this implies that a phone life timer update message will be sent down when the call is closed. |
|
1015 */ |
|
1016 void CCtsyComponentTestBase::DriverCompleteSuccessfulHangUpNotificationsL( |
|
1017 TInt aCallId, TBool aWithInBandInfo, TInt aNotifyError, TBool aCallHasDuration, TInt aExtraDelay) |
|
1018 { |
|
1019 RArray<RMobileCall::TMobileCallStatus> arrayCallStatus; |
|
1020 CleanupClosePushL(arrayCallStatus); |
|
1021 |
|
1022 if (aWithInBandInfo) |
|
1023 { |
|
1024 arrayCallStatus.AppendL(RMobileCall::EStatusDisconnectingWithInband); |
|
1025 } |
|
1026 else |
|
1027 { |
|
1028 arrayCallStatus.AppendL(RMobileCall::EStatusDisconnecting); |
|
1029 } |
|
1030 arrayCallStatus.AppendL(RMobileCall::EStatusIdle); |
|
1031 |
|
1032 DriverCompleteCallStatusChangeNotificationsL(arrayCallStatus, aCallId, aNotifyError, aExtraDelay); |
|
1033 |
|
1034 arrayCallStatus.Close(); |
|
1035 |
|
1036 //if (KErrGsmCCNormalCallClearing == aNotifyError) //the assumption is that the call has only had a duration if its been closed down normally |
|
1037 if (aCallHasDuration) |
|
1038 { |
|
1039 RBuf8 data; |
|
1040 TUint32 duration = 3; //this is the length of the call and its not possible to be certain of this due to |
|
1041 //e.g. logging statements so this argument is not actually checked in the mockltsy |
|
1042 TMockLtsyData1<TUint32> durationLtsyData(duration); |
|
1043 durationLtsyData.SerialiseL(data); |
|
1044 iMockLTSY.ExpectL(MLtsyDispatchCallControlUpdateLifeTimer::KLtsyDispatchCallControlUpdateLifeTimerApiId, data, KErrNone); |
|
1045 data.Close(); |
|
1046 } |
|
1047 |
|
1048 CleanupStack::PopAndDestroy(1, &arrayCallStatus); |
|
1049 } // CCtsyComponentTestBase::DriverCompleteSuccessfulHangUpNotificationsL |
|
1050 |
|
1051 /** |
|
1052 * @param aCallHasDuration set to ETrue if the call was connected for any amount of time, as the phone life timer will be updated causing an ipc to be sent down to ltsy. |
|
1053 */ |
|
1054 |
|
1055 void CCtsyComponentTestBase::DriverHangUpCallL(TInt aCallId, TInt aHangUpCause, TBool aCallHasDuration) |
|
1056 { |
|
1057 RBuf8 data; |
|
1058 CleanupClosePushL(data); |
|
1059 |
|
1060 TMockLtsyData2<TInt, TInt> mockData2(aCallId, aHangUpCause); |
|
1061 data.Close(); |
|
1062 mockData2.SerialiseL(data); |
|
1063 iMockLTSY.ExpectL(MLtsyDispatchCallControlHangUp::KLtsyDispatchCallControlHangUpApiId, data); |
|
1064 |
|
1065 DriverCompleteSuccessfulHangUpNotificationsL(aCallId, EFalse, KErrGsmCCNormalCallClearing, aCallHasDuration); |
|
1066 |
|
1067 TMockLtsyData1<TInt> hangUpData(aCallId); |
|
1068 data.Close(); |
|
1069 hangUpData.SerialiseL(data); |
|
1070 iMockLTSY.CompleteL(MLtsyDispatchCallControlHangUp::KLtsyDispatchCallControlHangUpApiId, KErrNone, data); |
|
1071 |
|
1072 data.Close(); |
|
1073 |
|
1074 CleanupStack::PopAndDestroy(1, &data); |
|
1075 } // CCtsyComponentTestBase::DriverHangUpCall |
|
1076 |
|
1077 |
|
1078 void CCtsyComponentTestBase::DriverHoldCallL(TInt aCallId, TInt aHoldError) |
|
1079 { |
|
1080 RBuf8 data; |
|
1081 CleanupClosePushL(data); |
|
1082 |
|
1083 TMockLtsyData1<TInt> mockData(aCallId); |
|
1084 data.Close(); |
|
1085 mockData.SerialiseL(data); |
|
1086 iMockLTSY.ExpectL(MLtsyDispatchCallControlHold::KLtsyDispatchCallControlHoldApiId, data); |
|
1087 |
|
1088 TMockLtsyData1<TInt> holdData(aCallId); |
|
1089 data.Close(); |
|
1090 holdData.SerialiseL(data); |
|
1091 iMockLTSY.CompleteL(MLtsyDispatchCallControlHold::KLtsyDispatchCallControlHoldApiId, aHoldError, data); |
|
1092 |
|
1093 if (aHoldError == KErrNone) |
|
1094 { |
|
1095 RMobileCall::TMobileCallStatus callStatus = RMobileCall::EStatusHold; |
|
1096 TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockCallData( |
|
1097 aCallId, RMobilePhone::EServiceUnspecified, callStatus); |
|
1098 data.Close(); |
|
1099 mockCallData.SerialiseL(data); |
|
1100 iMockLTSY.CompleteL(KMockLtsyDispatchCallControlNotifyCallStatusChangeIndId, KErrNone, data); |
|
1101 } |
|
1102 |
|
1103 data.Close(); |
|
1104 CleanupStack::PopAndDestroy(1, &data); |
|
1105 } // CCtsyComponentTestBase::DriverHoldCallL |
|
1106 |
|
1107 |
|
1108 void CCtsyComponentTestBase::DriverDialAndHoldFirstCallDialSecondCallL(RMobilePhone::TMobileService aMobileService, TInt aCallId1, TInt aCallId2) |
|
1109 { |
|
1110 DriverDialCallL(aCallId1, aMobileService); |
|
1111 |
|
1112 DriverHoldCallL(aCallId1, KErrNone); |
|
1113 |
|
1114 DriverDialCallL(aCallId2, aMobileService); |
|
1115 } // CCtsyComponentTestBase::DriverDialAndHoldFirstCallDialSecondCallL |
|
1116 |
|
1117 |
|
1118 /** |
|
1119 * Opens line and call objects, dials a call and waits until call notifications |
|
1120 * have been received and the call is connected. |
|
1121 * |
|
1122 * @param aMobileLine Line subsession to open. |
|
1123 * @param aMobileCall Call subsession to open. |
|
1124 * @param aLineName Name of line to open. |
|
1125 */ |
|
1126 void CCtsyComponentTestBase::ClientDialCallL( |
|
1127 RMobileLine& aMobileLine, RMobileCall& aMobileCall, RMobilePhone::TMobileService aMode, |
|
1128 TBool aDialEmergencyCall, TBool aPerformFdnCheck) |
|
1129 { |
|
1130 OpenLineAndCallL(aMobileLine, aMobileCall, aMode); |
|
1131 |
|
1132 RMobileCall::TMobileCallStatus callStatus; |
|
1133 TRequestStatus notifyCallStatus; |
|
1134 aMobileCall.NotifyMobileCallStatusChange(notifyCallStatus, callStatus); |
|
1135 |
|
1136 _LIT(KPhoneNumber, "135468456456"); |
|
1137 TRequestStatus dialStatus; |
|
1138 |
|
1139 if (aMode == RMobilePhone::EVoiceService || aMode == RMobilePhone::EAuxVoiceService) |
|
1140 { |
|
1141 if (aDialEmergencyCall) |
|
1142 { |
|
1143 RMobileENStore::TEmergencyNumber emergencyNumber = _L("911"); |
|
1144 aMobileCall.DialEmergencyCall(dialStatus, emergencyNumber); |
|
1145 } |
|
1146 else |
|
1147 { |
|
1148 RMobileCall::TMobileCallParamsV1 callParams; |
|
1149 RMobileCall::TMobileCallParamsV1Pckg callParamsPckg(callParams); |
|
1150 callParams.iAutoRedial = ETrue; |
|
1151 callParams.iIdRestrict = RMobileCall::ESendMyId; |
|
1152 if (aPerformFdnCheck) |
|
1153 { |
|
1154 aMobileCall.Dial(dialStatus, callParamsPckg, KPhoneNumber); |
|
1155 } |
|
1156 else |
|
1157 { |
|
1158 aMobileCall.DialNoFdnCheck(dialStatus, callParamsPckg, KPhoneNumber); |
|
1159 } |
|
1160 } |
|
1161 } |
|
1162 else |
|
1163 { |
|
1164 RMobileCall::TMobileDataCallParamsV1 callParams; |
|
1165 RMobileCall::TMobileDataCallParamsV1Pckg callParamsPckg(callParams); |
|
1166 callParams.iAckTimer = 3; |
|
1167 callParams.iAutoRedial = ETrue; |
|
1168 callParams.iInterval = 4; |
|
1169 callParams.iCug.iCugIndex = 0xFFFF; |
|
1170 callParams.iService = RMobileCall::EServiceDataCircuitAsync; |
|
1171 if (aPerformFdnCheck) |
|
1172 { |
|
1173 aMobileCall.Dial(dialStatus, callParamsPckg, KPhoneNumber); |
|
1174 } |
|
1175 else |
|
1176 { |
|
1177 aMobileCall.DialNoFdnCheck(dialStatus, callParamsPckg, KPhoneNumber); |
|
1178 } |
|
1179 } |
|
1180 |
|
1181 RArray<RMobileCall::TMobileCallStatus> expectedCallStatuses; |
|
1182 CleanupClosePushL(expectedCallStatuses); |
|
1183 expectedCallStatuses.AppendL(RMobileCall::EStatusDialling); |
|
1184 expectedCallStatuses.AppendL(RMobileCall::EStatusConnecting); |
|
1185 expectedCallStatuses.AppendL(RMobileCall::EStatusConnected); |
|
1186 ClientWaitForCallStatusNotifications(aMobileCall, notifyCallStatus, callStatus, expectedCallStatuses, KErrNone); |
|
1187 |
|
1188 User::WaitForRequest(dialStatus); |
|
1189 ASSERT_EQUALS(KErrNone, dialStatus.Int()); |
|
1190 |
|
1191 aMobileCall.GetMobileCallStatus(callStatus); |
|
1192 ASSERT_EQUALS(RMobileCall::EStatusConnected, callStatus); |
|
1193 |
|
1194 expectedCallStatuses.Close(); |
|
1195 CleanupStack::PopAndDestroy(1, &expectedCallStatuses); |
|
1196 } // CCtsyComponentTestBase::ClientDialCallL |
|
1197 |
|
1198 void CCtsyComponentTestBase::ClientWaitForCallStatusNotifications( |
|
1199 RMobileCall& aMobileCall, TRequestStatus& aRequestStatus, RMobileCall::TMobileCallStatus& aCallStatus, |
|
1200 RArray<RMobileCall::TMobileCallStatus>& aExpectedStatuses, TInt aExpectedError) |
|
1201 { |
|
1202 if (aExpectedStatuses.Count() == 0) |
|
1203 { |
|
1204 return; |
|
1205 } |
|
1206 |
|
1207 User::WaitForRequest(aRequestStatus); |
|
1208 ASSERT_EQUALS(aExpectedError, aRequestStatus.Int()); |
|
1209 ASSERT_EQUALS(aExpectedStatuses[0], aCallStatus); |
|
1210 |
|
1211 for (TInt i = 1; i < aExpectedStatuses.Count(); i++) |
|
1212 { |
|
1213 aMobileCall.NotifyMobileCallStatusChange(aRequestStatus, aCallStatus); |
|
1214 User::WaitForRequest(aRequestStatus); |
|
1215 ASSERT_EQUALS(aExpectedError, aRequestStatus.Int()); |
|
1216 ASSERT_EQUALS(aExpectedStatuses[i], aCallStatus); |
|
1217 } |
|
1218 |
|
1219 } // CCtsyComponentTestBase::ClientWaitForCallStatusNotificationsL |
|
1220 |
|
1221 void CCtsyComponentTestBase::ClientDialAndHoldFirstCallDialSecondCallL( |
|
1222 RMobilePhone::TMobileService aMobileService, |
|
1223 RMobileCall& aMobileCall1, RMobileLine& aMobileLine1, |
|
1224 RMobileCall& aMobileCall2, RMobileLine& aMobileLine2) |
|
1225 { |
|
1226 ClientDialCallL(aMobileLine1, aMobileCall1, aMobileService); |
|
1227 |
|
1228 TRequestStatus notifyStatus; |
|
1229 RMobileCall::TMobileCallStatus callStatus; |
|
1230 aMobileCall1.NotifyMobileCallStatusChange(notifyStatus, callStatus); |
|
1231 |
|
1232 TRequestStatus holdStatus; |
|
1233 aMobileCall1.Hold(holdStatus); |
|
1234 User::WaitForRequest(holdStatus); |
|
1235 ASSERT_EQUALS(KErrNone, holdStatus.Int()); |
|
1236 |
|
1237 User::WaitForRequest(notifyStatus); |
|
1238 ASSERT_EQUALS(KErrNone, notifyStatus.Int()); |
|
1239 ASSERT_EQUALS(RMobileCall::EStatusHold, callStatus); |
|
1240 |
|
1241 ClientDialCallL(aMobileLine2, aMobileCall2, aMobileService); |
|
1242 |
|
1243 // First call should be on hold, second call should be connected |
|
1244 ASSERT_EQUALS(KErrNone, aMobileCall1.GetMobileCallStatus(callStatus)); |
|
1245 ASSERT_EQUALS(RMobileCall::EStatusHold, callStatus); |
|
1246 ASSERT_EQUALS(KErrNone, aMobileCall2.GetMobileCallStatus(callStatus)); |
|
1247 ASSERT_EQUALS(RMobileCall::EStatusConnected, callStatus); |
|
1248 } // CCtsyComponentTestBase::ClientDialAndHoldFirstCallDialSecondCallL |
|
1249 |
|
1250 |
|
1251 /** |
|
1252 * Hangs up call and receives call notifications. |
|
1253 * @param aMobileCall Call subsession of connected call. |
|
1254 */ |
|
1255 void CCtsyComponentTestBase::ClientHangUpCallL(RMobileCall& aMobileCall) |
|
1256 { |
|
1257 TRequestStatus notifyCallStatus; |
|
1258 RMobileCall::TMobileCallStatus callStatus = RMobileCall::EStatusUnknown; |
|
1259 aMobileCall.NotifyMobileCallStatusChange(notifyCallStatus, callStatus); |
|
1260 |
|
1261 TRequestStatus hangupStatus; |
|
1262 aMobileCall.HangUp(hangupStatus); |
|
1263 |
|
1264 RArray<RMobileCall::TMobileCallStatus> expectedCallStatuses; |
|
1265 CleanupClosePushL(expectedCallStatuses); |
|
1266 expectedCallStatuses.AppendL(RMobileCall::EStatusDisconnecting); |
|
1267 expectedCallStatuses.AppendL(RMobileCall::EStatusIdle); |
|
1268 ClientWaitForCallStatusNotifications(aMobileCall, notifyCallStatus, callStatus, expectedCallStatuses, KErrNone); |
|
1269 |
|
1270 User::WaitForRequest(hangupStatus); |
|
1271 ASSERT_EQUALS(KErrNone, hangupStatus.Int()); |
|
1272 |
|
1273 aMobileCall.GetMobileCallStatus(callStatus); |
|
1274 ASSERT_EQUALS(RMobileCall::EStatusIdle, callStatus); |
|
1275 |
|
1276 expectedCallStatuses.Close(); |
|
1277 CleanupStack::PopAndDestroy(1, &expectedCallStatuses); |
|
1278 } // CCtsyComponentTestBase::ClientHangUpCallL |