remotemgmt_plat/diagnostics_framework_api/inc/diagengine.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 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     IMPORT_C TBool GetPluginDependencyL();
       
   173 
       
   174 public: // from MDiagEngineCommon
       
   175 
       
   176     /**
       
   177     * Returns current execution plan.
       
   178     * @see MDiagEngineCommon::ExecutionPlanL
       
   179     */
       
   180     virtual const MDiagPluginExecPlan& ExecutionPlanL() const;
       
   181 
       
   182     /**
       
   183     * Stop current execution of tests.
       
   184     * @see MDiagEngineCommon::ExecutionStopL
       
   185     */
       
   186     virtual void ExecutionStopL( TCancelMode aCancelMode );
       
   187     
       
   188     /**
       
   189     * Resets test execution watchdog timer.
       
   190     * @see MDiagEngineCommon::ResetWatchdog
       
   191     */
       
   192     virtual void ResetWatchdog();
       
   193     
       
   194     /**
       
   195     * Resets test execution watchdog timer.
       
   196     * @see MDiagEngineCommon::ResetWatchdog
       
   197     */
       
   198     virtual void ResetWatchdog( TDiagEngineWatchdogTypes aWatchdogType );
       
   199     
       
   200     /**
       
   201     * Resets test execution watchdog timer.
       
   202     * @see MDiagEngineCommon::ResetWatchdog
       
   203     */
       
   204     virtual void ResetWatchdog( TTimeIntervalMicroSeconds32 aExpectedTimeToComplete );
       
   205 
       
   206     /**
       
   207     * Get App Ui reference that launched Diagnostics Engine.
       
   208     * @see MDiagEngineCommon::ViewAppUi
       
   209     */
       
   210     virtual CAknViewAppUi& ViewAppUi();
       
   211 
       
   212     /**
       
   213     * Get App Ui reference that launched Diagnostics Engine.
       
   214     * @see MDiagEngineCommon::ViewAppUi
       
   215     */
       
   216     virtual const CAknViewAppUi& ViewAppUi() const;
       
   217 
       
   218     /**
       
   219     * Get Database Subsession for record open for writing.
       
   220     * @see MDiagEngineCommon::DbRecord
       
   221     */
       
   222     virtual RDiagResultsDatabaseRecord& DbRecord();
       
   223 
       
   224     /**
       
   225     * Get Database Subsession for record open for writing.
       
   226     * @see MDiagEngineCommon::DbRecord
       
   227     */
       
   228     virtual const RDiagResultsDatabaseRecord& DbRecord() const;
       
   229 
       
   230     /**
       
   231     * Get reference to Plugin Pool
       
   232     * @see MDiagEngineCommon::PluginPool
       
   233     */
       
   234     virtual CDiagPluginPool& PluginPool();
       
   235 
       
   236     /**
       
   237     * Get reference to Plugin Pool
       
   238     * @see MDiagEngineCommon::PluginPool
       
   239     */
       
   240     virtual const CDiagPluginPool& PluginPool() const;
       
   241 
       
   242     /**
       
   243     * Add a text to configuraiton list option. 
       
   244     * @see MDiagEngineCommon::AddToConfigListL
       
   245     */
       
   246     virtual void AddToConfigListL( TConfigListType aListType, const TDesC& aText );
       
   247 
       
   248     /**
       
   249     * Remove a text from configuration list.
       
   250     * @see MDiagEngineCommon::RemoveFromConfigListL
       
   251     */
       
   252     virtual void RemoveFromConfigListL( TConfigListType aListType, const TDesC& aText );
       
   253 
       
   254     /**
       
   255     * Create a common dialog.
       
   256     * @see MDiagEngineCommon::CreateCommonDialogL
       
   257     */
       
   258     virtual CAknDialog* CreateCommonDialogLC( TDiagCommonDialog aDialogType,
       
   259                                               TAny* aInitData );
       
   260 
       
   261     /**
       
   262     * Stop watchdog activity temporarily.
       
   263     * @see MDiagEngineCommon::StopWatchdogTemporarily
       
   264     */
       
   265     virtual void StopWatchdogTemporarily();
       
   266 
       
   267     /**
       
   268     * Check if current engine is being executed with dependency disabled.
       
   269     *  @see MDiagEngineCommon::IsDependencyDisabled
       
   270     */
       
   271     virtual TBool IsDependencyDisabled() const;
       
   272 
       
   273     /**
       
   274     * Get custom param
       
   275     *  @see MDiagEngineCommon::CustomParam
       
   276     */
       
   277     virtual TAny* CustomParam() const;
       
   278 
       
   279     /**
       
   280     * Execute an application command. 
       
   281     *   @see MDiagEngineCommon::ExecuteAppCommandL
       
   282     */
       
   283     virtual void ExecuteAppCommandL( TDiagAppCommand aCommand, 
       
   284                                      TAny* aParam1,
       
   285                                      TAny* aParam2 );
       
   286 
       
   287 private:    // private data
       
   288     CDiagEngineImpl* iEngineImpl;
       
   289     };
       
   290 
       
   291 
       
   292 #endif // DIAGENGINE_H
       
   293 
       
   294 // End of File
       
   295