resourcemgmt/hwresourcesmgr/test/multiclient/common/testcasecontroller.h
changeset 0 4e1aa6a622a0
child 21 ccb4f6b3db21
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef TESTCASECONTROLLER_H
       
    17 #define TESTCASECONTROLLER_H
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <e32def.h>
       
    21 #include <eikenv.h>
       
    22 #include <hwrmlight.h>
       
    23 #include <hwrmextendedlight.h>
       
    24 #include <hwrmenhancedlight.h>
       
    25 #include <hwrmvibra.h>
       
    26 #include <hwrmfmtx.h>
       
    27 #include "McFramework.h"
       
    28 #include "tc_log.h"
       
    29 #include "testcaseids.h"
       
    30 
       
    31 #define TEST_TRACE( a ) RDebug::Print a 
       
    32 
       
    33 class CMcFramework;
       
    34 class CRepository;
       
    35 
       
    36 class MHwrmTestCaseObserver
       
    37 	{
       
    38 public:
       
    39 	virtual void InfoMessage(const TDesC& aMessage) =0;
       
    40 	virtual void LogMessage(const TDesC& aMessage) 	=0;
       
    41 	virtual void DebugMessage(const TDesC& aMessage) =0;
       
    42 	};
       
    43 	
       
    44 class CHwrmTestCaseController : public CBase, 
       
    45 								public MHWRMLightObserver,
       
    46 								public MHWRMFmTxObserver
       
    47     {
       
    48 public:
       
    49 	static CHwrmTestCaseController* NewL(MHwrmTestCaseObserver& aObserver);
       
    50 	~CHwrmTestCaseController();	
       
    51 	
       
    52 	
       
    53 public:
       
    54 	void SetApiType(THWRMLightTestFAPIType aApiType);
       
    55 	void RunTestCases(TInt aCase);
       
    56     void RunTestCases(TInt aCasesFrom, TInt aCasesTo);
       
    57 	void RunBasicTestCases(THWRMLightTestFAPIType aApiType);
       
    58 	void RunMulticlientTestCases();
       
    59 	
       
    60 	void RunSlaveMode(); // background
       
    61 	
       
    62 private:
       
    63 	CHwrmTestCaseController(MHwrmTestCaseObserver& aObserver);
       
    64 	void ConstructL();
       
    65 	
       
    66 	enum THwrmMessageOp
       
    67 		{
       
    68 		EHwrmMessageOpInfo = 0,
       
    69 		EHwrmMessageOpLog,
       
    70 		EHwrmMessageOpDebug
       
    71 		};
       
    72 		 
       
    73 private:
       
    74 	void UpdateSupportedTargets();
       
    75 	
       
    76 	void LightStatusChanged( TInt aTarget, CHWRMLight::TLightStatus aStatus);
       
    77 	void VibraStatusChanged( CHWRMVibra::TVibraStatus aStatus);
       
    78 	void VibraModeChanged( CHWRMVibra::TVibraModeState aStatus);
       
    79 	void FmTxStatusChanged( TFmTxState aState);
       
    80 	void FmTxFrequencyChanged( TInt aFrequency);
       
    81 	
       
    82 
       
    83     void LightTargetTest( TInt aTargetMask );
       
    84     TInt LightTargetTestSDK( TInt aTarget );
       
    85     TInt LightTargetTestExtended( TInt aTarget );
       
    86 
       
    87     void LogResult( const TDesC& aText );
       
    88 	void LogResult(const TDesC& aTestCase, TInt aErrorCode);
       
    89 	void LogResult( const TDesC& aTestCase, TInt aErrorCode, TInt aExpected );
       
    90 	
       
    91 	TBool TargetSupported( TInt aTarget );
       
    92 
       
    93 	void LightTestAllSupportedSDKTargets( TInt aTargetsToBeSkipped );
       
    94 	void LightTestAllSupportedExtendedTargets( TInt aTargetsToBeSkipped );
       
    95 
       
    96 
       
    97 
       
    98    	TInt GetLightStatusForSystemTarget( CHWRMLight* aLight, CHWRMLight::TLightStatus aStatus );
       
    99 	TInt GetLightStatusForSystemTarget( CHWRMExtendedLight* aLight, CHWRMExtendedLight::TLightStatus aStatus );
       
   100 
       
   101 
       
   102 	TInt MC_Display_RGB_M();
       
   103     TInt MC_Primary_display_light_M();
       
   104     TInt MC_Display_on_and_keyboard_blink_M();
       
   105     TInt MC_Display_on_and_keyboard_reserved_M();
       
   106     TInt MC_Display_and_keyboard_blink_M();
       
   107     TInt MC_Vibra_Basic_Usage_M();
       
   108     TInt MC_Combined_light_and_vibra_usage_M();
       
   109     TInt MC_Combined_light_and_vibra_usage_2_M();
       
   110     TInt MC_FmTx_Basic_Usage_M();
       
   111     TInt MaliciousVibra();
       
   112     TInt ChargingNotify();
       
   113     TInt RunRepeatedlyInvalidValues();
       
   114     TInt TestLightOn(TInt aTarget, TInt aDur, TInt aIntens, TBool aFadeIn);
       
   115     TInt TestLightOn(TInt aTarget);	
       
   116     TInt TestLightOnColor(TInt aTarget, TInt aDur, THWRMLightColor& aColor);
       
   117 	TInt Verify_RGBColorValue(THWRMLightColor& aColor);
       
   118     TInt TestLightOff(TInt aTarget, TInt aDuration, TBool aFadeOut);	
       
   119     TInt TestLightOff(TInt aTarget);		
       
   120     TInt TestLightBlink(TInt aTarget,TInt aDuration,TInt aOnDuration,TInt aOffDuration,TInt aIntensity);
       
   121     TInt TestLightBlink(TInt aTarget,TInt aDuration);
       
   122     TInt TestLightBlink(TInt aTarget);
       
   123     TInt Verify_MCFramework_M();
       
   124     TInt RunTestVibra(TInt howLong, TInt whatIntensity);
       
   125 	TInt RunTestVibra(TInt howLong);
       
   126 	TInt StopTestVibra();
       
   127 	TInt RunTestFmTx( TInt aFrequency );
       
   128 	TInt StopTestFmTx();
       
   129 
       
   130 //
       
   131 // BACKGROUND
       
   132 	
       
   133 	TInt MC_Display_RGB_S();
       
   134 	TInt MC_Primary_display_light_S();
       
   135 	TInt MC_Display_on_and_keyboard_blink_S();
       
   136 	TInt MC_Display_on_and_keyboard_reserved_S();
       
   137 	TInt MC_Display_and_keyboard_blink_S();
       
   138 	TInt MC_Vibra_Basic_Usage_S();	
       
   139     TInt MC_Combined_light_and_vibra_usage_S();
       
   140     TInt MC_Combined_light_and_vibra_usage_2_S();
       
   141     TInt MC_FmTx_Basic_Usage_S();
       
   142 	//TInt TestLightOn(TInt aTarget, TInt aDur, TInt aIntens, TBool aFadeIn);
       
   143 	//TInt TestLightOn(TInt aTarget);	
       
   144 	//TInt TestLightOff(TInt aTarget, TInt aDuration, TBool aFadeOut);	
       
   145 	//TInt TestLightOff(TInt aTarget);		
       
   146 	//TInt TestLightBlink(TInt aTarget,TInt aDuration,TInt aOnDuration,TInt aOffDuration,TInt aIntensity);
       
   147 	//TInt TestLightBlink(TInt aTarget,TInt aDuration);
       
   148 	//TInt TestLightBlink(TInt aTarget);
       
   149 	TInt Verify_MCFramework_S();	
       
   150     //TInt RunTestVibra(TInt howLong, TInt whatIntensity);
       
   151 	//TInt RunTestVibra(TInt howLong);
       
   152 	//TInt StopTestVibra();
       
   153 // END BACKGROUND
       
   154 //
       
   155    	void LightOnDurationTest( TInt aTargetMask, TBool aIsRGBTest = EFalse, TInt aRed = 0, TInt aGreen = 0, TInt aBlue = 0 );
       
   156     TInt LightOnDurationTestSDK( TInt aTarget, TBool aIsRGBTest = EFalse, TInt aRed = 0, TInt aGreen = 0, TInt aBlue = 0 );
       
   157 	TInt LightOnDurationTestExtended( TInt aTarget );
       
   158 	TInt LightOnDurationTestEnhanced( TInt aTarget, TBool aIsRGBTest = EFalse, TInt aRed = 0, TInt aGreen = 0, TInt aBlue = 0 );
       
   159 
       
   160    	void LightOffDurationTest( TInt aTargetMask );
       
   161     TInt LightOffDurationTestSDK( TInt aTarget );
       
   162     TInt LightOffDurationTestExtended( TInt aTarget );
       
   163 
       
   164     void LightIntensityTest( TInt aTargetMask );
       
   165     TInt LightIntensityTestSDK( TInt aTarget );
       
   166     TInt LightIntensityTestExtended( TInt aTarget );
       
   167 
       
   168     void LightBlinkTest( TInt aTargetMask );
       
   169     TInt LightBlinkTestSDK( TInt aTarget );
       
   170     TInt LightBlinkTestExtended( TInt aTarget );
       
   171 
       
   172     void LightBlinkDurationTest( TInt aTargetMask, TBool aIsRGBTest = EFalse, TInt aRed = 0, TInt aGreen = 0, TInt aBlue = 0 );
       
   173     TInt LightBlinkDurationTestSDK( TInt aTarget, TBool aIsRGBTest = EFalse, TInt aRed = 0, TInt aGreen = 0, TInt aBlue = 0 );
       
   174     TInt LightBlinkDurationTestExtended( TInt aTarget );
       
   175     TInt LightBlinkDurationTestEnhanced( TInt aTarget, TBool aIsRGBTest = EFalse, TInt aRed = 0, TInt aGreen = 0, TInt aBlue = 0 );
       
   176 	
       
   177     void LightBlinkOnOffTest( TInt aTargetMask );
       
   178     TInt LightBlinkOnOffTestSDK( TInt aTarget );
       
   179     TInt LightBlinkOnOffTestExtended( TInt aTarget );
       
   180 	TInt LightWithDifferentTargetsSDK();
       
   181     TInt LightWithDifferentTargetsExtended();
       
   182 	TInt LightWithInvalidDurationSDK();
       
   183     TInt LightWithInvalidDurationExtended();
       
   184  	
       
   185  	TInt LightIntensitySDK();
       
   186  	TInt LightIntensityExtended();
       
   187 
       
   188     //TInt LightWithInvalidTarget();
       
   189    	 		 
       
   190    	// logging
       
   191    	void FormatMessageL(THwrmMessageOp aOp, const TDesC& aMessage);
       
   192    	void FormatMessageL(THwrmMessageOp aOp, const TDesC& aMessage, TInt aArg1);
       
   193    	void FormatMessageL(THwrmMessageOp aOp, const TDesC& aMessage, TInt aArg1, TInt aArg2);
       
   194    	void FormatMessageL(THwrmMessageOp aOp, const TDesC& aMessage, TInt aArg1, TInt aArg2, TInt aArg3);
       
   195    	void FormatMessageL(THwrmMessageOp aOp, const TDesC& aMessage, TInt aArg1, TInt aArg2, TInt aArg3, TInt aArg4);
       
   196    	void FormatMessageL(THwrmMessageOp aOp, const TDesC& aMessage, const TDesC* aArg1);
       
   197    	void FormatMessageL(THwrmMessageOp aOp, const TDesC& aMessage, const TDesC* aArg1, TInt aArg2, TInt aArg3);
       
   198    	void SendMessage(THwrmMessageOp aOp, const TDesC& aMessage);
       
   199    	
       
   200 private:
       
   201 	MHwrmTestCaseObserver& iObserver;
       
   202 	
       
   203 	//variable to store type of API (Extended or SDK) used in cases
       
   204 	THWRMLightTestFAPIType iApiType;
       
   205 	
       
   206 	CRepository* iSession;
       
   207 	TInt iErrCode;
       
   208 	CHWRMLight* iMyLight;
       
   209 	CHWRMLight::TLightStatus iMyStatus;
       
   210 	TInt iSupportedTargets;
       
   211 	
       
   212     CMcFramework* iMcFramework;
       
   213     CHWRMVibra* iVibra;
       
   214     CHWRMVibra::TVibraStatus iVibraStatus;
       
   215     CHWRMVibra::TVibraModeState iVibraMode;
       
   216     
       
   217 	CHWRMFmTx* iFmTx;
       
   218 	TFmTxState iFmTxState;        
       
   219     };
       
   220     
       
   221 #endif