|
1 // Copyright (c) 2002-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 // This file contains the main methods that test the Misc |
|
15 // Functionality of the MMTSY |
|
16 // |
|
17 // |
|
18 |
|
19 /** |
|
20 @file |
|
21 */ |
|
22 |
|
23 #include "Te_Misc.h" |
|
24 |
|
25 const TInt KOneSecond=1000000; // Used in a time out function, 1 second (in microSeconds) |
|
26 |
|
27 |
|
28 /*-- Server info Test -----------------------------------------------------------------*/ |
|
29 |
|
30 CServerInfo::CServerInfo() |
|
31 /** Each test step initialises it's own name |
|
32 */ |
|
33 { |
|
34 // store the name of this test case |
|
35 // this is the name that is used by the script file |
|
36 SetTestStepName(_L("ServerInfo")); |
|
37 } |
|
38 |
|
39 TVerdict CServerInfo::doTestStepL( void ) |
|
40 /** |
|
41 * This function retrieves the number of phones supported by the loaded ETel Tsy |
|
42 * Modules. Also gets information associated with the phone and queries the Tsy |
|
43 * about its supported functionality. |
|
44 */ |
|
45 { |
|
46 TInt numOfPhones; |
|
47 TESTL(iTelServer.EnumeratePhones(numOfPhones)==KErrNone); |
|
48 INFO_PRINTF2(_L("No. of phones supported by loaded ETel modules = %d"), numOfPhones); |
|
49 |
|
50 // Phone information |
|
51 RTelServer::TPhoneInfo phoneInfo; |
|
52 TEST_CHECKL(iTelServer.GetPhoneInfo(numOfPhones-1, phoneInfo),KErrNone, _L("Failed GetPhoneInfo()")); |
|
53 |
|
54 // Get the Network Type |
|
55 const TText* type=_S("Unknown"); |
|
56 switch(phoneInfo.iNetworkType) |
|
57 { |
|
58 case RTelServer::ENetworkTypeWiredAnalog: |
|
59 type=_S("Wired Analog Network"); break; |
|
60 case RTelServer::ENetworkTypeWiredDigital: |
|
61 type=_S("Wired Digital Network"); break; |
|
62 case RTelServer::ENetworkTypeMobileAnalog: |
|
63 type=_S("Mobile Analog Network"); break; |
|
64 case RTelServer::ENetworkTypeMobileDigital: |
|
65 type=_S("Mobile Digital Network"); break; |
|
66 default: |
|
67 type=_S("Unknown Network Type"); break; |
|
68 } |
|
69 |
|
70 INFO_PRINTF2(_L("Network Type : %s"), type); |
|
71 INFO_PRINTF2(_L("Phone's name : %S"), &phoneInfo.iName); |
|
72 INFO_PRINTF2(_L("No. of lines supported by the phone : %d"), phoneInfo.iNumberOfLines); |
|
73 INFO_PRINTF2(_L("Extensions supported by Tsy Module : %d"), phoneInfo.iExtensions); |
|
74 |
|
75 |
|
76 // Query TSY about supported functionality |
|
77 TBool result; |
|
78 TInt mixin=1; // same value used by etel\tetel\t_hyres1.cpp |
|
79 |
|
80 TBuf<10> tsyName; |
|
81 tsyName = KMmtsyName; |
|
82 |
|
83 TESTL(iTelServer.IsSupportedByModule(tsyName, mixin, result)==KErrNone); |
|
84 INFO_PRINTF1(_L("Querying TSY about supported functionality is Successful")); |
|
85 |
|
86 return TestStepResult(); |
|
87 } |
|
88 |
|
89 |
|
90 |
|
91 |
|
92 /*-- Signal And Battery Strength Test -------------------------------------------------*/ |
|
93 |
|
94 CSignalAndBatteryStrengthTest::CSignalAndBatteryStrengthTest() |
|
95 /** Each test step initialises it's own name |
|
96 */ |
|
97 { |
|
98 // store the name of this test case |
|
99 // this is the name that is used by the script file |
|
100 SetTestStepName(_L("SignalAndBatteryStrengthTest")); |
|
101 } |
|
102 |
|
103 TVerdict CSignalAndBatteryStrengthTest::doTestStepL( void ) |
|
104 /** |
|
105 * This method retrieves a phone's Signal and Battery Strength Information. |
|
106 */ |
|
107 { |
|
108 INFO_PRINTF1(_L("Get Signal And Battery Strength Information")); |
|
109 |
|
110 // Test Getting Battery caps |
|
111 INFO_PRINTF1(_L("Calling RMobilePhone::GetBatteryCaps()")); |
|
112 TUint32 aCaps; |
|
113 TEST_CHECKL(iPhone.GetBatteryCaps(aCaps), KErrNone, _L("Failed RMobilePhone::GetBatteryCaps()")) ; |
|
114 |
|
115 //Print Capabilities |
|
116 if(aCaps & RMobilePhone::KCapsGetBatteryInfo) |
|
117 { |
|
118 INFO_PRINTF1(_L("Phone supports requests to get the current battery info")); |
|
119 } |
|
120 if(aCaps & RMobilePhone::KCapsNotifyBatteryInfoChange) |
|
121 { |
|
122 INFO_PRINTF1(_L("Phone supports requests for notification of change in battery information.")); |
|
123 } |
|
124 |
|
125 |
|
126 //Test Getting Signal caps |
|
127 INFO_PRINTF1(_L("Calling RMobilePhone::GetSignalCaps()")); |
|
128 TEST_CHECKL(iPhone.GetSignalCaps(aCaps), KErrNone, _L("Failed RMobilePhone::GetSignalCaps()")); |
|
129 |
|
130 //Print Capabilities |
|
131 if(aCaps & RMobilePhone::KCapsGetSignalStrength) |
|
132 { |
|
133 INFO_PRINTF1(_L("Phone supports requests to get the current signal strength")); |
|
134 } |
|
135 if(aCaps & RMobilePhone::KCapsNotifySignalStrengthChange) |
|
136 { |
|
137 INFO_PRINTF1(_L("Phone supports requests for notification of change in signal strength")); |
|
138 } |
|
139 |
|
140 |
|
141 //Test Getting Battery Info |
|
142 INFO_PRINTF1(_L("Calling RMobilePhone::GetBatteryInfo()")); |
|
143 RMobilePhone::TMobilePhoneBatteryInfoV1 battery; |
|
144 iPhone.GetBatteryInfo(iStatus, battery); |
|
145 User::WaitForRequest(iStatus); |
|
146 if (iStatus==KErrNone) |
|
147 { |
|
148 INFO_PRINTF2(TRefByValue<const TDesC>(_L("Battery status : %d")), battery.iStatus); |
|
149 INFO_PRINTF2(TRefByValue<const TDesC>(_L("Battery charge level : %d")), battery.iChargeLevel); |
|
150 } |
|
151 else |
|
152 { |
|
153 INFO_PRINTF2(TRefByValue<const TDesC>(_L("Battery charge, Error %d returned.")), iStatus.Int()); |
|
154 SetTestStepResult(EFail); |
|
155 } |
|
156 |
|
157 |
|
158 //Get Signal Strength |
|
159 TInt32 signalStrength; |
|
160 TInt8 bars; |
|
161 |
|
162 INFO_PRINTF1(_L("Calling RMobilePhone::GetSignalStrength()")); |
|
163 iPhone.GetSignalStrength(iStatus, signalStrength, bars); |
|
164 User::WaitForRequest(iStatus); |
|
165 if (iStatus==KErrNone) |
|
166 { |
|
167 INFO_PRINTF2(TRefByValue<const TDesC>(_L("Signal strength (in dBm) : %d")), signalStrength); |
|
168 INFO_PRINTF2(TRefByValue<const TDesC>(_L("Signal strength (in display bars) : %d")), bars); |
|
169 } |
|
170 |
|
171 else |
|
172 { |
|
173 INFO_PRINTF2(TRefByValue<const TDesC>(_L("Signal strength, Error %d returned.")), iStatus.Int()); |
|
174 SetTestStepResult(EFail); |
|
175 } |
|
176 |
|
177 |
|
178 //Test Cancelling requests |
|
179 INFO_PRINTF1(_L("Performing Cancel Requests for the above functions")); |
|
180 |
|
181 iPhone.GetBatteryInfo(iStatus, battery); |
|
182 iPhone.CancelAsyncRequest(EMobilePhoneGetBatteryInfo); |
|
183 User::WaitForRequest(iStatus); |
|
184 INFO_PRINTF2(TRefByValue<const TDesC>(_L("GetBatteryInfo Cancel status = %d")), iStatus.Int()); |
|
185 User::After(1000000); //Wait for phone to produce response and for TSY to reject it |
|
186 |
|
187 iPhone.GetSignalStrength(iStatus, signalStrength, bars); |
|
188 iPhone.CancelAsyncRequest(EMobilePhoneGetSignalStrength); |
|
189 User::WaitForRequest(iStatus); |
|
190 INFO_PRINTF2(TRefByValue<const TDesC>(_L("GetSignalStrength Cancel status = %d")), iStatus.Int()); |
|
191 User::After(1000000); //Wait for phone to produce response and for TSY to reject it |
|
192 |
|
193 return TestStepResult(); |
|
194 } |
|
195 |
|
196 |
|
197 /*-- Manufacturer Info Test -----------------------------------------------------------*/ |
|
198 CManufacturerInfoTest::CManufacturerInfoTest() |
|
199 /** Each test step initialises it's own name |
|
200 */ |
|
201 { |
|
202 // store the name of this test case |
|
203 // this is the name that is used by the script file |
|
204 SetTestStepName(_L("ManufacturerInfoTest")); |
|
205 } |
|
206 |
|
207 TVerdict CManufacturerInfoTest::doTestStepL( void ) |
|
208 /** |
|
209 * This method retrieves a phone's Signal and Battery Strength Information. |
|
210 */ |
|
211 { |
|
212 INFO_PRINTF1(_L("Get Manufacturer ID, Model ID, Revision ID and Serial Number")); |
|
213 |
|
214 //Test Getting Phone Identity Caps |
|
215 INFO_PRINTF1(_L("Calling RMobilePhone::GetIdentityCaps()")); |
|
216 TUint32 aCaps; |
|
217 TInt ret = iPhone.GetIdentityCaps(aCaps); |
|
218 if(ret) |
|
219 { |
|
220 INFO_PRINTF2(_L("RMobilePhone::GetIdentityCaps() returned %d"), ret); |
|
221 SetTestStepResult(EFail); |
|
222 } |
|
223 |
|
224 if(aCaps & RMobilePhone::KCapsGetManufacturer) |
|
225 { |
|
226 INFO_PRINTF1(_L("Phone can return the identity of its manufacturer")); |
|
227 } |
|
228 if(aCaps & RMobilePhone::KCapsGetModel) |
|
229 { |
|
230 INFO_PRINTF1(_L("Phone can return the identity of its model")); |
|
231 } |
|
232 if(aCaps & RMobilePhone::KCapsGetRevision) |
|
233 { |
|
234 INFO_PRINTF1(_L("Phone can return the identity of its revision")); |
|
235 } |
|
236 if(aCaps & RMobilePhone::KCapsGetSerialNumber) |
|
237 { |
|
238 INFO_PRINTF1(_L("Phone can return the identity of its serial number")); |
|
239 } |
|
240 if(aCaps & RMobilePhone::KCapsGetSubscriberId) |
|
241 { |
|
242 INFO_PRINTF1(_L("Phone can return the identity of its subscriber")); |
|
243 } |
|
244 |
|
245 |
|
246 INFO_PRINTF1(_L("Calling RMobilePhone::GetPhoneId()")); |
|
247 RMobilePhone::TMobilePhoneIdentityV1 phoneId; |
|
248 iPhone.GetPhoneId(iStatus, phoneId); |
|
249 User::WaitForRequest(iStatus); |
|
250 |
|
251 if (iStatus==KErrNone) |
|
252 { |
|
253 INFO_PRINTF2(TRefByValue<const TDesC>(_L("Manufacturer ID : %S")), &phoneId.iManufacturer); |
|
254 INFO_PRINTF2(TRefByValue<const TDesC>(_L("Model ID : %S")), &phoneId.iModel); |
|
255 INFO_PRINTF2(TRefByValue<const TDesC>(_L("Revision ID : %S")), &phoneId.iRevision); |
|
256 INFO_PRINTF2(TRefByValue<const TDesC>(_L("Serial number : %S")), &phoneId.iSerialNumber); |
|
257 } |
|
258 else |
|
259 { |
|
260 INFO_PRINTF2(TRefByValue<const TDesC>(_L("Error RMobilePhone::GetPhoneId() returned %d")), iStatus.Int()); |
|
261 SetTestStepResult(EFail); |
|
262 } |
|
263 |
|
264 return TestStepResult(); |
|
265 } |
|
266 |
|
267 /*-- Subscriber ID Test -----------------------------------------------------------*/ |
|
268 CSubscriberIdTest::CSubscriberIdTest() |
|
269 /** Each test step initialises it's own name |
|
270 */ |
|
271 { |
|
272 // store the name of this test case |
|
273 // this is the name that is used by the script file |
|
274 SetTestStepName(_L("SubscriberIdTest")); |
|
275 } |
|
276 |
|
277 TVerdict CSubscriberIdTest::doTestStepL( void ) |
|
278 /** |
|
279 * This method retrieves a phone's subscriber ID |
|
280 */ |
|
281 { |
|
282 INFO_PRINTF1(_L("Get Subscriber ID")); |
|
283 |
|
284 // Get subscriber ID test |
|
285 INFO_PRINTF1(_L("Calling RMobilePhone::GetSubscriberId()")); |
|
286 RMobilePhone::TMobilePhoneSubscriberId subId; |
|
287 iPhone.GetSubscriberId(iStatus, subId); |
|
288 User::WaitForRequest(iStatus); |
|
289 |
|
290 // Do not consider KErrNotSupported return code as a test failure |
|
291 if(iStatus==KErrNotSupported) |
|
292 { |
|
293 INFO_PRINTF1(_L("***Phone returned KErrNotSupported***")); |
|
294 } |
|
295 else if(iStatus!=KErrNone) |
|
296 { |
|
297 // Log that and error occurred |
|
298 INFO_PRINTF2(TRefByValue<const TDesC>(_L("GetSubscriberId failed with status %d")), iStatus.Int()); |
|
299 SetTestStepResult(EFail); |
|
300 } |
|
301 |
|
302 if(iStatus==KErrNone) |
|
303 { |
|
304 // Log the Subscriber ID returned |
|
305 INFO_PRINTF2(TRefByValue<const TDesC>(_L("SubscriberId: %S")), &subId); |
|
306 } |
|
307 |
|
308 |
|
309 // Get subscriber ID and then cancel test |
|
310 iPhone.GetSubscriberId(iStatus, subId); |
|
311 iPhone.CancelAsyncRequest(EMobilePhoneGetSubscriberId); |
|
312 User::WaitForRequest(iStatus); |
|
313 INFO_PRINTF2(TRefByValue<const TDesC>(_L("RMobilePhone::GetSubscriberIdCancel status = %d")), iStatus.Int()); |
|
314 |
|
315 return TestStepResult(); |
|
316 } |
|
317 |
|
318 |
|
319 |
|
320 /*-- Phone Store Test -----------------------------------------------------------------*/ |
|
321 |
|
322 CPhoneStoreTest::CPhoneStoreTest() |
|
323 /** Each test step initialises it's own name |
|
324 */ |
|
325 { |
|
326 // store the name of this test case |
|
327 // this is the name that is used by the script file |
|
328 SetTestStepName(_L("PhoneStoreTest")); |
|
329 } |
|
330 |
|
331 TVerdict CPhoneStoreTest::doTestStepL( void ) |
|
332 /** |
|
333 * This method retrieves various phone store information |
|
334 */ |
|
335 |
|
336 { |
|
337 // Get phone store info for various phonebook |
|
338 INFO_PRINTF1(_L("Test the Phone Stores")); |
|
339 |
|
340 //Get phone store info for IccAdnPhoneBook |
|
341 INFO_PRINTF1(_L("Calling RMobilePhone::GetPhoneStoreInfo() for KETelIccAdnPhoneBook")); |
|
342 RMobilePhoneStore::TMobilePhoneStoreInfoV1 info; |
|
343 RMobilePhoneStore::TMobilePhoneStoreInfoV1Pckg infoPckg(info); |
|
344 iPhone.GetPhoneStoreInfo(iStatus, infoPckg, KETelIccAdnPhoneBook); |
|
345 User::WaitForRequest(iStatus); |
|
346 |
|
347 if(iStatus==KErrNone) |
|
348 { |
|
349 INFO_PRINTF2(TRefByValue<const TDesC>(_L("Store Name: %S")), &info.iName); |
|
350 TESTL(info.iType==RMobilePhoneStore::EPhoneBookStore); |
|
351 INFO_PRINTF2(TRefByValue<const TDesC>(_L("Number of used entries: %d")), info.iUsedEntries); |
|
352 INFO_PRINTF2(TRefByValue<const TDesC>(_L("Number of total entries: %d")), info.iTotalEntries); |
|
353 } |
|
354 else if (iStatus==KErrNotSupported) |
|
355 { |
|
356 INFO_PRINTF1(_L("***Phone returned KErrNotSupported***")); |
|
357 } |
|
358 else |
|
359 { |
|
360 // Log that and error occurred |
|
361 INFO_PRINTF2(TRefByValue<const TDesC>(_L("GetPhoneStoreInfo failed with status %d")), iStatus.Int()); |
|
362 SetTestStepResult(EFail); |
|
363 } |
|
364 |
|
365 //Get phonebook store info for MeAdnPhoneBook |
|
366 INFO_PRINTF1(_L("Calling RMobilePhone::GetPhoneStoreInfo() for KETelMeAdnPhoneBook")); |
|
367 RMobilePhoneBookStore::TMobilePhoneBookInfoV1 phbkInfo; |
|
368 RMobilePhoneBookStore::TMobilePhoneBookInfoV1Pckg phbkInfoPckg(phbkInfo); |
|
369 iPhone.GetPhoneStoreInfo(iStatus, phbkInfoPckg, KETelMeAdnPhoneBook); |
|
370 User::WaitForRequest(iStatus); |
|
371 |
|
372 if(iStatus==KErrNone) |
|
373 { |
|
374 INFO_PRINTF2(TRefByValue<const TDesC>(_L("Store Name: %S")), &phbkInfo.iName); |
|
375 TESTL(phbkInfo.iType==RMobilePhoneStore::EPhoneBookStore); |
|
376 INFO_PRINTF2(TRefByValue<const TDesC>(_L("Number of used entries: %d")), phbkInfo.iUsedEntries); |
|
377 INFO_PRINTF2(TRefByValue<const TDesC>(_L("Number of total entries: %d")), phbkInfo.iTotalEntries); |
|
378 INFO_PRINTF2(TRefByValue<const TDesC>(_L("Max text length: %d")), phbkInfo.iMaxTextLength); |
|
379 INFO_PRINTF2(TRefByValue<const TDesC>(_L("Max number length: %d")), phbkInfo.iMaxNumLength); |
|
380 } |
|
381 else if(iStatus==KErrNotSupported) |
|
382 { |
|
383 INFO_PRINTF1(_L("***Phone returned KErrNotSupported***")); |
|
384 } |
|
385 else |
|
386 { |
|
387 INFO_PRINTF2(TRefByValue<const TDesC>(_L("GetPhoneStoreInfo failed with status %d")), iStatus.Int()); |
|
388 SetTestStepResult(EFail); |
|
389 } |
|
390 |
|
391 // Get phone store info for KETelOwnNumberStore |
|
392 INFO_PRINTF1(_L("Calling RMobilePhone::GetPhoneStoreInfo() for KETelOwnNumberStore")); |
|
393 iPhone.GetPhoneStoreInfo(iStatus, infoPckg, KETelOwnNumberStore); |
|
394 User::WaitForRequest(iStatus); |
|
395 |
|
396 if(iStatus==KErrNone) |
|
397 { |
|
398 INFO_PRINTF2(TRefByValue<const TDesC>(_L("Store Name: %S")), &info.iName); |
|
399 TESTL(info.iType==RMobilePhoneStore::EOwnNumberStore); |
|
400 INFO_PRINTF2(TRefByValue<const TDesC>(_L("Number of used entries: %d")), info.iUsedEntries); |
|
401 INFO_PRINTF2(TRefByValue<const TDesC>(_L("Number of total entries: %d")), info.iTotalEntries); |
|
402 } |
|
403 else if(iStatus==KErrNotSupported) |
|
404 { |
|
405 INFO_PRINTF1(_L("***Phone returned KErrNotSupported***")); |
|
406 } |
|
407 else |
|
408 { |
|
409 INFO_PRINTF2(TRefByValue<const TDesC>(_L("GetPhoneStoreInfo failed with status %d")), iStatus.Int()); |
|
410 SetTestStepResult(EFail); |
|
411 } |
|
412 |
|
413 //Get own number store information |
|
414 INFO_PRINTF1(_L("Calling RMobilePhone::GetPhoneStoreInfo() for KETelOwnNumberStore...")); |
|
415 INFO_PRINTF1(_L("...but this time passing in a TMobileONStoreInfoV1Pckg")); |
|
416 RMobileONStore::TMobileONStoreInfoV1 onInfo; |
|
417 RMobileONStore::TMobileONStoreInfoV1Pckg onInfoPckg(onInfo); |
|
418 iPhone.GetPhoneStoreInfo(iStatus, onInfoPckg, KETelOwnNumberStore); |
|
419 User::WaitForRequest(iStatus); |
|
420 |
|
421 if(iStatus==KErrNone) |
|
422 { |
|
423 INFO_PRINTF2(TRefByValue<const TDesC>(_L("Store Name: %S")), &onInfo.iName); |
|
424 TESTL(onInfo.iType==RMobilePhoneStore::EOwnNumberStore); |
|
425 INFO_PRINTF2(TRefByValue<const TDesC>(_L("Number of used entries: %d")), onInfo.iUsedEntries); |
|
426 INFO_PRINTF2(TRefByValue<const TDesC>(_L("Number of total entries: %d")), onInfo.iTotalEntries); |
|
427 INFO_PRINTF2(TRefByValue<const TDesC>(_L("Max text length: %d")), onInfo.iTextLen); |
|
428 INFO_PRINTF2(TRefByValue<const TDesC>(_L("Max number length: %d")), onInfo.iNumberLen); |
|
429 } |
|
430 else if(iStatus==KErrNotSupported) |
|
431 { |
|
432 INFO_PRINTF1(_L("***Phone returned KErrNotSupported***")); |
|
433 } |
|
434 else |
|
435 { |
|
436 INFO_PRINTF2(TRefByValue<const TDesC>(_L("GetPhoneStoreInfo failed with status %d")), iStatus.Int()); |
|
437 SetTestStepResult(EFail); |
|
438 } |
|
439 |
|
440 return TestStepResult(); |
|
441 } |
|
442 |
|
443 |
|
444 /*-- Own Number Test ------------------------------------------------------------------*/ |
|
445 |
|
446 COwnNumberTest::COwnNumberTest() |
|
447 /** Each test step initialises it's own name |
|
448 */ |
|
449 { |
|
450 // store the name of this test case |
|
451 // this is the name that is used by the script file |
|
452 SetTestStepName(_L("OwnNumberTest")); |
|
453 } |
|
454 |
|
455 TVerdict COwnNumberTest::doTestStepL( void ) |
|
456 /** |
|
457 * This method test own number storage |
|
458 */ |
|
459 { |
|
460 INFO_PRINTF1(_L("Own number tests")); |
|
461 |
|
462 RMobileONStore iOwnNumberStore; |
|
463 |
|
464 // Check that TSY supports Own Number Store |
|
465 TBool supported; |
|
466 TInt ret; |
|
467 |
|
468 ret = iTelServer.IsSupportedByModule(KMmtsyName, KETelFuncMobileOwnNumberStore, supported); |
|
469 |
|
470 if ((ret==KErrNone) && (supported)) |
|
471 { |
|
472 // Open RMobileONStore |
|
473 ret=iOwnNumberStore.Open(iPhone); |
|
474 |
|
475 if (ret!=KErrNone) |
|
476 { |
|
477 INFO_PRINTF2(_L("Failed to open Own Number store (%d)"), ret); |
|
478 return EFail; |
|
479 } |
|
480 |
|
481 // Get Own Number Information |
|
482 RMobileONStore::TMobileONStoreInfoV1 ownNumberInfo; |
|
483 RMobileONStore::TMobileONStoreInfoV1Pckg ownNumberInfoPckg(ownNumberInfo); |
|
484 |
|
485 iOwnNumberStore.GetInfo(iStatus, ownNumberInfoPckg); |
|
486 User::WaitForRequest(iStatus); |
|
487 |
|
488 if ((iStatus==KErrNone) && (ownNumberInfo.iType==RMobilePhoneStore::EOwnNumberStore)) |
|
489 { |
|
490 INFO_PRINTF2(TRefByValue<const TDesC>(_L("Store Name: %S")), &ownNumberInfo.iName); |
|
491 INFO_PRINTF2(TRefByValue<const TDesC>(_L("Store Caps: %d")), ownNumberInfo.iCaps); |
|
492 INFO_PRINTF2(TRefByValue<const TDesC>(_L("Number of Entries: %d")), ownNumberInfo.iUsedEntries); |
|
493 INFO_PRINTF2(TRefByValue<const TDesC>(_L("Maximum no. of entries: %d")), ownNumberInfo.iTotalEntries); |
|
494 INFO_PRINTF2(TRefByValue<const TDesC>(_L("Max. length of tel.no: %d")), ownNumberInfo.iNumberLen); |
|
495 INFO_PRINTF2(TRefByValue<const TDesC>(_L("Max. length of text: %d")), ownNumberInfo.iTextLen); |
|
496 } |
|
497 else if (iStatus==KErrNotSupported) |
|
498 { |
|
499 INFO_PRINTF1(TRefByValue<const TDesC>(_L("GetOwnNumberInfo not supported by this phone"))); |
|
500 } |
|
501 else |
|
502 { |
|
503 INFO_PRINTF3(TRefByValue<const TDesC>(_L("GetOwnNumberInfo failed - status: %d, store type: %d")), iStatus.Int(), ownNumberInfo.iType); |
|
504 SetTestStepResult(EFail); |
|
505 } |
|
506 |
|
507 // Own Number Entry |
|
508 RMobileONStore::TMobileONEntryV1 ownNumberEntry; |
|
509 RMobileONStore::TMobileONEntryV1Pckg ownNumberEntryPckg(ownNumberEntry); |
|
510 |
|
511 for (TInt i=1; i<=ownNumberInfo.iTotalEntries; i++) |
|
512 { |
|
513 ownNumberEntry.iIndex = i; |
|
514 |
|
515 iOwnNumberStore.Read(iStatus, ownNumberEntryPckg); |
|
516 User::WaitForRequest(iStatus); |
|
517 |
|
518 if (iStatus==KErrNone) |
|
519 { |
|
520 INFO_PRINTF2(_L("GetOwnNumberEntry (%d) was successful"),i); |
|
521 INFO_PRINTF2(TRefByValue<const TDesC>(_L("Number: %S")), &ownNumberEntry.iNumber.iTelNumber); |
|
522 } |
|
523 else if (iStatus==KErrNotFound) |
|
524 { |
|
525 INFO_PRINTF2(_L("No Own Number Entry (%d) was found."),i); |
|
526 } |
|
527 else if (iStatus==KErrNotSupported) |
|
528 { |
|
529 INFO_PRINTF1(TRefByValue<const TDesC>(_L("GetOwnNumberEntry not supported by this phone"))); |
|
530 } |
|
531 else |
|
532 { |
|
533 INFO_PRINTF2(TRefByValue<const TDesC>(_L("GetOwnNumberEntry status %d")), iStatus.Int()); |
|
534 } |
|
535 } |
|
536 |
|
537 // Close and reopen store to test read before getinfo request |
|
538 iOwnNumberStore.Close(); |
|
539 ret=iOwnNumberStore.Open(iPhone); |
|
540 if (ret!=KErrNone) |
|
541 { |
|
542 INFO_PRINTF2(_L("Failed to open Own Number store (%d)"), ret); |
|
543 SetTestStepResult(EFail); |
|
544 } |
|
545 |
|
546 // Own Number Entry |
|
547 RMobileONStore::TMobileONEntryV1 ownNumberEntry2; |
|
548 ownNumberEntry2.iIndex = 2; |
|
549 |
|
550 RMobileONStore::TMobileONEntryV1Pckg ownNumberEntryPckg2(ownNumberEntry2); |
|
551 |
|
552 iOwnNumberStore.Read(iStatus, ownNumberEntryPckg2); |
|
553 User::WaitForRequest(iStatus); |
|
554 |
|
555 if (iStatus==KErrNone) |
|
556 { |
|
557 INFO_PRINTF1(_L("GetOwnNumberEntry (2) was successful")); |
|
558 INFO_PRINTF2(TRefByValue<const TDesC>(_L("Number: %S")), &ownNumberEntry2.iNumber.iTelNumber); |
|
559 } |
|
560 else if (iStatus==KErrNotFound) |
|
561 { |
|
562 INFO_PRINTF1(_L("No Own Number Entry (2) was found.")); |
|
563 } |
|
564 else if (iStatus==KErrNotSupported) |
|
565 { |
|
566 INFO_PRINTF1(TRefByValue<const TDesC>(_L("GetOwnNumberEntry not supported by this phone"))); |
|
567 } |
|
568 else |
|
569 { |
|
570 INFO_PRINTF2(TRefByValue<const TDesC>(_L("GetOwnNumberEntry (index 2) status %d")), iStatus.Int()); |
|
571 } |
|
572 |
|
573 |
|
574 //Test Cancel Requests |
|
575 INFO_PRINTF1(_L("Performing Cancel Requests for the above functions")); |
|
576 iOwnNumberStore.GetInfo(iStatus, ownNumberInfoPckg); |
|
577 iOwnNumberStore.CancelAsyncRequest(EMobilePhoneStoreGetInfo); |
|
578 User::WaitForRequest(iStatus); |
|
579 if (iStatus!=KErrNotSupported) |
|
580 { |
|
581 INFO_PRINTF2(TRefByValue<const TDesC>(_L("RMobileONStore::GetInfoCancel status = %d")), iStatus.Int()); |
|
582 } |
|
583 |
|
584 ownNumberEntry2.iIndex = 1; |
|
585 iOwnNumberStore.Read(iStatus, ownNumberEntryPckg2); |
|
586 iOwnNumberStore.CancelAsyncRequest(EMobilePhoneStoreRead); |
|
587 User::WaitForRequest(iStatus); |
|
588 if (iStatus!=KErrNotSupported) |
|
589 { |
|
590 INFO_PRINTF2(TRefByValue<const TDesC>(_L("RMobileONStore::ReadCancel status = %d")), iStatus.Int()); |
|
591 } |
|
592 |
|
593 iOwnNumberStore.Close(); |
|
594 } |
|
595 else |
|
596 { |
|
597 INFO_PRINTF1(_L("TSY does not support Own Number store")); |
|
598 } |
|
599 |
|
600 return TestStepResult(); |
|
601 } |
|
602 |
|
603 |
|
604 /*-- Get Caps Test --------------------------------------------------------------------*/ |
|
605 |
|
606 CGetCaps::CGetCaps() |
|
607 /** Each test step initialises it's own name |
|
608 */ |
|
609 { |
|
610 // store the name of this test case |
|
611 // this is the name that is used by the script file |
|
612 SetTestStepName(_L("GetCaps")); |
|
613 } |
|
614 |
|
615 TVerdict CGetCaps::doTestStepL( void ) |
|
616 /** |
|
617 * This method test own number storage |
|
618 */ |
|
619 { |
|
620 INFO_PRINTF1(_L("Get Phone Capabilities")); |
|
621 |
|
622 TInt ret; |
|
623 |
|
624 // Get Caps and print them |
|
625 INFO_PRINTF1(_L("Calling RMobilePhone::GetCaps()")); |
|
626 RPhone::TCaps aCaps; |
|
627 ret = iPhone.GetCaps(aCaps); |
|
628 if(ret) |
|
629 { |
|
630 INFO_PRINTF2(_L("RMobilePhone::GetCaps() returned: %d"), ret); |
|
631 SetTestStepResult(EFail); |
|
632 } |
|
633 if(aCaps.iFlags & RPhone::KCapsUnknown) |
|
634 { |
|
635 INFO_PRINTF1(_L("The capabilities of the phone are not currently known")); |
|
636 } |
|
637 if(aCaps.iFlags & RPhone::KCapsData) |
|
638 { |
|
639 INFO_PRINTF1(_L("The phone supports data calls")); |
|
640 } |
|
641 if(aCaps.iFlags & RPhone::KCapsFaxClassOne) |
|
642 { |
|
643 INFO_PRINTF1(_L("The phone supports the fax class 1 interface")); |
|
644 } |
|
645 if(aCaps.iFlags & RPhone::KCapsFaxClassOnePointZero) |
|
646 { |
|
647 INFO_PRINTF1(_L("The phone supports the fax class 1.0 interface")); |
|
648 } |
|
649 if(aCaps.iFlags & RPhone::KCapsFaxClassTwo) |
|
650 { |
|
651 INFO_PRINTF1(_L("The phone supports the fax class 2 interface")); |
|
652 } |
|
653 if(aCaps.iFlags & RPhone::KCapsFaxClassTwoPointZero) |
|
654 { |
|
655 INFO_PRINTF1(_L("The phone supports the fax class 2.0 interface")); |
|
656 } |
|
657 if(aCaps.iFlags & RPhone::KCapsFaxClassTwoPointOne) |
|
658 { |
|
659 INFO_PRINTF1(_L("The phone supports the fax class 2.1 interface")); |
|
660 } |
|
661 if(aCaps.iFlags & RPhone::KCapsVoice) |
|
662 { |
|
663 INFO_PRINTF1(_L("The phone supports voice calls")); |
|
664 } |
|
665 if(aCaps.iFlags & RPhone::KCapsEventModemDetection) |
|
666 { |
|
667 INFO_PRINTF1(_L("The phone supports modem detection events")); |
|
668 } |
|
669 if(aCaps.iFlags & RPhone::KCapsStealCommPort) |
|
670 { |
|
671 INFO_PRINTF1(_L("The phone supports the ability to take the comms port")); |
|
672 } |
|
673 |
|
674 |
|
675 // Gets Status and prints info |
|
676 INFO_PRINTF1(_L("Calling RMobilePhone::GetStatus()")); |
|
677 RPhone::TStatus phoneStatus; |
|
678 ret = iPhone.GetStatus(phoneStatus); |
|
679 if(ret) |
|
680 { |
|
681 INFO_PRINTF2(_L("RMobilePhone::GetStatus() returned %d"), ret); |
|
682 SetTestStepResult(EFail); |
|
683 } |
|
684 |
|
685 switch(phoneStatus.iMode) |
|
686 { |
|
687 case RPhone::EModeUnknown: |
|
688 INFO_PRINTF1(_L("The phone is currently in an unknown state")); |
|
689 break; |
|
690 |
|
691 case RPhone::EModeIdle: |
|
692 INFO_PRINTF1(_L("The phone is currently idle")); |
|
693 break; |
|
694 |
|
695 case RPhone::EModeEstablishingLink: |
|
696 INFO_PRINTF1(_L("The phone is currently trying to establish a call")); |
|
697 break; |
|
698 |
|
699 case RPhone::EModeOnlineData: |
|
700 INFO_PRINTF1(_L("The phone is in the connected and \"on-line data\" state")); |
|
701 break; |
|
702 |
|
703 case RPhone::EModeOnlineCommand: |
|
704 INFO_PRINTF1(_L("The phone is in the connected and \"on-line command\" state")); |
|
705 break; |
|
706 |
|
707 } |
|
708 |
|
709 //Get and print info |
|
710 INFO_PRINTF1(_L("Calling RMobilePhone::GetInfo()")); |
|
711 RPhone::TPhoneInfo phoneInfo; |
|
712 ret = iPhone.GetInfo(phoneInfo); |
|
713 if(ret) |
|
714 { |
|
715 INFO_PRINTF2(_L("RMobilePhone::GetInfo() returned %d"), ret); |
|
716 SetTestStepResult(EFail); |
|
717 } |
|
718 |
|
719 switch(phoneInfo.iDetection) |
|
720 { |
|
721 case RPhone::EDetectedPresent: |
|
722 INFO_PRINTF1(_L("The local modem is present")); |
|
723 break; |
|
724 |
|
725 case RPhone::EDetectedNotPresent: |
|
726 INFO_PRINTF1(_L("The local modem is not present")); |
|
727 break; |
|
728 |
|
729 case RPhone::EDetectedUnknown: |
|
730 INFO_PRINTF1(_L("Status of the local modem not detected")); |
|
731 break; |
|
732 } |
|
733 |
|
734 return TestStepResult(); |
|
735 } |
|
736 |
|
737 |
|
738 /*-- Get Lines Status Test ------------------------------------------------------------*/ |
|
739 |
|
740 CGetLinesStatus::CGetLinesStatus() |
|
741 /** Each test step initialises it's own name |
|
742 */ |
|
743 { |
|
744 // store the name of this test case |
|
745 // this is the name that is used by the script file |
|
746 SetTestStepName(_L("GetLinesStatus")); |
|
747 } |
|
748 |
|
749 TVerdict CGetLinesStatus::doTestStepL( void ) |
|
750 /** |
|
751 * This method tests getting the line status |
|
752 */ |
|
753 { |
|
754 INFO_PRINTF1(_L("Get Lines Status")); |
|
755 |
|
756 TInt aCount; |
|
757 TInt i; // Loop counter |
|
758 RPhone::TLineInfo lineInfo; |
|
759 |
|
760 //Test Enumeratting the lines |
|
761 INFO_PRINTF1(_L("Calling RPhone::EnumerateLines()")); |
|
762 TInt ret = iPhone.EnumerateLines(aCount); |
|
763 if(ret) |
|
764 { |
|
765 INFO_PRINTF2(_L("RPhone::EnumerateLines() returned %d"), ret); |
|
766 SetTestStepResult(EFail); |
|
767 } |
|
768 |
|
769 INFO_PRINTF2(_L("There are %d lines on this phone"), aCount); |
|
770 |
|
771 INFO_PRINTF1(_L("Calling RPhone::GetLineInfo()")); |
|
772 for(i=0;i<aCount;i++) |
|
773 { |
|
774 ret = iPhone.GetLineInfo(i, lineInfo); |
|
775 if(ret) |
|
776 { |
|
777 INFO_PRINTF2(_L("RPhone::GetLineInfo() returned %d"), ret); |
|
778 SetTestStepResult(EFail); |
|
779 } |
|
780 |
|
781 switch(lineInfo.iStatus) |
|
782 { |
|
783 case RCall::EStatusUnknown: |
|
784 INFO_PRINTF3(_L("Line index %d: %S, Status: The call status is not currently known"), i+1, &lineInfo.iName); |
|
785 break; |
|
786 |
|
787 case RCall::EStatusIdle: |
|
788 INFO_PRINTF3(_L("Line index %d: %S, Status: The call is idle"), i+1, &lineInfo.iName); |
|
789 break; |
|
790 |
|
791 case RCall::EStatusDialling: |
|
792 INFO_PRINTF3(_L("Line index %d: %S, Status: The call is dialling."), i+1, &lineInfo.iName); |
|
793 break; |
|
794 |
|
795 case RCall::EStatusRinging: |
|
796 INFO_PRINTF3(_L("Line index %d: %S, Status: The call is ringing "), i+1, &lineInfo.iName); |
|
797 break; |
|
798 |
|
799 case RCall::EStatusAnswering: |
|
800 INFO_PRINTF3(_L("Line index %d: %S, Status: The call is being answered"), i+1, &lineInfo.iName); |
|
801 break; |
|
802 |
|
803 case RCall::EStatusConnecting: |
|
804 INFO_PRINTF3(_L("Line index %d: %S, Status: The call is connecting"), i+1, &lineInfo.iName); |
|
805 break; |
|
806 |
|
807 case RCall::EStatusConnected: |
|
808 INFO_PRINTF3(_L("Line index %d: %S, Status: The call is connected and active"), i+1, &lineInfo.iName); |
|
809 break; |
|
810 |
|
811 case RCall::EStatusHangingUp: |
|
812 INFO_PRINTF3(_L("Line index %d: %S, Status: The call is being terminated"), i+1, &lineInfo.iName); |
|
813 break; |
|
814 |
|
815 } |
|
816 |
|
817 // Waits a bit |
|
818 User::After( 3 * KOneSecond); |
|
819 |
|
820 if(lineInfo.iLineCapsFlags & RLine::KCapsData) |
|
821 { |
|
822 INFO_PRINTF1(_L("The line supports data connections")); |
|
823 } |
|
824 if(lineInfo.iLineCapsFlags & RLine::KCapsFax) |
|
825 { |
|
826 INFO_PRINTF1(_L("The line supports fax connections")); |
|
827 } |
|
828 if(lineInfo.iLineCapsFlags & RLine::KCapsVoice) |
|
829 { |
|
830 INFO_PRINTF1(_L("The line supports voice connections")); |
|
831 } |
|
832 if(lineInfo.iLineCapsFlags & RLine::KCapsEventIncomingCall) |
|
833 { |
|
834 INFO_PRINTF1(_L("The line supports incoming call notification requests")); |
|
835 } |
|
836 } |
|
837 |
|
838 return TestStepResult(); |
|
839 } |
|
840 |
|
841 /*-- Get Multimode Caps Test ----------------------------------------------------------*/ |
|
842 |
|
843 CGetMultimodeCaps::CGetMultimodeCaps() |
|
844 /** Each test step initialises it's own name |
|
845 */ |
|
846 { |
|
847 // store the name of this test case |
|
848 // this is the name that is used by the script file |
|
849 SetTestStepName(_L("GetMultimodeCaps")); |
|
850 } |
|
851 |
|
852 TVerdict CGetMultimodeCaps::doTestStepL( void ) |
|
853 /** |
|
854 * This method tests getting the phone's multimode capabilities |
|
855 */ |
|
856 { |
|
857 INFO_PRINTF1(_L("Testing the phone's Multimode caps")); |
|
858 |
|
859 INFO_PRINTF1(_L("Calling RMobilePhone::GetMultimodeCaps()")); |
|
860 TUint32 aCaps; |
|
861 TInt ret = iPhone.GetMultimodeCaps(aCaps); |
|
862 if(ret) |
|
863 { |
|
864 INFO_PRINTF2(_L("RMobilePhone::GetMultimodeCaps returned %d"), ret); |
|
865 return EFail; |
|
866 } |
|
867 |
|
868 if(aCaps & RMobilePhone::KCapsGsmSupported) |
|
869 { |
|
870 INFO_PRINTF1(_L("Phone can operate in GSM 900/1800/1900 mode")); |
|
871 } |
|
872 if(aCaps & RMobilePhone::KCapsGprsSupported) |
|
873 { |
|
874 INFO_PRINTF1(_L("Phone can operate in GPRS mode")); |
|
875 } |
|
876 if(aCaps & RMobilePhone::KCapsAmpsSupported) |
|
877 { |
|
878 INFO_PRINTF1(_L("Phone can operate in AMPS 800 mode")); |
|
879 } |
|
880 if(aCaps & RMobilePhone::KCapsCdma95Supported) |
|
881 { |
|
882 INFO_PRINTF1(_L("Phone can operate in CDMA95 800/1900 mode")); |
|
883 } |
|
884 if(aCaps & RMobilePhone::KCapsCdma2000Supported) |
|
885 { |
|
886 INFO_PRINTF1(_L("Phone can operate in CDMA2000 800/1900 mode")); |
|
887 } |
|
888 if(aCaps & RMobilePhone::KCapsWcdmaSupported) |
|
889 { |
|
890 INFO_PRINTF1(_L("Phone can operate in W-CDMA mode")); |
|
891 } |
|
892 |
|
893 return EPass; |
|
894 } |
|
895 |
|
896 |
|
897 /*-- Get Network Caps Test ------------------------------------------------------------*/ |
|
898 |
|
899 CGetNetworkCaps::CGetNetworkCaps() |
|
900 /** Each test step initialises it's own name |
|
901 */ |
|
902 { |
|
903 // store the name of this test case |
|
904 // this is the name that is used by the script file |
|
905 SetTestStepName(_L("GetNetworkCaps")); |
|
906 } |
|
907 |
|
908 TVerdict CGetNetworkCaps::doTestStepL( void ) |
|
909 /** |
|
910 * This method tests getting Network Capabilities |
|
911 */ |
|
912 { |
|
913 INFO_PRINTF1(_L("Get Network Caps")); |
|
914 |
|
915 INFO_PRINTF1(_L("Calling RMobilePhone::GetNetworkCaps()")); |
|
916 TUint32 aCaps; |
|
917 TInt ret = iPhone.GetNetworkCaps(aCaps); |
|
918 if(ret==KErrNotSupported) // Do not consider KErrNotSupported as a test failure |
|
919 { |
|
920 INFO_PRINTF1(_L("***Phone returned KErrNotSupported***")); |
|
921 } |
|
922 else if(ret!=KErrNone) |
|
923 { |
|
924 INFO_PRINTF2(_L("RMobilePhone::GetNetworkCaps() returned %d/n"), ret); |
|
925 return EFail; |
|
926 } |
|
927 |
|
928 if(aCaps & RMobilePhone::KCapsGetRegistrationStatus) |
|
929 { |
|
930 INFO_PRINTF1(_L("The phone supports retrieval of current registration status")); |
|
931 } |
|
932 if(aCaps & RMobilePhone::KCapsNotifyRegistrationStatus) |
|
933 { |
|
934 INFO_PRINTF1(_L("The phone supports notifications of change in registration status")); |
|
935 } |
|
936 if(aCaps & RMobilePhone::KCapsGetCurrentMode) |
|
937 { |
|
938 INFO_PRINTF1(_L("The phone supports retrieval of current mode")); |
|
939 } |
|
940 if(aCaps & RMobilePhone::KCapsNotifyMode) |
|
941 { |
|
942 INFO_PRINTF1(_L("The phone supports notification of change in mode")); |
|
943 } |
|
944 if(aCaps & RMobilePhone::KCapsGetCurrentNetwork) |
|
945 { |
|
946 INFO_PRINTF1(_L("phone supports retrieval of current network information")); |
|
947 } |
|
948 if(aCaps & RMobilePhone::KCapsNotifyCurrentNetwork) |
|
949 { |
|
950 INFO_PRINTF1(_L("The phone supports notification of change of current network")); |
|
951 } |
|
952 if(aCaps & RMobilePhone::KCapsGetHomeNetwork) |
|
953 { |
|
954 INFO_PRINTF1(_L("The phone supports retrieval of home network information")); |
|
955 } |
|
956 if(aCaps & RMobilePhone::KCapsGetDetectedNetworks) |
|
957 { |
|
958 INFO_PRINTF1(_L("The phone supports retrieval of a list of detected networks")); |
|
959 } |
|
960 if(aCaps & RMobilePhone::KCapsManualNetworkSelection) |
|
961 { |
|
962 INFO_PRINTF1(_L("The phone supports manual network selection mode")); |
|
963 } |
|
964 if(aCaps & RMobilePhone::KCapsGetNITZInfo) |
|
965 { |
|
966 INFO_PRINTF1(_L("The phone supports retrieval of time/date from the network")); |
|
967 } |
|
968 if(aCaps & RMobilePhone::KCapsNotifyNITZInfo) |
|
969 { |
|
970 INFO_PRINTF1(_L("The phone supports notification of new updates of time/date from the network")); |
|
971 } |
|
972 |
|
973 |
|
974 return EPass; |
|
975 |
|
976 } |
|
977 |
|
978 |
|
979 /*-- Get Current Mode Test ------------------------------------------------------------*/ |
|
980 CGetCurrentMode::CGetCurrentMode() |
|
981 /** Each test step initialises it's own name |
|
982 */ |
|
983 { |
|
984 // store the name of this test case |
|
985 // this is the name that is used by the script file |
|
986 SetTestStepName(_L("GetCurrentMode")); |
|
987 } |
|
988 |
|
989 TVerdict CGetCurrentMode::doTestStepL( void ) |
|
990 /** |
|
991 * This method tests getting the current mode that the phone is in |
|
992 */ |
|
993 { |
|
994 INFO_PRINTF1(_L("Testing the current mode and notification")); |
|
995 |
|
996 INFO_PRINTF1(_L("Calling RMobilePhone::GetCurrentMode()")); |
|
997 RMobilePhone::TMobilePhoneNetworkMode netMode; |
|
998 TInt ret = iPhone.GetCurrentMode(netMode); |
|
999 if(ret==KErrNotSupported) // Do not consider KErrNotSupported as a test failure |
|
1000 { |
|
1001 INFO_PRINTF1(_L("***Phone returned KErrNotSupported***")); |
|
1002 } |
|
1003 else if(ret!=KErrNone) |
|
1004 { |
|
1005 // Log error code and return with error code so that AutoTest logs this as a test failure |
|
1006 INFO_PRINTF2(_L("RMobilePhone::GetCurrentMode() returned %d"), ret); |
|
1007 return EFail; |
|
1008 } |
|
1009 |
|
1010 if(ret==KErrNone) |
|
1011 { |
|
1012 switch(netMode) |
|
1013 { |
|
1014 case RMobilePhone:: ENetworkModeUnregistered: |
|
1015 INFO_PRINTF1(_L("ME is not registered.")); |
|
1016 break; |
|
1017 case RMobilePhone::ENetworkModeGsm: |
|
1018 INFO_PRINTF1(_L("GSM or DCS1800 network.")); |
|
1019 break; |
|
1020 case RMobilePhone::ENetworkModeAmps: |
|
1021 INFO_PRINTF1(_L("AMPS network")); |
|
1022 break; |
|
1023 case RMobilePhone::ENetworkModeCdma95: |
|
1024 INFO_PRINTF1(_L("CDMA95 network.")); |
|
1025 break; |
|
1026 case RMobilePhone::ENetworkModeCdma2000: |
|
1027 INFO_PRINTF1(_L("CDMA2000 network.")); |
|
1028 break; |
|
1029 case RMobilePhone::ENetworkModeWcdma: |
|
1030 INFO_PRINTF1(_L("WCDMA network")); |
|
1031 case RMobilePhone::ENetworkModeTdcdma: |
|
1032 INFO_PRINTF1(_L("TD-CDMA network")); |
|
1033 case RMobilePhone::ENetworkModeUnknown: |
|
1034 default: |
|
1035 INFO_PRINTF1(_L("Network mode is unknown")); |
|
1036 break; |
|
1037 } |
|
1038 } |
|
1039 |
|
1040 return EPass; |
|
1041 } |
|
1042 |
|
1043 |
|
1044 /*-- Async Network List Retrieval Test ------------------------------------------------*/ |
|
1045 |
|
1046 CGetAsyncNetList::CTestAsyncGetNetList* CGetAsyncNetList::CTestAsyncGetNetList::NewLC(RMobilePhone& aPhone) |
|
1047 { |
|
1048 CTestAsyncGetNetList* r=new(ELeave) CTestAsyncGetNetList(aPhone); |
|
1049 CleanupStack::PushL(r); |
|
1050 r->ConstructL(); |
|
1051 return r; |
|
1052 } |
|
1053 |
|
1054 CGetAsyncNetList::CTestAsyncGetNetList::CTestAsyncGetNetList(RMobilePhone& aPhone) |
|
1055 : CActive(EPriorityNormal), iPhone(aPhone), iCompleteCode(KErrNone) |
|
1056 { |
|
1057 } |
|
1058 |
|
1059 void CGetAsyncNetList::CTestAsyncGetNetList::ConstructL() |
|
1060 { |
|
1061 CActiveScheduler::Add(this); |
|
1062 iRetrieve=CRetrieveMobilePhoneDetectedNetworks::NewL(iPhone); |
|
1063 } |
|
1064 |
|
1065 CGetAsyncNetList::CTestAsyncGetNetList::~CTestAsyncGetNetList() |
|
1066 { |
|
1067 delete iRetrieve; |
|
1068 } |
|
1069 |
|
1070 void CGetAsyncNetList::CTestAsyncGetNetList::Start() |
|
1071 { |
|
1072 iRetrieve->Start(iStatus); |
|
1073 SetActive(); |
|
1074 } |
|
1075 |
|
1076 CMobilePhoneNetworkList* CGetAsyncNetList::CTestAsyncGetNetList::RetrieveList() |
|
1077 { |
|
1078 CMobilePhoneNetworkList* ptr=NULL; |
|
1079 TRAP_IGNORE(ptr=iRetrieve->RetrieveListL()); // trap and ignore err |
|
1080 return ptr; |
|
1081 } |
|
1082 |
|
1083 void CGetAsyncNetList::CTestAsyncGetNetList::RunL() |
|
1084 { |
|
1085 iCompleteCode=iStatus.Int(); |
|
1086 CActiveScheduler::Stop(); |
|
1087 } |
|
1088 |
|
1089 |
|
1090 TInt CGetAsyncNetList::CTestAsyncGetNetList::CompleteCode() |
|
1091 { |
|
1092 return iCompleteCode; |
|
1093 } |
|
1094 |
|
1095 void CGetAsyncNetList::CTestAsyncGetNetList::DoCancel() |
|
1096 { |
|
1097 iRetrieve->Cancel(); |
|
1098 } |
|
1099 |
|
1100 CGetAsyncNetList::CGetAsyncNetList() |
|
1101 /** Each test step initialises it's own name |
|
1102 */ |
|
1103 { |
|
1104 // store the name of this test case |
|
1105 // this is the name that is used by the script file |
|
1106 SetTestStepName(_L("GetAsyncNetList")); |
|
1107 } |
|
1108 |
|
1109 TVerdict CGetAsyncNetList::doTestStepL() |
|
1110 /** |
|
1111 * This method tests asynchronously getting a list of detected networks |
|
1112 */ |
|
1113 { |
|
1114 INFO_PRINTF1(_L("Testing Async retrieval of Network list")); |
|
1115 |
|
1116 iTestScheduler = new (ELeave) CActiveScheduler; |
|
1117 CActiveScheduler::Install(iTestScheduler); |
|
1118 |
|
1119 CTestAsyncGetNetList* netRetrieveList = CTestAsyncGetNetList::NewLC(iPhone); |
|
1120 |
|
1121 INFO_PRINTF1(_L("Starting ActiveObject CRetrieveMobilePhoneDetectedNetworks")); |
|
1122 netRetrieveList->Start(); |
|
1123 CActiveScheduler::Start(); |
|
1124 |
|
1125 |
|
1126 // Get completion code from netRetrieveList |
|
1127 const TInt completeCode = netRetrieveList->CompleteCode(); |
|
1128 if(completeCode==KErrNotSupported) // Do not consider KErrNotSupported a test failure |
|
1129 { |
|
1130 INFO_PRINTF1(_L("***Phone returned KErrNotSupported***")); |
|
1131 } |
|
1132 else if(completeCode!=KErrNone) |
|
1133 { |
|
1134 // Log that and error occurred |
|
1135 INFO_PRINTF2(TRefByValue<const TDesC>(_L("Failed with error code %d")),completeCode); |
|
1136 return EFail; |
|
1137 } |
|
1138 |
|
1139 |
|
1140 TInt i; // Loop counter |
|
1141 CMobilePhoneNetworkList* retList=NULL; |
|
1142 RMobilePhone::TMobilePhoneNetworkInfoV1 anEntry; |
|
1143 |
|
1144 if(completeCode==KErrNone) |
|
1145 { |
|
1146 retList = netRetrieveList->RetrieveList(); |
|
1147 const TInt count = retList->Enumerate(); |
|
1148 INFO_PRINTF2(_L("%d networks detected"), count); |
|
1149 |
|
1150 for(i=0; i<count; i++) |
|
1151 { |
|
1152 anEntry = retList->GetEntryL(i); |
|
1153 INFO_PRINTF3(_L("Network %d: %S"), i+1, &anEntry.iLongName); |
|
1154 INFO_PRINTF1(_L("Mode of the network: ")); |
|
1155 |
|
1156 switch(anEntry.iMode) |
|
1157 { |
|
1158 case RMobilePhone::ENetworkModeUnregistered: |
|
1159 INFO_PRINTF1(_L("ME is not registered.")); |
|
1160 break; |
|
1161 case RMobilePhone::ENetworkModeGsm: |
|
1162 INFO_PRINTF1(_L("GSM or DCS1800 network.")); |
|
1163 break; |
|
1164 case RMobilePhone::ENetworkModeAmps: |
|
1165 INFO_PRINTF1(_L(" AMPS network")); |
|
1166 break; |
|
1167 case RMobilePhone::ENetworkModeCdma95: |
|
1168 INFO_PRINTF1(_L("CDMA95 network")); |
|
1169 break; |
|
1170 case RMobilePhone::ENetworkModeCdma2000: |
|
1171 INFO_PRINTF1(_L("CDMA2000 network")); |
|
1172 break; |
|
1173 case RMobilePhone::ENetworkModeWcdma: |
|
1174 INFO_PRINTF1(_L("WCDMA network.")); |
|
1175 break; |
|
1176 case RMobilePhone::ENetworkModeTdcdma: |
|
1177 INFO_PRINTF1(_L("TD-CDMA network.")); |
|
1178 break; |
|
1179 case RMobilePhone::ENetworkModeUnknown: |
|
1180 default: |
|
1181 INFO_PRINTF1(_L("Network mode is unknown.")); |
|
1182 break; |
|
1183 } |
|
1184 |
|
1185 INFO_PRINTF1(_L("Status of the network: ")); |
|
1186 switch(anEntry.iStatus) |
|
1187 { |
|
1188 case RMobilePhone::ENetworkStatusUnknown: |
|
1189 INFO_PRINTF1(_L("Status is unknown")); |
|
1190 break; |
|
1191 case RMobilePhone::ENetworkStatusAvailable: |
|
1192 INFO_PRINTF1(_L("A network that the ME is allowed to register to")); |
|
1193 break; |
|
1194 case RMobilePhone::ENetworkStatusCurrent: |
|
1195 INFO_PRINTF1(_L("The currently registered network.")); |
|
1196 break; |
|
1197 case RMobilePhone::ENetworkStatusForbidden: |
|
1198 INFO_PRINTF1(_L("A network that the ME is not allowed to register to")); |
|
1199 break; |
|
1200 } |
|
1201 |
|
1202 INFO_PRINTF2(_L("Country code: %S"), &anEntry.iCountryCode); |
|
1203 INFO_PRINTF2(_L("The system identity (SID) of the CDMA network: %S"), &anEntry.iCdmaSID); |
|
1204 INFO_PRINTF2(_L("The system identity (SID) of the AMPS network: %S"), &anEntry.iAnalogSID); |
|
1205 INFO_PRINTF2(_L("The network identity (NID in CDMA and MNC in GSM): %S"), &anEntry.iNetworkId); |
|
1206 INFO_PRINTF2(_L("The alpha-tag displayed when this is the serving network: %S"), &anEntry.iDisplayTag); |
|
1207 INFO_PRINTF2(_L("The short name (up to 8 characters) of the network operator: %S"), &anEntry.iShortName); |
|
1208 INFO_PRINTF2(_L("The long name (up to 16 characters) of the network operator.: %S"), &anEntry.iLongName); |
|
1209 } |
|
1210 |
|
1211 } |
|
1212 CleanupStack::PopAndDestroy(); // netRetrieveList; |
|
1213 delete retList; |
|
1214 delete iTestScheduler; |
|
1215 return EPass; |
|
1216 } |
|
1217 |
|
1218 |
|
1219 /*-- Functional Unit Support Test -----------------------------------------------------*/ |
|
1220 CIsSupportedByModuleTest::CIsSupportedByModuleTest() |
|
1221 /** Each test step initialises it's own name |
|
1222 */ |
|
1223 { |
|
1224 // store the name of this test case |
|
1225 // this is the name that is used by the script file |
|
1226 SetTestStepName(_L("IsSupportedByModuleTest")); |
|
1227 } |
|
1228 |
|
1229 |
|
1230 TBool CIsSupportedByModuleTest::doIsSupportedByModuleTest(TInt aMixin) |
|
1231 { |
|
1232 TBool isSupported(EFalse); |
|
1233 TInt ret=iTelServer.IsSupportedByModule(KMmtsyName,aMixin,isSupported); |
|
1234 if(ret==KErrNone) |
|
1235 { |
|
1236 INFO_PRINTF2(_L("%d functional unit is supported!"), aMixin); |
|
1237 return ETrue; |
|
1238 } |
|
1239 else |
|
1240 { |
|
1241 INFO_PRINTF2(_L("%d functional unit is NOT supported"), aMixin); |
|
1242 return EFalse; |
|
1243 } |
|
1244 } |
|
1245 |
|
1246 TVerdict CIsSupportedByModuleTest::doTestStepL( void ) |
|
1247 /** |
|
1248 * This method tests is certain Functional Units are supported |
|
1249 */ |
|
1250 { |
|
1251 TBool isSupported(EFalse); |
|
1252 |
|
1253 isSupported = doIsSupportedByModuleTest(KETelFuncMobileNetwork); |
|
1254 if(!isSupported) |
|
1255 { |
|
1256 SetTestStepResult(EFail); |
|
1257 } |
|
1258 |
|
1259 isSupported = doIsSupportedByModuleTest(KETelFuncMobileIdentity); |
|
1260 if(!isSupported) |
|
1261 { |
|
1262 SetTestStepResult(EFail); |
|
1263 } |
|
1264 |
|
1265 isSupported = doIsSupportedByModuleTest(KETelFuncMobilePower); |
|
1266 if(!isSupported) |
|
1267 { |
|
1268 SetTestStepResult(EFail); |
|
1269 } |
|
1270 |
|
1271 isSupported = doIsSupportedByModuleTest(KETelFuncMobileSignal); |
|
1272 if(!isSupported) |
|
1273 { |
|
1274 SetTestStepResult(EFail); |
|
1275 } |
|
1276 |
|
1277 isSupported = doIsSupportedByModuleTest(KETelFuncMobileDataCall); |
|
1278 if(!isSupported) |
|
1279 { |
|
1280 SetTestStepResult(EFail); |
|
1281 } |
|
1282 |
|
1283 isSupported = doIsSupportedByModuleTest(KETelFuncMobileSmsMessaging); |
|
1284 if(!isSupported) |
|
1285 { |
|
1286 SetTestStepResult(EFail); |
|
1287 } |
|
1288 |
|
1289 isSupported = doIsSupportedByModuleTest(KETelFuncMobilePhonebook); |
|
1290 if(!isSupported) |
|
1291 { |
|
1292 SetTestStepResult(EFail); |
|
1293 } |
|
1294 isSupported = doIsSupportedByModuleTest(KETelFuncMobileSmsStore); |
|
1295 if(!isSupported) |
|
1296 { |
|
1297 SetTestStepResult(EFail); |
|
1298 } |
|
1299 isSupported = doIsSupportedByModuleTest(KETelFuncMobileOwnNumberStore); |
|
1300 if(!isSupported) |
|
1301 { |
|
1302 SetTestStepResult(EFail); |
|
1303 } |
|
1304 return TestStepResult(); |
|
1305 } |