devicediagnosticsfw/diagframework/inc/diagengineobserver.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:  Observer interface to use with CDiagEngine
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef DIAGENGINEOBSERVER_H
       
    20 #define DIAGENGINEOBSERVER_H
       
    21 
       
    22 
       
    23 // SYSTEM INCLUDES
       
    24 #include <e32def.h>                 // TUint
       
    25 #include <DiagCommonDialog.h>       // TDiagCommonDialog
       
    26 #include <DiagAppCommand.h>         // TDiagAppCommand
       
    27 
       
    28 // FORWARD DECLARATION
       
    29 class CDiagResultsDatabaseItem;
       
    30 class CAknDialog;
       
    31 
       
    32 /**
       
    33 *  Diagnostics Framework Engine Observer
       
    34 *
       
    35 *  This interface is called by CDiagEngine to notify its client
       
    36 *  of progress of requests made to engine.
       
    37 *
       
    38 * @since S60 v5.0
       
    39 */
       
    40 class MDiagEngineObserver
       
    41     {
       
    42 public: // Public Data types
       
    43     enum TSuspendReason
       
    44         {
       
    45         ESuspendByClient = 0,
       
    46         ESuspendByPhoneCall
       
    47         };
       
    48 
       
    49     enum TResumeReason
       
    50         {
       
    51         EResumedByClient = 0,
       
    52         EAutoResumedByCallHangup
       
    53         };
       
    54 
       
    55 public: // Public interface
       
    56 
       
    57     /**
       
    58     * Notify client of test execution begin. Clients can get testplan using
       
    59     * CDiagEngine::ExecutionPlanL. 
       
    60     */
       
    61     virtual void TestExecutionBeginL() = 0;
       
    62 
       
    63     /**
       
    64     * Notify client of test execution progress.
       
    65     *
       
    66     * @param aCurrentItemStep       - Progress in current entry.
       
    67     * @param aCurrentItemTotalSteps - Total steps to execute in current entry.
       
    68     */
       
    69     virtual void TestExecutionProgressL( TUint aCurrentItemStep,
       
    70                                          TUint aCurrentItemTotalSteps ) = 0;
       
    71 
       
    72     /**
       
    73     * Notify client of execution completion of one plug-in.
       
    74     *   This can be either test plug-in or suite plug-in.
       
    75     *
       
    76     * @param aError  - KErrNone - Success.
       
    77     *   KErrNoMemory - Out of memory.
       
    78     *   KErrCancel   - Cancelled due to ExecutionStopL()
       
    79     *
       
    80     * @param aResult - Result of the test. Ownership is transferred here. 
       
    81     *  Client must deallocate aResult to avoid memory leak. aResult is Null 
       
    82     *  if the plug-in being executed is a suite pre/post method.
       
    83     */
       
    84     virtual void TestExecutionPluginExecutedL( TInt aError,
       
    85                                                CDiagResultsDatabaseItem* aResult ) = 0;
       
    86 
       
    87     /**
       
    88     * Notify client of execution suspend.
       
    89     *
       
    90     * @param aSuspendReason - Why execution is suspended.
       
    91     */
       
    92     virtual void TestExecutionSuspendedL( TSuspendReason aSuspendReason ) = 0;
       
    93 
       
    94     /**
       
    95     * Notify client of execution resume.
       
    96     *
       
    97     * @param aResumeReason - Why execution is being resumed
       
    98     */
       
    99     virtual void TestExecutionResumedL( TResumeReason aResumeReason ) = 0;
       
   100 
       
   101     /**
       
   102     * Notify client of engine stopping.
       
   103     *
       
   104     * This indicates that engine execution has stopped. There will not be any
       
   105     * further messages from engine. This could be called because all
       
   106     * tests are completed, or an unrecoverable error occured during execution.
       
   107     *
       
   108     * Note that if cancel is called during plan creation or if plan creation
       
   109     * fails, TestExecutionStoppedL() may be called withing first calling
       
   110     * TestExecutionBeginL(). 
       
   111     *
       
   112     * @param aError - Reason for engine stopping. 
       
   113     *   a) KErrNone - All tests are successfully completed.
       
   114     *   b) KErrCancel - ExecutionStopL is called with ECancelAll. 
       
   115     *       Test session cannot be resumed later.
       
   116     *   c) KErrArgument - Parameters passed to engine are invalid.
       
   117     *   d) Others - Other critical that could not be recovered occured during
       
   118     *       test execution.  Test may be resumed later in this case.
       
   119     */
       
   120     virtual void TestExecutionCompletedL( TInt aError ) = 0;
       
   121 
       
   122     /**
       
   123     * Create a common Dialog.
       
   124     * Application should create an instance of requested dialog.
       
   125     * For available dialog types, @see DiagCommonDialog.h
       
   126     * 
       
   127     * @param aDialogType - Type of dialog to create.
       
   128     * @param aData - Initialization parameter. Ownership is passed to engine.
       
   129     * @return a pointer to newly created dialog. Ownership is passed to caller.
       
   130     */
       
   131     virtual CAknDialog* CreateCommonDialogLC( TDiagCommonDialog aDialogType,
       
   132                                               TAny* aInitData ) = 0;
       
   133 
       
   134     /**
       
   135     * Execute a command from plug-in. Parameters are identical to 
       
   136     * MDiagEngineCommon::ExecuteAppCommandL(). 
       
   137     * @see MDiagEngineCommon::ExecuteAppCommandL()
       
   138     * @see TDiagAppCommand
       
   139     */
       
   140     virtual void ExecuteAppCommandL( TDiagAppCommand aCommand, 
       
   141                                      TAny* aParam1,
       
   142                                      TAny* aParam2 ) = 0;
       
   143     };
       
   144 
       
   145 
       
   146 #endif // DIAGENGINEOBSERVER_H
       
   147 
       
   148 // End of File
       
   149