stif/TestCombiner/inc/TestCaseNotify.h
branchRCL_3
changeset 59 8ad140f3dd41
equal deleted inserted replaced
49:7fdc9a71d314 59:8ad140f3dd41
       
     1 /*
       
     2 * Copyright (c) 2009 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: This file contains the header file of
       
    15 * the CTestProgressNotifier and the CTestEventNotifier.
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef TEST_CASE_NOTIFY_H
       
    20 #define TEST_CASE_NOTIFY_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32std.h>
       
    24 #include <e32base.h>
       
    25 #include <stifinternal/TestServerClient.h>
       
    26 #include "TestCombiner.h"
       
    27 #include "StifCommand.h"
       
    28 
       
    29 // CONSTANTS
       
    30 // None
       
    31 
       
    32 // MACROS
       
    33 // None
       
    34 
       
    35 // DATA TYPES
       
    36 // None
       
    37 
       
    38 // FUNCTION PROTOTYPES
       
    39 // None
       
    40 
       
    41 // FORWARD DECLARATIONS
       
    42 // None
       
    43 
       
    44 // CLASS DECLARATION
       
    45 
       
    46 // DESCRIPTION
       
    47 // CTestProgressNotifier is an active object used for notifications called from
       
    48 // Test Module using the RTestExecution API.
       
    49 NONSHARABLE_CLASS(CTestProgressNotifier)
       
    50     :public CActive
       
    51     {
       
    52     public: // Enumerations
       
    53         
       
    54     private: // Enumerations
       
    55         // TTestProgressStatus defines the status of notification
       
    56         enum TTestProgressStatus
       
    57             {
       
    58             ETestProgressIdle,
       
    59             ETestProgressPending,
       
    60             ETestProgressCompleted
       
    61             };
       
    62 
       
    63     public: // Constructors and destructor
       
    64         /**
       
    65         * Two-phased constructor.
       
    66         */
       
    67         static CTestProgressNotifier* NewL( CTestCombiner* aTestCombiner, 
       
    68                                             CTCTestCase* aTestCase );
       
    69           
       
    70         /**
       
    71         * Destructor.
       
    72         */
       
    73         ~CTestProgressNotifier();
       
    74         
       
    75         /**
       
    76         * Checks is UI print progress finished.
       
    77         */
       
    78         TBool IsPrintProgressFinished();
       
    79           
       
    80     public: // New functions
       
    81           
       
    82     public: // Functions from base classes
       
    83         /**
       
    84         * RunL derived from CActive handles the completed requests.
       
    85         */
       
    86         void RunL();
       
    87 
       
    88         /**
       
    89         * DoCancel derived from CActive handles the Cancel.
       
    90         */
       
    91         void DoCancel();
       
    92 
       
    93         /**
       
    94         * RunError derived from CActive handles errors from active handler.
       
    95         */
       
    96         TInt RunError( TInt aError );
       
    97           
       
    98     protected: // New functions
       
    99         
       
   100     protected: // Functions from base classes
       
   101         
       
   102     private:
       
   103         /**
       
   104         * By default Symbian OS constructor is private.
       
   105         */
       
   106         void ConstructL();
       
   107 
       
   108         /**
       
   109         * Parametric C++ constructor.
       
   110         */
       
   111         CTestProgressNotifier( CTestCombiner* aTestCombiner, 
       
   112                                CTCTestCase* aTestCase );
       
   113 
       
   114         /**
       
   115         * Start progress notifier.
       
   116         */
       
   117          void StartL();
       
   118 
       
   119     public: // Data
       
   120      
       
   121     protected: // Data
       
   122     
       
   123     private: // Data
       
   124         // Pointer to CTestCombiner
       
   125         CTestCombiner*      iTestCombiner;
       
   126           
       
   127         // Pointer to CTCTestCase 
       
   128         CTCTestCase*         iTestCase;
       
   129 
       
   130         // Internal state
       
   131         TTestProgressStatus iState;
       
   132 
       
   133         // Test Progress
       
   134         TTestProgress       iProgress;
       
   135         TTestProgressPckg   iProgressPckg;
       
   136 
       
   137         // Indication for UI print process
       
   138         TBool               iIsPrintProcessFinished;
       
   139 
       
   140     public: // Friend classes
       
   141     
       
   142     protected: // Friend classes
       
   143     
       
   144     private: // Friend classes
       
   145     
       
   146     };     
       
   147     
       
   148 // DESCRIPTION
       
   149 // CTestErrorNotifier is an active object used for notifications called from
       
   150 // Test Module using the RTestExecution API.
       
   151 NONSHARABLE_CLASS(CTestErrorNotifier)
       
   152     :public CActive
       
   153     {
       
   154     public: // Enumerations
       
   155         
       
   156     private: // Enumerations
       
   157         // TTestProgressStatus defines the status of notification
       
   158         enum TTestErrorStatus
       
   159             {
       
   160             ETestErrorIdle,
       
   161             ETestErrorPending,
       
   162             ETestErrorCompleted
       
   163             };
       
   164 
       
   165     public: // Constructors and destructor
       
   166         /**
       
   167         * Two-phased constructor.
       
   168         */
       
   169         static CTestErrorNotifier* NewL( CTestCombiner* aTestCombiner, 
       
   170                                          CTCTestModule* aTestModule );
       
   171           
       
   172         /**
       
   173         * Destructor.
       
   174         */
       
   175         ~CTestErrorNotifier();
       
   176           
       
   177     public: // New functions
       
   178           
       
   179     public: // Functions from base classes
       
   180         /**
       
   181         * RunL derived from CActive handles the completed requests.
       
   182         */
       
   183         void RunL();
       
   184 
       
   185         /**
       
   186         * DoCancel derived from CActive handles the Cancel.
       
   187         */
       
   188         void DoCancel();
       
   189 
       
   190         /**
       
   191         * RunError derived from CActive handles errors from active handler.
       
   192         */
       
   193         TInt RunError( TInt aError );
       
   194           
       
   195     protected: // New functions
       
   196         
       
   197     protected: // Functions from base classes
       
   198         
       
   199     private:
       
   200         /**
       
   201         * By default Symbian OS constructor is private.
       
   202         */
       
   203         void ConstructL();
       
   204 
       
   205         /**
       
   206         * Parametric C++ constructor.
       
   207         */
       
   208         CTestErrorNotifier( CTestCombiner* aTestCombiner, 
       
   209                             CTCTestModule* aTestModule );
       
   210 
       
   211         /**
       
   212         * Start progress notifier.
       
   213         */
       
   214          void StartL();
       
   215 
       
   216     public: // Data
       
   217      
       
   218     protected: // Data
       
   219     
       
   220     private: // Data
       
   221         // Pointer to CTestCombiner
       
   222         CTestCombiner*      iTestCombiner;
       
   223           
       
   224         //Pointer to CTCTestCase 
       
   225         CTCTestModule*         iTestModule;
       
   226 
       
   227         // Internal state
       
   228         TTestErrorStatus iState;
       
   229 
       
   230         // Test Progress
       
   231         TErrorNotification       iError;
       
   232         TErrorNotificationPckg   iErrorPckg;
       
   233 
       
   234     public: // Friend classes
       
   235     
       
   236     protected: // Friend classes
       
   237     
       
   238     private: // Friend classes
       
   239     
       
   240     };     
       
   241 
       
   242 // CLASS DECLARATION
       
   243 
       
   244 // DESCRIPTION
       
   245 // CTestEventNotify is an active object used to get event notify from
       
   246 // Test Server.
       
   247 NONSHARABLE_CLASS(CTestEventNotify)
       
   248     :public CActive
       
   249     {
       
   250     public: // Enumerations
       
   251     
       
   252     private: // Enumerations
       
   253         // TTestEventStatus defines the status of notification
       
   254         enum TTestEventNotifyStatus
       
   255             {
       
   256             ETestEventNotifyIdle,
       
   257             ETestEventNotifyPending,
       
   258             ETestEventNotifyCompleted
       
   259             };
       
   260 
       
   261     public:  // Constructors and destructor
       
   262         /**
       
   263         * Two-phased constructor.
       
   264         */
       
   265         static CTestEventNotify* NewL( CTestCombiner* aTestCombiner,
       
   266                                        CTCTestCase* aTestCase,
       
   267                                        TEventIf& aEvent );
       
   268           
       
   269         /**
       
   270         * Destructor.
       
   271         */
       
   272         ~CTestEventNotify();
       
   273           
       
   274     public: // New functions     
       
   275           
       
   276         TEventIf& Event(){ return iEvent; };
       
   277         
       
   278     public: // Functions from base classes
       
   279         /**
       
   280         * RunL derived from CActive handles the completed requests.
       
   281         */
       
   282         void RunL();
       
   283 
       
   284         /**
       
   285         * DoCancel derived from CActive handles the Cancel.
       
   286         */
       
   287         void DoCancel();
       
   288 
       
   289         /**
       
   290         * RunError derived from CActive handles errors from active handler.
       
   291         */
       
   292         TInt RunError( TInt aError );
       
   293           
       
   294     protected:  // New functions
       
   295     
       
   296     protected:  // Functions from base classes
       
   297     
       
   298     private:
       
   299         /**
       
   300         * By default Symbian OS constructor is private.
       
   301         */
       
   302         void ConstructL( TEventIf& aEvent );
       
   303 
       
   304         /**
       
   305         * Parametric C++ constructor.
       
   306         */
       
   307         CTestEventNotify( CTestCombiner* aTestCombiner, 
       
   308                           CTCTestCase* aTestCase );
       
   309         
       
   310 
       
   311     public:    //Data
       
   312      
       
   313     protected:  // Data
       
   314  
       
   315     private:     // Data
       
   316         // Pointer to CTestCombiner
       
   317         CTestCombiner* iTestCombiner;
       
   318         
       
   319         // Pointer CTestCase
       
   320         CTCTestCase* iTestCase;
       
   321 
       
   322         // Internal state
       
   323         TTestEventNotifyStatus iState;
       
   324 
       
   325         // Event interface
       
   326         TEventIf iEvent;
       
   327         TEventIfPckg iEventPckg;
       
   328 
       
   329     public:      // Friend classes
       
   330 
       
   331     protected:  // Friend classes
       
   332 
       
   333     private:     // Friend classes
       
   334 
       
   335     };
       
   336     
       
   337 // CLASS DECLARATION
       
   338 
       
   339 // DESCRIPTION
       
   340 // CTestEventNotifier is an active object used for event notify from
       
   341 // Test Module using the RTestExecution API.
       
   342 NONSHARABLE_CLASS(CTestEventNotifier)
       
   343     :public CActive
       
   344     {
       
   345     public: // Enumerations
       
   346     
       
   347     private: // Enumerations
       
   348         // TTestEventStatus defines the status of notification
       
   349         enum TTestEventStatus
       
   350             {
       
   351             ETestEventIdle,
       
   352             ETestEventPending,
       
   353             ETestEventCompleted,
       
   354             ETestEventWaitUnset
       
   355             };
       
   356 
       
   357     public:  // Constructors and destructor
       
   358         /**
       
   359         * Two-phased constructor.
       
   360         */
       
   361         static CTestEventNotifier* NewL( CTestCombiner* aTestCombiner, 
       
   362                                          CTCTestCase* aTestCase  );
       
   363           
       
   364         /**
       
   365         * Destructor.
       
   366         */
       
   367         ~CTestEventNotifier();
       
   368           
       
   369     public: // New functions     
       
   370           
       
   371     public: // Functions from base classes
       
   372         /**
       
   373         * RunL derived from CActive handles the completed requests.
       
   374         */
       
   375         void RunL();
       
   376 
       
   377         /**
       
   378         * DoCancel derived from CActive handles the Cancel.
       
   379         */
       
   380         void DoCancel();
       
   381 
       
   382         /**
       
   383         * RunError derived from CActive handles errors from active handler.
       
   384         */
       
   385         TInt RunError( TInt aError );
       
   386           
       
   387     protected:  // New functions
       
   388     
       
   389     protected:  // Functions from base classes
       
   390     
       
   391     private:
       
   392         /**
       
   393         * By default Symbian OS constructor is private.
       
   394         */
       
   395         void ConstructL();
       
   396 
       
   397         /**
       
   398         * Parametric C++ constructor.
       
   399         */
       
   400         CTestEventNotifier( CTestCombiner* aTestCombiner, 
       
   401                             CTCTestCase* aTestCase );
       
   402 
       
   403         /**
       
   404         * StartL starts the CTestEventNotifier active object.
       
   405         */
       
   406         void StartL();
       
   407 
       
   408     public:    //Data
       
   409      
       
   410     protected:  // Data
       
   411  
       
   412     private:     // Data
       
   413         // Pointer to CTestCombiner
       
   414         CTestCombiner* iTestCombiner;
       
   415 
       
   416         // Pointer CTestCase
       
   417         CTCTestCase* iTestCase;
       
   418 
       
   419         // Internal state
       
   420         TTestEventStatus iState;
       
   421 
       
   422         // Event interface
       
   423         TEventIf iEvent;
       
   424         TEventIfPckg iEventPckg;
       
   425 
       
   426     public:      // Friend classes
       
   427 
       
   428     protected:  // Friend classes
       
   429 
       
   430     private:     // Friend classes
       
   431 
       
   432     };
       
   433 
       
   434 // DESCRIPTION
       
   435 // CTestCommandNotifier is an active object used for command notify from
       
   436 // Test Module using the RTestExecution API.
       
   437 NONSHARABLE_CLASS(CTestCommandNotifier): public CActive
       
   438     {
       
   439     public:     // Enumerations
       
   440         // None
       
   441 
       
   442     private:    // Enumerations
       
   443         // None
       
   444 
       
   445     public:     // Constructors and destructor
       
   446 
       
   447         /**
       
   448         * Two-phased constructor.
       
   449         */
       
   450         static CTestCommandNotifier* NewL(CTestCombiner* aTestCombiner, CTCTestCase* aTestCase);
       
   451 
       
   452         /**
       
   453         * Destructor.
       
   454         */
       
   455         ~CTestCommandNotifier();
       
   456 
       
   457     public:     // New functions
       
   458 
       
   459         /**
       
   460         * StartL starts the CTestCommandNotifier active object.
       
   461         */
       
   462         void Start();
       
   463 
       
   464     public:     // Functions from base classes
       
   465 
       
   466         /**
       
   467         * RunL derived from CActive handles the completed requests.
       
   468         */
       
   469         void RunL();
       
   470 
       
   471         /**
       
   472         * DoCancel derived from CActive handles the cancel
       
   473         */
       
   474         void DoCancel();
       
   475 
       
   476         /**
       
   477         * RunError derived from CActive handles errors from active handler.
       
   478         */
       
   479         TInt RunError(TInt aError);
       
   480 
       
   481     protected:      // New functions
       
   482         // None
       
   483 
       
   484     protected:  // Functions from base classes
       
   485         // None
       
   486 
       
   487     private:
       
   488 
       
   489         /**
       
   490         * By default Symbian OS constructor is private.
       
   491         */
       
   492         void ConstructL();
       
   493 
       
   494         /**
       
   495         * Parametric C++ constructor.
       
   496         */
       
   497         CTestCommandNotifier(CTestCombiner* aTestCombiner, CTCTestCase* aTestCase);
       
   498 
       
   499     public:     // Data
       
   500         // None
       
   501 
       
   502     protected:  // Data
       
   503         // None
       
   504 
       
   505     private:    // Data
       
   506 
       
   507         // Pointer to CTestCombiner
       
   508         CTestCombiner*     iTestCombiner;
       
   509 
       
   510         // Pointer to CTCTestCase
       
   511         CTCTestCase*       iTestCase;
       
   512 
       
   513         // Command to be sent
       
   514         TCommand                        iCommand;
       
   515         TCommandPckg                    iCommandPckg;
       
   516         TBuf8<KMaxCommandParamsLength2> iParamsPckg;
       
   517 
       
   518     public:     // Friend classes
       
   519         // None
       
   520 
       
   521     protected:  // Friend classes
       
   522         // None
       
   523 
       
   524     private:    // Friend classes
       
   525         // None
       
   526     };
       
   527 
       
   528 #endif // TEST_CASE_NOTIFY_H
       
   529 
       
   530 // End of File