devicediagnosticsfw/diagframework/inc/diagexecplanentryimpltest.h
branchRCL_3
changeset 25 b183ec05bd8c
parent 24 13d7c31c74e0
child 26 19bba8228ff0
equal deleted inserted replaced
24:13d7c31c74e0 25:b183ec05bd8c
     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 CDiagExecPlanEntryImplTest
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef DIAGEXECPLANENTRYIMPLTEST_H
       
    20 #define DIAGEXECPLANENTRYIMPLTEST_H
       
    21 
       
    22 // SYSTEM INCLUDE FILES
       
    23 #include <DiagResultsDatabaseItem.h>    // CDiagResultsDatabaseItem::TResult
       
    24 #include <DiagTestObserver.h>           // MDiagTestObserver
       
    25 #include <DiagTestPlugin.h>             // MDiagTestPlugin::TStopReason
       
    26 
       
    27 // USER INCLUDE FILES
       
    28 #include "diagexecplanentryimpl.h"      // CDiagExecPlanEntryImpl
       
    29 
       
    30 // FORWARD DECLARATION
       
    31 class MDiagTestPlugin;
       
    32 
       
    33 /**
       
    34 * Diagnostics Plug-in Execution Plan Entry Implementation for test plugin
       
    35 *
       
    36 * This class implements CDiagExecPlanEntryImplTest. It is meant to be private
       
    37 *   to Diagnostics Framework and not exported.
       
    38 *
       
    39 * @since S60 v5.0
       
    40 *
       
    41 */
       
    42 NONSHARABLE_CLASS( CDiagExecPlanEntryImplTest ): public CDiagExecPlanEntryImpl,
       
    43                                                  public MDiagTestObserver
       
    44     {
       
    45 public: // Public constructors and destructors
       
    46     /**
       
    47     * Symbian two-phased constructor
       
    48     *
       
    49     * @param aEngine - Diagnostics Engine
       
    50     * @param aEngineConig - Engine configuration.
       
    51     * @param aObserver - Execution plan entry observer.
       
    52     * @param aPlugin - Test plug-in that this plan entry represents.
       
    53     * @param aAsDependency - Whether this item is being executed as dependency or not.
       
    54     * @param aResult - Initial result. 
       
    55     *
       
    56     * @return a new instance of CDiagExecPlanEntryImplTest
       
    57     */
       
    58     static CDiagExecPlanEntryImplTest* NewL( MDiagEngineCommon& aEngine,
       
    59                                              const TDiagEngineConfig& aEngineConfig,
       
    60                                              MDiagExecPlanEntryImplObserver& aObserver,
       
    61                                              MDiagTestPlugin& aPlugin,
       
    62                                              TBool aAsDependency,
       
    63                                              CDiagResultsDatabaseItem::TResult aResult );
       
    64 
       
    65     /**
       
    66     * Symbian two-phased constructor.
       
    67     * This will put an entry in cleanup stack.
       
    68     *
       
    69     * @param aEngine - Diagnostics Engine
       
    70     * @param aEngineConig - Engine configuration.
       
    71     * @param aObserver - Execution plan entry observer.
       
    72     * @param aPlugin - Test plug-in that this plan entry represents.
       
    73     * @param aAsDependency - Whether this item is being executed as dependency or not.
       
    74     * @param aResult - Initial result. 
       
    75     *
       
    76     * @return a new instance of CDiagExecPlanEntryImplTest
       
    77     */
       
    78     static CDiagExecPlanEntryImplTest* NewLC( MDiagEngineCommon& aEngine,
       
    79                                               const TDiagEngineConfig& aEngineConfig,
       
    80                                               MDiagExecPlanEntryImplObserver& aObserver,
       
    81                                               MDiagTestPlugin& aPlugin,
       
    82                                               TBool aAsDependency,
       
    83                                               CDiagResultsDatabaseItem::TResult aResult );
       
    84 
       
    85     /**
       
    86     * C++ destructor
       
    87     */
       
    88     virtual ~CDiagExecPlanEntryImplTest();
       
    89 
       
    90 public:     // new public api
       
    91     /**
       
    92     * Get test result
       
    93     *   @return Test result enum.
       
    94     */
       
    95     CDiagResultsDatabaseItem::TResult Result() const;
       
    96 
       
    97     /**
       
    98     * Set test result
       
    99     *   @param aResult - Test result.
       
   100     */
       
   101     void SetResult( CDiagResultsDatabaseItem::TResult aResult );
       
   102 
       
   103     /**
       
   104     * Get result database item. If cached value is available, it will use
       
   105     * cached value. Otherwise, it will retrieve from database.
       
   106     *   @return Test result item from database. Ownership is transferred.
       
   107     */
       
   108     CDiagResultsDatabaseItem* GetLastTestResultL();
       
   109 
       
   110     /**
       
   111     * Get test plugin associated.
       
   112     * @return a reference to test plug-in that this entry represents.
       
   113     */
       
   114     MDiagTestPlugin& TestPlugin();
       
   115 
       
   116 private:    // from CActive
       
   117     /*
       
   118     * @see CActive::RunL
       
   119     */
       
   120     virtual void RunL();
       
   121 
       
   122     /*
       
   123     * @see CActive::DoCancel
       
   124     */
       
   125     virtual void DoCancel();
       
   126 
       
   127     /*
       
   128     * @see CActive::RunError
       
   129     */
       
   130     virtual TInt RunError( TInt aError );
       
   131 
       
   132 private:    // from CDiagExecPlanEntryImpl
       
   133     /**
       
   134     * @see CDiagExecPlanEntryImpl::ExecuteL
       
   135     */
       
   136     virtual void ExecuteL();
       
   137 
       
   138     /**
       
   139     * @see CDiagExecPlanEntryImpl::StopExecutionByWatchdogL
       
   140     */
       
   141     virtual void StopExecutionByWatchdogL();
       
   142 
       
   143     /**
       
   144     * @see CDiagExecPlanEntryImpl::DoStopExecutionByClientL
       
   145     */
       
   146     virtual void DoStopExecutionByClientL( MDiagEngineCommon::TCancelMode aCancelMode );
       
   147 
       
   148     /**
       
   149     * @see CDiagExecPlanEntryImpl::SuspendL
       
   150     */
       
   151     virtual void SuspendL();
       
   152 
       
   153     /**
       
   154     * @see CDiagExecPlanEntryImpl::ResumeL
       
   155     */
       
   156     virtual void ResumeL();
       
   157 
       
   158 private:    // from MDiagTestObserver
       
   159     /**
       
   160     * Notify engine of test plug-in execution progress.
       
   161     * @see MDiagTestObserver::TestProgressL
       
   162     */
       
   163     virtual void TestProgressL( const MDiagTestPlugin& aSender, 
       
   164                                 TUint aCurrentStep );
       
   165 
       
   166     /**
       
   167     * Notify engine of test plug-in execution completion.
       
   168     * @see MDiagTestObserver::TestExecutionCompletedL
       
   169     */
       
   170     virtual void TestExecutionCompletedL( const MDiagTestPlugin& aSender, 
       
   171                                           CDiagResultsDatabaseItem* aTestResult );
       
   172     
       
   173     
       
   174 private:    // Private methods
       
   175     /**
       
   176     * c++ constructor.
       
   177     *
       
   178     * @param aEngine - Diagnostics Engine
       
   179     * @param aEngineConig - Engine configuration.
       
   180     * @param aObserver - Execution plan entry observer.
       
   181     * @param aPlugin - Test plug-in that this plan entry represents.
       
   182     * @param aAsDependency - Whether this item is being executed as dependency or not.
       
   183     * @param aResult - Initial result. 
       
   184     */
       
   185     CDiagExecPlanEntryImplTest( MDiagEngineCommon& aEngine,
       
   186                                 const TDiagEngineConfig& aEngineConfig,
       
   187                                 MDiagExecPlanEntryImplObserver& aObserver,
       
   188                                 MDiagTestPlugin& aPlugin,
       
   189                                 TBool aAsDependency,
       
   190                                 CDiagResultsDatabaseItem::TResult aResult );
       
   191     
       
   192     /**
       
   193     * Starts executing test.
       
   194     */
       
   195     void DoExecuteTestPluginL();
       
   196 
       
   197     /**
       
   198     * Stop test plugin
       
   199     */
       
   200     CDiagResultsDatabaseItem* StopTestPluginL( MDiagTestPlugin::TStopReason aReason );
       
   201 
       
   202     /**
       
   203     * Handler function for initial delay timer expiration.
       
   204     */
       
   205     static TInt HandleDelayTimerExpiredL( TAny* aData );
       
   206 
       
   207     /**
       
   208     * Stop initial delay timer.
       
   209     */
       
   210     void StopInitDelayTimer();
       
   211 
       
   212     /**
       
   213     * Stop all active requests and timers.
       
   214     */
       
   215     void StopAll();
       
   216 
       
   217     /**
       
   218     * Stops test execution, but test result is not reported.
       
   219     */
       
   220     void StopExecutionAndIgnoreResultL();
       
   221 
       
   222     /**
       
   223     * Get human readable name for test result. This is meant for debugging
       
   224     * purpose only. In non-debug build, it will return empty string.
       
   225     */
       
   226     static const TDesC& TestResultString( CDiagResultsDatabaseItem::TResult aResult );
       
   227 
       
   228 
       
   229 private:    // private data
       
   230     /**
       
   231     * Test result
       
   232     */
       
   233     CDiagResultsDatabaseItem::TResult iResult;
       
   234 
       
   235     /**
       
   236     * Plugin test initial delay timer.
       
   237     * Ownership - this
       
   238     */
       
   239     CPeriodic* iInitDelayTimer;
       
   240 
       
   241     /**
       
   242     * Cached test result. This stores test result temporarily, so that database access
       
   243     * could be avoided. Currently, cache will remain only for one request after
       
   244     * test is completed.
       
   245     * Ownership - this
       
   246     */
       
   247     CDiagResultsDatabaseItem* iCachedResult;
       
   248 
       
   249     };
       
   250 
       
   251 #endif // DIAGEXECPLANENTRYIMPLTEST_H
       
   252 
       
   253 // End of File
       
   254