|
1 // Copyright (c) 1997-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 #include <e32test.h> |
|
17 #include <etelmm.h> |
|
18 #include <mmretrieve.h> |
|
19 #include "Te_LoopBackCPhoneLine.h" |
|
20 #include "../../hayes/TSYCONFG.H" // for KInternetAccessPoint |
|
21 |
|
22 /** |
|
23 @file |
|
24 */ |
|
25 |
|
26 // publics |
|
27 const TInt Pause=5000000; // 5 second pause |
|
28 |
|
29 // |
|
30 // Test-side class |
|
31 // With the assistance of the base class, this class must start the emulator |
|
32 // and drive the ETel API. |
|
33 // |
|
34 CTestDrivePhoneLine* CTestDrivePhoneLine::NewL(const TScriptList aScriptListEntry) |
|
35 { |
|
36 CTestDrivePhoneLine* phoneLine = new (ELeave) CTestDrivePhoneLine(aScriptListEntry); |
|
37 CleanupStack::PushL(phoneLine); |
|
38 phoneLine->ConstructL(); |
|
39 CleanupStack::Pop(); |
|
40 return phoneLine; |
|
41 } |
|
42 |
|
43 CTestDrivePhoneLine::CTestDrivePhoneLine(const TScriptList aScriptListEntry) : |
|
44 iScriptListEntry(aScriptListEntry) |
|
45 {} |
|
46 |
|
47 CTestDrivePhoneLine::~CTestDrivePhoneLine() |
|
48 {} |
|
49 |
|
50 TInt CTestDrivePhoneLine::RunTestL() |
|
51 { |
|
52 iCurrentScript = iScriptListEntry; |
|
53 return StartEmulatorL(); |
|
54 } |
|
55 |
|
56 TInt CTestDrivePhoneLine::DriveETelApiL() |
|
57 // |
|
58 // This function contains the real meat of the Client-side test code |
|
59 // |
|
60 { |
|
61 // Open the iPhone object |
|
62 _LIT(KPhoneName, "GsmPhone1"); |
|
63 TESTL(iVlPhone.Open(iServer, KPhoneName) == KErrNone); |
|
64 |
|
65 // Initialization Cancel Request |
|
66 INFO_PRINTF1(_L("Phone Initialization Cancel Request")); |
|
67 TRequestStatus initStat; |
|
68 INFO_PRINTF1(_L("Initialize the iPhone...")); |
|
69 |
|
70 RMobilePhone::TMMTableSettings tableSettings; |
|
71 tableSettings.iLocId=KInternetAccessPoint; |
|
72 RMobilePhone::TMMTableSettingsPckg tableSettingsPckg(tableSettings); |
|
73 iVlPhone.InitialiseMM(initStat , tableSettingsPckg); |
|
74 |
|
75 INFO_PRINTF1(_L("Cancel the iPhone initialization...")); |
|
76 iVlPhone.InitialiseCancel(); |
|
77 User::WaitForRequest(initStat); |
|
78 INFO_PRINTF2(_L("Cancel status = %d"), initStat.Int()); |
|
79 TESTL((initStat==KErrCancel)||(initStat==KErrNone)); |
|
80 |
|
81 // Initialise the iPhone |
|
82 INFO_PRINTF1(_L("Initialize the iPhone...")); |
|
83 |
|
84 iVlPhone.InitialiseMM(initStat , tableSettingsPckg); |
|
85 User::WaitForRequest(initStat); |
|
86 TESTL(initStat == KErrNone); |
|
87 |
|
88 ERR_PRINTF1(_L("Phone Information")); |
|
89 testPhoneL(); |
|
90 User::After(Pause); // Give the user time to see the test results |
|
91 |
|
92 ERR_PRINTF1(_L("Line Information")); |
|
93 testLineL(); |
|
94 |
|
95 // Close the iPhone |
|
96 INFO_PRINTF1(_L("Close the iPhone...")); |
|
97 iVlPhone.Close(); |
|
98 return (KErrNone); |
|
99 } |
|
100 |
|
101 |
|
102 void CTestDrivePhoneLine::testPhoneL() |
|
103 |
|
104 /** |
|
105 * This function retrieves the: |
|
106 * Phone's capabilities, |
|
107 * A snapshot of the iPhone's GSM information, |
|
108 * the Number of lines associated with the iPhone and |
|
109 * performs some Cancel Requests. |
|
110 */ |
|
111 { |
|
112 // get all of the iPhone's capabilities |
|
113 INFO_PRINTF1(_L("Get the Phone's Capabilities...\n")); |
|
114 |
|
115 // API Version |
|
116 TInt mmApiVersion; |
|
117 TESTL(iVlPhone.GetMultimodeAPIVersion(mmApiVersion)== KErrNone); |
|
118 INFO_PRINTF2(_L("Multimode API version = %d\n"), mmApiVersion); |
|
119 |
|
120 // MultiMode Caps |
|
121 TUint32 mmCaps =0; |
|
122 TESTL(iVlPhone.GetMultimodeCaps(mmCaps)==KErrNone); |
|
123 INFO_PRINTF2(_L("Phone Multimode Capabilities = 0x%x"), mmCaps); |
|
124 INFO_PRINTF2(_L("Phone Multimode Capabilities = %d"), mmCaps); |
|
125 if (mmCaps & RMobilePhone::KCapsGsmSupported) |
|
126 INFO_PRINTF1(_L(" Phone Caps Support GSM\n")); |
|
127 if (mmCaps & RMobilePhone::KCapsGprsSupported) |
|
128 INFO_PRINTF1(_L(" Phone Caps Support GPRS\n")); |
|
129 if (mmCaps & RMobilePhone::KCapsAmpsSupported) |
|
130 INFO_PRINTF1(_L(" Phone Caps Support AMPS\n")); |
|
131 if (mmCaps & RMobilePhone::KCapsWcdmaSupported) |
|
132 INFO_PRINTF1(_L(" Phone Caps Support W-CDMA\n")); |
|
133 |
|
134 // Get Current Network |
|
135 RMobilePhone::TMobilePhoneNetworkMode mmNetworkMode; |
|
136 iVlPhone.GetCurrentMode(mmNetworkMode); |
|
137 INFO_PRINTF2(_L("Phone Network Mode = 0x%x\n"), mmNetworkMode); |
|
138 if (mmNetworkMode & RMobilePhone::ENetworkModeUnknown) |
|
139 INFO_PRINTF1(_L(" Phone Network Mode = Unknown\n")); |
|
140 if (mmNetworkMode & RMobilePhone::ENetworkModeUnregistered) |
|
141 INFO_PRINTF1(_L(" Phone Network Mode = Unregistered\n")); |
|
142 if (mmNetworkMode & RMobilePhone::ENetworkModeGsm) |
|
143 INFO_PRINTF1(_L(" Phone Network Mode = GSM\n")); |
|
144 if (mmNetworkMode & RMobilePhone::ENetworkModeAmps) |
|
145 INFO_PRINTF1(_L(" Phone Network Mode = AMPS\n")); |
|
146 if (mmNetworkMode & RMobilePhone::ENetworkModeWcdma) |
|
147 INFO_PRINTF1(_L(" Phone Network Mode W-CDMA\n")); |
|
148 |
|
149 // ICC (Integrated Circuit Card) Caps |
|
150 TUint32 mmIccAccessCaps = 0; |
|
151 TESTL(iVlPhone.GetIccAccessCaps(mmIccAccessCaps)); |
|
152 INFO_PRINTF2(_L("Phone ICC Access Caps = 0x%x\n"), mmIccAccessCaps); |
|
153 if (mmIccAccessCaps & RMobilePhone::KCapsSimAccessSupported) |
|
154 INFO_PRINTF1(_L(" SIM Access Supported\n")); |
|
155 if (mmIccAccessCaps & RMobilePhone::KCapsRUimAccessSupported) |
|
156 INFO_PRINTF1(_L(" RUIM Access Supported\n")); |
|
157 if (mmIccAccessCaps & RMobilePhone::KCapsUSimAccessSupported) |
|
158 INFO_PRINTF1(_L(" USIM Access Supported\n")); |
|
159 |
|
160 // Battery Caps |
|
161 TUint32 mmBatteryCaps =0; |
|
162 TESTL(iVlPhone.GetBatteryCaps(mmBatteryCaps)); |
|
163 INFO_PRINTF2(_L("Phone Battery Caps = 0x%x\n"), mmBatteryCaps); |
|
164 if (mmBatteryCaps & RMobilePhone::KCapsGetBatteryInfo) |
|
165 INFO_PRINTF1(_L(" Get Battery Info Supported\n")); |
|
166 if (mmBatteryCaps & RMobilePhone::KCapsNotifyBatteryInfoChange) |
|
167 INFO_PRINTF1(_L(" Notify Battery Info Supported\n")); |
|
168 |
|
169 // Signal Caps |
|
170 TUint32 mmSignalCaps =0; |
|
171 TESTL(iVlPhone.GetSignalCaps(mmSignalCaps)==KErrNone); |
|
172 INFO_PRINTF2(_L("Phone Signal Strength Caps = 0x%x\n"), mmSignalCaps); |
|
173 if (mmSignalCaps & RMobilePhone::KCapsGetSignalStrength) |
|
174 INFO_PRINTF1(_L(" Get Signal Strength Supported\n")); |
|
175 if (mmSignalCaps & RMobilePhone::KCapsNotifySignalStrengthChange) |
|
176 INFO_PRINTF1(_L(" Notify Signal Strength Supported\n")); |
|
177 |
|
178 // Identity Caps |
|
179 TUint32 mmIdentityCaps =0; |
|
180 TESTL(iVlPhone.GetIdentityCaps(mmIdentityCaps)==KErrNone); |
|
181 INFO_PRINTF2(_L("Phone Identity Caps = 0x%x\n"), mmIdentityCaps); |
|
182 if (mmIdentityCaps & RMobilePhone::KCapsGetManufacturer) |
|
183 INFO_PRINTF1(_L(" Get Manufacturer Supported\n")); |
|
184 if (mmIdentityCaps & RMobilePhone::KCapsGetModel) |
|
185 INFO_PRINTF1(_L(" Get Model Supported\n")); |
|
186 if (mmIdentityCaps & RMobilePhone::KCapsGetRevision) |
|
187 INFO_PRINTF1(_L(" Get Revision Supported\n")); |
|
188 if (mmIdentityCaps & RMobilePhone::KCapsGetSerialNumber) |
|
189 INFO_PRINTF1(_L(" Get Serial Number Supported\n")); |
|
190 if (mmIdentityCaps & RMobilePhone::KCapsGetSubscriberId) |
|
191 INFO_PRINTF1(_L(" Get Subscriber Id Supported\n")); |
|
192 |
|
193 // DTMF Caps |
|
194 TUint32 mmDtmfCaps = 0; |
|
195 TESTL(iVlPhone.GetDTMFCaps(mmDtmfCaps)); |
|
196 INFO_PRINTF2(_L("Phone DTMF Caps = 0x%x\n"), mmDtmfCaps); |
|
197 if (mmDtmfCaps & RMobilePhone::KCapsSendDTMFString) |
|
198 INFO_PRINTF1(_L(" Send DTMF String Supported\n")); |
|
199 if (mmDtmfCaps & RMobilePhone::KCapsSendDTMFSingleTone) |
|
200 INFO_PRINTF1(_L(" Send DTMF Single Tone Supported\n")); |
|
201 |
|
202 // Network Caps |
|
203 TUint32 mmNetworkCaps = 0; |
|
204 TESTL(iVlPhone.GetNetworkCaps(mmNetworkCaps)==KErrNone); |
|
205 INFO_PRINTF2(_L("Phone Network Caps = 0x%x\n"), mmNetworkCaps); |
|
206 if (mmNetworkCaps & RMobilePhone::KCapsGetRegistrationStatus) |
|
207 INFO_PRINTF1(_L(" Get Registration Status Supported\n")); |
|
208 if (mmNetworkCaps & RMobilePhone::KCapsNotifyRegistrationStatus) |
|
209 INFO_PRINTF1(_L(" Notify Registration Status Supported\n")); |
|
210 if (mmNetworkCaps & RMobilePhone::KCapsGetCurrentMode) |
|
211 INFO_PRINTF1(_L(" Get Current Mode Supported\n")); |
|
212 if (mmNetworkCaps & RMobilePhone::KCapsNotifyMode) |
|
213 INFO_PRINTF1(_L(" Notify Mode Supported\n")); |
|
214 if (mmNetworkCaps & RMobilePhone::KCapsGetCurrentNetwork) |
|
215 INFO_PRINTF1(_L(" Get Current Network Supported\n")); |
|
216 if (mmNetworkCaps & RMobilePhone::KCapsNotifyCurrentNetwork) |
|
217 INFO_PRINTF1(_L(" Notify Current Network Supported\n")); |
|
218 if (mmNetworkCaps & RMobilePhone::KCapsGetHomeNetwork) |
|
219 INFO_PRINTF1(_L(" Get Home Network Supported\n")); |
|
220 if (mmNetworkCaps & RMobilePhone::KCapsGetDetectedNetworks) |
|
221 INFO_PRINTF1(_L(" Get Detected Networks Supported\n")); |
|
222 if (mmNetworkCaps & RMobilePhone::KCapsManualNetworkSelection) |
|
223 INFO_PRINTF1(_L(" Manual Network Selection Supported\n")); |
|
224 if (mmNetworkCaps & RMobilePhone::KCapsGetNITZInfo) |
|
225 INFO_PRINTF1(_L(" Get NITZ Info Supported\n")); |
|
226 if (mmNetworkCaps & RMobilePhone::KCapsNotifyNITZInfo) |
|
227 INFO_PRINTF1(_L(" Notify NITZ Info Supported\n")); |
|
228 |
|
229 // Supplementary Call Service Caps |
|
230 TUint32 mmCallServiceCaps = 0; |
|
231 TESTL(iVlPhone.GetCallServiceCaps(mmCallServiceCaps)); |
|
232 INFO_PRINTF2(_L("Supplementary Call Service Caps = 0x%x\n"), mmCallServiceCaps); |
|
233 if (mmCallServiceCaps & RMobilePhone::KCapsGetCFStatusCache) |
|
234 INFO_PRINTF1(_L(" Get CF Status Cache Supported\n")); |
|
235 if (mmCallServiceCaps & RMobilePhone::KCapsGetCFStatusNetwork) |
|
236 INFO_PRINTF1(_L(" Get CF Status Network Supported\n")); |
|
237 if (mmCallServiceCaps & RMobilePhone::KCapsSetCFStatus) |
|
238 INFO_PRINTF1(_L(" Set CF Status Supported\n")); |
|
239 if (mmCallServiceCaps & RMobilePhone::KCapsNotifyCFStatus) |
|
240 INFO_PRINTF1(_L(" Notify CF Status Supported\n")); |
|
241 if (mmCallServiceCaps & RMobilePhone::KCapsGetClipStatus) |
|
242 INFO_PRINTF1(_L(" Get Clip Status Supported\n")); |
|
243 if (mmCallServiceCaps & RMobilePhone::KCapsGetClirStatus) |
|
244 INFO_PRINTF1(_L(" Get Clir Status Supported\n")); |
|
245 if (mmCallServiceCaps & RMobilePhone::KCapsGetColpStatus) |
|
246 INFO_PRINTF1(_L(" Get Colp Status Supported\n")); |
|
247 if (mmCallServiceCaps & RMobilePhone::KCapsGetColrStatus) |
|
248 INFO_PRINTF1(_L(" Get Colr Status Supported\n")); |
|
249 if (mmCallServiceCaps & RMobilePhone::KCapsGetCnapStatus) |
|
250 INFO_PRINTF1(_L(" Get Cnap Status Supported\n")); |
|
251 if (mmCallServiceCaps & RMobilePhone::KCapsGetCBStatusCache) |
|
252 INFO_PRINTF1(_L(" Get CB Status Cache Supported\n")); |
|
253 if (mmCallServiceCaps & RMobilePhone::KCapsGetCBStatusNetwork) |
|
254 INFO_PRINTF1(_L(" Get CB Status Network Supported\n")); |
|
255 if (mmCallServiceCaps & RMobilePhone::KCapsSetCBStatus) |
|
256 INFO_PRINTF1(_L(" Set CB Status Supported\n")); |
|
257 if (mmCallServiceCaps & RMobilePhone::KCapsNotifyCBStatus) |
|
258 INFO_PRINTF1(_L(" Notify CB Status Supported\n")); |
|
259 if (mmCallServiceCaps & RMobilePhone::KCapsChangeCBPassword) |
|
260 INFO_PRINTF1(_L(" Change CB Password Supported\n")); |
|
261 if (mmCallServiceCaps & RMobilePhone::KCapsBarAllIncoming) |
|
262 INFO_PRINTF1(_L(" Bar All Incoming Supported\n")); |
|
263 if (mmCallServiceCaps & RMobilePhone::KCapsBarIncomingRoaming) |
|
264 INFO_PRINTF1(_L(" Bar Incoming Roaming Supported\n")); |
|
265 if (mmCallServiceCaps & RMobilePhone::KCapsBarAllOutgoing) |
|
266 INFO_PRINTF1(_L(" Bar All Outgoing Supported\n")); |
|
267 if (mmCallServiceCaps & RMobilePhone::KCapsBarOutgoingInternational) |
|
268 INFO_PRINTF1(_L(" Bar Outgoing International Supported\n")); |
|
269 if (mmCallServiceCaps & RMobilePhone::KCapsBarOutgoingInternationalExHC) |
|
270 INFO_PRINTF1(_L(" Bar Outgoing International ExHC Supported\n")); |
|
271 if (mmCallServiceCaps & RMobilePhone::KCapsBarAllCases) |
|
272 INFO_PRINTF1(_L(" Bar All Cases Supported\n")); |
|
273 if (mmCallServiceCaps & RMobilePhone::KCapsGetCWStatusCache) |
|
274 INFO_PRINTF1(_L(" Get CW Status Cache Supported\n")); |
|
275 if (mmCallServiceCaps & RMobilePhone::KCapsGetCWStatusNetwork) |
|
276 INFO_PRINTF1(_L(" Get CW Status Network Supported\n")); |
|
277 if (mmCallServiceCaps & RMobilePhone::KCapsSetCWStatus) |
|
278 INFO_PRINTF1(_L(" Set CW Status Supported\n")); |
|
279 if (mmCallServiceCaps & RMobilePhone::KCapsNotifyCWStatus) |
|
280 INFO_PRINTF1(_L(" Notify CW Status Supported\n")); |
|
281 if (mmCallServiceCaps & RMobilePhone::KCapsGetCCBSStatusCache) |
|
282 INFO_PRINTF1(_L(" Get CCBS Status Cache Supported\n")); |
|
283 if (mmCallServiceCaps & RMobilePhone::KCapsGetCCBSStatusNetwork) |
|
284 INFO_PRINTF1(_L(" Get CCBS Status Network Supported\n")); |
|
285 if (mmCallServiceCaps & RMobilePhone::KCapsDeactivateAllCCBS) |
|
286 INFO_PRINTF1(_L(" Deactivate All CCBS Supported\n")); |
|
287 if (mmCallServiceCaps & RMobilePhone::KCapsRetrieveActiveCCBS) |
|
288 INFO_PRINTF1(_L(" Retrieve Active CCBS Supported\n")); |
|
289 if (mmCallServiceCaps & RMobilePhone::KCapsFeatureCode) |
|
290 INFO_PRINTF1(_L(" Feature Code Supported\n")); |
|
291 if (mmCallServiceCaps & RMobilePhone::KCapsNetworkServiceRequest) |
|
292 INFO_PRINTF1(_L(" Network Service Request Supported\n")); |
|
293 |
|
294 // Alternating Calls Caps |
|
295 TUint32 mmAlternatingCallCaps = 0; |
|
296 TESTL(iVlPhone.GetAlternatingCallCaps(mmAlternatingCallCaps)); |
|
297 INFO_PRINTF2(_L("Phone Alternating Call Caps = 0x%x\n"), mmAlternatingCallCaps); |
|
298 if (mmAlternatingCallCaps & RMobilePhone::KCapsMOVoiceData) |
|
299 INFO_PRINTF1(_L(" MO Voice Call Supported\n")); |
|
300 if (mmAlternatingCallCaps & RMobilePhone::KCapsMOVoiceThenData) |
|
301 INFO_PRINTF1(_L(" MO Voice Then Data Supported\n")); |
|
302 if (mmAlternatingCallCaps & RMobilePhone::KCapsMOVoiceFax) |
|
303 INFO_PRINTF1(_L(" MO Voice Fax Supported\n")); |
|
304 if (mmAlternatingCallCaps & RMobilePhone::KCapsMTVoiceData) |
|
305 INFO_PRINTF1(_L(" MT Voice Data Supported\n")); |
|
306 if (mmAlternatingCallCaps & RMobilePhone::KCapsMTVoiceThenData) |
|
307 INFO_PRINTF1(_L(" MT Voice Then Data Supported\n")); |
|
308 if (mmAlternatingCallCaps & RMobilePhone::KCapsMTVoiceFax) |
|
309 INFO_PRINTF1(_L(" MT Voice Fax Supported\n")); |
|
310 |
|
311 // Cost Caps |
|
312 TUint32 mmCostCaps = 0; |
|
313 TESTL(iVlPhone.GetCostCaps(mmCostCaps)); |
|
314 INFO_PRINTF2(_L("Phone Cost Caps = 0x%x\n"), mmCostCaps); |
|
315 if (mmCostCaps & RMobilePhone::KCapsCostInformation) |
|
316 INFO_PRINTF1(_L(" Cost Information Supported\n")); |
|
317 if (mmCostCaps & RMobilePhone::KCapsCostCharging) |
|
318 INFO_PRINTF1(_L(" Cost Charging Supported\n")); |
|
319 if (mmCostCaps & RMobilePhone::KCapsClearCost) |
|
320 INFO_PRINTF1(_L(" Clear Cost Supported\n")); |
|
321 if (mmCostCaps & RMobilePhone::KCapsSetMaxCost) |
|
322 INFO_PRINTF1(_L(" Set Max Cost Supported\n")); |
|
323 if (mmCostCaps & RMobilePhone::KCapsSetPuct) |
|
324 INFO_PRINTF1(_L(" Set Puct Supported\n")); |
|
325 if (mmCostCaps & RMobilePhone::KCapsGetCost) |
|
326 INFO_PRINTF1(_L(" Get Cost Supported\n")); |
|
327 if (mmCostCaps & RMobilePhone::KCapsNotifyCostChange) |
|
328 INFO_PRINTF1(_L(" Notify Cost Change Supported\n")); |
|
329 |
|
330 // Security Caps |
|
331 TUint32 mmSecurityCaps =0; |
|
332 TESTL(iVlPhone.GetSecurityCaps(mmSecurityCaps)); |
|
333 INFO_PRINTF2(_L("Phone Security Caps = 0x%x\n"), mmSecurityCaps); |
|
334 if (mmSecurityCaps & RMobilePhone::KCapsLockPhone) |
|
335 INFO_PRINTF1(_L(" Lock Phone Supported\n")); |
|
336 if (mmSecurityCaps & RMobilePhone::KCapsLockICC) |
|
337 INFO_PRINTF1(_L(" Lock ICC Supported\n")); |
|
338 if (mmSecurityCaps & RMobilePhone::KCapsLockPhoneToICC) |
|
339 INFO_PRINTF1(_L(" Lock Phone To ICC Supported\n")); |
|
340 if (mmSecurityCaps & RMobilePhone::KCapsLockPhoneToFirstICC) |
|
341 INFO_PRINTF1(_L(" Lock Phone To First ICC Supported\n")); |
|
342 if (mmSecurityCaps & RMobilePhone::KCapsLockOTA) |
|
343 INFO_PRINTF1(_L(" Lock OTA Supported\n")); |
|
344 if (mmSecurityCaps & RMobilePhone::KCapsAccessPin1) |
|
345 INFO_PRINTF1(_L(" Access Pin1 Supported\n")); |
|
346 if (mmSecurityCaps & RMobilePhone::KCapsAccessPin2) |
|
347 INFO_PRINTF1(_L(" Access Pin2 Supported\n")); |
|
348 if (mmSecurityCaps & RMobilePhone::KCapsAccessPhonePassword) |
|
349 INFO_PRINTF1(_L(" Access Phone Password Supported\n")); |
|
350 if (mmSecurityCaps & RMobilePhone::KCapsAccessSPC) |
|
351 INFO_PRINTF1(_L(" Access SPC Supported\n")); |
|
352 |
|
353 |
|
354 // base class iPhone caps |
|
355 RPhone::TCaps phoneCaps; |
|
356 TESTL(iVlPhone.GetCaps(phoneCaps) == KErrNone); |
|
357 if (!(phoneCaps.iFlags & RPhone::KCapsVoice)) |
|
358 { |
|
359 INFO_PRINTF2(_L("This iPhone does not support voice calls (caps=0x%x)\n"), phoneCaps.iFlags); |
|
360 iVlPhone.Close(); |
|
361 return; |
|
362 } |
|
363 INFO_PRINTF2(_L("Base Class RPhone Caps = 0x%x\n"), phoneCaps.iFlags); |
|
364 if (phoneCaps.iFlags & RPhone::KCapsUnknown) |
|
365 INFO_PRINTF1(_L(" Caps Unknown\n")); |
|
366 if (phoneCaps.iFlags & RPhone::KCapsData) |
|
367 INFO_PRINTF1(_L(" Data Supported\n")); |
|
368 if (phoneCaps.iFlags & RPhone::KCapsFaxClassOne) |
|
369 INFO_PRINTF1(_L(" Fax Class 1 Supported\n")); |
|
370 if (phoneCaps.iFlags & RPhone::KCapsFaxClassOnePointZero) |
|
371 INFO_PRINTF1(_L(" Fax Class 2 Point Zero Supported\n")); |
|
372 if (phoneCaps.iFlags & RPhone::KCapsFaxClassTwo) |
|
373 INFO_PRINTF1(_L(" Fax Class 2 Supported\n")); |
|
374 if (phoneCaps.iFlags & RPhone::KCapsFaxClassTwoPointZero) |
|
375 INFO_PRINTF1(_L(" Fax Class 2 Point 0 Supported\n")); |
|
376 if (phoneCaps.iFlags & RPhone::KCapsFaxClassTwoPointOne) |
|
377 INFO_PRINTF1(_L(" Fax Class 2 Point 1 Supported\n")); |
|
378 if (phoneCaps.iFlags & RPhone::KCapsVoice) |
|
379 INFO_PRINTF1(_L(" Voice Supported\n")); |
|
380 if (phoneCaps.iFlags & RPhone::KCapsEventModemDetection) |
|
381 INFO_PRINTF1(_L(" Event Modem Detection Supported\n")); |
|
382 if (phoneCaps.iFlags & RPhone::KCapsStealCommPort) |
|
383 INFO_PRINTF1(_L(" Steal Comm Port Supported\n")); |
|
384 |
|
385 |
|
386 // Get the iPhone info |
|
387 // Unlike GSM, the MM API does not include this method. it uses several other methods |
|
388 INFO_PRINTF1(_L("Get Phone Info...\n")); |
|
389 RPhone::TPhoneInfo phoneInfo; |
|
390 TInt ret = iVlPhone.GetInfo(phoneInfo); |
|
391 if (ret == KErrNotSupported) |
|
392 { |
|
393 INFO_PRINTF1(_L("Get Phone info is NOT Supported\n\n")); |
|
394 } |
|
395 else if (ret == KErrNone) |
|
396 { |
|
397 INFO_PRINTF1(_L("Get Phone Info is successful.\n")); |
|
398 TESTL(phoneInfo.iDetection == RPhone::EDetectedPresent); |
|
399 INFO_PRINTF1(_L("Local Modem has been detected.\n\n")); |
|
400 } |
|
401 else |
|
402 { |
|
403 INFO_PRINTF1(_L("Error getting Phone Info.\n\n")); |
|
404 } |
|
405 |
|
406 |
|
407 // Number of lines associated with the iPhone |
|
408 INFO_PRINTF1(_L("Getting the number of lines associated with the iPhone\n")); |
|
409 TInt lineCount = 0; |
|
410 TESTL(iVlPhone.EnumerateLines(lineCount) == KErrNone); |
|
411 TESTL(lineCount > 0); |
|
412 INFO_PRINTF2(_L("Number of associated lines: %d\n"), lineCount); |
|
413 |
|
414 // find the iPhone's voice line and get the line info for it |
|
415 RPhone::TLineInfo lineInfo; |
|
416 for (;lineCount>0; lineCount--) |
|
417 { |
|
418 TESTL(iVlPhone.GetLineInfo(lineCount-1, lineInfo) == KErrNone); |
|
419 INFO_PRINTF4(_L("Line %d (%S) cap flags = 0x%x\n"), |
|
420 lineCount-1, &lineInfo.iName, lineInfo.iLineCapsFlags); |
|
421 if (lineInfo.iLineCapsFlags & RLine::KCapsVoice) |
|
422 { |
|
423 INFO_PRINTF3(_L("Line %d (%S) has voice capability\n\n"), lineCount-1, &lineInfo.iName); |
|
424 break; |
|
425 } |
|
426 } |
|
427 TESTL(lineCount > 0); |
|
428 |
|
429 // get the iPhone status |
|
430 INFO_PRINTF1(_L("Get the Phone's Status...")); |
|
431 RPhone::TStatus phoneStatus; |
|
432 ret = iVlPhone.GetStatus(phoneStatus); |
|
433 if (ret == KErrNotSupported) |
|
434 INFO_PRINTF1(_L("Get Phone Status is NOT Supported")); |
|
435 if (ret == KErrNone) |
|
436 { |
|
437 INFO_PRINTF1(_L("Get Phone Status is successful.")); |
|
438 TESTL(phoneStatus.iMode == RPhone::EModeIdle); |
|
439 INFO_PRINTF1(_L("The iPhone is currently Idle")); |
|
440 } |
|
441 |
|
442 // Notification Cancel Requests : Modem Detected |
|
443 INFO_PRINTF1(_L("Notify Modem Detected Cancel Request...")); |
|
444 RPhone::TModemDetection detected; |
|
445 TRequestStatus cancelStat; |
|
446 iVlPhone.NotifyModemDetected(cancelStat, detected); |
|
447 iVlPhone.NotifyModemDetectedCancel(); |
|
448 User::WaitForRequest(cancelStat); |
|
449 INFO_PRINTF2(_L("Notify Modem Detected Cancel status: %d"), cancelStat.Int()); |
|
450 |
|
451 // Notification Cancel Requests : Caps Change |
|
452 INFO_PRINTF1(_L("Notify Caps Change Cancel Request...")); |
|
453 iVlPhone.NotifyCapsChange(cancelStat, phoneCaps); |
|
454 iVlPhone.NotifyCapsChangeCancel(); |
|
455 User::WaitForRequest(cancelStat); |
|
456 INFO_PRINTF2(_L("Notify Caps Change Cancel status: %d"), cancelStat.Int()); |
|
457 } |
|
458 |
|
459 |
|
460 void CTestDrivePhoneLine::testLineL() |
|
461 |
|
462 /** |
|
463 * This function gets the Line capabilities, line information, Number of calls |
|
464 * on the line and call information, Hook status and changes in hook status. |
|
465 * It also tests Line Notifications and Notification Cancel Requests. |
|
466 */ |
|
467 { |
|
468 _LIT(KVoiceLineName, "Voice"); |
|
469 |
|
470 RLine voiceLine; |
|
471 INFO_PRINTF1(_L("Opening Voice Line\n")); |
|
472 TESTL(voiceLine.Open(iVlPhone, KVoiceLineName) == KErrNone); |
|
473 |
|
474 // Line Capabilities |
|
475 INFO_PRINTF1(_L("Retrieving Line Capabilities\n")); |
|
476 RLine::TCaps lineCaps; |
|
477 TInt ret = voiceLine.GetCaps(lineCaps); |
|
478 if (ret != KErrNone) |
|
479 { |
|
480 INFO_PRINTF1(_L("Get Line Capabilities is NOT supported\n")); |
|
481 } |
|
482 else |
|
483 { |
|
484 if ((lineCaps.iFlags & RLine::KCapsData) != 0) |
|
485 INFO_PRINTF1(_L("This line supports Data connections\n")); |
|
486 if ((lineCaps.iFlags & RLine::KCapsFax) != 0) |
|
487 INFO_PRINTF1(_L("This line supports Fax connections\n")); |
|
488 if ((lineCaps.iFlags & RLine::KCapsVoice) != 0) |
|
489 INFO_PRINTF1(_L("This line supports Voice connections\n")); |
|
490 if ((lineCaps.iFlags & RLine::KCapsEventIncomingCall) != 0) |
|
491 INFO_PRINTF1(_L("This line supports Incoming Call Notification requests\n")); |
|
492 } |
|
493 |
|
494 // Line Information |
|
495 INFO_PRINTF1(_L("Retrieving Line Information\n")); |
|
496 RLine::TLineInfo lineInfo; |
|
497 ret = voiceLine.GetInfo(lineInfo); |
|
498 if (ret != KErrNone) |
|
499 { |
|
500 INFO_PRINTF1(_L("Get Line Info is NOT supported\n")); |
|
501 } |
|
502 else |
|
503 { |
|
504 INFO_PRINTF1(_L("Get Line Info is successful\n")); |
|
505 } |
|
506 |
|
507 // Line Status Information |
|
508 INFO_PRINTF1(_L("\nRetrieving Line Status...\n")); |
|
509 RCall::TStatus lineStatus; |
|
510 ret = voiceLine.GetStatus(lineStatus); |
|
511 if (ret == KErrNone) |
|
512 { |
|
513 TESTL(lineStatus == RCall::EStatusIdle); |
|
514 INFO_PRINTF1(_L("The line is IDLE \n\n")); |
|
515 } |
|
516 else |
|
517 INFO_PRINTF1(_L("Error retrieving the Line status\n")); |
|
518 |
|
519 // Hook status information |
|
520 INFO_PRINTF1(_L("\nRetrieving Hook Status...\n")); |
|
521 RCall::THookStatus hookStatus; |
|
522 ret = voiceLine.GetHookStatus(hookStatus); |
|
523 if (ret != KErrNone) |
|
524 INFO_PRINTF1(_L("Get Hook status is NOT supported\n")); |
|
525 else |
|
526 { |
|
527 TESTL(hookStatus == RCall::EHookStatusOn); |
|
528 INFO_PRINTF1(_L("The line is currently ON Hook\n")); |
|
529 } |
|
530 |
|
531 // Count the no. of calls on the line & Get call info. |
|
532 INFO_PRINTF1(_L("Retrieving no. of calls opened from the line..\n")); |
|
533 TInt numCalls = 0; |
|
534 voiceLine.EnumerateCall(numCalls); |
|
535 INFO_PRINTF2(TRefByValue<const TDesC>(_L("No of calls opened = %d\n")), numCalls); |
|
536 |
|
537 INFO_PRINTF1(_L("Getting Call info..")); |
|
538 RLine::TCallInfo callInfo; |
|
539 TInt firstCall = 0; |
|
540 ret = voiceLine.GetCallInfo(firstCall, callInfo); |
|
541 if (ret == KErrNotSupported) |
|
542 INFO_PRINTF1(_L("Get Call information is NOT supported")); |
|
543 if (ret == KErrNone) |
|
544 INFO_PRINTF1(_L("Get Call information is successful")); |
|
545 |
|
546 User::After(Pause); // Give the user time to see the test results |
|
547 |
|
548 // Notification Cancel Requests |
|
549 TRequestStatus cancelStatus; |
|
550 |
|
551 // Hook Change Notification Cancel |
|
552 INFO_PRINTF1(_L("Hook change Notification Cancel")); |
|
553 voiceLine.NotifyHookChange(cancelStatus, hookStatus); |
|
554 voiceLine.NotifyHookChangeCancel(); |
|
555 User::WaitForRequest(cancelStatus); |
|
556 INFO_PRINTF2(_L("Hook notification Cancel status = %d"), cancelStatus.Int()); |
|
557 |
|
558 // Call Added Notification Cancel |
|
559 INFO_PRINTF1(_L("Call Added Notification Cancel")); |
|
560 TName tCallName; |
|
561 voiceLine.NotifyCallAdded(cancelStatus, tCallName); |
|
562 voiceLine.NotifyCallAddedCancel(); |
|
563 User::WaitForRequest(cancelStatus); |
|
564 INFO_PRINTF2(_L("Notify Call added Cancel status = %d"), cancelStatus.Int()); |
|
565 |
|
566 // Caps Change Notification Cancel |
|
567 INFO_PRINTF1(_L("Caps change Notification Cancel\n")); |
|
568 voiceLine.NotifyCapsChange(cancelStatus, lineCaps); |
|
569 voiceLine.NotifyCapsChangeCancel(); |
|
570 User::WaitForRequest(cancelStatus); |
|
571 INFO_PRINTF2(_L("Caps Change Cancel status = %d"), cancelStatus.Int()); |
|
572 |
|
573 // Incoming Call Notification Cancel |
|
574 INFO_PRINTF1(_L("Incoming call Notification Cancel")); |
|
575 TName callName; |
|
576 voiceLine.NotifyIncomingCall(cancelStatus, callName); |
|
577 voiceLine.NotifyIncomingCallCancel(); |
|
578 User::WaitForRequest(cancelStatus); |
|
579 INFO_PRINTF2(_L("Incoming call Notification Cancel status = %d"), cancelStatus.Int()); |
|
580 |
|
581 // Status change Notification Cancel |
|
582 INFO_PRINTF1(_L("Status change Notification Cancel\n")); |
|
583 voiceLine.NotifyStatusChange(cancelStatus, lineStatus); |
|
584 voiceLine.NotifyStatusChangeCancel(); |
|
585 User::WaitForRequest(cancelStatus); |
|
586 INFO_PRINTF2(_L("Status change Notification Cancel = %d"), cancelStatus.Int()); |
|
587 |
|
588 // Close the Voice line |
|
589 voiceLine.Close(); |
|
590 } |
|
591 |
|
592 |
|
593 // |
|
594 // Emulator-side class |
|
595 // With the assistance of the base class, this class must run the designated script |
|
596 // |
|
597 CTestPhoneLine* CTestPhoneLine::NewL(const TScript* aScript) |
|
598 { |
|
599 CTestPhoneLine* phoneLine = new (ELeave) CTestPhoneLine(aScript); |
|
600 CleanupStack::PushL(phoneLine); |
|
601 phoneLine->ConstructL(); |
|
602 CleanupStack::Pop(); |
|
603 return (phoneLine); |
|
604 } |
|
605 |
|
606 CTestPhoneLine::CTestPhoneLine(const TScript* aScript) : |
|
607 iScript(aScript) |
|
608 {} |
|
609 |
|
610 void CTestPhoneLine::ConstructL() |
|
611 { |
|
612 CATScriptEng::ConstructL(); |
|
613 } |
|
614 |
|
615 CTestPhoneLine::~CTestPhoneLine() |
|
616 {} |
|
617 |
|
618 TInt CTestPhoneLine::Start() |
|
619 { |
|
620 StartScript(iScript); |
|
621 return (KErrNone); |
|
622 } |
|
623 |
|
624 void CTestPhoneLine::SpecificAlgorithmL(TInt /* aParam */) |
|
625 { |
|
626 } |
|
627 |
|
628 void CTestPhoneLine::Complete(TInt aError) |
|
629 { |
|
630 iReturnValue = aError; |
|
631 CActiveScheduler::Stop(); |
|
632 } |