|
1 /* |
|
2 * Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <e32svr.h> |
|
23 #include <StifParser.h> |
|
24 #include <Stiftestinterface.h> |
|
25 #include <hal.h> |
|
26 #include "tsysinfoservicetests.h" |
|
27 #include "tbatterystrengthasyn.h" |
|
28 #include "tuseractivitynotifier.h" |
|
29 #include "Tautolocknotifier.h" |
|
30 |
|
31 #include "sysinfoservice.h" |
|
32 #include "entitykeys.h" |
|
33 |
|
34 using namespace SysInfo; |
|
35 _LIT(KROMInstallDir,"\\system\\install\\"); |
|
36 _LIT(KS60ProductIdFile,"Series60v*.sis"); |
|
37 _LIT(KDisplayLanguage,"DisplayLanguage"); |
|
38 |
|
39 const TPtrC KFeature[] = |
|
40 { |
|
41 KCamera.operator()(), |
|
42 KMemoryCard.operator()(), |
|
43 KFMRadio.operator()(), |
|
44 KQwerty.operator()(), |
|
45 KWLan.operator()(), |
|
46 KUsb.operator()(), |
|
47 KPen.operator()(), |
|
48 KLED.operator()(), |
|
49 KCoverUI.operator()(), |
|
50 KSideVolumeKeys.operator()(), |
|
51 KVibra.operator()(), |
|
52 }; |
|
53 |
|
54 const TInt KSize = sizeof(KFeature)/sizeof(TPtrC); |
|
55 |
|
56 // ============================ MEMBER FUNCTIONS =============================== |
|
57 |
|
58 // ----------------------------------------------------------------------------- |
|
59 // Ctsysinfoservicetests::Delete |
|
60 // Delete here all resources allocated and opened from test methods. |
|
61 // Called from destructor. |
|
62 // ----------------------------------------------------------------------------- |
|
63 // |
|
64 void Ctsysinfoservicetests::Delete() |
|
65 { |
|
66 |
|
67 } |
|
68 |
|
69 // ----------------------------------------------------------------------------- |
|
70 // Ctsysinfoservicetests::RunMethodL |
|
71 // Run specified method. Contains also table of test mothods and their names. |
|
72 // ----------------------------------------------------------------------------- |
|
73 // |
|
74 TInt Ctsysinfoservicetests::RunMethodL( |
|
75 CStifItemParser& aItem ) |
|
76 { |
|
77 |
|
78 static TStifFunctionInfo const KFunctions[] = |
|
79 { |
|
80 // Copy this line for every implemented function. |
|
81 // First string is the function name used in TestScripter script file. |
|
82 // Second is the actual implementation member function. |
|
83 //Features |
|
84 ENTRY( "Features", Ctsysinfoservicetests::FeaturesL), |
|
85 //Battery |
|
86 ENTRY( "BatteryLevelSync", Ctsysinfoservicetests::BatteryLevelAutoL), |
|
87 ENTRY( "BatteryStrengthASync", Ctsysinfoservicetests::BatteryStrengthAsyncL), |
|
88 ENTRY( "BatteryChargeSync", Ctsysinfoservicetests::BatteryChargingAutoL), |
|
89 //Device |
|
90 ENTRY( "FirmwareVersion", Ctsysinfoservicetests::FirmwareVersionL), |
|
91 ENTRY( "PlatformVersion", Ctsysinfoservicetests::PlatformVersionL), |
|
92 ENTRY( "SymbianOSversion", Ctsysinfoservicetests::SymbianOSVersionL), |
|
93 ENTRY( "MachineID", Ctsysinfoservicetests::MachineIDL), |
|
94 ENTRY( "ProductType", Ctsysinfoservicetests::ProductTypeL), |
|
95 ENTRY( "Manufacturer", Ctsysinfoservicetests::ManufacturerL), |
|
96 ENTRY( "PhoneModel", Ctsysinfoservicetests::PhoneModelL), |
|
97 ENTRY( "IMEINumber", Ctsysinfoservicetests::IMEINumberL), |
|
98 //General |
|
99 ENTRY( "ConnectedAcc", Ctsysinfoservicetests::ConnectedAcc), |
|
100 ENTRY( "SetDisplayLang", Ctsysinfoservicetests::SetDisplayLang), |
|
101 ENTRY( "GetDisplayLang", Ctsysinfoservicetests::GetDisplayLang), |
|
102 ENTRY( "SetInputLang", Ctsysinfoservicetests::SetInputLang), |
|
103 ENTRY( "SupportedLang", Ctsysinfoservicetests::SupportedLang), |
|
104 ENTRY( "InputLang", Ctsysinfoservicetests::InputLang), |
|
105 ENTRY( "PredText", Ctsysinfoservicetests::PredText), |
|
106 ENTRY( "VibraStatus", Ctsysinfoservicetests::VibraStatus), |
|
107 ENTRY( "AvailableUSBModes", Ctsysinfoservicetests::AvailableUSBModes), |
|
108 ENTRY( "ActiveUSBModes", Ctsysinfoservicetests::ActiveUSBModes), |
|
109 ENTRY( "NotificationCancelVibra", Ctsysinfoservicetests::NotificationCancelVibra), |
|
110 //Connectivity |
|
111 ENTRY( "ConnBluetooth", Ctsysinfoservicetests::ConnBluetooth), |
|
112 ENTRY( "IRStatus", Ctsysinfoservicetests::IRStatus), |
|
113 ENTRY( "GetActiveConnections", Ctsysinfoservicetests::GetActiveConnections), |
|
114 ENTRY( "GetWlanMacAddress", Ctsysinfoservicetests::GetWlanMacAddress), |
|
115 ENTRY( "GetActiveConnectionsCancel", Ctsysinfoservicetests::GetActiveConnectionsCancel), |
|
116 //Display |
|
117 ENTRY( "GetSetBrightness", Ctsysinfoservicetests::GetSetBrightnessL), |
|
118 ENTRY( "GetSetScreensaverTimeOut", Ctsysinfoservicetests::GetSetScreensaverTimeOutL), |
|
119 ENTRY( "UserInactivityNotifier", Ctsysinfoservicetests::UserInactivityNotifierL), |
|
120 ENTRY( "SetGetAutoLockTime", Ctsysinfoservicetests::SetGetAutoLockTimeL), |
|
121 ENTRY( "AutoLockNotifier", Ctsysinfoservicetests::AutoLockNotifierL), |
|
122 ENTRY( "DisplayResolution", Ctsysinfoservicetests::DisplayResolutionL), |
|
123 ENTRY( "DisplayOrientation", Ctsysinfoservicetests::DisplayOrientationL), |
|
124 ENTRY( "GetSetLightTimeOut", Ctsysinfoservicetests::GetSetLightTimeOutL), |
|
125 ENTRY( "GetSetWallPaper", Ctsysinfoservicetests::GetSetWallPaperL), |
|
126 ENTRY( "GetSetKeyGaurdTime", Ctsysinfoservicetests::GetSetKeyGaurdL), |
|
127 //Memory |
|
128 ENTRY( "GetListofDrives", Ctsysinfoservicetests::GetListofDrivesL), |
|
129 ENTRY( "GetDriveInfo", Ctsysinfoservicetests::GetDriveInfoL), |
|
130 }; |
|
131 |
|
132 const TInt count = sizeof( KFunctions ) / |
|
133 sizeof( TStifFunctionInfo ); |
|
134 |
|
135 return RunInternalL( KFunctions, count, aItem ); |
|
136 |
|
137 } |
|
138 |
|
139 TInt Ctsysinfoservicetests::FeaturesL(CStifItemParser& ) |
|
140 { |
|
141 _LIT( KExample, "TestFeaturesL" ); |
|
142 iLog->Log( KExample ); |
|
143 TInt Err(PASS); |
|
144 |
|
145 #if (!(defined(__WINS__) || defined(__WINSCW__))) |
|
146 TInt MachineId; |
|
147 HAL::Get(HALData::EMachineUid, MachineId); |
|
148 iLog->Log(_L("Device MachineID: %x"),MachineId ); |
|
149 switch(MachineId) |
|
150 { |
|
151 case 0x20001857: //E70 |
|
152 Err |= TestE70(); |
|
153 break; |
|
154 case 0x20000606: //N6290 |
|
155 Err |= TestN6290(); |
|
156 break; |
|
157 case 0x101fb3e8: |
|
158 Err |= TestDevlon(); |
|
159 break; |
|
160 default: |
|
161 iLog->Log(_L("Unknown Device ")); |
|
162 TestDevlon(); |
|
163 Err |= PASS; |
|
164 break; |
|
165 } |
|
166 #endif |
|
167 return Err; |
|
168 } |
|
169 |
|
170 TInt Ctsysinfoservicetests::FirmwareVersionL(CStifItemParser& /*aItem*/) |
|
171 { |
|
172 _LIT( KExample, "FirmwareVersionL" ); |
|
173 iLog->Log( KExample ); |
|
174 TInt Err(PASS); |
|
175 |
|
176 __UHEAP_MARK; |
|
177 CSysInfoService *obj = CSysInfoService::NewL(); |
|
178 CleanupStack::PushL(obj); |
|
179 |
|
180 |
|
181 CSysData* output=NULL; |
|
182 |
|
183 TRAPD(err,obj->GetInfoL(KDevice,KFirmwareVersion,output)); |
|
184 if (!err) |
|
185 { |
|
186 if(!output) |
|
187 { |
|
188 Err |= FAIL; |
|
189 iLog->Log( _L("Output data Set to NULL") ); |
|
190 } |
|
191 else |
|
192 { |
|
193 CleanupStack::PushL(output); |
|
194 if( CSysData::EStringData != output->DataType() ) |
|
195 { |
|
196 iLog->Log( _L("Invalid output data") ); |
|
197 Err |= FAIL; |
|
198 } |
|
199 else |
|
200 { |
|
201 TPtrC firmwareversion; |
|
202 ((CStringData*)output)->StringData(firmwareversion); |
|
203 iLog->Log( _L("Firmware Version: %s"), firmwareversion.Ptr()); |
|
204 if(!(firmwareversion.Length() > 0)) |
|
205 { |
|
206 iLog->Log( _L("Null string returned..") ); |
|
207 Err |= FAIL; |
|
208 } |
|
209 } |
|
210 CleanupStack::PopAndDestroy(output); |
|
211 } |
|
212 } |
|
213 else |
|
214 { |
|
215 Err |= err; |
|
216 iLog->Log( _L("GetInfo API returned error") ); |
|
217 } |
|
218 |
|
219 CleanupStack::PopAndDestroy(obj); |
|
220 |
|
221 __UHEAP_MARKEND; |
|
222 return Err; |
|
223 } |
|
224 |
|
225 TInt Ctsysinfoservicetests::SymbianOSVersionL(CStifItemParser& /*aItem*/) |
|
226 { |
|
227 _LIT( KExample, "SymbianOSVersionL" ); |
|
228 iLog->Log( KExample ); |
|
229 TInt Err(PASS); |
|
230 _LIT(KSymbianOsVersion,"OSVersion"); |
|
231 __UHEAP_MARK; |
|
232 CSysInfoService *obj = CSysInfoService::NewL(); |
|
233 CleanupStack::PushL(obj); |
|
234 |
|
235 CSysData* output; |
|
236 |
|
237 TRAPD(err,obj->GetInfoL(KDevice,KSymbianOsVersion,output)); |
|
238 if (err == KErrNotFound) |
|
239 { |
|
240 iLog->Log( _L("SymbianOsVersion not supported") ); |
|
241 } |
|
242 else |
|
243 { |
|
244 Err |= FAIL; |
|
245 iLog->Log( _L("GetInfo API should return KErrNotFound") ); |
|
246 } |
|
247 |
|
248 CleanupStack::PopAndDestroy(obj); |
|
249 |
|
250 __UHEAP_MARKEND; |
|
251 return Err; |
|
252 } |
|
253 |
|
254 TInt Ctsysinfoservicetests::PlatformVersionL(CStifItemParser& /*aItem*/) |
|
255 { |
|
256 _LIT( KExample, "PlatformVersionL" ); |
|
257 iLog->Log( KExample ); |
|
258 TInt Err(PASS); |
|
259 |
|
260 __UHEAP_MARK; |
|
261 CSysInfoService *obj = CSysInfoService::NewL(); |
|
262 CleanupStack::PushL(obj); |
|
263 |
|
264 CSysData* output; |
|
265 |
|
266 TRAPD(err,obj->GetInfoL(KDevice,KPlatformVersion,output)); |
|
267 if (!err) |
|
268 { |
|
269 if(!output) |
|
270 { |
|
271 Err |= FAIL; |
|
272 iLog->Log( _L("Output data Set to NULL") ); |
|
273 } |
|
274 else |
|
275 { |
|
276 CleanupStack::PushL(output); |
|
277 //Check data type |
|
278 if( CSysData::EVersion != output->DataType() ) |
|
279 { |
|
280 iLog->Log( _L("Invalid output data") ); |
|
281 Err |= FAIL; |
|
282 } |
|
283 else |
|
284 { |
|
285 TInt Major,Minor; |
|
286 Major = ((CVersion*)output)->MajorVersion(); |
|
287 Minor = ((CVersion*)output)->MinorVersion(); |
|
288 iLog->Log( _L("Platform version: Major: %d, Minor: %d"), Major,Minor); |
|
289 TInt ExpectedMajor,ExpectedMinor; |
|
290 GetPlatformVersion(ExpectedMajor,ExpectedMinor); |
|
291 if(!(ExpectedMajor == Major && ExpectedMinor == Minor)) |
|
292 { |
|
293 iLog->Log( _L("incorrect major minor versions returned..") ); |
|
294 Err |= FAIL; |
|
295 } |
|
296 } |
|
297 CleanupStack::PopAndDestroy(output); |
|
298 } |
|
299 } |
|
300 else |
|
301 { |
|
302 Err |= err; |
|
303 iLog->Log( _L("GetInfo API returned error") ); |
|
304 } |
|
305 |
|
306 CleanupStack::PopAndDestroy(obj); |
|
307 |
|
308 __UHEAP_MARKEND; |
|
309 return Err; |
|
310 } |
|
311 |
|
312 TInt Ctsysinfoservicetests::ProductTypeL(CStifItemParser& /*aItem*/) |
|
313 { |
|
314 _LIT( KExample, "ProductTypeL" ); |
|
315 iLog->Log( KExample ); |
|
316 TInt Err(PASS); |
|
317 |
|
318 __UHEAP_MARK; |
|
319 CSysInfoService *obj = CSysInfoService::NewL(); |
|
320 CleanupStack::PushL(obj); |
|
321 |
|
322 CSysData* output; |
|
323 |
|
324 TRAPD(err,obj->GetInfoL(KDevice,KProductType,output)); |
|
325 if (!err) |
|
326 { |
|
327 if(!output) |
|
328 { |
|
329 Err |= FAIL; |
|
330 iLog->Log( _L("Output data Set to NULL") ); |
|
331 } |
|
332 else |
|
333 { |
|
334 CleanupStack::PushL(output); |
|
335 //Check data type |
|
336 if( CSysData::EStringData != output->DataType() ) |
|
337 { |
|
338 iLog->Log( _L("Invalid output data") ); |
|
339 Err |= FAIL; |
|
340 } |
|
341 else |
|
342 { |
|
343 #if ( !((defined(__WINS__) || defined(__WINSCW__))) ) |
|
344 TPtrC ProductType; |
|
345 ((CStringData*)output)->StringData(ProductType); |
|
346 iLog->Log( _L("Product Type: %s"), ProductType.Ptr()); |
|
347 #endif |
|
348 } |
|
349 |
|
350 CleanupStack::PopAndDestroy(output); |
|
351 } |
|
352 } |
|
353 else |
|
354 { |
|
355 Err |= err; |
|
356 iLog->Log( _L("GetInfo API returned error") ); |
|
357 } |
|
358 |
|
359 CleanupStack::PopAndDestroy(obj); |
|
360 |
|
361 __UHEAP_MARKEND; |
|
362 return Err; |
|
363 } |
|
364 |
|
365 TInt Ctsysinfoservicetests::MachineIDL(CStifItemParser& /*aItem*/) |
|
366 { |
|
367 _LIT( KExample, "MachineIDL" ); |
|
368 iLog->Log( KExample ); |
|
369 TInt Err(PASS); |
|
370 |
|
371 __UHEAP_MARK; |
|
372 CSysInfoService *obj = CSysInfoService::NewL(); |
|
373 CleanupStack::PushL(obj); |
|
374 |
|
375 CSysData* output; |
|
376 |
|
377 TRAPD(err,obj->GetInfoL(KDevice,KMachineID,output)); |
|
378 if (!err) |
|
379 { |
|
380 if(!output) |
|
381 { |
|
382 Err |= FAIL; |
|
383 iLog->Log( _L("Output data Set to NULL") ); |
|
384 } |
|
385 else |
|
386 { |
|
387 CleanupStack::PushL(output); |
|
388 //Check data type |
|
389 if( CSysData::EStatus != output->DataType() ) |
|
390 { |
|
391 iLog->Log( _L("Invalid output data") ); |
|
392 Err |= FAIL; |
|
393 } |
|
394 else |
|
395 { |
|
396 TInt MachineID; |
|
397 MachineID = ((CStatus*)output)->Status(); |
|
398 iLog->Log( _L("Machine ID: %x"), MachineID); |
|
399 TInt ExpectedMachineId; |
|
400 HAL::Get(HALData::EMachineUid, ExpectedMachineId); |
|
401 if(!(ExpectedMachineId == MachineID)) |
|
402 { |
|
403 iLog->Log( _L("Incorrect Machine ID") ); |
|
404 Err |= FAIL; |
|
405 } |
|
406 } |
|
407 CleanupStack::PopAndDestroy(output); |
|
408 } |
|
409 } |
|
410 else |
|
411 { |
|
412 Err |= err; |
|
413 iLog->Log( _L("GetInfo API returned error") ); |
|
414 } |
|
415 |
|
416 CleanupStack::PopAndDestroy(obj); |
|
417 |
|
418 __UHEAP_MARKEND; |
|
419 return Err; |
|
420 } |
|
421 |
|
422 |
|
423 TInt Ctsysinfoservicetests::ManufacturerL(CStifItemParser& /*aItem*/) |
|
424 { |
|
425 _LIT( KExample, "ManufacturerL" ); |
|
426 iLog->Log( KExample ); |
|
427 TInt Err(PASS); |
|
428 |
|
429 __UHEAP_MARK; |
|
430 CSysInfoService *obj = CSysInfoService::NewL(); |
|
431 CleanupStack::PushL(obj); |
|
432 |
|
433 CSysData* output; |
|
434 |
|
435 TRAPD(err,obj->GetInfoL(KDevice,KManufacturer,output)); |
|
436 if (!err) |
|
437 { |
|
438 if(!output) |
|
439 { |
|
440 Err |= FAIL; |
|
441 iLog->Log( _L("Output Data Set to NULL") ); |
|
442 } |
|
443 else |
|
444 { |
|
445 CleanupStack::PushL(output); |
|
446 //Check data type |
|
447 if( CSysData::EStringData != output->DataType() ) |
|
448 { |
|
449 iLog->Log( _L("Invalid output data") ); |
|
450 Err |= FAIL; |
|
451 } |
|
452 else |
|
453 { |
|
454 TPtrC Manufacturer; |
|
455 ((CStringData*)output)->StringData(Manufacturer); |
|
456 iLog->Log( _L("PhoneModel: %s"), Manufacturer.Ptr()); |
|
457 TBuf<100> manufacturer(Manufacturer); |
|
458 manufacturer.UpperCase(); |
|
459 if( manufacturer.Compare(_L("NOKIA")) ) |
|
460 { |
|
461 iLog->Log( _L("Incorrect Manufacturer Name") ); |
|
462 Err |= FAIL; |
|
463 } |
|
464 CleanupStack::PopAndDestroy(output); |
|
465 } |
|
466 } |
|
467 } |
|
468 else |
|
469 { |
|
470 Err |= err; |
|
471 iLog->Log( _L("GetInfo API returned error") ); |
|
472 } |
|
473 |
|
474 CleanupStack::PopAndDestroy(obj); |
|
475 |
|
476 __UHEAP_MARKEND; |
|
477 return Err; |
|
478 } |
|
479 |
|
480 TInt Ctsysinfoservicetests::PhoneModelL(CStifItemParser& /*aItem*/) |
|
481 { |
|
482 _LIT( KExample, "PhoneModelL" ); |
|
483 iLog->Log( KExample ); |
|
484 TInt Err(PASS); |
|
485 |
|
486 __UHEAP_MARK; |
|
487 CSysInfoService *obj = CSysInfoService::NewL(); |
|
488 CleanupStack::PushL(obj); |
|
489 |
|
490 CSysData* output; |
|
491 |
|
492 TRAPD(err,obj->GetInfoL(KDevice,KPhoneModel,output)); |
|
493 if (!err) |
|
494 { |
|
495 if(!output) |
|
496 { |
|
497 Err |= FAIL; |
|
498 iLog->Log( _L("Output data Set to NULL") ); |
|
499 } |
|
500 else |
|
501 { |
|
502 CleanupStack::PushL(output); |
|
503 //Check data type |
|
504 if( CSysData::EStringData != output->DataType() ) |
|
505 { |
|
506 iLog->Log( _L("Invalid output data") ); |
|
507 Err |= FAIL; |
|
508 } |
|
509 else |
|
510 { |
|
511 TPtrC PhoneModel; |
|
512 ((CStringData*)output)->StringData(PhoneModel); |
|
513 |
|
514 iLog->Log( _L("PhoneModel: %s"), PhoneModel.Ptr()); |
|
515 |
|
516 if(!(PhoneModel.Length() > 2)) |
|
517 { |
|
518 iLog->Log( _L("Invalid PhoneModel") ); |
|
519 Err |= FAIL; |
|
520 } |
|
521 } |
|
522 CleanupStack::PopAndDestroy(output); |
|
523 } |
|
524 } |
|
525 else |
|
526 { |
|
527 Err |= err; |
|
528 iLog->Log( _L("GetInfo API returned error") ); |
|
529 } |
|
530 |
|
531 CleanupStack::PopAndDestroy(obj); |
|
532 |
|
533 __UHEAP_MARKEND; |
|
534 return Err; |
|
535 } |
|
536 |
|
537 TInt Ctsysinfoservicetests::IMEINumberL(CStifItemParser& /*aItem*/) |
|
538 { |
|
539 _LIT( KExample, "IMEINumberL" ); |
|
540 iLog->Log( KExample ); |
|
541 TInt Err(PASS); |
|
542 |
|
543 __UHEAP_MARK; |
|
544 CSysInfoService *obj = CSysInfoService::NewL(); |
|
545 CleanupStack::PushL(obj); |
|
546 |
|
547 CSysData* output; |
|
548 |
|
549 TRAPD(err,obj->GetInfoL(KDevice,KIMEI,output)); |
|
550 if (!err) |
|
551 { |
|
552 if(!output) |
|
553 { |
|
554 Err |= FAIL; |
|
555 iLog->Log( _L("Output data Set to NULL") ); |
|
556 } |
|
557 else |
|
558 { |
|
559 CleanupStack::PushL(output); |
|
560 //Check data type |
|
561 if( CSysData::EStringData != output->DataType() ) |
|
562 { |
|
563 iLog->Log( _L("Invalid output data") ); |
|
564 Err |= FAIL; |
|
565 } |
|
566 else |
|
567 { |
|
568 TPtrC IMEINumber; |
|
569 ((CStringData*)output)->StringData(IMEINumber); |
|
570 iLog->Log( _L("IMEI: %s"), IMEINumber.Ptr()); |
|
571 if(!(IMEINumber.Length() >= 15)) |
|
572 { |
|
573 iLog->Log( _L("Invalid producttype") ); |
|
574 Err |= FAIL; |
|
575 } |
|
576 } |
|
577 CleanupStack::PopAndDestroy(output); |
|
578 } |
|
579 } |
|
580 else |
|
581 { |
|
582 Err |= err; |
|
583 iLog->Log( _L("GetInfo API returned error") ); |
|
584 } |
|
585 |
|
586 |
|
587 CleanupStack::PopAndDestroy(obj); |
|
588 |
|
589 __UHEAP_MARKEND; |
|
590 return Err; |
|
591 } |
|
592 TInt Ctsysinfoservicetests::GetListofDrivesL(CStifItemParser& /*aItem*/) |
|
593 { |
|
594 _LIT( KExample, "GetListofDrivesL" ); |
|
595 iLog->Log( KExample ); |
|
596 TInt Err(PASS); |
|
597 |
|
598 __UHEAP_MARK; |
|
599 CSysInfoService *obj = CSysInfoService::NewL(); |
|
600 CleanupStack::PushL(obj); |
|
601 |
|
602 CSysData* output=NULL; |
|
603 TRAPD(err,obj->GetInfoL(KMemory,KListDrives,output)); |
|
604 if (!err) |
|
605 { |
|
606 if(!output) |
|
607 { |
|
608 Err |= FAIL; |
|
609 iLog->Log( _L("Output data Set to NULL") ); |
|
610 } |
|
611 else |
|
612 { |
|
613 CleanupStack::PushL(output); |
|
614 //On Emulator this must give C:2,D:3,Z:25 |
|
615 if( CSysData::EDriveList != output->DataType() ) |
|
616 { |
|
617 iLog->Log( _L("Invalid output data") ); |
|
618 Err |= FAIL; |
|
619 } |
|
620 else |
|
621 { |
|
622 CDriveList* drivelist = (CDriveList*)output; |
|
623 TInt count = drivelist->Count(); |
|
624 //atleast one drive. |
|
625 if(count<=0) |
|
626 { |
|
627 iLog->Log( _L("Atlease One drive must be present") ); |
|
628 Err |= FAIL; |
|
629 } |
|
630 else |
|
631 { |
|
632 iLog->Log( _L("Available Drives: ")); |
|
633 for(TInt i=0;i<count;i++) |
|
634 { |
|
635 TInt driveno = (*drivelist)[i]; |
|
636 iLog->Log( _L("Drive (Number,Letter): (%d, %c)"),driveno,97+driveno ); |
|
637 if( driveno < 0 ) |
|
638 { |
|
639 iLog->Log( _L("Invalid drive number found") ); |
|
640 Err |= FAIL; |
|
641 } |
|
642 } |
|
643 } |
|
644 CleanupStack::PopAndDestroy(output); |
|
645 } |
|
646 } |
|
647 } |
|
648 else |
|
649 { |
|
650 Err |= err; |
|
651 iLog->Log( _L("GetInfo API returned error") ); |
|
652 } |
|
653 |
|
654 CleanupStack::PopAndDestroy(obj); |
|
655 |
|
656 __UHEAP_MARKEND; |
|
657 return Err; |
|
658 } |
|
659 |
|
660 TInt Ctsysinfoservicetests::GetDriveInfoL(CStifItemParser& /*aItem*/) |
|
661 { |
|
662 _LIT( KExample, "GetDriveInfoL" ); |
|
663 iLog->Log( KExample ); |
|
664 TInt Err(PASS); |
|
665 |
|
666 __UHEAP_MARK; |
|
667 CSysInfoService *obj = CSysInfoService::NewL(); |
|
668 CleanupStack::PushL(obj); |
|
669 |
|
670 CSysData* output=NULL; |
|
671 TRAPD(err,obj->GetInfoL(KMemory,KListDrives,output)); |
|
672 if (!err) |
|
673 { |
|
674 if(!output) |
|
675 { |
|
676 Err |= FAIL; |
|
677 iLog->Log( _L("Output data Set to NULL") ); |
|
678 } |
|
679 else |
|
680 { |
|
681 CleanupStack::PushL(output); |
|
682 //On Emulator this must give C:2,D:3,Z:25 |
|
683 if( CSysData::EDriveList != output->DataType() ) |
|
684 { |
|
685 iLog->Log( _L("Invalid output data") ); |
|
686 Err |= FAIL; |
|
687 } |
|
688 else |
|
689 { |
|
690 CDriveList* drivelist = (CDriveList*)output; |
|
691 TInt count = drivelist->Count(); |
|
692 //atleast one drive. |
|
693 if(count<=0) |
|
694 { |
|
695 iLog->Log( _L("Atleast One drive must be present") ); |
|
696 Err |= FAIL; |
|
697 } |
|
698 else |
|
699 { |
|
700 for(TInt i=0;i<count;i++) |
|
701 { |
|
702 TInt driveno = (*drivelist)[i]; |
|
703 CSysData* input1 = CDriveInfo::NewL(driveno); |
|
704 CleanupStack::PushL(input1); |
|
705 |
|
706 CSysData* output1; |
|
707 |
|
708 TRAPD(err,obj->GetInfoL(KMemory,KDriveInfo,output1,input1)); |
|
709 CleanupStack::PopAndDestroy(input1); |
|
710 if(!err ) |
|
711 { |
|
712 CleanupStack::PushL(output1); |
|
713 User::LeaveIfError(DriveInfoL(output1)); |
|
714 CleanupStack::PopAndDestroy(output1); |
|
715 } |
|
716 else |
|
717 { |
|
718 if( err == KErrNotReady && driveno == 4) |
|
719 { |
|
720 iLog->Log( _L("Memory card not present")); |
|
721 continue; |
|
722 } |
|
723 iLog->Log( _L("Error retriving drive information of %d drive, err: %d"),driveno,err); |
|
724 Err |= FAIL; |
|
725 } |
|
726 }//for |
|
727 }//count |
|
728 }//datatype |
|
729 CleanupStack::PopAndDestroy(output); |
|
730 }//output |
|
731 }//err |
|
732 else |
|
733 { |
|
734 Err |= err; |
|
735 iLog->Log( _L("GetInfo API returned error") ); |
|
736 } |
|
737 |
|
738 iLog->Log( _L("Test Completed err: %d"),Err); |
|
739 CleanupStack::PopAndDestroy(obj); |
|
740 |
|
741 __UHEAP_MARKEND; |
|
742 return Err; |
|
743 } |
|
744 |
|
745 TInt Ctsysinfoservicetests::DriveInfoL(CSysData* aOutput) |
|
746 { |
|
747 TInt Err(PASS); |
|
748 CDriveInfo* driveinfo = (CDriveInfo*)aOutput; |
|
749 |
|
750 TInt drvno = driveinfo->DriveNumber(); |
|
751 iLog->Log( _L("Drive (Number,Letter): (%d, %c)"),drvno,97+drvno ); |
|
752 if( !(drvno >=0 && drvno <= EDriveZ )) |
|
753 { |
|
754 iLog->Log( _L("Incorrect drive number in output data") ); |
|
755 Err |= FAIL; |
|
756 } |
|
757 |
|
758 iLog->Log( _L("-------------------------------") ); |
|
759 TPtrC drvname; |
|
760 driveinfo->DriveName(drvname); |
|
761 iLog->Log( _L("Drive Name: %s"),drvname.Ptr() ); |
|
762 |
|
763 iLog->Log( _L("Total Space: %ld"),driveinfo->TotalSpace() ); |
|
764 if( driveinfo->TotalSpace() < 0) |
|
765 { |
|
766 iLog->Log( _L("Incorrect total space") ); |
|
767 Err |= FAIL; |
|
768 } |
|
769 |
|
770 iLog->Log( _L("Free Space: %ld"),driveinfo->FreeSpace() ); |
|
771 if( driveinfo->FreeSpace() < 0) |
|
772 { |
|
773 iLog->Log( _L("Incorrect free space") ); |
|
774 Err |= FAIL; |
|
775 } |
|
776 |
|
777 TInt CriticalLevel = driveinfo->CriticalSpace(); |
|
778 iLog->Log( _L("Critical Space: %d"),CriticalLevel ); |
|
779 if( CriticalLevel <= 0) |
|
780 { |
|
781 iLog->Log( _L("Incorrect Critical Sapce") ); |
|
782 Err |= FAIL; |
|
783 } |
|
784 |
|
785 iLog->Log( _L("Media Type: %d"),driveinfo->MediaType() ); |
|
786 if( !(driveinfo->MediaType() <= EMediaRotatingMedia) ) |
|
787 { |
|
788 iLog->Log( _L("Incorrect media type") ); |
|
789 Err |= FAIL; |
|
790 } |
|
791 |
|
792 iLog->Log( _L("-------------------------------") ); |
|
793 return Err; |
|
794 } |
|
795 |
|
796 |
|
797 TInt Ctsysinfoservicetests::BatteryLevelAutoL(CStifItemParser& ) |
|
798 { |
|
799 _LIT( KExample, "BatteryLevelAutoL" ); |
|
800 iLog->Log( KExample ); |
|
801 TInt Err(PASS); |
|
802 |
|
803 #if ( !(defined(__WINS__) || defined(__WINSCW__)) ) |
|
804 __UHEAP_MARK; |
|
805 CSysInfoService *obj = CSysInfoService::NewL(); |
|
806 CleanupStack::PushL(obj); |
|
807 |
|
808 CSysData* output=NULL; |
|
809 |
|
810 _LIT(KBatteryLevel,"BatteryLevel"); |
|
811 |
|
812 TRAPD(err,obj->GetInfoL(KBattery,KBatteryLevel,output)); |
|
813 if ( err == KErrNotFound ) |
|
814 { |
|
815 Err = PASS; |
|
816 iLog->Log( _L("Battery Level Not supported ")); |
|
817 } |
|
818 else |
|
819 { |
|
820 Err |= FAIL; |
|
821 iLog->Log( _L("GetInfo API returned error: %d Expected Error: %d"), err,KErrNotFound); |
|
822 } |
|
823 |
|
824 CleanupStack::PopAndDestroy(obj); |
|
825 __UHEAP_MARKEND; |
|
826 |
|
827 #endif |
|
828 return Err; |
|
829 } |
|
830 |
|
831 TInt Ctsysinfoservicetests::BatteryChargingAutoL(CStifItemParser& ) |
|
832 { |
|
833 _LIT( KExample, "BatteryChargingAutoL" ); |
|
834 iLog->Log( KExample ); |
|
835 TInt Err(PASS); |
|
836 |
|
837 #if ( !(defined(__WINS__) || defined(__WINSCW__)) ) |
|
838 __UHEAP_MARK; |
|
839 CSysInfoService *obj = CSysInfoService::NewL(); |
|
840 CleanupStack::PushL(obj); |
|
841 |
|
842 CSysData* output=NULL; |
|
843 |
|
844 TRAPD(err,obj->GetInfoL(KBattery,KChargingStatus,output)); |
|
845 if (!err) |
|
846 { |
|
847 if(!output) |
|
848 { |
|
849 Err |= FAIL; |
|
850 iLog->Log( _L("Output data Set to NULL") ); |
|
851 } |
|
852 else |
|
853 { |
|
854 CleanupStack::PushL(output); |
|
855 //Check data type |
|
856 if( CSysData::EStatus != output->DataType() ) |
|
857 { |
|
858 iLog->Log( _L("Invalid output data") ); |
|
859 Err |= FAIL; |
|
860 } |
|
861 else |
|
862 { |
|
863 TInt BatteryCharg; |
|
864 BatteryCharg = ((CStatus*)output)->Status(); |
|
865 |
|
866 iLog->Log(_L("Battery Charger State: %d"),BatteryCharg); |
|
867 |
|
868 if( !(BatteryCharg == 0 || BatteryCharg == 1) ) |
|
869 { |
|
870 iLog->Log( _L("Invalid Battery Level : %d"),BatteryCharg); |
|
871 Err |= FAIL; |
|
872 } |
|
873 } |
|
874 CleanupStack::PopAndDestroy(output); |
|
875 } |
|
876 } |
|
877 else |
|
878 { |
|
879 Err |= err; |
|
880 iLog->Log( _L("GetInfo API returned error: %d"), err); |
|
881 } |
|
882 |
|
883 CleanupStack::PopAndDestroy(obj); |
|
884 __UHEAP_MARKEND; |
|
885 |
|
886 #endif |
|
887 return Err; |
|
888 } |
|
889 |
|
890 TInt Ctsysinfoservicetests::BatteryStrengthAsyncL(CStifItemParser&) |
|
891 { |
|
892 _LIT( KExample, "BatteryStrengthAsyncL" ); |
|
893 iLog->Log( KExample ); |
|
894 TInt Err(PASS); |
|
895 |
|
896 #if ( !(defined(__WINS__) || defined(__WINSCW__)) ) |
|
897 __UHEAP_MARK; |
|
898 CBatteryStrengthAsync* test = CBatteryStrengthAsync::NewL(iLog); |
|
899 test->Start(); |
|
900 Err = test->Result(); |
|
901 delete test; |
|
902 |
|
903 #endif |
|
904 __UHEAP_MARKEND; |
|
905 return Err; |
|
906 } |
|
907 |
|
908 TInt Ctsysinfoservicetests::GetSetBrightnessL(CStifItemParser& /*aItem*/) |
|
909 { |
|
910 _LIT( KExample, "GetSetBrightnessL" ); |
|
911 iLog->Log( KExample ); |
|
912 TInt Err(PASS); |
|
913 |
|
914 __UHEAP_MARK; |
|
915 CSysInfoService *obj = CSysInfoService::NewL(); |
|
916 CleanupStack::PushL(obj); |
|
917 |
|
918 CSysData* output=NULL; |
|
919 TRAPD(err,obj->GetInfoL(KDisplay,KBrightness,output)); |
|
920 if (!err) |
|
921 { |
|
922 if(!output) |
|
923 { |
|
924 Err |= FAIL; |
|
925 iLog->Log( _L("Output data Set to NULL") ); |
|
926 } |
|
927 else |
|
928 { |
|
929 CleanupStack::PushL(output); |
|
930 if( CSysData::EStatus != output->DataType() ) |
|
931 { |
|
932 iLog->Log( _L("Invalid output data") ); |
|
933 Err |= FAIL; |
|
934 } |
|
935 else |
|
936 { |
|
937 TInt OldBrightness; |
|
938 CStatus* brightness = (CStatus*)output; |
|
939 OldBrightness = brightness->Status(); |
|
940 iLog->Log( _L("System Brigthness Value: %d"),OldBrightness ); |
|
941 CleanupStack::PopAndDestroy(output); |
|
942 #ifdef _SET_BRIGHTNESS_SUPPORTED_ |
|
943 CStatus* set_bright_val = CStatus::NewL(80); |
|
944 CleanupStack::PushL(set_bright_val); |
|
945 |
|
946 TRAPD(err,obj->SetInfoL(KDisplay,KBrightness,set_bright_val)); |
|
947 if(!err) |
|
948 { |
|
949 iLog->Log( _L("Brigthness set to %d"),80 ); |
|
950 } |
|
951 else |
|
952 { |
|
953 Err |= err; |
|
954 iLog->Log( _L("SetInfoL API returned error") ); |
|
955 } |
|
956 |
|
957 CleanupStack::PopAndDestroy(set_bright_val); |
|
958 |
|
959 iLog->Log( _L("Getting Brightness Value after setting to 80") ); |
|
960 |
|
961 CSysData* output1=NULL; |
|
962 TRAP(err,obj->GetInfoL(KDisplay,KBrightness,output1)); |
|
963 if(!err) |
|
964 { |
|
965 if(!output1) |
|
966 { |
|
967 Err |= FAIL; |
|
968 iLog->Log( _L("Output data Set to NULL") ); |
|
969 } |
|
970 else |
|
971 { |
|
972 CleanupStack::PushL(output1); |
|
973 TInt cur_brightness = ((CStatus*)output1)->Status(); |
|
974 if (cur_brightness != 80) |
|
975 { |
|
976 Err |= FAIL; |
|
977 iLog->Log( _L("Brightness value not set to 80, read val: %d"), cur_brightness); |
|
978 } |
|
979 else |
|
980 { |
|
981 iLog->Log( _L("Brightness value set to 80")); |
|
982 } |
|
983 CleanupStack::PopAndDestroy(output1); |
|
984 } |
|
985 } |
|
986 else |
|
987 { |
|
988 Err |= err; |
|
989 iLog->Log( _L("GetInfoL API returned error on secound attempt") ); |
|
990 } |
|
991 |
|
992 iLog->Log( _L("Restoring Brightness Value to %d"), OldBrightness); |
|
993 set_bright_val = CStatus::NewL(OldBrightness); |
|
994 CleanupStack::PushL(set_bright_val); |
|
995 |
|
996 TRAP(err,obj->SetInfoL(KDisplay,KBrightness,set_bright_val)); |
|
997 if(!err) |
|
998 { |
|
999 iLog->Log( _L("Brigthness Value restored to %d"),OldBrightness ); |
|
1000 } |
|
1001 else |
|
1002 { |
|
1003 Err |= err; |
|
1004 iLog->Log( _L("SetInfoL API returned error") ); |
|
1005 } |
|
1006 |
|
1007 CleanupStack::PopAndDestroy(set_bright_val); |
|
1008 #endif |
|
1009 } |
|
1010 } |
|
1011 } |
|
1012 else |
|
1013 { |
|
1014 Err |= err; |
|
1015 iLog->Log( _L("GetInfo API returned error") ); |
|
1016 } |
|
1017 |
|
1018 CleanupStack::PopAndDestroy(obj); |
|
1019 |
|
1020 __UHEAP_MARKEND; |
|
1021 return Err; |
|
1022 } |
|
1023 |
|
1024 TInt Ctsysinfoservicetests::GetSetScreensaverTimeOutL(CStifItemParser& /*aItem*/) |
|
1025 { |
|
1026 _LIT( KExample, "GetSetScreensaverTimeOutL" ); |
|
1027 iLog->Log( KExample ); |
|
1028 TInt Err(PASS); |
|
1029 |
|
1030 __UHEAP_MARK; |
|
1031 CSysInfoService *obj = CSysInfoService::NewL(); |
|
1032 CleanupStack::PushL(obj); |
|
1033 |
|
1034 CSysData* output=NULL; |
|
1035 TRAPD(err,obj->GetInfoL(KDisplay,KScreenSaverTimeOut,output)); |
|
1036 if (!err) |
|
1037 { |
|
1038 if(!output) |
|
1039 { |
|
1040 Err |= FAIL; |
|
1041 iLog->Log( _L("Output data Set to NULL") ); |
|
1042 } |
|
1043 else |
|
1044 { |
|
1045 CleanupStack::PushL(output); |
|
1046 if( CSysData::EStatus != output->DataType() ) |
|
1047 { |
|
1048 iLog->Log( _L("Invalid output data") ); |
|
1049 Err |= FAIL; |
|
1050 } |
|
1051 else |
|
1052 { |
|
1053 TInt OldScrTimeOut; |
|
1054 CStatus* ScrTimeOut = (CStatus*)output; |
|
1055 OldScrTimeOut = ScrTimeOut->Status(); |
|
1056 |
|
1057 iLog->Log( _L("System Screen Saver Timeout Value: %d"),OldScrTimeOut ); |
|
1058 CleanupStack::PopAndDestroy(output); |
|
1059 #ifdef _SET_SCREESAVER_SUPPORTED_ |
|
1060 CStatus* set_scrtimeout_val = CStatus::NewL(30); |
|
1061 CleanupStack::PushL(set_scrtimeout_val); |
|
1062 |
|
1063 TRAPD(err,obj->SetInfoL(KDisplay,KScreenSaverTimeOut,set_scrtimeout_val)); |
|
1064 if(!err) |
|
1065 { |
|
1066 iLog->Log( _L("Screen saver timeout set to %d"),30 ); |
|
1067 } |
|
1068 else |
|
1069 { |
|
1070 Err |= err; |
|
1071 iLog->Log( _L("SetInfoL API returned error") ); |
|
1072 } |
|
1073 |
|
1074 CleanupStack::PopAndDestroy(set_scrtimeout_val); |
|
1075 |
|
1076 iLog->Log( _L("Getting Screen saver timeout Value after setting to 30") ); |
|
1077 |
|
1078 CSysData* output1=NULL; |
|
1079 TRAP(err,obj->GetInfoL(KDisplay,KScreenSaverTimeOut,output1)); |
|
1080 if(!err) |
|
1081 { |
|
1082 if(!output1) |
|
1083 { |
|
1084 Err |= FAIL; |
|
1085 iLog->Log( _L("Output data Set to NULL") ); |
|
1086 } |
|
1087 else |
|
1088 { |
|
1089 CleanupStack::PushL(output1); |
|
1090 TInt cur_scrtimeout = ((CStatus*)output1)->Status(); |
|
1091 if (cur_scrtimeout != 30) |
|
1092 { |
|
1093 Err |= FAIL; |
|
1094 iLog->Log( _L("Screen saver timeout value not set to 30, read val: %d"), cur_scrtimeout); |
|
1095 } |
|
1096 else |
|
1097 { |
|
1098 iLog->Log( _L("Brightness value set to 30")); |
|
1099 } |
|
1100 CleanupStack::PopAndDestroy(output1); |
|
1101 } |
|
1102 } |
|
1103 else |
|
1104 { |
|
1105 Err |= err; |
|
1106 iLog->Log( _L("GetInfoL API returned error on secound attempt") ); |
|
1107 } |
|
1108 |
|
1109 iLog->Log( _L("Restoring Screen saver timeout Value to %d"), OldScrTimeOut); |
|
1110 set_scrtimeout_val = CStatus::NewL(OldScrTimeOut); |
|
1111 CleanupStack::PushL(set_scrtimeout_val); |
|
1112 |
|
1113 TRAP(err,obj->SetInfoL(KDisplay,KScreenSaverTimeOut,set_scrtimeout_val)); |
|
1114 if(!err) |
|
1115 { |
|
1116 iLog->Log( _L("Screen saver value restored to %d"),OldScrTimeOut ); |
|
1117 } |
|
1118 else |
|
1119 { |
|
1120 Err |= err; |
|
1121 iLog->Log( _L("SetInfoL API returned error") ); |
|
1122 } |
|
1123 |
|
1124 CleanupStack::PopAndDestroy(set_scrtimeout_val); |
|
1125 #endif |
|
1126 } |
|
1127 } |
|
1128 } |
|
1129 else |
|
1130 { |
|
1131 Err |= err; |
|
1132 iLog->Log( _L("GetInfo API returned error") ); |
|
1133 } |
|
1134 |
|
1135 CleanupStack::PopAndDestroy(obj); |
|
1136 |
|
1137 __UHEAP_MARKEND; |
|
1138 return Err; |
|
1139 } |
|
1140 |
|
1141 TInt Ctsysinfoservicetests::UserInactivityNotifierL(CStifItemParser& ) |
|
1142 { |
|
1143 _LIT( KExample, "UserInactivityNotifierL" ); |
|
1144 iLog->Log( KExample ); |
|
1145 TInt Err(PASS); |
|
1146 |
|
1147 __UHEAP_MARK; |
|
1148 |
|
1149 CTestUserActivity* test = CTestUserActivity::NewL(iLog,1,CTestUserActivity::ETESTINACTIVITY); |
|
1150 test->Start(); |
|
1151 Err = test->Result(); |
|
1152 delete test; |
|
1153 |
|
1154 __UHEAP_MARKEND; |
|
1155 |
|
1156 return Err; |
|
1157 } |
|
1158 |
|
1159 TInt Ctsysinfoservicetests::UserActivityNotifierL(CStifItemParser& ) |
|
1160 { |
|
1161 _LIT( KExample, "UserInactivityNotifierL" ); |
|
1162 iLog->Log( KExample ); |
|
1163 TInt Err(PASS); |
|
1164 |
|
1165 __UHEAP_MARK; |
|
1166 |
|
1167 CTestUserActivity* test = CTestUserActivity::NewL(iLog,1,CTestUserActivity::ETESTACTIVITY); |
|
1168 test->Start(); |
|
1169 Err = test->Result(); |
|
1170 delete test; |
|
1171 |
|
1172 __UHEAP_MARKEND; |
|
1173 |
|
1174 return Err; |
|
1175 } |
|
1176 |
|
1177 TInt Ctsysinfoservicetests::SetGetAutoLockTimeL(CStifItemParser& ) |
|
1178 { |
|
1179 _LIT( KExample, "SetGetAutoLockTimeL" ); |
|
1180 iLog->Log( KExample ); |
|
1181 TInt Err(PASS); |
|
1182 |
|
1183 __UHEAP_MARK; |
|
1184 CSysInfoService *obj = CSysInfoService::NewL(); |
|
1185 CleanupStack::PushL(obj); |
|
1186 |
|
1187 CSysData* output=NULL; |
|
1188 TRAPD(err,obj->GetInfoL(KDisplay,KAutoLockTime,output)); |
|
1189 if (!err) |
|
1190 { |
|
1191 if(!output) |
|
1192 { |
|
1193 Err |= FAIL; |
|
1194 iLog->Log( _L("Output data Set to NULL") ); |
|
1195 } |
|
1196 else |
|
1197 { |
|
1198 CleanupStack::PushL(output); |
|
1199 if( CSysData::EStatus != output->DataType() ) |
|
1200 { |
|
1201 iLog->Log( _L("Invalid output data") ); |
|
1202 Err |= FAIL; |
|
1203 } |
|
1204 else |
|
1205 { |
|
1206 TInt OldAutolockTime; |
|
1207 CStatus* AutoLockTimeOut = (CStatus*)output; |
|
1208 OldAutolockTime = AutoLockTimeOut->Status(); |
|
1209 |
|
1210 iLog->Log( _L("System Auto Lock Time Value: %d"),OldAutolockTime ); |
|
1211 CleanupStack::PopAndDestroy(output); |
|
1212 #ifdef _SET_SCREESAVER_SUPPORTED_ |
|
1213 CStatus* set_autolocktime_val = CStatus::NewL(1); |
|
1214 CleanupStack::PushL(set_autolocktime_val); |
|
1215 |
|
1216 TRAPD(err,obj->SetInfoL(KDisplay,KAutoLockTime,set_autolocktime_val)); |
|
1217 if(!err) |
|
1218 { |
|
1219 iLog->Log( _L("Auto Lock time set to %d"),1 ); |
|
1220 } |
|
1221 else |
|
1222 { |
|
1223 Err |= err; |
|
1224 iLog->Log( _L("SetInfoL API returned error") ); |
|
1225 } |
|
1226 |
|
1227 CleanupStack::PopAndDestroy(set_autolocktime_val); |
|
1228 |
|
1229 iLog->Log( _L("Getting Auto Lock time Value after setting to 1") ); |
|
1230 |
|
1231 CSysData* output1=NULL; |
|
1232 TRAP(err,obj->GetInfoL(KDisplay,KAutoLockTime,output1)); |
|
1233 if(!err) |
|
1234 { |
|
1235 if(!output1) |
|
1236 { |
|
1237 Err |= FAIL; |
|
1238 iLog->Log( _L("Output1 data Set to NULL") ); |
|
1239 } |
|
1240 else |
|
1241 { |
|
1242 CleanupStack::PushL(output1); |
|
1243 TInt cur_autolocktime = ((CStatus*)output1)->Status(); |
|
1244 if (cur_autolocktime != 1) |
|
1245 { |
|
1246 Err |= FAIL; |
|
1247 iLog->Log( _L("Auto lock time value not set to 1, read val: %d"), cur_autolocktime); |
|
1248 } |
|
1249 else |
|
1250 { |
|
1251 iLog->Log( _L("Auto lock value set to %d"),cur_autolocktime); |
|
1252 } |
|
1253 CleanupStack::PopAndDestroy(output1); |
|
1254 } |
|
1255 } |
|
1256 else |
|
1257 { |
|
1258 Err |= err; |
|
1259 iLog->Log( _L("GetInfoL API returned error on secound attempt") ); |
|
1260 } |
|
1261 |
|
1262 iLog->Log( _L("Restoring Auto lock time Value to %d"), OldAutolockTime); |
|
1263 set_autolocktime_val = CStatus::NewL(OldAutolockTime); |
|
1264 CleanupStack::PushL(set_autolocktime_val); |
|
1265 |
|
1266 TRAP(err,obj->SetInfoL(KDisplay,KAutoLockTime,set_autolocktime_val)); |
|
1267 if(!err) |
|
1268 { |
|
1269 iLog->Log( _L("Screen saver value restored to %d"),OldAutolockTime ); |
|
1270 } |
|
1271 else |
|
1272 { |
|
1273 Err |= err; |
|
1274 iLog->Log( _L("SetInfoL API returned error") ); |
|
1275 } |
|
1276 |
|
1277 CleanupStack::PopAndDestroy(set_autolocktime_val); |
|
1278 #endif |
|
1279 } |
|
1280 } |
|
1281 } |
|
1282 else |
|
1283 { |
|
1284 Err |= err; |
|
1285 iLog->Log( _L("GetInfo API returned error") ); |
|
1286 } |
|
1287 |
|
1288 CleanupStack::PopAndDestroy(obj); |
|
1289 |
|
1290 __UHEAP_MARKEND; |
|
1291 return Err; |
|
1292 } |
|
1293 |
|
1294 TInt Ctsysinfoservicetests::AutoLockNotifierL(CStifItemParser& ) |
|
1295 { |
|
1296 _LIT( KExample, "AutoLockNotifierL" ); |
|
1297 iLog->Log( KExample ); |
|
1298 TInt Err(PASS); |
|
1299 |
|
1300 __UHEAP_MARK; |
|
1301 |
|
1302 CAutoLockNotifier* test = CAutoLockNotifier::NewL(iLog,1); |
|
1303 test->Start(); |
|
1304 Err = test->Result(); |
|
1305 delete test; |
|
1306 |
|
1307 __UHEAP_MARKEND; |
|
1308 |
|
1309 return Err; |
|
1310 } |
|
1311 |
|
1312 TInt Ctsysinfoservicetests::DisplayResolutionL(CStifItemParser& ) |
|
1313 { |
|
1314 _LIT( KExample, "DisplayResolutionL" ); |
|
1315 iLog->Log( KExample ); |
|
1316 TInt Err(PASS); |
|
1317 |
|
1318 __UHEAP_MARK; |
|
1319 CSysInfoService *obj = CSysInfoService::NewL(); |
|
1320 CleanupStack::PushL(obj); |
|
1321 |
|
1322 CSysData* output=NULL; |
|
1323 TRAPD(err,obj->GetInfoL(KDisplay,KDisplayResolution,output)); |
|
1324 if (!err) |
|
1325 { |
|
1326 if(!output) |
|
1327 { |
|
1328 Err |= FAIL; |
|
1329 iLog->Log( _L("Output data Set to NULL") ); |
|
1330 } |
|
1331 else |
|
1332 { |
|
1333 CleanupStack::PushL(output); |
|
1334 if( CSysData::EResolution != output->DataType() ) |
|
1335 { |
|
1336 iLog->Log( _L("Invalid output data") ); |
|
1337 Err |= FAIL; |
|
1338 } |
|
1339 else |
|
1340 { |
|
1341 CResolution* resolution = (CResolution*)output; |
|
1342 TInt xpix = resolution->XPixels(); |
|
1343 TInt ypix = resolution->YPixels(); |
|
1344 if( xpix <= 0 || ypix<= 0) |
|
1345 { |
|
1346 Err |= FAIL; |
|
1347 iLog->Log( _L("Incorrect Display Resolution.. ")); |
|
1348 } |
|
1349 |
|
1350 iLog->Log( _L("XPixels: %d"), xpix); |
|
1351 iLog->Log( _L("YPixels: %d"), ypix); |
|
1352 } |
|
1353 CleanupStack::PopAndDestroy(output); |
|
1354 } |
|
1355 } |
|
1356 else |
|
1357 { |
|
1358 Err |= err; |
|
1359 iLog->Log( _L("GetInfo API returned error") ); |
|
1360 } |
|
1361 |
|
1362 CleanupStack::PopAndDestroy(obj); |
|
1363 |
|
1364 __UHEAP_MARKEND; |
|
1365 return Err; |
|
1366 } |
|
1367 |
|
1368 TInt Ctsysinfoservicetests::DisplayOrientationL(CStifItemParser& ) |
|
1369 { |
|
1370 _LIT( KExample, "DisplayOrientationL" ); |
|
1371 iLog->Log( KExample ); |
|
1372 TInt Err(PASS); |
|
1373 |
|
1374 __UHEAP_MARK; |
|
1375 CSysInfoService *obj = CSysInfoService::NewL(); |
|
1376 CleanupStack::PushL(obj); |
|
1377 |
|
1378 CSysData* output=NULL; |
|
1379 TRAPD(err,obj->GetInfoL(KDisplay,KDisplayOrientation,output)); |
|
1380 if (!err) |
|
1381 { |
|
1382 if(!output) |
|
1383 { |
|
1384 Err |= FAIL; |
|
1385 iLog->Log( _L("Output data Set to NULL") ); |
|
1386 } |
|
1387 else |
|
1388 { |
|
1389 CleanupStack::PushL(output); |
|
1390 if( CSysData::EStatus != output->DataType() ) |
|
1391 { |
|
1392 iLog->Log( _L("Invalid output data") ); |
|
1393 Err |= FAIL; |
|
1394 } |
|
1395 else |
|
1396 { |
|
1397 CStatus* orientation = (CStatus*)output; |
|
1398 TInt orient = orientation->Status(); |
|
1399 iLog->Log( _L("Display Orientation: %d"), orient); |
|
1400 } |
|
1401 CleanupStack::PopAndDestroy(output); |
|
1402 } |
|
1403 } |
|
1404 else |
|
1405 { |
|
1406 Err |= err; |
|
1407 iLog->Log( _L("GetInfo API returned error") ); |
|
1408 } |
|
1409 |
|
1410 CleanupStack::PopAndDestroy(obj); |
|
1411 |
|
1412 __UHEAP_MARKEND; |
|
1413 return Err; |
|
1414 } |
|
1415 TInt Ctsysinfoservicetests::GetSetLightTimeOutL(CStifItemParser& ) |
|
1416 { |
|
1417 _LIT( KExample, "GetSetLightTimeOutL" ); |
|
1418 iLog->Log( KExample ); |
|
1419 TInt Err(PASS); |
|
1420 |
|
1421 __UHEAP_MARK; |
|
1422 CSysInfoService *obj = CSysInfoService::NewL(); |
|
1423 CleanupStack::PushL(obj); |
|
1424 |
|
1425 CSysData* output=NULL; |
|
1426 TRAPD(err,obj->GetInfoL(KDisplay,KLightTimeOut,output)); |
|
1427 if (!err) |
|
1428 { |
|
1429 if(!output) |
|
1430 { |
|
1431 Err |= FAIL; |
|
1432 iLog->Log( _L("Output data Set to NULL") ); |
|
1433 } |
|
1434 else |
|
1435 { |
|
1436 CleanupStack::PushL(output); |
|
1437 if( CSysData::EStatus != output->DataType() ) |
|
1438 { |
|
1439 iLog->Log( _L("Invalid output data") ); |
|
1440 Err |= FAIL; |
|
1441 } |
|
1442 else |
|
1443 { |
|
1444 TInt OldLightTimeOut; |
|
1445 CStatus* LightTimeOut = (CStatus*)output; |
|
1446 OldLightTimeOut = LightTimeOut->Status(); |
|
1447 |
|
1448 iLog->Log( _L("System Light TimeOu Value: %d"),OldLightTimeOut ); |
|
1449 CleanupStack::PopAndDestroy(output); |
|
1450 #ifdef _SET_LIGHTSTIMEOUT_SUPPORTED_ |
|
1451 CStatus* set_lighttimeout_val = CStatus::NewL(5); |
|
1452 CleanupStack::PushL(set_lighttimeout_val); |
|
1453 |
|
1454 TRAPD(err,obj->SetInfoL(KDisplay,KLightTimeOut,set_lighttimeout_val)); |
|
1455 if(!err) |
|
1456 { |
|
1457 iLog->Log( _L("Light timeout set to %d"),5 ); |
|
1458 } |
|
1459 else |
|
1460 { |
|
1461 Err |= err; |
|
1462 iLog->Log( _L("SetInfoL API returned error") ); |
|
1463 } |
|
1464 |
|
1465 CleanupStack::PopAndDestroy(set_lighttimeout_val); |
|
1466 |
|
1467 iLog->Log( _L("Getting Light TimeOut Value after setting to 5") ); |
|
1468 |
|
1469 CSysData* output1=NULL; |
|
1470 TRAP(err,obj->GetInfoL(KDisplay,KLightTimeOut,output1)); |
|
1471 if(!err) |
|
1472 { |
|
1473 if(!output1) |
|
1474 { |
|
1475 Err |= FAIL; |
|
1476 iLog->Log( _L("Output1 data Set to NULL") ); |
|
1477 } |
|
1478 else |
|
1479 { |
|
1480 CleanupStack::PushL(output1); |
|
1481 TInt cur_lighttimeout = ((CStatus*)output1)->Status(); |
|
1482 if (cur_lighttimeout != 5) |
|
1483 { |
|
1484 Err |= FAIL; |
|
1485 iLog->Log( _L("Light TimeOut value not set to 1, read val: %d"), cur_lighttimeout); |
|
1486 } |
|
1487 else |
|
1488 { |
|
1489 iLog->Log( _L("Light TimeOut value set to %d"),cur_lighttimeout); |
|
1490 } |
|
1491 CleanupStack::PopAndDestroy(output1); |
|
1492 } |
|
1493 } |
|
1494 else |
|
1495 { |
|
1496 Err |= err; |
|
1497 iLog->Log( _L("GetInfoL API returned error on secound attempt") ); |
|
1498 } |
|
1499 |
|
1500 iLog->Log( _L("Restoring Light Timeout Value to %d"), OldLightTimeOut); |
|
1501 set_lighttimeout_val = CStatus::NewL(OldLightTimeOut); |
|
1502 CleanupStack::PushL(set_lighttimeout_val); |
|
1503 |
|
1504 TRAP(err,obj->SetInfoL(KDisplay,KLightTimeOut,set_lighttimeout_val)); |
|
1505 if(!err) |
|
1506 { |
|
1507 iLog->Log( _L("Light TimeOut value restored to %d"),OldLightTimeOut ); |
|
1508 } |
|
1509 else |
|
1510 { |
|
1511 Err |= err; |
|
1512 iLog->Log( _L("SetInfoL API returned error") ); |
|
1513 } |
|
1514 CleanupStack::PopAndDestroy(set_lighttimeout_val); |
|
1515 #endif |
|
1516 } |
|
1517 } |
|
1518 } |
|
1519 else |
|
1520 { |
|
1521 Err |= err; |
|
1522 iLog->Log( _L("GetInfo API returned error") ); |
|
1523 } |
|
1524 |
|
1525 CleanupStack::PopAndDestroy(obj); |
|
1526 |
|
1527 __UHEAP_MARKEND; |
|
1528 return Err; |
|
1529 } |
|
1530 |
|
1531 TInt Ctsysinfoservicetests::GetSetWallPaperL(CStifItemParser& ) |
|
1532 { |
|
1533 _LIT( KExample, "GetSetWallPaperL" ); |
|
1534 iLog->Log( KExample ); |
|
1535 TInt Err(PASS); |
|
1536 /* |
|
1537 __UHEAP_MARK; |
|
1538 CSysInfoService *obj = CSysInfoService::NewL(); |
|
1539 CleanupStack::PushL(obj); |
|
1540 |
|
1541 CSysData* output=NULL; |
|
1542 TRAPD(err,obj->GetInfoL(KDisplay,KWallpaper,output)); |
|
1543 if (!err) |
|
1544 { |
|
1545 if(!output) |
|
1546 { |
|
1547 Err |= FAIL; |
|
1548 iLog->Log( _L("Output data Set to NULL") ); |
|
1549 } |
|
1550 else |
|
1551 { |
|
1552 CleanupStack::PushL(output); |
|
1553 if( CSysData::EStatus != output->DataType() ) |
|
1554 { |
|
1555 iLog->Log( _L("Invalid output data") ); |
|
1556 Err |= FAIL; |
|
1557 } |
|
1558 else |
|
1559 { |
|
1560 TInt OldLightTimeOut; |
|
1561 CStatus* LightTimeOut = (CStatus*)output; |
|
1562 OldLightTimeOut = LightTimeOut->Status(); |
|
1563 |
|
1564 iLog->Log( _L("System Light TimeOu Value: %d"),OldLightTimeOut ); |
|
1565 CleanupStack::PopAndDestroy(output); |
|
1566 |
|
1567 CStatus* set_lighttimeout_val = CStatus::NewL(5); |
|
1568 CleanupStack::PushL(set_lighttimeout_val); |
|
1569 |
|
1570 TRAPD(err,obj->SetInfoL(KDisplay,KLightTimeOut,set_lighttimeout_val)); |
|
1571 if(!err) |
|
1572 { |
|
1573 iLog->Log( _L("Light timeout set to %d"),5 ); |
|
1574 } |
|
1575 else |
|
1576 { |
|
1577 Err |= err; |
|
1578 iLog->Log( _L("SetInfoL API returned error") ); |
|
1579 } |
|
1580 |
|
1581 CleanupStack::PopAndDestroy(set_lighttimeout_val); |
|
1582 |
|
1583 iLog->Log( _L("Getting Light TimeOut Value after setting to 5") ); |
|
1584 |
|
1585 CSysData* output1=NULL; |
|
1586 TRAP(err,obj->GetInfoL(KDisplay,KLightTimeOut,output1)); |
|
1587 if(!err) |
|
1588 { |
|
1589 if(!output1) |
|
1590 { |
|
1591 Err |= FAIL; |
|
1592 iLog->Log( _L("Output1 data Set to NULL") ); |
|
1593 } |
|
1594 else |
|
1595 { |
|
1596 CleanupStack::PushL(output1); |
|
1597 TInt cur_lighttimeout = ((CStatus*)output1)->Status(); |
|
1598 if (cur_lighttimeout != 5) |
|
1599 { |
|
1600 Err |= FAIL; |
|
1601 iLog->Log( _L("Light TimeOut value not set to 1, read val: %d"), cur_lighttimeout); |
|
1602 } |
|
1603 else |
|
1604 { |
|
1605 iLog->Log( _L("Light TimeOut value set to %d"),cur_lighttimeout); |
|
1606 } |
|
1607 CleanupStack::PopAndDestroy(output1); |
|
1608 } |
|
1609 } |
|
1610 else |
|
1611 { |
|
1612 Err |= err; |
|
1613 iLog->Log( _L("GetInfoL API returned error on secound attempt") ); |
|
1614 } |
|
1615 |
|
1616 iLog->Log( _L("Restoring Light Timeout Value to %d"), OldLightTimeOut); |
|
1617 set_lighttimeout_val = CStatus::NewL(OldLightTimeOut); |
|
1618 CleanupStack::PushL(set_lighttimeout_val); |
|
1619 |
|
1620 TRAP(err,obj->SetInfoL(KDisplay,KLightTimeOut,set_lighttimeout_val)); |
|
1621 if(!err) |
|
1622 { |
|
1623 iLog->Log( _L("Light TimeOut value restored to %d"),OldLightTimeOut ); |
|
1624 } |
|
1625 else |
|
1626 { |
|
1627 Err |= err; |
|
1628 iLog->Log( _L("SetInfoL API returned error") ); |
|
1629 } |
|
1630 CleanupStack::PopAndDestroy(set_lighttimeout_val); |
|
1631 } |
|
1632 } |
|
1633 } |
|
1634 else |
|
1635 { |
|
1636 Err |= err; |
|
1637 iLog->Log( _L("GetInfo API returned error") ); |
|
1638 } |
|
1639 |
|
1640 CleanupStack::PopAndDestroy(obj); |
|
1641 */ |
|
1642 __UHEAP_MARKEND; |
|
1643 return Err; |
|
1644 } |
|
1645 |
|
1646 TInt Ctsysinfoservicetests::GetSetKeyGaurdL(CStifItemParser& /*aItem*/) |
|
1647 { |
|
1648 _LIT( KExample, "GetSetKeyGaurdL" ); |
|
1649 iLog->Log( KExample ); |
|
1650 TInt Err(PASS); |
|
1651 |
|
1652 __UHEAP_MARK; |
|
1653 CSysInfoService *obj = CSysInfoService::NewL(); |
|
1654 CleanupStack::PushL(obj); |
|
1655 |
|
1656 CSysData* output=NULL; |
|
1657 TRAPD(err,obj->GetInfoL(KDisplay,KKeyGaurdTime,output)); |
|
1658 if (!err) |
|
1659 { |
|
1660 if(!output) |
|
1661 { |
|
1662 Err |= FAIL; |
|
1663 iLog->Log( _L("Output data Set to NULL") ); |
|
1664 } |
|
1665 else |
|
1666 { |
|
1667 CleanupStack::PushL(output); |
|
1668 if( CSysData::EStatus != output->DataType() ) |
|
1669 { |
|
1670 iLog->Log( _L("Invalid output data") ); |
|
1671 Err |= FAIL; |
|
1672 } |
|
1673 else |
|
1674 { |
|
1675 TInt OldKeyGaurdTime; |
|
1676 CStatus* keygaurdtime = (CStatus*)output; |
|
1677 OldKeyGaurdTime = keygaurdtime->Status(); |
|
1678 iLog->Log( _L("System keygaurdtime Value: %d"),OldKeyGaurdTime ); |
|
1679 CleanupStack::PopAndDestroy(output); |
|
1680 #ifdef _SET_KEYGAURD_SUPPORTED_ |
|
1681 CStatus* set_keygaurdtime_val = CStatus::NewL(5); |
|
1682 CleanupStack::PushL(set_keygaurdtime_val); |
|
1683 |
|
1684 TRAPD(err,obj->SetInfoL(KDisplay,KKeyGaurdTime,set_keygaurdtime_val)); |
|
1685 if(!err) |
|
1686 { |
|
1687 iLog->Log( _L("KeyGaurd Time set to %d"),5 ); |
|
1688 } |
|
1689 else |
|
1690 { |
|
1691 Err |= err; |
|
1692 iLog->Log( _L("SetInfoL API returned error") ); |
|
1693 } |
|
1694 |
|
1695 CleanupStack::PopAndDestroy(set_keygaurdtime_val); |
|
1696 |
|
1697 iLog->Log( _L("Getting KeyGaurd Time Value after setting to 5") ); |
|
1698 |
|
1699 CSysData* output1=NULL; |
|
1700 TRAP(err,obj->GetInfoL(KDisplay,KKeyGaurdTime,output1)); |
|
1701 if(!err) |
|
1702 { |
|
1703 if(!output1) |
|
1704 { |
|
1705 Err |= FAIL; |
|
1706 iLog->Log( _L("Output data Set to NULL") ); |
|
1707 } |
|
1708 else |
|
1709 { |
|
1710 CleanupStack::PushL(output1); |
|
1711 TInt cur_keygaurdval = ((CStatus*)output1)->Status(); |
|
1712 if (cur_keygaurdval != 5) |
|
1713 { |
|
1714 Err |= FAIL; |
|
1715 iLog->Log( _L("KeyGaurd Time value not set to 5, read val: %d"), cur_keygaurdval); |
|
1716 } |
|
1717 else |
|
1718 { |
|
1719 iLog->Log( _L("KeyGaurd Time value set to 5")); |
|
1720 } |
|
1721 CleanupStack::PopAndDestroy(output1); |
|
1722 } |
|
1723 } |
|
1724 else |
|
1725 { |
|
1726 Err |= err; |
|
1727 iLog->Log( _L("GetInfoL API returned error on secound attempt") ); |
|
1728 } |
|
1729 |
|
1730 iLog->Log( _L("Restoring KeyGaurd Time Value to %d"), OldKeyGaurdTime); |
|
1731 set_keygaurdtime_val = CStatus::NewL(OldKeyGaurdTime); |
|
1732 CleanupStack::PushL(set_keygaurdtime_val); |
|
1733 |
|
1734 TRAP(err,obj->SetInfoL(KDisplay,KKeyGaurdTime,set_keygaurdtime_val)); |
|
1735 if(!err) |
|
1736 { |
|
1737 iLog->Log( _L("KeyGaurd Time Value restored to %d"),OldKeyGaurdTime ); |
|
1738 } |
|
1739 else |
|
1740 { |
|
1741 Err |= err; |
|
1742 iLog->Log( _L("SetInfoL API returned error") ); |
|
1743 } |
|
1744 |
|
1745 CleanupStack::PopAndDestroy(set_keygaurdtime_val); |
|
1746 #endif |
|
1747 } |
|
1748 } |
|
1749 } |
|
1750 else |
|
1751 { |
|
1752 Err |= err; |
|
1753 iLog->Log( _L("GetInfo API returned error") ); |
|
1754 } |
|
1755 |
|
1756 CleanupStack::PopAndDestroy(obj); |
|
1757 |
|
1758 __UHEAP_MARKEND; |
|
1759 return Err; |
|
1760 } |
|
1761 |
|
1762 |
|
1763 |
|
1764 |
|
1765 //returns OS VERSION |
|
1766 void Ctsysinfoservicetests::GetOSVersion(TInt& aMajor,TInt& aMinor) |
|
1767 { |
|
1768 TInt MachineId; |
|
1769 HAL::Get(HALData::EMachineUid, MachineId); |
|
1770 switch(MachineId) |
|
1771 { |
|
1772 case 0x101F466A : |
|
1773 case 0x101F8C19 : |
|
1774 case 0x101FB2B1 : |
|
1775 case 0x10005E33 : |
|
1776 case 0X101FA031 : |
|
1777 case 0x101F9071 : |
|
1778 aMajor = 6; |
|
1779 aMinor = 1; |
|
1780 break; |
|
1781 case 0x101F408B : |
|
1782 case 0x101FB2AE : |
|
1783 case 0x10200AC6 : |
|
1784 case 0x101F6B26 : |
|
1785 aMajor = 7; |
|
1786 aMinor = 0; |
|
1787 break; |
|
1788 case 0x10200F97 : |
|
1789 case 0x101FB3DD : |
|
1790 case 0x101FB3F4 : |
|
1791 case 0x101FB3F3 : |
|
1792 case 0x101F3EE3 : |
|
1793 case 0x101FBE09 : |
|
1794 case 0x101F8ED1 : |
|
1795 case 0x1020E048 : |
|
1796 case 0x101FF525 : //iversion = 7.0s; |
|
1797 aMajor = 7; |
|
1798 aMinor = 0; |
|
1799 break; |
|
1800 |
|
1801 case 0x101FBB55 : |
|
1802 case 0x10200f99 : |
|
1803 case 0x10200F9C : |
|
1804 case 0x10200F9B : |
|
1805 // iversion 8.0a; |
|
1806 aMajor = 8; |
|
1807 aMinor = 0; |
|
1808 break; |
|
1809 case 0x10200F9A : |
|
1810 case 0x10200F98 : |
|
1811 //iversion 8.1a; |
|
1812 aMajor = 8; |
|
1813 aMinor = 1; |
|
1814 break; |
|
1815 case 0x1020E285 : |
|
1816 case 0x10274BFA : |
|
1817 case 0x10274BF9 : |
|
1818 case 0x200005F8 : |
|
1819 case 0x20000602 : |
|
1820 case 0x200005FF : |
|
1821 case 0x200005FB : |
|
1822 case 0x200005FE : |
|
1823 case 0x20000601 : |
|
1824 case 0x200005F9 : |
|
1825 case 0x200005FC : |
|
1826 case 0x200005FA : |
|
1827 case 0x20000600 : |
|
1828 case 0x20000605 : |
|
1829 case 0x20002495 : |
|
1830 case 0x20001856 : |
|
1831 case 0x20001858 : |
|
1832 case 0x20002D7F : |
|
1833 case 0x20001859 : |
|
1834 case 0x20000604 : |
|
1835 case 0x20001857 : |
|
1836 aMajor = 9; |
|
1837 aMinor = 1; |
|
1838 break; |
|
1839 case 0x20002D7C : |
|
1840 case 0x20002D7B : |
|
1841 case 0x20002D7E : |
|
1842 case 0x20000606 : |
|
1843 case 0x2000060A : |
|
1844 case 0x2000060B : |
|
1845 case 0x20002496 : |
|
1846 aMajor = 9; |
|
1847 aMinor = 2; |
|
1848 break; |
|
1849 case 0x101fb3e8 : |
|
1850 case 0x2000da56 : |
|
1851 aMajor = 9; |
|
1852 aMinor = 3; |
|
1853 break; |
|
1854 } |
|
1855 } |
|
1856 |
|
1857 void Ctsysinfoservicetests::GetPlatformVersion(TInt& aMajor, TInt& aMinor) |
|
1858 { |
|
1859 //get platform version |
|
1860 RFs fs; |
|
1861 CDir* result; |
|
1862 |
|
1863 |
|
1864 CleanupClosePushL(fs); |
|
1865 User::LeaveIfError(fs.Connect()); |
|
1866 |
|
1867 TFindFile ff(fs); |
|
1868 TInt err(KErrNone); |
|
1869 err = ff.FindWildByDir(KS60ProductIdFile,KROMInstallDir,result); |
|
1870 if(!err) |
|
1871 { |
|
1872 CleanupStack::PushL(result); |
|
1873 User::LeaveIfError(result->Sort(ESortByName|EDescending)); |
|
1874 |
|
1875 if(result->Count() >= 0) |
|
1876 { |
|
1877 TPtrC filename = (*result)[0].iName; |
|
1878 TLex parser((filename)); |
|
1879 parser.Inc(9); |
|
1880 |
|
1881 // Get major version value |
|
1882 err = parser.Val(aMajor); |
|
1883 |
|
1884 if( parser.Get() != '.' || err ) |
|
1885 { |
|
1886 aMajor = 0; |
|
1887 } |
|
1888 else |
|
1889 { |
|
1890 // Get minor version value |
|
1891 err = parser.Val(aMinor); |
|
1892 if( err ) |
|
1893 { |
|
1894 aMajor = 0; |
|
1895 aMinor = 0; |
|
1896 } |
|
1897 } |
|
1898 } |
|
1899 // clean up result |
|
1900 CleanupStack::PopAndDestroy(result); |
|
1901 } |
|
1902 // clean up file session fs. |
|
1903 CleanupStack::PopAndDestroy(&fs); |
|
1904 } |
|
1905 |
|
1906 TInt Ctsysinfoservicetests::TestE70() |
|
1907 { |
|
1908 _LIT( KExample, "TestE70L" ); |
|
1909 iLog->Log( KExample ); |
|
1910 TInt Err(PASS); |
|
1911 |
|
1912 __UHEAP_MARK; |
|
1913 CSysInfoService *obj = CSysInfoService::NewL(); |
|
1914 CleanupStack::PushL(obj); |
|
1915 |
|
1916 TInt ExpectedValue[KSize]= |
|
1917 { |
|
1918 ETrue, //KCamera |
|
1919 ETrue, //KMemoryCard |
|
1920 EFalse, //KFMRadio |
|
1921 ETrue, //KQwerty |
|
1922 ETrue, //KWLan |
|
1923 ETrue, //KUsb |
|
1924 EFalse, //KPen |
|
1925 EFalse, //KLED |
|
1926 EFalse, //KCoverUI |
|
1927 EFalse, //KSideVolumeKeys |
|
1928 ETrue, //KVibra |
|
1929 }; |
|
1930 |
|
1931 for(TInt i=0;i<KSize;i++) |
|
1932 { |
|
1933 CSysData* output=NULL; |
|
1934 TRAPD(err,obj->GetInfoL(KFeatures,KFeature[i],output)); |
|
1935 if (!err) |
|
1936 { |
|
1937 if(!output) |
|
1938 { |
|
1939 Err |= FAIL; |
|
1940 iLog->Log( _L("Output data Set to NULL feature: %s"),KFeature[i].Ptr() ); |
|
1941 } |
|
1942 else |
|
1943 { |
|
1944 CleanupStack::PushL(output); |
|
1945 if( CSysData::EStatus != output->DataType() ) |
|
1946 { |
|
1947 iLog->Log( _L("Invalid output data: %s"), KFeature[i].Ptr()); |
|
1948 Err |= FAIL; |
|
1949 } |
|
1950 else |
|
1951 { |
|
1952 TInt IsSupported = ((CStatus*)output)->Status(); |
|
1953 |
|
1954 if(IsSupported) |
|
1955 { |
|
1956 iLog->Log( _L("Feature %s: Supported"), KFeature[i].Ptr()); |
|
1957 } |
|
1958 else |
|
1959 { |
|
1960 iLog->Log( _L("Feature %s: Not Supported"), KFeature[i].Ptr()); |
|
1961 } |
|
1962 |
|
1963 if(ExpectedValue[i] != IsSupported) |
|
1964 { |
|
1965 iLog->Log( _L("Incorrect Feature of the device configuration :%s"), KFeature[i].Ptr()); |
|
1966 Err |= FAIL; |
|
1967 } |
|
1968 } |
|
1969 CleanupStack::PopAndDestroy(output); |
|
1970 } |
|
1971 } |
|
1972 else |
|
1973 { |
|
1974 Err |= err; |
|
1975 iLog->Log( _L("GetInfo API returned error") ); |
|
1976 } |
|
1977 } |
|
1978 CleanupStack::PopAndDestroy(obj); |
|
1979 return Err; |
|
1980 } |
|
1981 |
|
1982 TInt Ctsysinfoservicetests::TestDevlon() |
|
1983 { |
|
1984 _LIT( KExample, "TestDevlon" ); |
|
1985 iLog->Log( KExample ); |
|
1986 TInt Err(PASS); |
|
1987 |
|
1988 __UHEAP_MARK; |
|
1989 CSysInfoService *obj = CSysInfoService::NewL(); |
|
1990 CleanupStack::PushL(obj); |
|
1991 |
|
1992 TInt ExpectedValue[KSize]= |
|
1993 { |
|
1994 ETrue, //KCamera |
|
1995 ETrue, //KMemoryCard |
|
1996 ETrue, //KFMRadio |
|
1997 EFalse, //KQwerty |
|
1998 ETrue, //KWLan |
|
1999 ETrue, //KUsb |
|
2000 ETrue, //KPen |
|
2001 EFalse, //KLED |
|
2002 EFalse, //KCoverUI |
|
2003 ETrue, //KSideVolumeKeys |
|
2004 ETrue, //KVibra |
|
2005 }; |
|
2006 |
|
2007 for(TInt i=0;i<KSize;i++) |
|
2008 { |
|
2009 CSysData* output=NULL; |
|
2010 TRAPD(err,obj->GetInfoL(KFeatures,KFeature[i],output)); |
|
2011 if (!err) |
|
2012 { |
|
2013 if(!output) |
|
2014 { |
|
2015 Err |= FAIL; |
|
2016 iLog->Log( _L("Output data Set to NULL feature: %s"),KFeature[i].Ptr() ); |
|
2017 } |
|
2018 else |
|
2019 { |
|
2020 CleanupStack::PushL(output); |
|
2021 if( CSysData::EStatus != output->DataType() ) |
|
2022 { |
|
2023 iLog->Log( _L("Invalid output data: %s"), KFeature[i].Ptr()); |
|
2024 Err |= FAIL; |
|
2025 } |
|
2026 else |
|
2027 { |
|
2028 TInt IsSupported = ((CStatus*)output)->Status(); |
|
2029 |
|
2030 if(IsSupported) |
|
2031 { |
|
2032 iLog->Log( _L("Feature %s: Supported"), KFeature[i].Ptr()); |
|
2033 } |
|
2034 else |
|
2035 { |
|
2036 iLog->Log( _L("Feature %s: Not Supported"), KFeature[i].Ptr()); |
|
2037 } |
|
2038 |
|
2039 if(ExpectedValue[i] != IsSupported) |
|
2040 { |
|
2041 iLog->Log( _L("Incorrect Feature of the device configuration :%s"), KFeature[i].Ptr()); |
|
2042 Err |= FAIL; |
|
2043 } |
|
2044 } |
|
2045 CleanupStack::PopAndDestroy(output); |
|
2046 } |
|
2047 } |
|
2048 else |
|
2049 { |
|
2050 Err |= err; |
|
2051 iLog->Log( _L("GetInfo API returned error") ); |
|
2052 } |
|
2053 } |
|
2054 CleanupStack::PopAndDestroy(obj); |
|
2055 return Err; |
|
2056 } |
|
2057 |
|
2058 TInt Ctsysinfoservicetests::TestN6290() |
|
2059 { |
|
2060 _LIT( KExample, "TestN6290" ); |
|
2061 iLog->Log( KExample ); |
|
2062 TInt Err(PASS); |
|
2063 |
|
2064 __UHEAP_MARK; |
|
2065 CSysInfoService *obj = CSysInfoService::NewL(); |
|
2066 CleanupStack::PushL(obj); |
|
2067 |
|
2068 TInt ExpectedValue[KSize]= |
|
2069 { |
|
2070 ETrue, //KCamera |
|
2071 ETrue, //KMemoryCard |
|
2072 ETrue, //KFMRadio |
|
2073 EFalse, //KQwerty |
|
2074 EFalse, //KWLan |
|
2075 ETrue, //KUsb |
|
2076 EFalse, //KPen |
|
2077 EFalse, //KLED |
|
2078 EFalse, //KCoverUI // but supported need to check. |
|
2079 ETrue, //KSideVolumeKeys |
|
2080 ETrue, //KVibra |
|
2081 }; |
|
2082 |
|
2083 for(TInt i=0;i<KSize;i++) |
|
2084 { |
|
2085 CSysData* output=NULL; |
|
2086 TRAPD(err,obj->GetInfoL(KFeatures,KFeature[i],output)); |
|
2087 if (!err) |
|
2088 { |
|
2089 if(!output) |
|
2090 { |
|
2091 Err |= FAIL; |
|
2092 iLog->Log( _L("Output data Set to NULL feature: %s"),KFeature[i].Ptr() ); |
|
2093 } |
|
2094 else |
|
2095 { |
|
2096 CleanupStack::PushL(output); |
|
2097 if( CSysData::EStatus != output->DataType() ) |
|
2098 { |
|
2099 iLog->Log( _L("Invalid output data: %s"), KFeature[i].Ptr()); |
|
2100 Err |= FAIL; |
|
2101 } |
|
2102 else |
|
2103 { |
|
2104 TInt IsSupported = ((CStatus*)output)->Status(); |
|
2105 |
|
2106 if(IsSupported) |
|
2107 { |
|
2108 iLog->Log( _L("Feature %s: Supported"), KFeature[i].Ptr()); |
|
2109 } |
|
2110 else |
|
2111 { |
|
2112 iLog->Log( _L("Feature %s: Not Supported"), KFeature[i].Ptr()); |
|
2113 } |
|
2114 |
|
2115 if(ExpectedValue[i] != IsSupported) |
|
2116 { |
|
2117 iLog->Log( _L("Incorrect Feature of the device configuration :%s"), KFeature[i].Ptr()); |
|
2118 Err |= FAIL; |
|
2119 } |
|
2120 } |
|
2121 CleanupStack::PopAndDestroy(output); |
|
2122 } |
|
2123 } |
|
2124 else |
|
2125 { |
|
2126 Err |= err; |
|
2127 iLog->Log( _L("GetInfo API returned error: %d"),err ); |
|
2128 } |
|
2129 } |
|
2130 CleanupStack::PopAndDestroy(obj); |
|
2131 return Err; |
|
2132 } |
|
2133 |
|
2134 |
|
2135 // ----------------------------------------------------------------------------- |
|
2136 // Ctsysinfoservicetests::VibraStatus |
|
2137 // |
|
2138 // ----------------------------------------------------------------------------- |
|
2139 // |
|
2140 TInt Ctsysinfoservicetests::VibraStatus(CStifItemParser& /*aItem*/) |
|
2141 { |
|
2142 |
|
2143 int ret=0; |
|
2144 ret = VibraNotification(); |
|
2145 |
|
2146 if(ret==0) |
|
2147 return KErrNone; |
|
2148 else |
|
2149 return KErrGeneral; |
|
2150 } |
|
2151 // ----------------------------------------------------------------------------- |
|
2152 // Ctsysinfoservicetests::PredText |
|
2153 // |
|
2154 // ----------------------------------------------------------------------------- |
|
2155 // |
|
2156 TInt Ctsysinfoservicetests::PredText(CStifItemParser& /*aItem*/) |
|
2157 { int ret=0; |
|
2158 ret = PredTextNotification(); |
|
2159 |
|
2160 if(ret==0) |
|
2161 return KErrNone; |
|
2162 else |
|
2163 return KErrGeneral; |
|
2164 } |
|
2165 |
|
2166 // ----------------------------------------------------------------------------- |
|
2167 // Ctsysinfoservicetests::InputLang |
|
2168 // |
|
2169 // ----------------------------------------------------------------------------- |
|
2170 // |
|
2171 TInt Ctsysinfoservicetests::InputLang(CStifItemParser& /*aItem*/) |
|
2172 { int ret=0; |
|
2173 ret = InputLangNotification(); |
|
2174 |
|
2175 if(ret==0) |
|
2176 return KErrNone; |
|
2177 else |
|
2178 return KErrGeneral; |
|
2179 } |
|
2180 |
|
2181 // ----------------------------------------------------------------------------- |
|
2182 // Ctsysinfoservicetests::GetDisplayLang |
|
2183 // |
|
2184 // ----------------------------------------------------------------------------- |
|
2185 // |
|
2186 TInt Ctsysinfoservicetests::GetDisplayLang(CStifItemParser& /*aItem*/) |
|
2187 { |
|
2188 |
|
2189 TInt result = KErrNone; |
|
2190 __UHEAP_MARK; |
|
2191 |
|
2192 |
|
2193 _LIT( KExample, "GetDisplayLang:" ); |
|
2194 iLog->Log( KExample ); |
|
2195 |
|
2196 |
|
2197 CSysInfoService* iSysInfoService = CSysInfoService::NewL(); |
|
2198 |
|
2199 CleanupStack::PushL(iSysInfoService); |
|
2200 |
|
2201 |
|
2202 CSysData* data2 = NULL; |
|
2203 |
|
2204 TRAPD(err,iSysInfoService->GetInfoL(KGeneral,KDisplayLanguage,data2)); |
|
2205 if( err != KErrNotFound ) |
|
2206 { |
|
2207 iLog->Log( _L("Failed,Get Display language found ret err: %d"),err ); |
|
2208 result = KErrGeneral; |
|
2209 } |
|
2210 else |
|
2211 { |
|
2212 result = KErrNone; |
|
2213 iLog->Log( _L("Passed Get Display language not found") ); |
|
2214 } |
|
2215 |
|
2216 delete data2; |
|
2217 |
|
2218 CleanupStack::PopAndDestroy(1); |
|
2219 __UHEAP_MARKEND; |
|
2220 |
|
2221 return result; |
|
2222 |
|
2223 |
|
2224 } |
|
2225 |
|
2226 // ----------------------------------------------------------------------------- |
|
2227 // Ctsysinfoservicetests::SetDisplayLang |
|
2228 // |
|
2229 // ----------------------------------------------------------------------------- |
|
2230 // |
|
2231 TInt Ctsysinfoservicetests::SetDisplayLang(CStifItemParser& /*aItem*/) |
|
2232 { |
|
2233 |
|
2234 TInt result = KErrNone; |
|
2235 |
|
2236 __UHEAP_MARK; |
|
2237 |
|
2238 CSysInfoService* iSysInfoService = CSysInfoService::NewL(); |
|
2239 |
|
2240 CleanupStack::PushL(iSysInfoService); |
|
2241 |
|
2242 |
|
2243 CStatus* data = CStatus::NewL(10); |
|
2244 CleanupStack::PushL(data); |
|
2245 TRAPD(err,iSysInfoService->SetInfoL(KGeneral,KDisplayLanguage,data)); |
|
2246 if( err != KErrNotFound ) |
|
2247 { |
|
2248 iLog->Log( _L("Failed,Set Display language found ret err: %d"),err ); |
|
2249 result = KErrGeneral; |
|
2250 } |
|
2251 else |
|
2252 { |
|
2253 result = KErrNone; |
|
2254 iLog->Log( _L("Passed Set Display language not found") ); |
|
2255 } |
|
2256 CleanupStack::PopAndDestroy(data); |
|
2257 |
|
2258 CSysData *data1 = NULL; |
|
2259 TRAPD(err1,iSysInfoService->GetInfoL(KGeneral,KDisplayLanguage,data1)); |
|
2260 if( err1 != KErrNotFound ) |
|
2261 { |
|
2262 iLog->Log( _L("Failed,Set Display language found ret err: %d"),err ); |
|
2263 result = KErrGeneral; |
|
2264 } |
|
2265 else |
|
2266 { |
|
2267 result = KErrNone; |
|
2268 iLog->Log( _L("Passed Set Display language not found") ); |
|
2269 } |
|
2270 delete data1; |
|
2271 |
|
2272 CleanupStack::PopAndDestroy(1); |
|
2273 __UHEAP_MARKEND; |
|
2274 |
|
2275 return result; |
|
2276 |
|
2277 |
|
2278 } |
|
2279 // ----------------------------------------------------------------------------- |
|
2280 // Ctsysinfoservicetests::SetInputLang |
|
2281 // |
|
2282 // ----------------------------------------------------------------------------- |
|
2283 // |
|
2284 TInt Ctsysinfoservicetests::SetInputLang(CStifItemParser& /*aItem*/) |
|
2285 { |
|
2286 |
|
2287 TInt result = KErrNone; |
|
2288 TInt oldInputLang ,newInputLang; |
|
2289 |
|
2290 __UHEAP_MARK; |
|
2291 |
|
2292 CSysInfoService* iSysInfoService = CSysInfoService::NewL(); |
|
2293 |
|
2294 CleanupStack::PushL(iSysInfoService); |
|
2295 |
|
2296 CSysData* data1 = NULL; |
|
2297 |
|
2298 TRAPD(err1,iSysInfoService->GetInfoL(KGeneral,KSupportedLanguages,data1)); |
|
2299 result = err1; |
|
2300 |
|
2301 if(err1 == KErrNone) |
|
2302 { |
|
2303 |
|
2304 CSysData* data2 = NULL; |
|
2305 |
|
2306 TRAPD(err2,iSysInfoService->GetInfoL(KGeneral,KInputLanguage,data2)); |
|
2307 oldInputLang = ((CStatus*)data2)->Status(); |
|
2308 |
|
2309 result = err2; |
|
2310 if(err2 == KErrNone) |
|
2311 { |
|
2312 |
|
2313 for(TInt i=0;i< ((CLanguageList*)data1)->Count() ;i++) |
|
2314 { |
|
2315 ((CLanguageList*)data1)->At(i,newInputLang); |
|
2316 if(newInputLang != oldInputLang) |
|
2317 { |
|
2318 break; |
|
2319 } |
|
2320 } |
|
2321 |
|
2322 CStatus* data3 = CStatus::NewL(newInputLang); |
|
2323 |
|
2324 TRAPD(err3,iSysInfoService->SetInfoL(KGeneral,KInputLanguage,data3)); |
|
2325 TInt changedInputLang = ((CStatus*)data3)->Status(); |
|
2326 result = err3; |
|
2327 if(err3 == KErrNone) |
|
2328 { |
|
2329 if(newInputLang == changedInputLang) |
|
2330 { |
|
2331 result = KErrNone; |
|
2332 } |
|
2333 else |
|
2334 { |
|
2335 result = KErrGeneral; |
|
2336 |
|
2337 } |
|
2338 delete data2; |
|
2339 delete data3; |
|
2340 |
|
2341 } |
|
2342 } |
|
2343 } |
|
2344 |
|
2345 CleanupStack::PopAndDestroy(1); |
|
2346 delete data1; |
|
2347 |
|
2348 __UHEAP_MARKEND; |
|
2349 |
|
2350 return result; |
|
2351 |
|
2352 |
|
2353 |
|
2354 } |
|
2355 // ----------------------------------------------------------------------------- |
|
2356 // Ctsysinfoservicetests::SupportedLang |
|
2357 // |
|
2358 // ----------------------------------------------------------------------------- |
|
2359 // |
|
2360 TInt Ctsysinfoservicetests::SupportedLang(CStifItemParser& /*aItem*/) |
|
2361 { |
|
2362 |
|
2363 TInt result = KErrNone; |
|
2364 TInt newDisplayLang; |
|
2365 |
|
2366 __UHEAP_MARK; |
|
2367 |
|
2368 _LIT( KExample, "SupportedLang:" ); |
|
2369 iLog->Log( KExample ); |
|
2370 |
|
2371 |
|
2372 CSysInfoService* iSysInfoService = CSysInfoService::NewL(); |
|
2373 |
|
2374 CleanupStack::PushL(iSysInfoService); |
|
2375 |
|
2376 CSysData* data1 = NULL; |
|
2377 |
|
2378 TRAPD(err1,iSysInfoService->GetInfoL(KGeneral,KSupportedLanguages,data1)); |
|
2379 |
|
2380 if(err1 == KErrNone) |
|
2381 { |
|
2382 TInt lang; |
|
2383 for(TInt i=0;i< ((CLanguageList*)data1)->Count() ;i++) |
|
2384 { |
|
2385 ((CLanguageList*)data1)->At(i,lang); |
|
2386 TBuf8<50> buf; |
|
2387 buf.AppendNum(newDisplayLang); |
|
2388 iLog->Log(buf); |
|
2389 } |
|
2390 } |
|
2391 else |
|
2392 { |
|
2393 iLog->Log(_L("Error GetInfo on supported languages: %d"),err1); |
|
2394 } |
|
2395 |
|
2396 result = err1; |
|
2397 CleanupStack::PopAndDestroy(1); |
|
2398 delete data1; |
|
2399 |
|
2400 __UHEAP_MARKEND; |
|
2401 |
|
2402 return result; |
|
2403 } |
|
2404 // ----------------------------------------------------------------------------- |
|
2405 // Ctsysinfoservicetests::AvailableUSBModes |
|
2406 // |
|
2407 // ----------------------------------------------------------------------------- |
|
2408 // |
|
2409 |
|
2410 TInt Ctsysinfoservicetests::AvailableUSBModes(CStifItemParser& /*aItem*/) |
|
2411 { |
|
2412 TInt result = KErrNone; |
|
2413 TPtrC usbModes; |
|
2414 |
|
2415 #if (!(defined(__WINS__) || defined(__WINSCW__))) |
|
2416 |
|
2417 __UHEAP_MARK; |
|
2418 _LIT( KExample, "AvailableUSBModes:" ); |
|
2419 iLog->Log( KExample ); |
|
2420 |
|
2421 CSysInfoService* iSysInfoService = CSysInfoService::NewL(); |
|
2422 |
|
2423 CleanupStack::PushL(iSysInfoService); |
|
2424 |
|
2425 |
|
2426 CSysData* data1 = NULL; |
|
2427 |
|
2428 TRAPD(err1,iSysInfoService->GetInfoL(KGeneral,KAvailableUSBModes,data1)); |
|
2429 |
|
2430 if(err1 == KErrNone) |
|
2431 { |
|
2432 for(TInt i=0;i< ((CStringList*)data1)->Count() ;i++) |
|
2433 { |
|
2434 ((CStringList*)data1)->At(i,usbModes); |
|
2435 TBuf<50> buf; |
|
2436 buf.Copy(usbModes); |
|
2437 iLog->Log(buf); |
|
2438 |
|
2439 } |
|
2440 } |
|
2441 result = err1; |
|
2442 CleanupStack::PopAndDestroy(1); |
|
2443 delete data1; |
|
2444 __UHEAP_MARKEND; |
|
2445 |
|
2446 #endif |
|
2447 |
|
2448 return result; |
|
2449 } |
|
2450 |
|
2451 // ----------------------------------------------------------------------------- |
|
2452 // Ctsysinfoservicetests::ActiveUSBModes |
|
2453 // |
|
2454 // ----------------------------------------------------------------------------- |
|
2455 // |
|
2456 TInt Ctsysinfoservicetests::ActiveUSBModes(CStifItemParser& /*aItem*/) |
|
2457 { |
|
2458 TInt result = KErrNone; |
|
2459 TPtrC activeUsbmode; |
|
2460 |
|
2461 #if (!(defined(__WINS__) || defined(__WINSCW__))) |
|
2462 __UHEAP_MARK; |
|
2463 |
|
2464 _LIT( KExample, "Active USB Modes:" ); |
|
2465 iLog->Log( KExample ); |
|
2466 |
|
2467 |
|
2468 CSysInfoService* iSysInfoService = CSysInfoService::NewL(); |
|
2469 |
|
2470 CleanupStack::PushL(iSysInfoService); |
|
2471 |
|
2472 CSysData* data1 = NULL; |
|
2473 |
|
2474 TRAPD(err1,iSysInfoService->GetInfoL(KGeneral,KActiveUSBMode,data1)); |
|
2475 |
|
2476 if(err1 == KErrNone) |
|
2477 { |
|
2478 ((CStringData*)data1)->StringData(activeUsbmode); |
|
2479 iLog->Log(_L("active usb mode...............")); |
|
2480 TBuf<50> mode; |
|
2481 mode.Copy(activeUsbmode); |
|
2482 iLog->Log(mode); |
|
2483 |
|
2484 |
|
2485 } |
|
2486 CleanupStack::Pop(1); |
|
2487 result = err1; |
|
2488 delete data1; |
|
2489 delete iSysInfoService; |
|
2490 |
|
2491 __UHEAP_MARKEND; |
|
2492 |
|
2493 #endif |
|
2494 return result; |
|
2495 } |
|
2496 |
|
2497 |
|
2498 // ----------------------------------------------------------------------------- |
|
2499 // Ctsysinfoservicetests::ConnectedAcc |
|
2500 // |
|
2501 // ----------------------------------------------------------------------------- |
|
2502 // |
|
2503 |
|
2504 TInt Ctsysinfoservicetests::ConnectedAcc(CStifItemParser& /*aItem*/) |
|
2505 { |
|
2506 TInt result = 0; |
|
2507 TPtrC usbModes; |
|
2508 // On Emulator this is not supported. |
|
2509 #if (! (defined(__WINS__) || defined(__WINSCW__)) ) |
|
2510 |
|
2511 __UHEAP_MARK; |
|
2512 |
|
2513 _LIT( KExample, "Connected Accessories:" ); |
|
2514 iLog->Log( KExample ); |
|
2515 |
|
2516 |
|
2517 CSysInfoService* iSysInfoService = CSysInfoService::NewL(); |
|
2518 |
|
2519 CleanupStack::PushL(iSysInfoService); |
|
2520 |
|
2521 |
|
2522 CSysData* data1 = NULL; |
|
2523 |
|
2524 const CAccessoryInfo* accInfo= NULL; |
|
2525 |
|
2526 TRAPD(err1,iSysInfoService->GetInfoL(KGeneral,KConnectedAccessories,data1)); |
|
2527 |
|
2528 if(err1 == KErrNone) |
|
2529 { |
|
2530 for(TInt i=0;i< ((CAccList*)data1)->Count() ;i++) |
|
2531 { |
|
2532 ((CAccList*)data1)->AtL(i,accInfo); |
|
2533 TBuf8<50> acctype ; |
|
2534 TBuf8<50> accConnState; |
|
2535 acctype.AppendNum( accInfo->AccessoryType() ); |
|
2536 accConnState.AppendNum( accInfo->ConnectionState() ); |
|
2537 iLog->Log(_L("Accessory Type:")); |
|
2538 iLog->Log(acctype); |
|
2539 |
|
2540 iLog->Log(_L("Accessory Connection State:")); |
|
2541 iLog->Log(accConnState); |
|
2542 |
|
2543 |
|
2544 |
|
2545 } |
|
2546 } |
|
2547 result = err1; |
|
2548 CleanupStack::PopAndDestroy(1); |
|
2549 delete data1; |
|
2550 |
|
2551 __UHEAP_MARKEND; |
|
2552 #endif |
|
2553 return result; |
|
2554 } |
|
2555 |
|
2556 // ----------------------------------------------------------------------------- |
|
2557 // Ctsysinfoservicetests::VibraNotificationCancel |
|
2558 // |
|
2559 // ----------------------------------------------------------------------------- |
|
2560 // |
|
2561 TInt Ctsysinfoservicetests::NotificationCancelVibra(CStifItemParser& /*aItem*/) |
|
2562 { |
|
2563 |
|
2564 int ret=0; |
|
2565 ret = VibraNotificationCancel(); |
|
2566 |
|
2567 if(ret==0) |
|
2568 return KErrNone; |
|
2569 else |
|
2570 return KErrGeneral; |
|
2571 } |
|
2572 |
|
2573 |
|
2574 TInt Ctsysinfoservicetests::ConnBluetooth(CStifItemParser& /*aItem*/) |
|
2575 { int ret=0; |
|
2576 ret = ReqNotification(0, NULL); |
|
2577 |
|
2578 if(ret==0) |
|
2579 return KErrNone; |
|
2580 else |
|
2581 return KErrGeneral; |
|
2582 } |
|
2583 |
|
2584 TInt Ctsysinfoservicetests::IRStatus(CStifItemParser& /*aItem*/) |
|
2585 { int ret=0; |
|
2586 ret = IRNotification(0, NULL); |
|
2587 |
|
2588 if(ret==0) |
|
2589 return KErrNone; |
|
2590 else |
|
2591 return KErrGeneral; |
|
2592 } |
|
2593 |
|
2594 TInt Ctsysinfoservicetests::GetActiveConnections(CStifItemParser& /*aItem*/) |
|
2595 { |
|
2596 _LIT( KExample, "GetActiveConnections" ); |
|
2597 iLog->Log( KExample ); |
|
2598 |
|
2599 int ret=0; |
|
2600 ret = ActiveConnection(iLog); |
|
2601 |
|
2602 if(ret==0) |
|
2603 return KErrNone; |
|
2604 else |
|
2605 return KErrGeneral; |
|
2606 } |
|
2607 |
|
2608 |
|
2609 TInt Ctsysinfoservicetests::GetWlanMacAddress(CStifItemParser& /*aItem*/) |
|
2610 { |
|
2611 int ret=0; |
|
2612 |
|
2613 #if (!(defined(__WINS__) || defined(__WINSCW__))) |
|
2614 TInt Err(PASS); |
|
2615 |
|
2616 _LIT( KExample, "GetWlanMacAddress" ); |
|
2617 iLog->Log( KExample ); |
|
2618 TPtrC wlanAddress; |
|
2619 |
|
2620 CSysInfoService* iSysInfoService = CSysInfoService::NewL(); |
|
2621 |
|
2622 CleanupStack::PushL(iSysInfoService); |
|
2623 CSysData* data2 = NULL; |
|
2624 |
|
2625 TRAPD(err1,iSysInfoService->GetInfoL(KFeatures,KWLan,data2)); |
|
2626 if (!err1) |
|
2627 { |
|
2628 if(!data2) |
|
2629 { |
|
2630 Err |= FAIL; |
|
2631 iLog->Log( _L("Output data Set to NULL feature: %s"),KWLan ); |
|
2632 } |
|
2633 else |
|
2634 { |
|
2635 CleanupStack::PushL(data2); |
|
2636 if( CSysData::EStatus != data2->DataType() ) |
|
2637 { |
|
2638 iLog->Log( _L("Invalid output data: %s"), KWLan); |
|
2639 Err |= FAIL; |
|
2640 } |
|
2641 else |
|
2642 { |
|
2643 TInt IsSupported = ((CStatus*)data2)->Status(); |
|
2644 |
|
2645 if(IsSupported) |
|
2646 { |
|
2647 CSysData* data1 = NULL; |
|
2648 |
|
2649 TRAPD(err1,iSysInfoService->GetInfoL(KConnectivity,KWLanMacAddress,data1)); |
|
2650 ret = err1; |
|
2651 if(err1 == KErrNone) |
|
2652 { |
|
2653 ((CStringData*)data1)->StringData(wlanAddress); |
|
2654 |
|
2655 iLog->Log(_L("WlanMacAddress:")); |
|
2656 TBuf8<50> buf; |
|
2657 buf.Copy(wlanAddress); |
|
2658 iLog->Log(buf); |
|
2659 |
|
2660 } |
|
2661 else |
|
2662 { |
|
2663 iLog->Log(_L("Error reading: %d"),err1); |
|
2664 } |
|
2665 delete data1; |
|
2666 } |
|
2667 } |
|
2668 CleanupStack::Pop(1); |
|
2669 } |
|
2670 } |
|
2671 delete data2; |
|
2672 CleanupStack::PopAndDestroy(1); |
|
2673 |
|
2674 #endif |
|
2675 return ret; |
|
2676 |
|
2677 } |
|
2678 |
|
2679 |
|
2680 TInt Ctsysinfoservicetests::GetActiveConnectionsCancel(CStifItemParser& /*aItem*/) |
|
2681 { |
|
2682 |
|
2683 _LIT( KExample, "ConnNotification" ); |
|
2684 iLog->Log( KExample ); |
|
2685 |
|
2686 int ret=0; |
|
2687 ret = GetActiveConnReqCancel(); |
|
2688 |
|
2689 if(ret==0) |
|
2690 return KErrNone; |
|
2691 else |
|
2692 return KErrGeneral; |
|
2693 } |
|
2694 |
|
2695 |
|
2696 |