homescreensrv_plat/sapi_homescreenplugin/tsrc/common/inc/mt_hspsteststep.h
changeset 0 79c6a41cd166
equal deleted inserted replaced
-1:000000000000 0:79c6a41cd166
       
     1 /*
       
     2 * Copyright (c) 2008 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 "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:  Defination of class MT_CHSPSTeststep
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_MT_HSPSTESTSTEP_H
       
    20 #define C_MT_HSPSTESTSTEP_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <liwcommon.h>
       
    24 #include <liwgenericparam.h>
       
    25 
       
    26 /**
       
    27  * This class defines a HSPS test step used in HSPS testing
       
    28 */
       
    29 NONSHARABLE_CLASS( MT_CHSPSTeststep )
       
    30 	: public CActive, public MLiwNotifyCallback
       
    31     {
       
    32     
       
    33     public: // Constructors and destructors
       
    34 
       
    35         /**
       
    36          * Two phase construction
       
    37          */
       
    38         static MT_CHSPSTeststep* NewL(
       
    39             MLiwInterface& aInterface,
       
    40             TUint8* aMethod,
       
    41             TUint8* aInParams,
       
    42             TUint8* aExpOutParams,
       
    43             TBool aAsync,
       
    44             TBool aMeasureExecTime = EFalse );
       
    45         
       
    46         /**
       
    47          * Destructor
       
    48          */
       
    49         virtual ~MT_CHSPSTeststep();
       
    50 
       
    51     private: // Constructors and destructors
       
    52 
       
    53         MT_CHSPSTeststep(
       
    54             MLiwInterface& aInterface,
       
    55             TUint8* aMethod,
       
    56             TUint8* aInParams,
       
    57             TUint8* aExpOutParams,
       
    58             TBool aAsync,
       
    59             TBool aMeasureExecTime );
       
    60         
       
    61     public: // Functions from base classes
       
    62 
       
    63         /**
       
    64         * From CActive
       
    65         */
       
    66         void RunL();
       
    67 
       
    68         /**
       
    69          * From CActive
       
    70          */
       
    71         TInt RunError( TInt aError );
       
    72 
       
    73         /**
       
    74          * From CActive
       
    75          */
       
    76         void DoCancel();
       
    77 
       
    78         /**
       
    79         * From MLiwNotifyCallback
       
    80         * @param aCmdId                The service command associated to the event.
       
    81         * @param aEventId              Occured event, see LiwCommon.hrh.
       
    82         * @param aEventParamList       Event parameters, if any, as defined per
       
    83         *                              each event.
       
    84         * @param aInParamList          Input parameters, if any, given in the
       
    85         *                              related HandleCommmandL.
       
    86         * @return                      Error code for the callback.
       
    87         */       
       
    88         TInt HandleNotifyL(
       
    89             TInt aCmdId,
       
    90             TInt aEventId,
       
    91             CLiwGenericParamList& aEventParamList,
       
    92             const CLiwGenericParamList& aInParamList );
       
    93         
       
    94     public: // New methods
       
    95     
       
    96         /**
       
    97         * Calls service method
       
    98         */
       
    99         void CallServiceL();
       
   100 
       
   101         /**
       
   102         * Checks output parameters of method call
       
   103         * @return                      TRUE, if received output parameters 
       
   104         *                              match to expected output paramters
       
   105         *                              FALSE, if received output paramters
       
   106         *                              does not match to expected output parameters
       
   107         */
       
   108         TInt CheckOutParams();
       
   109 
       
   110     private: // New functions
       
   111         
       
   112         /**
       
   113         * Creates input parameter list from a descriptor stream
       
   114         * @param aInParams             Input parameter stream
       
   115         * @return                      Pointer to created input parameter list
       
   116         */
       
   117         CLiwGenericParamList* CreateInParamListL(
       
   118             TUint8* aInParams );
       
   119 
       
   120         /**
       
   121         * Creates output descriptor stream from output parameter list
       
   122         * @param aOutParamList         Output parameter list
       
   123         * @return                      Pointer to created output parameter stream
       
   124         */
       
   125         HBufC8* CreateOutParamsL(
       
   126                 CLiwGenericParamList& aOutParamList );
       
   127 
       
   128         /**
       
   129         * Starts timing of SAPI method execution
       
   130         * @param aMethod               Called SAPI method
       
   131         * @return                      void
       
   132         */
       
   133         void StartTiming(
       
   134             TDesC8& aMethod );
       
   135 
       
   136         /**
       
   137         * Calculates SAPI method execution time
       
   138         * @return                      void
       
   139         */
       
   140         void StopTiming();
       
   141         
       
   142 #ifdef HSPS_LOG_ACTIVE        
       
   143         /**
       
   144          * Debug output to a text file
       
   145          * @param aOutPtr An array of bytes from the SAPI call
       
   146          */
       
   147         void DebugL( const TUint8* aOutPtr );
       
   148 #endif
       
   149         
       
   150     public: // Data
       
   151 
       
   152         // Output parameters
       
   153         HBufC8* iOutParams;
       
   154         // Test step timeout
       
   155         CPeriodic* iTimeout;
       
   156         
       
   157     private: // Data
       
   158     
       
   159         /** 
       
   160          * Service interface
       
   161          */
       
   162         MLiwInterface& iInterface;
       
   163 
       
   164         /**
       
   165          * Test step method 
       
   166          * ( Not owned )
       
   167          */
       
   168         TUint8* iMethod;
       
   169         
       
   170         /**
       
   171          * Test step input parameters as a binary stream
       
   172          * ( Not owned )
       
   173          */
       
   174         TUint8* iInParams;
       
   175         
       
   176         /**
       
   177          * Test step output parameters as a binary stream
       
   178          * ( Not owned )
       
   179          */
       
   180         TUint8* iExpOutParams;
       
   181         
       
   182         /** 
       
   183          * Test step asynchronous status
       
   184          */
       
   185         TBool iAsync;
       
   186 
       
   187         /** 
       
   188          * Execution time measurement status
       
   189          */
       
   190         TBool iMeasureExecTime;
       
   191 
       
   192         /** 
       
   193          * Test step method start time
       
   194          */
       
   195         TTime iStartTime;
       
   196         
       
   197     };
       
   198 
       
   199 #endif      //  C_MT_HSPSTESTSTEP_H
       
   200 
       
   201 // End of file