author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 24 Nov 2009 08:56:33 +0200 | |
changeset 33 | 50974a8b132e |
parent 19 | 989d2f495d90 |
permissions | -rw-r--r-- |
19 | 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: Tests device information |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
||
21 |
// INCLUDE FILES |
|
22 |
#include <e32svr.h> |
|
23 |
#include <StifParser.h> |
|
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
24 |
#include <StifTestInterface.h> |
19 | 25 |
#include "tsysdevice.h" |
26 |
#include <sysutil.h> |
|
27 |
||
28 |
// EXTERNAL DATA STRUCTURES |
|
29 |
//extern ?external_data; |
|
30 |
||
31 |
// EXTERNAL FUNCTION PROTOTYPES |
|
32 |
//extern ?external_function( ?arg_type,?arg_type ); |
|
33 |
||
34 |
// CONSTANTS |
|
35 |
//const ?type ?constant_var = ?constant; |
|
36 |
||
37 |
// MACROS |
|
38 |
//#define ?macro ?macro_def |
|
39 |
||
40 |
// LOCAL CONSTANTS AND MACROS |
|
41 |
//const ?type ?constant_var = ?constant; |
|
42 |
//#define ?macro_name ?macro_def |
|
43 |
||
44 |
// MODULE DATA STRUCTURES |
|
45 |
//enum ?declaration |
|
46 |
//typedef ?declaration |
|
47 |
||
48 |
// LOCAL FUNCTION PROTOTYPES |
|
49 |
//?type ?function_name( ?arg_type, ?arg_type ); |
|
50 |
||
51 |
// FORWARD DECLARATIONS |
|
52 |
//class ?FORWARD_CLASSNAME; |
|
53 |
||
54 |
// ============================= LOCAL FUNCTIONS =============================== |
|
55 |
||
56 |
// ----------------------------------------------------------------------------- |
|
57 |
// ?function_name ?description. |
|
58 |
// ?description |
|
59 |
// Returns: ?value_1: ?description |
|
60 |
// ?value_n: ?description_line1 |
|
61 |
// ?description_line2 |
|
62 |
// ----------------------------------------------------------------------------- |
|
63 |
// |
|
64 |
/* |
|
65 |
?type ?function_name( |
|
66 |
?arg_type arg, // ?description |
|
67 |
?arg_type arg) // ?description |
|
68 |
{ |
|
69 |
||
70 |
?code // ?comment |
|
71 |
||
72 |
// ?comment |
|
73 |
?code |
|
74 |
} |
|
75 |
*/ |
|
76 |
||
77 |
// ============================ MEMBER FUNCTIONS =============================== |
|
78 |
||
79 |
// ----------------------------------------------------------------------------- |
|
80 |
// Ctsysdevice::Delete |
|
81 |
// Delete here all resources allocated and opened from test methods. |
|
82 |
// Called from destructor. |
|
83 |
// ----------------------------------------------------------------------------- |
|
84 |
// |
|
85 |
void Ctsysdevice::Delete() |
|
86 |
{ |
|
87 |
||
88 |
} |
|
89 |
||
90 |
// ----------------------------------------------------------------------------- |
|
91 |
// Ctsysdevice::RunMethodL |
|
92 |
// Run specified method. Contains also table of test mothods and their names. |
|
93 |
// ----------------------------------------------------------------------------- |
|
94 |
// |
|
95 |
TInt Ctsysdevice::RunMethodL( |
|
96 |
CStifItemParser& aItem ) |
|
97 |
{ |
|
98 |
||
99 |
static TStifFunctionInfo const KFunctions[] = |
|
100 |
{ |
|
101 |
// Copy this line for every implemented function. |
|
102 |
// First string is the function name used in TestScripter script file. |
|
103 |
// Second is the actual implementation member function. |
|
104 |
ENTRY( "FirmwareVersion", Ctsysdevice::FirmwareVersion ), |
|
105 |
ENTRY( "ProductType", Ctsysdevice::ProductType ), |
|
106 |
ENTRY( "Manufacturer", Ctsysdevice::Manufacturer ), |
|
107 |
ENTRY( "PhoneModel", Ctsysdevice::PhoneModel ), |
|
108 |
ENTRY( "IMEI", Ctsysdevice::IMEI ), |
|
109 |
ENTRY( "MachineID", Ctsysdevice::MachineID ), |
|
110 |
ENTRY( "PlatformVersion", Ctsysdevice::PlatformVersion ), |
|
111 |
ENTRY( "SymbianOsVersion", Ctsysdevice::SymbianOsVersion ), |
|
112 |
}; |
|
113 |
||
114 |
const TInt count = sizeof( KFunctions ) / |
|
115 |
sizeof( TStifFunctionInfo ); |
|
116 |
||
117 |
return RunInternalL( KFunctions, count, aItem ); |
|
118 |
||
119 |
} |
|
120 |
||
121 |
// ----------------------------------------------------------------------------- |
|
122 |
// Ctsysdevice::FirmwareVersion |
|
123 |
// Tests FirmwareVersion functionlity |
|
124 |
// ----------------------------------------------------------------------------- |
|
125 |
// |
|
126 |
TInt Ctsysdevice::FirmwareVersion( CStifItemParser& /*aItem*/ ) |
|
127 |
{ |
|
128 |
||
129 |
__UHEAP_MARK; |
|
130 |
||
131 |
_LIT(KEntity,"Device") ; |
|
132 |
_LIT(KKey,"FirmwareVersion") ; |
|
133 |
||
134 |
||
135 |
TInt returnCode = KErrNone ; |
|
136 |
TInt expDataType = 12 ; |
|
137 |
||
138 |
CSysInfoService *CoreObj = CSysInfoService :: NewL() ; |
|
139 |
||
140 |
if( NULL == CoreObj) |
|
141 |
{ |
|
142 |
iLog->Log(_L8("Failed.. @Core")) ; |
|
143 |
return KErrGeneral ; |
|
144 |
} |
|
145 |
||
146 |
CSysData *sysData ; |
|
147 |
||
148 |
TRAPD(leaveCode, CoreObj->GetInfoL(KEntity, KKey, sysData) ); |
|
149 |
||
150 |
if(KErrNone == leaveCode) |
|
151 |
{ |
|
152 |
||
153 |
TInt retType = sysData->DataType() ; |
|
154 |
||
155 |
if(expDataType == retType) |
|
156 |
{ |
|
157 |
||
158 |
CStringData *status = (CStringData*)sysData ; |
|
159 |
TPtrC firmVersion ; |
|
160 |
status->StringData(firmVersion) ; |
|
161 |
if((firmVersion.Length()) > 0) |
|
162 |
{ |
|
163 |
TBuf<KSysUtilVersionTextLength> firmVersionBuf(firmVersion) ; |
|
164 |
iLog->Log(_L8("Firmware version")) ; |
|
165 |
iLog->Log(firmVersionBuf) ; |
|
166 |
} |
|
167 |
else |
|
168 |
{ |
|
169 |
returnCode = KErrGeneral ; |
|
170 |
iLog->Log(_L8("Firmware version wrong")); |
|
171 |
} |
|
172 |
} |
|
173 |
||
174 |
else |
|
175 |
{ |
|
176 |
returnCode = KErrGeneral ; |
|
177 |
iLog->Log(_L8("Failed.. @retType")) ; |
|
178 |
} |
|
179 |
} |
|
180 |
else |
|
181 |
{ |
|
182 |
iLog->Log(_L8("Failed.. @TRAPD")) ; |
|
183 |
} |
|
184 |
delete CoreObj ; |
|
185 |
delete sysData ; |
|
186 |
||
187 |
__UHEAP_MARKEND ; |
|
188 |
return returnCode ; |
|
189 |
||
190 |
} |
|
191 |
||
192 |
||
193 |
// ----------------------------------------------------------------------------- |
|
194 |
// Ctsysdevice::ProductType |
|
195 |
// Tests ProductType functionlity |
|
196 |
// ----------------------------------------------------------------------------- |
|
197 |
// |
|
198 |
TInt Ctsysdevice::ProductType( CStifItemParser& /*aItem*/ ) |
|
199 |
{ |
|
200 |
||
201 |
__UHEAP_MARK; |
|
202 |
||
203 |
_LIT(KEntity,"Device") ; |
|
204 |
_LIT(KKey,"ProductType") ; |
|
205 |
||
206 |
||
207 |
TInt returnCode = KErrNone ; |
|
208 |
TInt expDataType = 12 ; |
|
209 |
||
210 |
CSysInfoService *CoreObj = CSysInfoService :: NewL() ; |
|
211 |
||
212 |
if( NULL == CoreObj) |
|
213 |
{ |
|
214 |
iLog->Log(_L8("Failed.. @Core")) ; |
|
215 |
return KErrGeneral ; |
|
216 |
} |
|
217 |
||
218 |
CSysData *sysData ; |
|
219 |
||
220 |
TRAPD(leaveCode, CoreObj->GetInfoL(KEntity, KKey, sysData) ); |
|
221 |
||
222 |
if(KErrNone == leaveCode) |
|
223 |
{ |
|
224 |
||
225 |
TInt retType = sysData->DataType() ; |
|
226 |
||
227 |
if(expDataType == retType) |
|
228 |
{ |
|
229 |
#if ( !((defined(__WINS__) || defined(__WINSCW__))) ) |
|
230 |
CStringData *status = (CStringData*)sysData ; |
|
231 |
TPtrC prdType ; |
|
232 |
status->StringData(prdType) ; |
|
233 |
||
234 |
if((prdType.Length()) > 0) |
|
235 |
{ |
|
236 |
TBuf<50> prdTypeBuf(prdType) ; |
|
237 |
iLog->Log(_L8("Product Type ")) ; |
|
238 |
iLog->Log(prdTypeBuf) ; |
|
239 |
} |
|
240 |
else |
|
241 |
{ |
|
242 |
returnCode = KErrGeneral ; |
|
243 |
iLog->Log(_L8("Failed..@wrong prdType")) ; |
|
244 |
} |
|
245 |
#endif |
|
246 |
} |
|
247 |
||
248 |
else |
|
249 |
{ |
|
250 |
returnCode = KErrGeneral ; |
|
251 |
iLog->Log(_L8("Failed.. @retType")) ; |
|
252 |
} |
|
253 |
} |
|
254 |
else |
|
255 |
{ |
|
256 |
iLog->Log(_L8("Failed.. @TRAPD")) ; |
|
257 |
} |
|
258 |
delete CoreObj ; |
|
259 |
delete sysData ; |
|
260 |
||
261 |
__UHEAP_MARKEND ; |
|
262 |
return returnCode ; |
|
263 |
||
264 |
} |
|
265 |
||
266 |
||
267 |
||
268 |
||
269 |
// ----------------------------------------------------------------------------- |
|
270 |
// Ctsysdevice::Manufacturer |
|
271 |
// Tests Manufacturer functionlity |
|
272 |
// ----------------------------------------------------------------------------- |
|
273 |
// |
|
274 |
TInt Ctsysdevice::Manufacturer( CStifItemParser& /*aItem*/ ) |
|
275 |
{ |
|
276 |
||
277 |
__UHEAP_MARK; |
|
278 |
||
279 |
_LIT(KEntity,"Device") ; |
|
280 |
_LIT(KKey,"Manufacturer") ; |
|
281 |
||
282 |
||
283 |
TInt returnCode = KErrNone ; |
|
284 |
TInt expDataType = 12 ; |
|
285 |
||
286 |
CSysInfoService *CoreObj = CSysInfoService :: NewL() ; |
|
287 |
||
288 |
if( NULL == CoreObj) |
|
289 |
{ |
|
290 |
iLog->Log(_L8("Failed.. @Core")) ; |
|
291 |
return KErrGeneral ; |
|
292 |
} |
|
293 |
||
294 |
CSysData *sysData ; |
|
295 |
||
296 |
TRAPD(leaveCode, CoreObj->GetInfoL(KEntity, KKey, sysData) ); |
|
297 |
||
298 |
if(KErrNone == leaveCode) |
|
299 |
{ |
|
300 |
||
301 |
TInt retType = sysData->DataType() ; |
|
302 |
||
303 |
if(expDataType == retType) |
|
304 |
{ |
|
305 |
||
306 |
#if ( !((defined(__WINS__) || defined(__WINSCW__))) ) |
|
307 |
_LIT(expMfg,"NOKIA") ; |
|
308 |
||
309 |
#else |
|
310 |
_LIT(expMfg,"PHONEMAKER") ; |
|
311 |
||
312 |
#endif |
|
313 |
||
314 |
CStringData *status = (CStringData*)sysData ; |
|
315 |
TPtrC manufacturer ; |
|
316 |
status->StringData(manufacturer) ; |
|
317 |
||
318 |
TBuf<50> mfdBuf(manufacturer) ; |
|
319 |
mfdBuf.UpperCase(); |
|
320 |
||
321 |
if( !(mfdBuf.Compare(expMfg) )) |
|
322 |
{ |
|
323 |
||
324 |
iLog->Log(_L8("Manufacturer")) ; |
|
325 |
iLog->Log(mfdBuf) ; |
|
326 |
} |
|
327 |
else |
|
328 |
{ |
|
329 |
returnCode = KErrGeneral ; |
|
330 |
iLog->Log(_L8("Wrong manufacturere ret..")) ; |
|
331 |
} |
|
332 |
} |
|
333 |
||
334 |
else |
|
335 |
{ |
|
336 |
returnCode = KErrGeneral ; |
|
337 |
iLog->Log(_L8("Failed.. @retType")) ; |
|
338 |
} |
|
339 |
} |
|
340 |
else |
|
341 |
{ |
|
342 |
iLog->Log(_L8("Failed.. @TRAPD")) ; |
|
343 |
} |
|
344 |
delete CoreObj ; |
|
345 |
delete sysData ; |
|
346 |
||
347 |
__UHEAP_MARKEND ; |
|
348 |
return returnCode ; |
|
349 |
||
350 |
} |
|
351 |
||
352 |
||
353 |
||
354 |
||
355 |
// ----------------------------------------------------------------------------- |
|
356 |
// Ctsysdevice::PhoneModel |
|
357 |
// Tests PhoneModel functionlity |
|
358 |
// ----------------------------------------------------------------------------- |
|
359 |
// |
|
360 |
TInt Ctsysdevice::PhoneModel( CStifItemParser& /*aItem*/ ) |
|
361 |
{ |
|
362 |
||
363 |
__UHEAP_MARK; |
|
364 |
||
365 |
_LIT(KEntity,"Device") ; |
|
366 |
_LIT(KKey,"PhoneModel") ; |
|
367 |
||
368 |
||
369 |
TInt returnCode = KErrNone ; |
|
370 |
TInt expDataType = 12 ; |
|
371 |
||
372 |
CSysInfoService *CoreObj = CSysInfoService :: NewL() ; |
|
373 |
||
374 |
if( NULL == CoreObj) |
|
375 |
{ |
|
376 |
iLog->Log(_L8("Failed.. @Core")) ; |
|
377 |
return KErrGeneral ; |
|
378 |
} |
|
379 |
||
380 |
CSysData *sysData ; |
|
381 |
||
382 |
||
383 |
||
384 |
TRAPD(leaveCode, CoreObj->GetInfoL(KEntity, KKey, sysData) ); |
|
385 |
||
386 |
if(KErrNone == leaveCode) |
|
387 |
{ |
|
388 |
||
389 |
TInt retType = sysData->DataType() ; |
|
390 |
||
391 |
if(expDataType == retType) |
|
392 |
{ |
|
393 |
||
394 |
CStringData *status = (CStringData*)sysData ; |
|
395 |
TPtrC phonemodel ; |
|
396 |
||
397 |
status->StringData(phonemodel) ; |
|
398 |
||
399 |
if((phonemodel.Length()) > 0) |
|
400 |
{ |
|
401 |
TBuf<50> phonemodelBuf(phonemodel) ; |
|
402 |
iLog->Log(_L8("PhoneModel")) ; |
|
403 |
iLog->Log(phonemodelBuf) ; |
|
404 |
} |
|
405 |
else |
|
406 |
{ |
|
407 |
returnCode = KErrGeneral ; |
|
408 |
iLog->Log(_L8("Failed..@wrong phonemodel")) ; |
|
409 |
} |
|
410 |
} |
|
411 |
||
412 |
else |
|
413 |
{ |
|
414 |
returnCode = KErrGeneral ; |
|
415 |
iLog->Log(_L8("Failed.. @retType")) ; |
|
416 |
} |
|
417 |
} |
|
418 |
else |
|
419 |
{ |
|
420 |
iLog->Log(_L8("Failed.. @TRAPD")) ; |
|
421 |
} |
|
422 |
delete CoreObj ; |
|
423 |
delete sysData ; |
|
424 |
||
425 |
__UHEAP_MARKEND ; |
|
426 |
return returnCode ; |
|
427 |
||
428 |
} |
|
429 |
||
430 |
||
431 |
||
432 |
// ----------------------------------------------------------------------------- |
|
433 |
// Ctsysdevice::IMEI |
|
434 |
// Tests IMEI functionlity |
|
435 |
// ----------------------------------------------------------------------------- |
|
436 |
// |
|
437 |
TInt Ctsysdevice::IMEI( CStifItemParser& /*aItem*/ ) |
|
438 |
{ |
|
439 |
||
440 |
__UHEAP_MARK; |
|
441 |
||
442 |
_LIT(KEntity,"Device") ; |
|
443 |
_LIT(KKey,"IMEI") ; |
|
444 |
||
445 |
||
446 |
TInt returnCode = KErrNone ; |
|
447 |
TInt expDataType = 12 ; |
|
448 |
||
449 |
CSysInfoService *CoreObj = CSysInfoService :: NewL() ; |
|
450 |
||
451 |
if( NULL == CoreObj) |
|
452 |
{ |
|
453 |
iLog->Log(_L8("Failed.. @Core")) ; |
|
454 |
return KErrGeneral ; |
|
455 |
} |
|
456 |
||
457 |
CSysData *sysData ; |
|
458 |
||
459 |
TRAPD(leaveCode, CoreObj->GetInfoL(KEntity, KKey, sysData) ); |
|
460 |
||
461 |
if(KErrNone == leaveCode) |
|
462 |
{ |
|
463 |
||
464 |
TInt retType = sysData->DataType() ; |
|
465 |
||
466 |
if(expDataType == retType) |
|
467 |
{ |
|
468 |
#if ( !((defined(__WINS__) || defined(__WINSCW__))) ) |
|
469 |
||
470 |
CStringData *status = (CStringData*)sysData ; |
|
471 |
TPtrC imei ; |
|
472 |
status->StringData(imei) ; |
|
473 |
if((imei.Length()) >= 15) |
|
474 |
{ |
|
475 |
TBuf<50> imeiBuf(imei) ; |
|
476 |
iLog->Log(_L8("IMEI") ); |
|
477 |
iLog->Log(imeiBuf) ; |
|
478 |
} |
|
479 |
else |
|
480 |
{ |
|
481 |
returnCode = KErrGeneral; |
|
482 |
iLog->Log(_L8("Wrong IMEI..")) ; |
|
483 |
} |
|
484 |
#endif |
|
485 |
} |
|
486 |
||
487 |
else |
|
488 |
{ |
|
489 |
returnCode = KErrGeneral ; |
|
490 |
iLog->Log(_L8("Failed.. @retType")) ; |
|
491 |
} |
|
492 |
} |
|
493 |
else |
|
494 |
{ |
|
495 |
iLog->Log(_L8("Failed.. @TRAPD")) ; |
|
496 |
} |
|
497 |
delete CoreObj ; |
|
498 |
delete sysData ; |
|
499 |
||
500 |
__UHEAP_MARKEND ; |
|
501 |
return returnCode ; |
|
502 |
||
503 |
} |
|
504 |
||
505 |
||
506 |
// ----------------------------------------------------------------------------- |
|
507 |
// Ctsysdevice::MachineID |
|
508 |
// Tests MachineID functionlity |
|
509 |
// ----------------------------------------------------------------------------- |
|
510 |
// |
|
511 |
TInt Ctsysdevice::MachineID( CStifItemParser& /*aItem*/ ) |
|
512 |
{ |
|
513 |
||
514 |
__UHEAP_MARK; |
|
515 |
||
516 |
_LIT(KEntity,"Device") ; |
|
517 |
_LIT(KKey,"MachineID") ; |
|
518 |
||
519 |
||
520 |
TInt returnCode = KErrNone ; |
|
521 |
TInt expDataType = 0 ; |
|
522 |
||
523 |
CSysInfoService *CoreObj = CSysInfoService :: NewL() ; |
|
524 |
||
525 |
if( NULL == CoreObj) |
|
526 |
{ |
|
527 |
iLog->Log(_L8("Failed.. @Core")) ; |
|
528 |
return KErrGeneral ; |
|
529 |
} |
|
530 |
||
531 |
CSysData *sysData ; |
|
532 |
||
533 |
||
534 |
TRAPD(leaveCode, CoreObj->GetInfoL(KEntity, KKey, sysData) ); |
|
535 |
||
536 |
if(KErrNone == leaveCode) |
|
537 |
{ |
|
538 |
||
539 |
TInt retType = sysData->DataType() ; |
|
540 |
||
541 |
if(expDataType == retType) |
|
542 |
{ |
|
543 |
#if ( !((defined(__WINS__) || defined(__WINSCW__))) ) |
|
544 |
||
545 |
CStatus *status = (CStatus*)sysData ; |
|
546 |
TInt machineid ; |
|
547 |
machineid = status->Status() ; |
|
548 |
if(machineid > 0) |
|
549 |
{ |
|
550 |
iLog->Log(_L8("machineid %d"),machineid) ; |
|
551 |
} |
|
552 |
else |
|
553 |
{ |
|
554 |
returnCode = KErrGeneral ; |
|
555 |
iLog->Log(_L8("wrong machineid..")) ; |
|
556 |
} |
|
557 |
#endif |
|
558 |
||
559 |
} |
|
560 |
||
561 |
else |
|
562 |
{ |
|
563 |
returnCode = KErrGeneral ; |
|
564 |
iLog->Log(_L8("Failed.. @retType")) ; |
|
565 |
} |
|
566 |
} |
|
567 |
else |
|
568 |
{ |
|
569 |
iLog->Log(_L8("Failed.. @TRAPD")) ; |
|
570 |
} |
|
571 |
delete CoreObj ; |
|
572 |
delete sysData ; |
|
573 |
||
574 |
__UHEAP_MARKEND ; |
|
575 |
return returnCode ; |
|
576 |
||
577 |
} |
|
578 |
||
579 |
// ----------------------------------------------------------------------------- |
|
580 |
// Ctsysdevice::PlatformVersion |
|
581 |
// Tests PlatformVersion functionlity |
|
582 |
// ----------------------------------------------------------------------------- |
|
583 |
// |
|
584 |
TInt Ctsysdevice::PlatformVersion( CStifItemParser& /*aItem*/ ) |
|
585 |
{ |
|
586 |
||
587 |
__UHEAP_MARK; |
|
588 |
||
589 |
_LIT(KEntity,"Device") ; |
|
590 |
_LIT(KKey,"PlatformVersion") ; |
|
591 |
||
592 |
||
593 |
TInt returnCode = KErrNone ; |
|
594 |
TInt expDataType = 1 ; |
|
595 |
||
596 |
CSysInfoService *CoreObj = CSysInfoService :: NewL() ; |
|
597 |
||
598 |
if( NULL == CoreObj) |
|
599 |
{ |
|
600 |
iLog->Log(_L8("Failed.. @Core")) ; |
|
601 |
return KErrGeneral ; |
|
602 |
} |
|
603 |
||
604 |
||
605 |
CSysData *sysData ; |
|
606 |
||
607 |
||
608 |
TRAPD(leaveCode, CoreObj->GetInfoL(KEntity, KKey, sysData) ); |
|
609 |
||
610 |
if(KErrNone == leaveCode) |
|
611 |
{ |
|
612 |
||
613 |
TInt retType = sysData->DataType() ; |
|
614 |
||
615 |
if(expDataType == retType) |
|
616 |
{ |
|
617 |
||
618 |
CVersion *status = (CVersion*)sysData ; |
|
619 |
TInt majorVersion ; |
|
620 |
TInt minorVersion ; |
|
621 |
majorVersion = status->MajorVersion() ; |
|
622 |
minorVersion = status->MinorVersion() ; |
|
623 |
if((majorVersion > 0) && (minorVersion >= 0)) |
|
624 |
{ |
|
625 |
iLog->Log(_L8("MajorVersion %d"),majorVersion) ; |
|
626 |
iLog->Log(_L8("MinorVersion %d"),minorVersion) ; |
|
627 |
} |
|
628 |
else |
|
629 |
{ |
|
630 |
returnCode = KErrGeneral ; |
|
631 |
iLog->Log(_L8("Wrong s60 version..")) ; |
|
632 |
} |
|
633 |
||
634 |
} |
|
635 |
||
636 |
else |
|
637 |
{ |
|
638 |
returnCode = KErrGeneral ; |
|
639 |
iLog->Log(_L8("Failed.. @retType")) ; |
|
640 |
} |
|
641 |
} |
|
642 |
else |
|
643 |
{ |
|
644 |
iLog->Log(_L8("Failed.. @TRAPD")) ; |
|
645 |
} |
|
646 |
delete CoreObj ; |
|
647 |
delete sysData ; |
|
648 |
||
649 |
__UHEAP_MARKEND ; |
|
650 |
return returnCode ; |
|
651 |
||
652 |
} |
|
653 |
||
654 |
// ----------------------------------------------------------------------------- |
|
655 |
// Ctsysdevice::SymbianOsVersion |
|
656 |
// Tests SymbianOsVersion functionlity |
|
657 |
// ----------------------------------------------------------------------------- |
|
658 |
// |
|
659 |
TInt Ctsysdevice::SymbianOsVersion( CStifItemParser& /*aItem*/ ) |
|
660 |
{ |
|
661 |
||
662 |
__UHEAP_MARK; |
|
663 |
||
664 |
_LIT(KEntity,"Device") ; |
|
665 |
_LIT(KKey,"OsVersion") ; |
|
666 |
||
667 |
||
668 |
TInt returnCode = KErrNone ; |
|
669 |
TInt expDataType = 1 ; |
|
670 |
||
671 |
CSysInfoService *CoreObj = CSysInfoService :: NewL() ; |
|
672 |
||
673 |
if( NULL == CoreObj) |
|
674 |
{ |
|
675 |
iLog->Log(_L8("Failed.. @Core")) ; |
|
676 |
return KErrGeneral ; |
|
677 |
} |
|
678 |
||
679 |
CSysData *sysData = NULL; |
|
680 |
||
681 |
TRAPD(leaveCode, CoreObj->GetInfoL(KEntity, KKey, sysData) ); |
|
682 |
||
683 |
if(KErrNotFound == leaveCode) |
|
684 |
{ |
|
685 |
iLog->Log(_L8("Symbian OS Version Not Supported..")); |
|
686 |
returnCode = KErrNone; |
|
687 |
} |
|
688 |
else if(KErrNone == leaveCode) |
|
689 |
{ |
|
690 |
||
691 |
TInt retType = sysData->DataType() ; |
|
692 |
||
693 |
if(expDataType == retType) |
|
694 |
{ |
|
695 |
#if ( !((defined(__WINS__) || defined(__WINSCW__))) ) |
|
696 |
CVersion *status = (CVersion*)sysData ; |
|
697 |
TInt majorVersion ; |
|
698 |
TInt minorVersion ; |
|
699 |
majorVersion = status->MajorVersion() ; |
|
700 |
minorVersion = status->MinorVersion() ; |
|
701 |
||
702 |
if((majorVersion > 0) && (minorVersion >= 0)) |
|
703 |
{ |
|
704 |
iLog->Log(_L8("MajorVersion %d"),majorVersion) ; |
|
705 |
iLog->Log(_L8("MinorVersion %d"),minorVersion) ; |
|
706 |
} |
|
707 |
else |
|
708 |
{ |
|
709 |
returnCode = KErrGeneral ; |
|
710 |
iLog->Log(_L8("Wrong symbian os version..")) ; |
|
711 |
} |
|
712 |
#endif |
|
713 |
} |
|
714 |
||
715 |
else |
|
716 |
{ |
|
717 |
returnCode = KErrGeneral ; |
|
718 |
iLog->Log(_L8("Failed.. @retType")) ; |
|
719 |
} |
|
720 |
} |
|
721 |
else |
|
722 |
{ |
|
723 |
iLog->Log(_L8("Failed.. @TRAPD")) ; |
|
724 |
} |
|
725 |
||
726 |
if(CoreObj) |
|
727 |
delete CoreObj ; |
|
728 |
||
729 |
if(sysData) |
|
730 |
delete sysData ; |
|
731 |
||
732 |
__UHEAP_MARKEND ; |
|
733 |
return returnCode ; |
|
734 |
||
735 |
} |
|
736 |
// ----------------------------------------------------------------------------- |
|
737 |
// Ctsysdevice::?member_function |
|
738 |
// ?implementation_description |
|
739 |
// (other items were commented in a header). |
|
740 |
// ----------------------------------------------------------------------------- |
|
741 |
// |
|
742 |
/* |
|
743 |
TInt Ctsysdevice::?member_function( |
|
744 |
CItemParser& aItem ) |
|
745 |
{ |
|
746 |
||
747 |
?code |
|
748 |
||
749 |
} |
|
750 |
*/ |
|
751 |
||
752 |
// ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
753 |
// None |
|
754 |
||
755 |
// End of File |