sapi_sysinfo/tsrc/testing/tsysmanualtest/src/tsysmanualtestblocks.cpp
changeset 0 14df0fbfcc4e
equal deleted inserted replaced
-1:000000000000 0:14df0fbfcc4e
       
     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 "tsysmanualtest.h"
       
    26 #include "tmemnot.h"
       
    27 #include "tsysbatterynot.h"
       
    28 
       
    29 // EXTERNAL DATA STRUCTURES
       
    30 //extern  ?external_data;
       
    31 
       
    32 // EXTERNAL FUNCTION PROTOTYPES  
       
    33 //extern ?external_function( ?arg_type,?arg_type );
       
    34 
       
    35 // CONSTANTS
       
    36 //const ?type ?constant_var = ?constant;
       
    37 
       
    38 // MACROS
       
    39 //#define ?macro ?macro_def
       
    40 
       
    41 // LOCAL CONSTANTS AND MACROS
       
    42 //const ?type ?constant_var = ?constant;
       
    43 //#define ?macro_name ?macro_def
       
    44 
       
    45 // MODULE DATA STRUCTURES
       
    46 //enum ?declaration
       
    47 //typedef ?declaration
       
    48 
       
    49 // LOCAL FUNCTION PROTOTYPES
       
    50 //?type ?function_name( ?arg_type, ?arg_type );
       
    51 
       
    52 // FORWARD DECLARATIONS
       
    53 //class ?FORWARD_CLASSNAME;
       
    54 
       
    55 // ============================= LOCAL FUNCTIONS ===============================
       
    56 
       
    57 // -----------------------------------------------------------------------------
       
    58 // ?function_name ?description.
       
    59 // ?description
       
    60 // Returns: ?value_1: ?description
       
    61 //          ?value_n: ?description_line1
       
    62 //                    ?description_line2
       
    63 // -----------------------------------------------------------------------------
       
    64 //
       
    65 /*
       
    66 ?type ?function_name(
       
    67     ?arg_type arg,  // ?description
       
    68     ?arg_type arg)  // ?description
       
    69     {
       
    70 
       
    71     ?code  // ?comment
       
    72 
       
    73     // ?comment
       
    74     ?code
       
    75     }
       
    76 */
       
    77 
       
    78 // ============================ MEMBER FUNCTIONS ===============================
       
    79 
       
    80 // -----------------------------------------------------------------------------
       
    81 // Ctsysmanualtest::Delete
       
    82 // Delete here all resources allocated and opened from test methods. 
       
    83 // Called from destructor. 
       
    84 // -----------------------------------------------------------------------------
       
    85 //
       
    86 void Ctsysmanualtest::Delete() 
       
    87     {
       
    88 
       
    89     }
       
    90 
       
    91 // -----------------------------------------------------------------------------
       
    92 // Ctsysmanualtest::RunMethodL
       
    93 // Run specified method. Contains also table of test mothods and their names.
       
    94 // -----------------------------------------------------------------------------
       
    95 //
       
    96 TInt Ctsysmanualtest::RunMethodL( 
       
    97     CStifItemParser& aItem ) 
       
    98     {
       
    99 
       
   100     static TStifFunctionInfo const KFunctions[] =
       
   101         {  
       
   102         // Copy this line for every implemented function.
       
   103         // First string is the function name used in TestScripter script file.
       
   104         // Second is the actual implementation member function. 
       
   105         ENTRY( "NotifyVibraAndAcc", Ctsysmanualtest::NotifyVibraAndAcc ),
       
   106 		//Battery related
       
   107 		ENTRY( "BatteryNotifications",Ctsysmanualtest::BatteryNotifications),
       
   108 		ENTRY( "BatteryLevel", Ctsysmanualtest::BatteryLevel ),
       
   109 		ENTRY( "ChargingStatus", Ctsysmanualtest::ChargingStatus ),
       
   110 		
       
   111 		//Memory related
       
   112 		ENTRY( "MemoryCardState", Ctsysmanualtest::MemoryCardState ) ,
       
   113 //		ENTRY( "CriticalMemNotification", Ctsysmanualtest::CriticalMemNotitication ),
       
   114 //		ENTRY( "MemCardNotification", Ctsysmanualtest::MemCardNotification ),
       
   115         
       
   116         //Display related
       
   117         ENTRY( "DisplayOrientation", Ctsysmanualtest::DisplayOrientation ),
       
   118         ENTRY( "SetAndGetKeyLockTime", Ctsysmanualtest::SetAndGetKeyLockTime ),
       
   119         ENTRY( "SetAndGetKeyGuardTime", Ctsysmanualtest::SetAndGetKeyGuardTime ),
       
   120         
       
   121         //General related
       
   122         ENTRY( "GetFlipStatus", Ctsysmanualtest::GetFlipStatus ),
       
   123         ENTRY( "GetGripStatus", Ctsysmanualtest::GetGripStatus ),
       
   124         ENTRY( "GetConnAcc", Ctsysmanualtest::GetConnAcc ),
       
   125         ENTRY( "SetDisplayLanguage", Ctsysmanualtest::SetDisplayLanguage ),
       
   126         
       
   127         };
       
   128 
       
   129     const TInt count = sizeof( KFunctions ) / 
       
   130                         sizeof( TStifFunctionInfo );
       
   131 
       
   132     return RunInternalL( KFunctions, count, aItem );
       
   133 
       
   134     }
       
   135 
       
   136 // -----------------------------------------------------------------------------
       
   137 // Ctsysmanualtest::NotifyVibraAndAcc
       
   138 // Example test method function.
       
   139 // (other items were commented in a header).
       
   140 // -----------------------------------------------------------------------------
       
   141 //
       
   142 TInt Ctsysmanualtest::NotifyVibraAndAcc( CStifItemParser& /*aItem*/ )
       
   143     {
       
   144  __UHEAP_MARK;
       
   145  
       
   146     TInt returnCode = KErrNone ;
       
   147    
       
   148     returnCode = TestAccAndVibraNot(iLog) ;
       
   149    
       
   150     __UHEAP_MARKEND ;
       
   151     return returnCode ;
       
   152 
       
   153     }
       
   154 
       
   155 // -----------------------------------------------------------------------------
       
   156 // Ctsysmanualtest::BatteryNotifications
       
   157 // Example test method function.
       
   158 // (other items were commented in a header).
       
   159 // -----------------------------------------------------------------------------
       
   160 //
       
   161 TInt Ctsysmanualtest::BatteryNotifications( CStifItemParser& /*aItem*/ )
       
   162     {
       
   163    	TInt Err = KErrNone ;
       
   164 	
       
   165 	#if ( !(defined(__WINS__) || defined(__WINSCW__)) )
       
   166 	__UHEAP_MARK;
       
   167 
       
   168 	CBatteryNot *test = CBatteryNot::NewL(iLog);
       
   169 	test->Start();
       
   170 	Err = test->Result();
       
   171 	delete test;
       
   172     
       
   173     #endif
       
   174 	__UHEAP_MARKEND;
       
   175 	return Err;
       
   176 
       
   177     
       
   178     }
       
   179     
       
   180 // -----------------------------------------------------------------------------
       
   181 // Ctsysmanualtest::BatteryLevel
       
   182 // Tests Battery level
       
   183 // -----------------------------------------------------------------------------
       
   184 //
       
   185 TInt Ctsysmanualtest::BatteryLevel( CStifItemParser& aItem )
       
   186     {
       
   187 
       
   188     __UHEAP_MARK;
       
   189    
       
   190     TInt returnCode = KErrNone ;
       
   191   
       
   192     _LIT(KEntity,"Battery") ;
       
   193     _LIT(KKey,"BatteryLevel") ;
       
   194     
       
   195     
       
   196     TInt expLevel = 0;
       
   197     TInt expDataType = 0 ;
       
   198     aItem.GetNextInt ( expLevel ) ;
       
   199    
       
   200     #if ( !(defined(__WINS__) || defined(__WINSCW__)) )
       
   201     
       
   202     CSysInfoService *CoreObj = CSysInfoService :: NewL() ;
       
   203     
       
   204     if( NULL == CoreObj)
       
   205 	    {
       
   206 	    iLog->Log(_L8("Failed.. @Core")) ;
       
   207 	   	return KErrGeneral ;
       
   208 	   	}
       
   209     
       
   210 
       
   211     CSysData *sysData ;
       
   212    	
       
   213    	
       
   214     iLog->Log(_L8("expLevel : %d"),expLevel) ;
       
   215     
       
   216     TRAPD(leaveCode, CoreObj->GetInfoL(KEntity,KKey,sysData) );
       
   217     
       
   218     if(KErrNone == leaveCode)
       
   219     	{
       
   220         
       
   221 	    TInt retType = sysData->DataType() ;
       
   222 	    
       
   223 	    if(expDataType == retType)
       
   224 		    {
       
   225 		      
       
   226 		    CStatus *status = (CStatus*)sysData ;
       
   227 		    TInt retStatus = status->Status() ;
       
   228 	   
       
   229 		    if(expLevel != retStatus)
       
   230 		    	{
       
   231 		        returnCode = KErrGeneral ; 
       
   232 		    	iLog->Log(_L8("Failed.. @retStatus")) ;
       
   233 		    	}
       
   234 		   	else
       
   235 		   		{
       
   236 		   		iLog->Log(_L8("Passed..")) ; 	
       
   237 		   		}
       
   238 		   	  
       
   239 		    }
       
   240 		    
       
   241 		else
       
   242 			{
       
   243 			returnCode = KErrGeneral ;	
       
   244 			iLog->Log(_L8("Failed.. @retType")) ;
       
   245 			}    
       
   246 	    
       
   247 	    delete sysData ;
       
   248 	    
       
   249 	    }
       
   250     else
       
   251     	{
       
   252     	returnCode = KErrGeneral ;
       
   253     	iLog->Log(_L8("Failed.. @TRAPD")) ;
       
   254     	}
       
   255     delete CoreObj ;
       
   256     
       
   257     #endif
       
   258     
       
   259     __UHEAP_MARKEND ;
       
   260  
       
   261     return returnCode ;
       
   262     
       
   263     }
       
   264 
       
   265 
       
   266 // -----------------------------------------------------------------------------
       
   267 // Ctsysmanualtest::ChargingStatus
       
   268 // Tests Charging status
       
   269 // -----------------------------------------------------------------------------
       
   270 //
       
   271 TInt Ctsysmanualtest::ChargingStatus( CStifItemParser& aItem )
       
   272     {
       
   273 
       
   274     __UHEAP_MARK;
       
   275     
       
   276     TInt returnCode = KErrNone ;
       
   277        
       
   278     _LIT(KEntity,"Battery") ;
       
   279     _LIT(KKey,"ChargingStatus") ;
       
   280     
       
   281     
       
   282     TInt expStatus = 0;
       
   283     TInt expDataType = 0 ;
       
   284     aItem.GetNextInt ( expStatus ) ;
       
   285     
       
   286     #if ( !(defined(__WINS__) || defined(__WINSCW__)) ) 
       
   287     
       
   288     CSysInfoService *CoreObj = CSysInfoService :: NewL() ;
       
   289     
       
   290     if( NULL == CoreObj)
       
   291 	    {
       
   292 	    iLog->Log(_L8("Failed.. @Core")) ;
       
   293 	   	return KErrGeneral ;
       
   294 	   	}
       
   295     
       
   296     CSysData *sysData ;
       
   297    	
       
   298     iLog->Log(_L8("expStatus : %d"),expStatus) ;
       
   299     
       
   300     TRAPD(leaveCode, CoreObj->GetInfoL(KEntity,KKey,sysData) );
       
   301     
       
   302     if(KErrNone == leaveCode)
       
   303     {
       
   304         
       
   305     TInt retType = sysData->DataType() ;
       
   306     
       
   307     if(expDataType == retType)
       
   308 	    {
       
   309 	      
       
   310 	    CStatus *status = (CStatus*)sysData ;
       
   311 	    TInt retStatus = status->Status() ;
       
   312    
       
   313 	    if(expStatus != retStatus)
       
   314 	    	{
       
   315 	        returnCode = KErrGeneral ; 
       
   316 	    	iLog->Log(_L8("Failed.. @retStatus")) ;
       
   317 	    	}
       
   318 	   	else
       
   319 	   		{
       
   320 	   		iLog->Log(_L8("Passed..")) ; 	
       
   321 	   		}
       
   322 	   	  
       
   323 	    }
       
   324 	    
       
   325 	else
       
   326 		{
       
   327 		returnCode = KErrGeneral ;	
       
   328 		iLog->Log(_L8("Failed.. @retType")) ;
       
   329 		}    
       
   330    
       
   331     delete sysData ;
       
   332      
       
   333     }
       
   334     else
       
   335     	{
       
   336     	returnCode = KErrGeneral ;
       
   337     	iLog->Log(_L8("Failed.. @TRAPD")) ;
       
   338     	}
       
   339     delete CoreObj ;
       
   340     
       
   341     #endif
       
   342    
       
   343     __UHEAP_MARKEND ;
       
   344     return returnCode ;
       
   345     
       
   346     }
       
   347 
       
   348 // -----------------------------------------------------------------------------
       
   349 // Ctsysmanualtest::MemoryCardState
       
   350 // Tests the MemoryCardState functionality
       
   351 // -----------------------------------------------------------------------------
       
   352 //
       
   353 TInt Ctsysmanualtest::MemoryCardState( CStifItemParser& aItem )
       
   354     {
       
   355 
       
   356 	 __UHEAP_MARK;
       
   357     
       
   358     _LIT(KEntity,"Memory") ;
       
   359     _LIT(KKey,"MemoryCard") ;
       
   360     
       
   361     TInt returnCode = KErrNone ;
       
   362     TInt expState = 0 ;
       
   363     TInt expDataType = 0 ;
       
   364     aItem.GetNextInt (expState) ;
       
   365     
       
   366     CSysInfoService *CoreObj = CSysInfoService :: NewL() ;
       
   367     
       
   368     if( NULL == CoreObj)
       
   369 	    {
       
   370 	    iLog->Log(_L8("Failed.. @Core")) ;
       
   371 	   	return KErrGeneral ;
       
   372 	   	}
       
   373 
       
   374     CSysData *sysData ;
       
   375    	
       
   376    	
       
   377     iLog->Log(_L8("expState : %d"),expState) ;	
       
   378     TRAPD(leaveCode, CoreObj->GetInfoL(KEntity,KKey,sysData)) ;
       
   379     if(KErrNone == leaveCode)
       
   380 	    {
       
   381 	       
       
   382 	    TInt retType = sysData->DataType() ;
       
   383 	    
       
   384 	    if(expDataType == retType)
       
   385 		    {
       
   386 		      
       
   387 		    CStatus *status = (CStatus*)sysData ;
       
   388 		    TInt retStatus = status->Status() ;
       
   389 		    	   
       
   390 		    if(expState != retStatus)
       
   391 		    	{
       
   392 		        returnCode = KErrGeneral ; 
       
   393 		    	iLog->Log(_L8("Failed.. @retStatus")) ;
       
   394 		    	}
       
   395 		    else
       
   396 		    	{
       
   397 		    	iLog->Log(_L8("Passed..")) ;	
       
   398 		    	}
       
   399 		     }
       
   400 		    
       
   401 		else
       
   402 			{
       
   403 			returnCode = KErrGeneral ;	
       
   404 			iLog->Log(_L8("Failed.. @retType")) ;
       
   405 			}    
       
   406 	    
       
   407 	    delete sysData ;
       
   408 	    
       
   409 	    }
       
   410     else
       
   411     	{
       
   412     	returnCode = KErrGeneral ;
       
   413     	iLog->Log(_L8("Failed.. @TRAPD")) ;
       
   414     	}
       
   415     delete CoreObj ;
       
   416    
       
   417     __UHEAP_MARKEND ;
       
   418     return returnCode ;
       
   419 
       
   420     }
       
   421 
       
   422 // -----------------------------------------------------------------------------
       
   423 // Ctsysmanualtest::DisplayOrientation
       
   424 // Tests DisplayOrientation values
       
   425 // -----------------------------------------------------------------------------
       
   426 //
       
   427 TInt Ctsysmanualtest::DisplayOrientation( CStifItemParser& aItem )
       
   428     {
       
   429 
       
   430    __UHEAP_MARK;
       
   431     
       
   432     _LIT(KEntity,"Display") ;
       
   433     _LIT(KKey,"DisplayOrientation") ;
       
   434     
       
   435     TInt returnCode = KErrNone ;
       
   436     TInt expDataType = 0 ;
       
   437     TInt expOrientation = 0;
       
   438     aItem.GetNextInt ( expOrientation ) ;   
       
   439     
       
   440     CSysInfoService *CoreObj = CSysInfoService :: NewL() ;
       
   441     
       
   442     if( NULL == CoreObj)
       
   443 	    {
       
   444 	    iLog->Log(_L8("Failed.. @Core")) ;
       
   445 	   	return KErrGeneral ;
       
   446 	   	}
       
   447 
       
   448     CSysData *sysData ;
       
   449    	
       
   450     iLog->Log(_L8("expOrientation : %d"),expOrientation) ;
       
   451        
       
   452     TRAPD(leaveCode, CoreObj->GetInfoL(KEntity,KKey,sysData) );
       
   453     
       
   454     if(KErrNone == leaveCode)
       
   455     {
       
   456         
       
   457     TInt retType = sysData->DataType() ;
       
   458     
       
   459     if(expDataType == retType)
       
   460 	    {
       
   461 	      
       
   462 	    CStatus *status = (CStatus*)sysData ;
       
   463 	    TInt retStatus = status->Status() ;
       
   464    		iLog->Log(_L8("retStatus : %d"),retStatus) ;
       
   465 	    
       
   466 	    if(expOrientation == retStatus) 
       
   467 	    	{
       
   468 	       	iLog->Log(_L8("Passed..")) ; 
       
   469 	        }
       
   470 	   	else
       
   471 	   		{
       
   472 	   		returnCode = KErrGeneral ; 
       
   473 	    	iLog->Log(_L8("Failed.. @retStatus")) ;
       
   474 	   		}
       
   475 	   	  
       
   476 	    }
       
   477 	    
       
   478 	else
       
   479 		{
       
   480 		returnCode = KErrGeneral ;	
       
   481 		iLog->Log(_L8("Failed.. @retType")) ;
       
   482 		}    
       
   483     
       
   484     delete sysData ;
       
   485     
       
   486     }
       
   487     else
       
   488     	{
       
   489     	iLog->Log(_L8("Failed.. @TRAPD")) ;
       
   490     	}
       
   491     delete CoreObj ;
       
   492     
       
   493     
       
   494     __UHEAP_MARKEND ;
       
   495     return returnCode ;
       
   496     
       
   497 
       
   498     }
       
   499     
       
   500  
       
   501  // -----------------------------------------------------------------------------
       
   502 // Ctsysmanualtest::SetAndGetKeyLockTime
       
   503 // Tests set and get KeylockTime values
       
   504 // -----------------------------------------------------------------------------
       
   505 //
       
   506 TInt Ctsysmanualtest::SetAndGetKeyLockTime( CStifItemParser& aItem )
       
   507     {
       
   508 
       
   509    __UHEAP_MARK;
       
   510     
       
   511     _LIT(KEntity,"Display") ;
       
   512     _LIT(KKey,"AutoLockTime") ;
       
   513     
       
   514     TInt returnCode = KErrNone ;
       
   515     TInt expDataType = 0 ;
       
   516     TInt defValue = 0 ;
       
   517     TInt expTime = 0;
       
   518     aItem.GetNextInt ( expTime ) ;   
       
   519     
       
   520     CSysInfoService *CoreObj = CSysInfoService :: NewL() ;
       
   521     
       
   522     if( NULL == CoreObj)
       
   523 	    {
       
   524 	    iLog->Log(_L8("Failed.. @Core")) ;
       
   525 	   	return KErrGeneral ;
       
   526 	   	}
       
   527  	
       
   528  	CStatus *ipData = CStatus::NewL(expTime) ;
       
   529    	      
       
   530     TRAPD(leaveCode, CoreObj->SetInfoL(KEntity,KKey,ipData)) ;
       
   531     
       
   532     if(KErrNone == leaveCode)
       
   533 	    {
       
   534 	   
       
   535 	    CSysData *sysData ;
       
   536 	   	
       
   537 	    iLog->Log(_L8("expTime : %d"),expTime) ;
       
   538 	       
       
   539 	    TRAPD(leaveCode, CoreObj->GetInfoL(KEntity,KKey,sysData) );
       
   540 	    
       
   541 	    if(KErrNone == leaveCode)
       
   542 	    {
       
   543 	        
       
   544 	    TInt retType = sysData->DataType() ;
       
   545 	    
       
   546 	    if(expDataType == retType)
       
   547 		    {
       
   548 		      
       
   549 		    CStatus *status = (CStatus*)sysData ;
       
   550 		    TInt retStatus = status->Status() ;
       
   551 	   		iLog->Log(_L8("retStatus : %d"),retStatus) ;
       
   552 		    
       
   553 		    if(expTime == retStatus) 
       
   554 		    	{
       
   555 		      	iLog->Log(_L8("Passed..")) ; 
       
   556 		        }
       
   557 		   	else
       
   558 		   		{
       
   559 		   		returnCode = KErrGeneral ; 
       
   560 		    	iLog->Log(_L8("Failed.. @retStatus")) ;
       
   561 		   		}
       
   562 			    
       
   563 		    }
       
   564 		    
       
   565 		else
       
   566 			{
       
   567 			returnCode = KErrGeneral ;	
       
   568 			iLog->Log(_L8("Failed.. @retType")) ;
       
   569 			}    
       
   570 	    
       
   571 	    delete sysData ;
       
   572 	    
       
   573 	    }
       
   574 	    else
       
   575 	    	{
       
   576 	    	returnCode = KErrGeneral ;
       
   577 	    	iLog->Log(_L8("Failed.. @2 TRAPD")) ;
       
   578 	    	}
       
   579 	         	
       
   580 	    }
       
   581     
       
   582     else
       
   583     	{
       
   584     	returnCode = KErrGeneral ;
       
   585     	iLog->Log(_L8("Failed.. @TRAPD")) ;
       
   586     	}
       
   587 
       
   588    	CStatus *defData = CStatus::NewL(defValue) ;
       
   589    	      
       
   590 //    CoreObj->SetInfoL(KEntity,KKey,defData) ;
       
   591     
       
   592     delete defData ;
       
   593     delete ipData ;
       
   594     delete CoreObj ;
       
   595      
       
   596     __UHEAP_MARKEND ;
       
   597     return returnCode ;
       
   598     
       
   599 
       
   600     }
       
   601        
       
   602 // -----------------------------------------------------------------------------
       
   603 // Ctsysmanualtest::SetAndGetKeyGuardTime
       
   604 // Tests set and get KeyguardTime values
       
   605 // -----------------------------------------------------------------------------
       
   606 //
       
   607 TInt Ctsysmanualtest::SetAndGetKeyGuardTime( CStifItemParser& aItem )
       
   608     {
       
   609 
       
   610    __UHEAP_MARK;
       
   611     
       
   612     _LIT(KEntity,"Display") ;
       
   613     _LIT(KKey,"KeyGaurdTime") ;
       
   614     
       
   615     TInt returnCode = KErrNone ;
       
   616     TInt expDataType = 0 ;
       
   617     TInt defValue = 0 ;
       
   618     TInt expTime = 0;
       
   619     aItem.GetNextInt ( expTime ) ;   
       
   620     
       
   621     CSysInfoService *CoreObj = CSysInfoService :: NewL() ;
       
   622     
       
   623     if( NULL == CoreObj)
       
   624 	    {
       
   625 	    iLog->Log(_L8("Failed.. @Core")) ;
       
   626 	   	return KErrGeneral ;
       
   627 	   	}
       
   628  	
       
   629  	CStatus *ipData = CStatus::NewL(expTime) ;
       
   630    	      
       
   631     TRAPD(leaveCode, CoreObj->SetInfoL(KEntity,KKey,ipData)) ;
       
   632     
       
   633     if(KErrNone == leaveCode)
       
   634 	    {
       
   635 	   
       
   636 	    CSysData *sysData ;
       
   637 	   	
       
   638 	    iLog->Log(_L8("expTime : %d"),expTime) ;
       
   639 	       
       
   640 	    TRAPD(leaveCode, CoreObj->GetInfoL(KEntity,KKey,sysData) );
       
   641 	    
       
   642 	    if(KErrNone == leaveCode)
       
   643 	    {
       
   644 	        
       
   645 	    TInt retType = sysData->DataType() ;
       
   646 	    
       
   647 	    if(expDataType == retType)
       
   648 		    {
       
   649 		      
       
   650 		    CStatus *status = (CStatus*)sysData ;
       
   651 		    TInt retStatus = status->Status() ;
       
   652 	   		iLog->Log(_L8("retStatus : %d"),retStatus) ;
       
   653 		    
       
   654 		    if(expTime == retStatus) 
       
   655 		    	{
       
   656 		      	iLog->Log(_L8("Passed..")) ; 
       
   657 		        }
       
   658 		   	else
       
   659 		   		{
       
   660 		   		returnCode = KErrGeneral ; 
       
   661 		    	iLog->Log(_L8("Failed.. @retStatus")) ;
       
   662 		   		}
       
   663 			    
       
   664 		    }
       
   665 		    
       
   666 		else
       
   667 			{
       
   668 			returnCode = KErrGeneral ;	
       
   669 			iLog->Log(_L8("Failed.. @retType")) ;
       
   670 			}    
       
   671 	    
       
   672 	    delete sysData ;
       
   673 	    
       
   674 	    }
       
   675 	    else
       
   676 	    	{
       
   677 	    	returnCode = KErrGeneral ;
       
   678 	    	iLog->Log(_L8("Failed.. @2 TRAPD")) ;
       
   679 	    	}
       
   680 	         	
       
   681 	    }
       
   682     
       
   683     else
       
   684     	{
       
   685     	returnCode = KErrGeneral ;
       
   686     	iLog->Log(_L8("Failed.. @TRAPD")) ;
       
   687     	}
       
   688 
       
   689    	CStatus *defData = CStatus::NewL(defValue) ;
       
   690    	      
       
   691  //   CoreObj->SetInfoL(KEntity,KKey,defData) ;
       
   692     
       
   693     delete defData ;
       
   694     delete ipData ;
       
   695     delete CoreObj ;
       
   696      
       
   697     __UHEAP_MARKEND ;
       
   698     return returnCode ;
       
   699     
       
   700 
       
   701     }
       
   702  
       
   703  // -----------------------------------------------------------------------------
       
   704 // Ctsysmanualtest::GetFlipStatus
       
   705 // Test method for getting FlipStatus 
       
   706 // -----------------------------------------------------------------------------
       
   707 //
       
   708 TInt Ctsysmanualtest::GetFlipStatus( CStifItemParser& aItem )
       
   709     {
       
   710 
       
   711     __UHEAP_MARK;
       
   712     
       
   713     _LIT(KEntity,"General") ;
       
   714     _LIT(KKey,"FlipStatus") ;
       
   715     
       
   716     TInt returnCode = KErrNone ;
       
   717     TInt expState = 0 ;
       
   718     TInt expDataType = 0 ;
       
   719     aItem.GetNextInt (expState) ;
       
   720     
       
   721     CSysInfoService *CoreObj = CSysInfoService :: NewL() ;
       
   722     
       
   723     if( NULL == CoreObj)
       
   724 	    {
       
   725 	    iLog->Log(_L8("Failed.. @Core")) ;
       
   726 	   	return KErrGeneral ;
       
   727 	   	}
       
   728     
       
   729 
       
   730     CSysData *sysData ;
       
   731    	
       
   732    	
       
   733     iLog->Log(_L8("FlipStatus : %d"),expState) ;	
       
   734     TRAPD(leaveCode, CoreObj->GetInfoL(KEntity,KKey,sysData)) ;
       
   735     if(KErrNone == leaveCode)
       
   736 	    {
       
   737 	       
       
   738 	    TInt retType = sysData->DataType() ;
       
   739 	    
       
   740 	    if(expDataType == retType)
       
   741 		    {
       
   742 		      
       
   743 		    CStatus *status = (CStatus*)sysData ;
       
   744 		    TInt retStatus = status->Status() ;
       
   745 		    	   
       
   746 		    if(expState != retStatus)
       
   747 		    	{
       
   748 		        returnCode = KErrGeneral ; 
       
   749 		    	iLog->Log(_L8("Failed.. @retStatus")) ;
       
   750 		    	}
       
   751 		    else
       
   752 		    	{
       
   753 		    	iLog->Log(_L8("Passed..")) ;	
       
   754 		    	}
       
   755 		     }
       
   756 		    
       
   757 		else
       
   758 			{
       
   759 			returnCode = KErrGeneral ;	
       
   760 			iLog->Log(_L8("Failed.. @retType")) ;
       
   761 			}    
       
   762 	    
       
   763 	    delete sysData ;
       
   764 	    
       
   765 	    }
       
   766     else
       
   767     	{
       
   768     	returnCode = KErrGeneral ;
       
   769     	iLog->Log(_L8("Failed.. @TRAPD")) ;
       
   770     	}
       
   771     delete CoreObj ;
       
   772 
       
   773     __UHEAP_MARKEND ;
       
   774     return returnCode ;
       
   775 
       
   776     }
       
   777   
       
   778   
       
   779 // -----------------------------------------------------------------------------
       
   780 // Ctsysmanualtest::GetGripStatus
       
   781 // Test method for getting GripStatus 
       
   782 // -----------------------------------------------------------------------------
       
   783 //
       
   784 TInt Ctsysmanualtest::GetGripStatus( CStifItemParser& aItem )
       
   785     {
       
   786 
       
   787     __UHEAP_MARK;
       
   788     
       
   789     _LIT(KEntity,"General") ;
       
   790     _LIT(KKey,"GripStatus") ;
       
   791     
       
   792     TInt returnCode = KErrNone ;
       
   793     TInt expState = 0 ;
       
   794     TInt expDataType = 0 ;
       
   795     aItem.GetNextInt (expState) ;
       
   796     
       
   797     CSysInfoService *CoreObj = CSysInfoService :: NewL() ;
       
   798     
       
   799     if( NULL == CoreObj)
       
   800 	    {
       
   801 	    iLog->Log(_L8("Failed.. @Core")) ;
       
   802 	   	return KErrGeneral ;
       
   803 	   	}
       
   804     
       
   805 
       
   806     CSysData *sysData ;
       
   807    	
       
   808    	
       
   809     iLog->Log(_L8("GripStatus : %d"),expState) ;	
       
   810     TRAPD(leaveCode, CoreObj->GetInfoL(KEntity,KKey,sysData)) ;
       
   811     if(KErrNone == leaveCode)
       
   812 	    {
       
   813 	       
       
   814 	    TInt retType = sysData->DataType() ;
       
   815 	    
       
   816 	    if(expDataType == retType)
       
   817 		    {
       
   818 		      
       
   819 		    CStatus *status = (CStatus*)sysData ;
       
   820 		    TInt retStatus = status->Status() ;
       
   821 		    	   
       
   822 		    if(expState != retStatus)
       
   823 		    	{
       
   824 		        returnCode = KErrGeneral ; 
       
   825 		    	iLog->Log(_L8("Failed.. @retStatus")) ;
       
   826 		    	}
       
   827 		    else
       
   828 		    	{
       
   829 		    	iLog->Log(_L8("Passed..")) ;	
       
   830 		    	}
       
   831 		     }
       
   832 		    
       
   833 		else
       
   834 			{
       
   835 			returnCode = KErrGeneral ;	
       
   836 			iLog->Log(_L8("Failed.. @retType")) ;
       
   837 			}    
       
   838 	    
       
   839 	    delete sysData ;
       
   840 	    
       
   841 	    }
       
   842     else
       
   843     	{
       
   844     	returnCode = KErrGeneral ;
       
   845     	iLog->Log(_L8("Failed.. @TRAPD")) ;
       
   846     	}
       
   847     delete CoreObj ;
       
   848 
       
   849     __UHEAP_MARKEND ;
       
   850     return returnCode ;
       
   851 
       
   852     }  
       
   853     
       
   854 // -----------------------------------------------------------------------------
       
   855 // Ctsysmanualtest::GetConnAcc
       
   856 // Test method for getting connected accessories 
       
   857 // -----------------------------------------------------------------------------
       
   858 //
       
   859 TInt Ctsysmanualtest::GetConnAcc( CStifItemParser& aItem )
       
   860     {
       
   861 
       
   862     __UHEAP_MARK;
       
   863     
       
   864     _LIT(KEntity,"General") ;
       
   865     _LIT(KKey,"ConnectedAccessories") ;
       
   866     
       
   867     TInt expDataType = 8 ;
       
   868     TInt returnCode = KErrNone ;
       
   869     TInt expAcc ;
       
   870     TInt expAccStatus ;
       
   871     aItem.GetNextInt(expAcc) ;   
       
   872     aItem.GetNextInt(expAccStatus) ;
       
   873     
       
   874     CSysInfoService *CoreObj = CSysInfoService :: NewL() ;
       
   875     
       
   876     if( NULL == CoreObj)
       
   877 	    {
       
   878 	    iLog->Log(_L8("Failed.. @Core")) ;
       
   879 	   	return KErrGeneral ;
       
   880 	   	}
       
   881     
       
   882     CSysData *sysData ;
       
   883     
       
   884     TRAPD(leaveCode, CoreObj->GetInfoL(KEntity,KKey,sysData)) ;
       
   885     if(KErrNone == leaveCode)
       
   886 	    {
       
   887 	       
       
   888 	    TInt retType = sysData->DataType() ;
       
   889 	    
       
   890 	    if(expDataType == retType)
       
   891 		    {
       
   892 		      
       
   893 		    CAccList *retData = (CAccList*)sysData ;
       
   894 		    TInt listCount ;
       
   895 		    listCount = retData->Count() ;
       
   896 		    
       
   897 		    if(listCount)
       
   898 			    {
       
   899 			    	
       
   900 			    const CAccessoryInfo* accInfo = NULL ;
       
   901 			    for(TInt i=0; i<listCount; i++)
       
   902 				    {
       
   903   				    TInt accType ;
       
   904   				    TInt accStatus ;
       
   905   				    retData->AtL(i,accInfo) ;
       
   906 				    accType = accInfo->AccessoryType() ;
       
   907 				    accStatus = accInfo->ConnectionState() ;
       
   908 				    if((accType == expAcc) && (accStatus == expAccStatus))
       
   909 				    	{
       
   910 				    	TBuf<20> accBuf(accType) ;
       
   911 				    	TBuf<20> accStatBuf(accStatus) ;
       
   912 				    	iLog->Log(_L8("Accessory :")) ;		    	   
       
   913 				    	iLog->Log(accBuf) ;	
       
   914 				    	iLog->Log(_L8("Status :")) ;		    	   
       
   915 				    	iLog->Log(accStatBuf) ;	
       
   916 				    	}
       
   917 					else
       
   918 						{
       
   919 						returnCode = KErrGeneral ;
       
   920 						}	  
       
   921 							   	
       
   922 				   	}
       
   923 			    
       
   924 			    }
       
   925 		    
       
   926 		    else
       
   927 		    	{
       
   928 		    	returnCode = KErrGeneral ;
       
   929 		    	}
       
   930 		     }
       
   931 		    
       
   932 		else
       
   933 			{
       
   934 			returnCode = KErrGeneral ;	
       
   935 			iLog->Log(_L8("Failed.. @retType")) ;
       
   936 			}    
       
   937 	    
       
   938 	    delete sysData ;
       
   939 	    
       
   940 	    }
       
   941     else
       
   942     	{
       
   943     	returnCode = KErrGeneral ;
       
   944     	iLog->Log(_L8("Failed.. @TRAPD")) ;
       
   945     	}
       
   946     delete CoreObj ;
       
   947  
       
   948     __UHEAP_MARKEND ;
       
   949     return returnCode ;
       
   950 
       
   951     }
       
   952        
       
   953 
       
   954 // -----------------------------------------------------------------------------
       
   955 // Ctsysmanualtest::SetDisplayLanguage
       
   956 // Test method for setting DisplayLanguage 
       
   957 // -----------------------------------------------------------------------------
       
   958 //
       
   959 TInt Ctsysmanualtest::SetDisplayLanguage( CStifItemParser& aItem )
       
   960     {
       
   961 
       
   962     __UHEAP_MARK;
       
   963     
       
   964     _LIT(KEntity,"General") ;
       
   965     _LIT(KKey,"DisplayLanguage") ;
       
   966     
       
   967     TInt returnCode = KErrNone ;
       
   968     TInt expLanguage = 0 ;
       
   969     TInt expDataType = 0 ;
       
   970     aItem.GetNextInt (expLanguage) ;
       
   971     
       
   972     CSysInfoService *CoreObj = CSysInfoService :: NewL() ;
       
   973     
       
   974     if( NULL == CoreObj)
       
   975 	    {
       
   976 	    iLog->Log(_L8("Failed.. @Core")) ;
       
   977 	   	return KErrGeneral ;
       
   978 	   	}
       
   979     
       
   980    	CStatus *sysData = CStatus::NewL(expLanguage) ;
       
   981    	
       
   982     iLog->Log(_L8("DisplayLanguage : %d"),expLanguage) ;	
       
   983     
       
   984     TRAPD(leaveCode, CoreObj->SetInfoL(KEntity,KKey,sysData)) ;
       
   985     
       
   986     if(KErrNone == leaveCode)
       
   987 	    {
       
   988 	       
       
   989 	    CSysData *outData ;
       
   990   	
       
   991 		TRAPD(leaveCode, CoreObj->GetInfoL(KEntity,KKey,outData)) ;
       
   992     	
       
   993     	if(KErrNone == leaveCode)
       
   994 	    	{
       
   995 	       
       
   996 	    	TInt retType = outData->DataType() ;
       
   997 	    
       
   998 	    	if(expDataType == retType)
       
   999 		    	{
       
  1000 		      
       
  1001 		    	CStatus *status = (CStatus*)outData ;
       
  1002 		    	TInt retStatus = status->Status() ;
       
  1003 		    	   
       
  1004 		    	if(expLanguage != retStatus)
       
  1005 			    	{
       
  1006 			        returnCode = KErrGeneral ; 
       
  1007 			    	iLog->Log(_L8("Failed.. @retStatus")) ;
       
  1008 			    	}
       
  1009 			    else
       
  1010 			    	{
       
  1011 			    	iLog->Log(_L8("Passed..")) ;	
       
  1012 			    	}
       
  1013 		        
       
  1014 		        delete outData ;
       
  1015 		        
       
  1016 	      		}
       
  1017 	    	}
       
  1018 	    else
       
  1019 	    	{
       
  1020 	    	returnCode = KErrGeneral ;
       
  1021     		iLog->Log(_L8("Failed.. @2 TRAPD")) ;
       
  1022 	    	}
       
  1023 	    }
       
  1024     else
       
  1025     	{
       
  1026     	returnCode = KErrGeneral ;
       
  1027     	iLog->Log(_L8("Failed.. @TRAPD")) ;
       
  1028     	}
       
  1029     
       
  1030     delete sysData ;
       
  1031     delete CoreObj ;
       
  1032     
       
  1033        
       
  1034     __UHEAP_MARKEND ;
       
  1035     return returnCode ;
       
  1036 
       
  1037     }
       
  1038 
       
  1039 
       
  1040 // -----------------------------------------------------------------------------
       
  1041 // Ctsysmanualtest::CriticalMemNotitication
       
  1042 // Example test method function.
       
  1043 // (other items were commented in a header).
       
  1044 // -----------------------------------------------------------------------------
       
  1045 //
       
  1046 /*TInt Ctsysmanualtest::CriticalMemNotitication( CStifItemParser& aItem )
       
  1047     {
       
  1048    	TInt Err = KErrNone ;
       
  1049 	TInt expDrive = 0 ;
       
  1050 	aItem.GetNextInt (expDrive) ;
       
  1051 //	#if ( !(defined(__WINS__) || defined(__WINSCW__)) )
       
  1052 	__UHEAP_MARK;
       
  1053 
       
  1054 	CCriticalMemNot *test = CCriticalMemNot::NewL(iLog, expDrive, 0);
       
  1055 	test->Start();
       
  1056 	Err = test->Result();
       
  1057 	delete test;
       
  1058     
       
  1059 //    #endif
       
  1060 	__UHEAP_MARKEND;
       
  1061 	return Err;
       
  1062 
       
  1063     
       
  1064     }
       
  1065 
       
  1066 */
       
  1067 // -----------------------------------------------------------------------------
       
  1068 // Ctsysmanualtest::MemCardNotification
       
  1069 // Example test method function.
       
  1070 // (other items were commented in a header).
       
  1071 // -----------------------------------------------------------------------------
       
  1072 //
       
  1073 /*TInt Ctsysmanualtest::MemCardNotification( CStifItemParser& aItem )
       
  1074     {
       
  1075    	TInt Err = KErrNone ;
       
  1076 //	#if ( !(defined(__WINS__) || defined(__WINSCW__)) )
       
  1077 	__UHEAP_MARK;
       
  1078 
       
  1079 	CCriticalMemNot *test = CCriticalMemNot::NewL(iLog, 1, 1);
       
  1080 	test->Start();
       
  1081 	Err = test->Result();
       
  1082 	delete test;
       
  1083     
       
  1084 //    #endif
       
  1085 	__UHEAP_MARKEND;
       
  1086 	return Err;
       
  1087 
       
  1088     
       
  1089     }
       
  1090 */
       
  1091 // -----------------------------------------------------------------------------
       
  1092 // Ctsysmanualtest::?member_function
       
  1093 // ?implementation_description
       
  1094 // (other items were commented in a header).
       
  1095 // -----------------------------------------------------------------------------
       
  1096 //
       
  1097 /*
       
  1098 TInt Ctsysmanualtest::?member_function(
       
  1099    CItemParser& aItem )
       
  1100    {
       
  1101 
       
  1102    ?code
       
  1103 
       
  1104    }
       
  1105 */
       
  1106 
       
  1107 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
  1108 // None
       
  1109 
       
  1110 //  End of File