devicediagnosticsfw/diagframework/inc/diagexecplanentryimpl.h
branchRCL_3
changeset 26 19bba8228ff0
parent 0 b497e44ab2fc
equal deleted inserted replaced
25:b183ec05bd8c 26:19bba8228ff0
       
     1 /*
       
     2 * Copyright (c) 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 "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:  Class declaration for CDiagExecPlanEntryImpl
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef DIAGEXECPLANENTRYIMPL_H
       
    20 #define DIAGEXECPLANENTRYIMPL_H
       
    21 
       
    22 // SYSTEM INCLUDE FILES
       
    23 #include <e32base.h>                // CBase
       
    24 #include <DiagExecPlanEntry.h>      // MDiagExecPlanEntry
       
    25 #include <DiagEngineCommon.h>       // MDiagEngineCommon::TCancelMode
       
    26 
       
    27 class MDiagExecPlanEntryImplObserver;
       
    28 class TDiagEngineConfig;
       
    29 
       
    30 /**
       
    31 * Diagnostics Plug-in Execution Plan Entry Implementation.
       
    32 *
       
    33 * This class implements MDiagExecPlanEntry. It is meant to be private
       
    34 *   to Diagnostics Framework and not exported.
       
    35 *
       
    36 * @since S60 v5.0
       
    37 *
       
    38 */
       
    39 NONSHARABLE_CLASS( CDiagExecPlanEntryImpl ) :  public CActive,
       
    40                                                public MDiagExecPlanEntry
       
    41     {
       
    42 public:     // Data Types
       
    43     /**
       
    44     * TType - Execution plan entry type. 
       
    45     *   ETypeTestExec           - Test plugin execution.
       
    46     *   ETypeSuitePrepare       - Suite prepare execution
       
    47     *   ETypeSuiteFinalize      - Suite finalize execution
       
    48     *   ETypeSuiteUnexpanded    - Suite before being expanded into 
       
    49     *                               ETypeSuitePrepare or ETypeSuiteFinalize
       
    50     */
       
    51     enum TType
       
    52         {
       
    53         ETypeTestExec = 0,      
       
    54         ETypeSuitePrepare,      
       
    55         ETypeSuiteFinalize,     
       
    56         ETypeSuiteUnexpanded,   
       
    57         };
       
    58 
       
    59 public:     // Public API
       
    60     /**
       
    61     * C++ destructor 
       
    62     */
       
    63     virtual ~CDiagExecPlanEntryImpl();
       
    64 
       
    65     /**
       
    66     * Plugin associated with the entry
       
    67     *   @return Reference to the plugin.
       
    68     */
       
    69     MDiagPlugin& Plugin();      //lint !e1411  This is proper overload
       
    70 
       
    71     /**
       
    72     * Get item type
       
    73     *   @return current item type
       
    74     */
       
    75     TType Type() const;
       
    76 
       
    77     /**
       
    78     * Update item type
       
    79     *   @param aType - new type.
       
    80     */
       
    81     void SetType( TType aType );
       
    82 
       
    83     /**
       
    84     * Update dependency
       
    85     *   @param aAsDependency - ETrue if item is being executed to satisfy 
       
    86     *       dependency. EFalse otherwise.
       
    87     */
       
    88     void SetAsDependency( TBool aAsDependency );
       
    89 
       
    90     /**
       
    91     * Handle cancel execution by client. Calling this will case IsStoppedByClient()
       
    92     * to return ETrue.
       
    93     *
       
    94     * @param aCancelMode - Cancellation mode.
       
    95     */
       
    96     void StopExecutionByClientL( MDiagEngineCommon::TCancelMode aCancelMode );
       
    97 
       
    98     /**
       
    99     * Check if test was stopped by client.
       
   100     *
       
   101     * @return ETrue if it was stopped by StopExecutionByClientL call. 
       
   102     *   EFalse otherwise.
       
   103     */
       
   104     TBool IsStoppedByClient() const;
       
   105 
       
   106     /**
       
   107     * Reset Watchdog to last known value.  
       
   108     * If watchdog was suspended, it will resume. 
       
   109     * If watchdog was not running, this does nothing.
       
   110     */
       
   111     void ResetWatchdog();
       
   112 
       
   113     /**
       
   114     * Reset Watchdog to one of the default based on watchdog type
       
   115     * If watchdog was suspended, it will resume. 
       
   116     * If watchdog was not running, this does nothing.
       
   117     * @param aWatchdogType - type of watchdog to use.
       
   118     */
       
   119     void ResetWatchdog( TDiagEngineWatchdogTypes aWatchdogType );
       
   120 
       
   121     /**
       
   122     * Reset watchdog to a specific value.
       
   123     * If watchdog was suspended, it will resume. 
       
   124     * If watchdog was not running, this does nothing.
       
   125     * @param aTimer value - watchdog timer value. 
       
   126     */
       
   127     void ResetWatchdog( TTimeIntervalMicroSeconds32 aWatchdogValue );
       
   128 
       
   129     /**
       
   130     * Stop watchdog temporarily.
       
   131     */
       
   132     void StopWatchdogTemporarily();
       
   133 
       
   134 public:     // APIs to be implemented by derived class
       
   135     /**
       
   136     * Execute plan entry. To cancel request, call Cancel()
       
   137     */
       
   138     virtual void ExecuteL() = 0;
       
   139 
       
   140     /**
       
   141     * Suspend execution.
       
   142     */
       
   143     virtual void SuspendL() = 0;
       
   144 
       
   145     /**
       
   146     * Resume suspended execution.
       
   147     */
       
   148     virtual void ResumeL() = 0;
       
   149 
       
   150 public:    // From MDiagExecPlanEntry
       
   151     /**
       
   152     * Plugin associated with the entry
       
   153     *   @see MDiagExecPlanEntry::Plugin
       
   154     */
       
   155     const MDiagPlugin& Plugin() const;
       
   156 
       
   157     /**
       
   158     * Returns whether item is being executed to satisfy dependency or not.
       
   159     *   @see MDiagExecPlanEntry::AsDepndent
       
   160     */
       
   161     TBool AsDependency() const;
       
   162 
       
   163     /**
       
   164     * Item State
       
   165     *   @see MDiagExecPlanEntry::State
       
   166     */
       
   167     TState State() const;
       
   168 
       
   169 
       
   170 protected:  // API for derived class
       
   171     /**
       
   172     * C++ Constructor
       
   173     *   This is protected since it should not be created directly.
       
   174     *   Use one of the derived class version.
       
   175     *
       
   176     *   @param aEngine - Reference to the engine.
       
   177     *   @param aEngineConifg - Reference to the engine configuration.
       
   178     *   @param aPlugin - Reference to the plug-in.
       
   179     *   @param aAsDependent - Whether it is being executed as dependent test.
       
   180     *   @param aType - Type of entry. @see CDiagExecPlanEntryImpl::TType
       
   181     */
       
   182     CDiagExecPlanEntryImpl( MDiagEngineCommon& aEngine,
       
   183                             const TDiagEngineConfig& aEngineConfig,
       
   184                             MDiagExecPlanEntryImplObserver& aObserver,
       
   185                             MDiagPlugin& aPlugin,
       
   186                             TBool aAsDependency,
       
   187                             TType aType );
       
   188 
       
   189     /**
       
   190     * Get Engine reference
       
   191     * 
       
   192     * @return reference to engine.
       
   193     */
       
   194     MDiagEngineCommon& Engine();
       
   195 
       
   196     /**
       
   197     * Get Engine configuration reference
       
   198     * 
       
   199     * @return Reference to engine configuration.
       
   200     */
       
   201     const TDiagEngineConfig& EngineConfig() const;
       
   202 
       
   203     /**
       
   204     * Get observer.
       
   205     * 
       
   206     * @return Reference to plan entry observer.
       
   207     */
       
   208     MDiagExecPlanEntryImplObserver& Observer();
       
   209 
       
   210     /**
       
   211     * Change current state to a new state.  
       
   212     *   @param aState - new state to set to.
       
   213     */
       
   214     void ChangeStateL( TState aState );
       
   215 
       
   216 protected:  // API to be implemented by derived class.
       
   217     /**
       
   218     * Handle cancel execution by client.
       
   219     *
       
   220     * @param aCancelMode - Cancellation mode.
       
   221     */
       
   222     virtual void DoStopExecutionByClientL( MDiagEngineCommon::TCancelMode aCancelMode ) = 0;
       
   223 
       
   224     /**
       
   225     * Watchdog timeout stop.
       
   226     */
       
   227     virtual void StopExecutionByWatchdogL() = 0;
       
   228 
       
   229 
       
   230 private:    // private methods
       
   231     /**
       
   232     * Watchdog timer timeout handler.
       
   233     * @param aPtr - pointer to *this* object.
       
   234     */
       
   235     static TInt WatchdogTimerExpiredL( TAny* aPtr );
       
   236 
       
   237 private:    // Private data
       
   238     /**
       
   239     * Engine
       
   240     */
       
   241     MDiagEngineCommon& iEngine;
       
   242 
       
   243     /**
       
   244     * Engine Configuration.
       
   245     */
       
   246     const TDiagEngineConfig& iEngineConfig;
       
   247 
       
   248     /**
       
   249     * Observer
       
   250     */
       
   251     MDiagExecPlanEntryImplObserver& iObserver;
       
   252 
       
   253     /**
       
   254     * Plug-in
       
   255     */
       
   256     MDiagPlugin& iPlugin;
       
   257 
       
   258     /**
       
   259     * Indicates whether it is being executed as dependent test.
       
   260     */
       
   261     TBool iAsDependency;
       
   262 
       
   263     /**
       
   264     * Indicates whether execution is stopped by client.
       
   265     */
       
   266     TBool iStoppedByClient;
       
   267 
       
   268     /**
       
   269     * Current item state
       
   270     *   @see MDiagExecPlanEntry::TState
       
   271     */
       
   272     TState iState;
       
   273 
       
   274     /**
       
   275     * Current item type
       
   276     *   @see CDiagExecPlanEntryImpl::TType
       
   277     */
       
   278     TType iType;
       
   279     
       
   280     /**
       
   281     * Watchdog timer value. It is a microsecond value to be used with 
       
   282     * watchdog timer.
       
   283     */
       
   284     TTimeIntervalMicroSeconds32 iWatchdogValue;
       
   285 
       
   286     /**
       
   287     * Watchdog timer
       
   288     * Owership: this.
       
   289     */
       
   290     CPeriodic* iWatchdogTimer;
       
   291 
       
   292     };
       
   293 
       
   294 #endif // DIAGEXECPLANENTRY_H
       
   295 
       
   296 // End of File
       
   297