devicediagnosticsfw/diagframework/inc/diagengine.h
changeset 0 b497e44ab2fc
equal deleted inserted replaced
-1:000000000000 0:b497e44ab2fc
       
     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 CDiagEngine
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef DIAGENGINE_H
       
    20 #define DIAGENGINE_H
       
    21 
       
    22 
       
    23 // system includes
       
    24 #include <e32base.h>                // CBase
       
    25 
       
    26 // user includes.
       
    27 #include <DiagEngineCommon.h>       // MDiagEngineCommon
       
    28 
       
    29 // Forward declarations
       
    30 class MDiagEngineObserver;
       
    31 class RDiagResultsDatabase;
       
    32 class CDiagPluginPool;
       
    33 class CDiagEngineImpl;
       
    34 
       
    35 
       
    36 /**
       
    37 *  Diagnostics Framework Engine 
       
    38 *
       
    39 *  This class is used by the client to execute tests and load plug-ins.
       
    40 *
       
    41 *  @since S60 v5.0
       
    42 */
       
    43 NONSHARABLE_CLASS( CDiagEngine ) : public CBase,
       
    44                                    public MDiagEngineCommon
       
    45     {
       
    46 public:
       
    47 
       
    48     /**
       
    49     * Two-phased constructors. 
       
    50     *
       
    51     * @param aViewAppUi    View App Ui that is using this engine.
       
    52     * @param aObserver     Engine observer.
       
    53     * @param aDbSession    Session to RDiagResultDatabase to create record.
       
    54     * @param aPluginPool   Initialized plug-in pool that holds plug-ins.
       
    55     * @param aDisableDependency    if ETrue, plug-ins should execute
       
    56     *                      event if dependencies are not met.
       
    57     * @param aExecutionBatch array of plug-ins to execute.
       
    58     * @return New instance of CDiagEngine*.
       
    59     */
       
    60     IMPORT_C static CDiagEngine* NewL( CAknViewAppUi&          aViewAppUi, 
       
    61                                        MDiagEngineObserver&    aObserver,
       
    62                                        RDiagResultsDatabase&   aDbSession,
       
    63                                        CDiagPluginPool&        aPluginPool,
       
    64                                        TBool                   aDisableDependency,
       
    65                                        const RArray< TUid >&   aExecutionBatch );
       
    66 
       
    67     /**
       
    68     * Two-phased constructors. This is identical to NewL, except that it will 
       
    69     * keep newl instance in clean up stack.
       
    70     *
       
    71     * @param aViewAppUi    View App Ui that is using this engine.
       
    72     * @param aObserver     Engine observer.
       
    73     * @param aDbSession    Session to RDiagResultDatabase to create record.
       
    74     * @param aPluginPool   Initialized plug-in pool that holds plug-ins.
       
    75     * @param aDisableDependency    if ETrue, plug-ins should execute
       
    76     *                      event if dependencies are not met.
       
    77     * @param aExecutionBatch array of plug-ins to execute.
       
    78     * @return New instance of CDiagEngine*.
       
    79     */
       
    80     IMPORT_C static CDiagEngine* NewLC( CAknViewAppUi&          aViewAppUi, 
       
    81                                         MDiagEngineObserver&    aObserver,
       
    82                                         RDiagResultsDatabase&   aDbSession,
       
    83                                         CDiagPluginPool&        aPluginPool,
       
    84                                         TBool                   aDisableDependency,
       
    85                                         const RArray< TUid >&   aExecutionBatch );
       
    86     /**
       
    87     * Two-phased constructors. 
       
    88     *
       
    89     * @param aViewAppUi    View App Ui that is using this engine.
       
    90     * @param aObserver     Engine observer.
       
    91     * @param aDbSession    Session to RDiagResultDatabase to create record.
       
    92     * @param aPluginPool   Initialized plug-in pool that holds plug-ins.
       
    93     * @param aIncompleteRecordUid - Uid to the record to resume.
       
    94     *   
       
    95     * @return New instance of CDiagEngine*.
       
    96     */
       
    97     IMPORT_C static CDiagEngine* NewL( CAknViewAppUi&          aViewAppUi, 
       
    98                                        MDiagEngineObserver&    aObserver,
       
    99                                        RDiagResultsDatabase&   aDbSession,
       
   100                                        CDiagPluginPool&        aPluginPool,
       
   101                                        TUid                    aIncompleteRecordUid );
       
   102 
       
   103     /**
       
   104     * Two-phased constructors. This is identical to NewL, except that it will 
       
   105     * keep newl instance in clean up stack.
       
   106     *
       
   107     * @param aViewAppUi    View App Ui that is using this engine.
       
   108     * @param aObserver     Engine observer.
       
   109     * @param aDbSession    Session to RDiagResultDatabase to create record.
       
   110     * @param aPluginPool   Initialized plug-in pool that holds plug-ins.
       
   111     * @param aIncompleteRecordUid - Uid to the record to resume.
       
   112     *
       
   113     * @return New instance of CDiagEngine*.
       
   114     */
       
   115     IMPORT_C static CDiagEngine* NewLC( CAknViewAppUi&          aViewAppUi, 
       
   116                                         MDiagEngineObserver&    aObserver,
       
   117                                         RDiagResultsDatabase&   aDbSession,
       
   118                                         CDiagPluginPool&        aPluginPool,
       
   119                                         TUid                    aIncompleteRecordUid );
       
   120     
       
   121     /**
       
   122     * Destructor.
       
   123     */
       
   124     virtual ~CDiagEngine();
       
   125 
       
   126     /**
       
   127     * Execute tests. This is a asynchronous method. 
       
   128     * First, execution plan is sent via MDiagEngineObserver::TestExecutionBeginL(). 
       
   129     * Then, during the execution, MDiagEngineObserver::TestExecutionProgressL() 
       
   130     * may be called multiple times to notify execution progress.  
       
   131     * When execution is completed, 
       
   132     * MDiagEngineObserver::TestExecutionCompletedL() is called.
       
   133     */
       
   134     IMPORT_C void ExecuteL();
       
   135 
       
   136     /**
       
   137     * Set custom execution parameter.
       
   138     *
       
   139     * @param aCustomParams - Custom data. Owership is not transefrred
       
   140     *   so, the client must delete it once test is completed.
       
   141     *   Desipte it being a pointer, ownership cannot be transferred 
       
   142     *   because engine does not know the type of pointer. 
       
   143     */
       
   144     IMPORT_C void SetCustomParam( TAny* aCustomParams );
       
   145 
       
   146     /**
       
   147     * Suspend execution.  This can be used to suspend test execution.
       
   148     * If currently executing test is suspendable, it will be suspended and resumed.
       
   149     * Otherwise, it will be stopped. When CDiagEngine::ResumeL is called, 
       
   150     * the stopped test will be restarted from the beginning. Already executed
       
   151     * tests are not affected. 
       
   152     * 
       
   153     * After engine is suspended, MDiagEngineObserver::TestExecutionSuspendedL() is called.
       
   154     *
       
   155     */
       
   156     IMPORT_C void SuspendL();
       
   157 
       
   158     /**
       
   159     * Resume suspended execution. This function can be used to resume 
       
   160     * previously suspended execution. If execution was suspended on a test
       
   161     * that cannot be suspended, the test will restart. Previously executed tests
       
   162     * will not be re-run. Also, dependent tests will not be re-run.  If 
       
   163     * the suspended test fails to resume (e.g. leaves), it will be marked as
       
   164     * failure.
       
   165     *
       
   166     * After engine is resumed, MDiagEngineObserver::TestExecutionResumedL() is called.
       
   167     */
       
   168     IMPORT_C void ResumeL();
       
   169     
       
   170     
       
   171     // ADO & Platformization Changes
       
   172     ///@@@KSR: changes for Codescanner error val = High
       
   173     //IMPORT_C TBool GetPluginDependency();
       
   174     IMPORT_C TBool GetPluginDependencyL();
       
   175 
       
   176 public: // from MDiagEngineCommon
       
   177 
       
   178     /**
       
   179     * Returns current execution plan.
       
   180     * @see MDiagEngineCommon::ExecutionPlanL
       
   181     */
       
   182     virtual const MDiagPluginExecPlan& ExecutionPlanL() const;
       
   183 
       
   184     /**
       
   185     * Stop current execution of tests.
       
   186     * @see MDiagEngineCommon::ExecutionStopL
       
   187     */
       
   188     virtual void ExecutionStopL( TCancelMode aCancelMode );
       
   189     
       
   190     /**
       
   191     * Resets test execution watchdog timer.
       
   192     * @see MDiagEngineCommon::ResetWatchdog
       
   193     */
       
   194     virtual void ResetWatchdog();
       
   195     
       
   196     /**
       
   197     * Resets test execution watchdog timer.
       
   198     * @see MDiagEngineCommon::ResetWatchdog
       
   199     */
       
   200     virtual void ResetWatchdog( TDiagEngineWatchdogTypes aWatchdogType );
       
   201     
       
   202     /**
       
   203     * Resets test execution watchdog timer.
       
   204     * @see MDiagEngineCommon::ResetWatchdog
       
   205     */
       
   206     virtual void ResetWatchdog( TTimeIntervalMicroSeconds32 aExpectedTimeToComplete );
       
   207 
       
   208     /**
       
   209     * Get App Ui reference that launched Diagnostics Engine.
       
   210     * @see MDiagEngineCommon::ViewAppUi
       
   211     */
       
   212     virtual CAknViewAppUi& ViewAppUi();
       
   213 
       
   214     /**
       
   215     * Get App Ui reference that launched Diagnostics Engine.
       
   216     * @see MDiagEngineCommon::ViewAppUi
       
   217     */
       
   218     virtual const CAknViewAppUi& ViewAppUi() const;
       
   219 
       
   220     /**
       
   221     * Get Database Subsession for record open for writing.
       
   222     * @see MDiagEngineCommon::DbRecord
       
   223     */
       
   224     virtual RDiagResultsDatabaseRecord& DbRecord();
       
   225 
       
   226     /**
       
   227     * Get Database Subsession for record open for writing.
       
   228     * @see MDiagEngineCommon::DbRecord
       
   229     */
       
   230     virtual const RDiagResultsDatabaseRecord& DbRecord() const;
       
   231 
       
   232     /**
       
   233     * Get reference to Plugin Pool
       
   234     * @see MDiagEngineCommon::PluginPool
       
   235     */
       
   236     virtual CDiagPluginPool& PluginPool();
       
   237 
       
   238     /**
       
   239     * Get reference to Plugin Pool
       
   240     * @see MDiagEngineCommon::PluginPool
       
   241     */
       
   242     virtual const CDiagPluginPool& PluginPool() const;
       
   243 
       
   244     /**
       
   245     * Add a text to configuraiton list option. 
       
   246     * @see MDiagEngineCommon::AddToConfigListL
       
   247     */
       
   248     virtual void AddToConfigListL( TConfigListType aListType, const TDesC& aText );
       
   249 
       
   250     /**
       
   251     * Remove a text from configuration list.
       
   252     * @see MDiagEngineCommon::RemoveFromConfigListL
       
   253     */
       
   254     virtual void RemoveFromConfigListL( TConfigListType aListType, const TDesC& aText );
       
   255 
       
   256     /**
       
   257     * Create a common dialog.
       
   258     * @see MDiagEngineCommon::CreateCommonDialogL
       
   259     */
       
   260     virtual CAknDialog* CreateCommonDialogLC( TDiagCommonDialog aDialogType,
       
   261                                               TAny* aInitData );
       
   262 
       
   263     /**
       
   264     * Stop watchdog activity temporarily.
       
   265     * @see MDiagEngineCommon::StopWatchdogTemporarily
       
   266     */
       
   267     virtual void StopWatchdogTemporarily();
       
   268 
       
   269     /**
       
   270     * Check if current engine is being executed with dependency disabled.
       
   271     *  @see MDiagEngineCommon::IsDependencyDisabled
       
   272     */
       
   273     virtual TBool IsDependencyDisabled() const;
       
   274 
       
   275     /**
       
   276     * Get custom param
       
   277     *  @see MDiagEngineCommon::CustomParam
       
   278     */
       
   279     virtual TAny* CustomParam() const;
       
   280 
       
   281     /**
       
   282     * Execute an application command. 
       
   283     *   @see MDiagEngineCommon::ExecuteAppCommandL
       
   284     */
       
   285     virtual void ExecuteAppCommandL( TDiagAppCommand aCommand, 
       
   286                                      TAny* aParam1,
       
   287                                      TAny* aParam2 );
       
   288 
       
   289 private:    // private data
       
   290     CDiagEngineImpl* iEngineImpl;
       
   291     };
       
   292 
       
   293 
       
   294 #endif // DIAGENGINE_H
       
   295 
       
   296 // End of File
       
   297