devicediagnostics/diagplugins/diagbatterychargerplugin/inc/diagbatterychargercableengine.h
changeset 0 3ce708148e4d
child 54 9360ca28b668
equal deleted inserted replaced
-1:000000000000 0:3ce708148e4d
       
     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:  This is the header for the Diagnostics Battery Charger 
       
    15 *                 Cable Test Engine
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef DIAGBATTERYCHARGERCABLETESTENGINE_H
       
    21 #define DIAGBATTERYCHARGERCABLETESTENGINE_H
       
    22 
       
    23 
       
    24 // INCLUDES
       
    25 
       
    26 #include <DiagResultsDatabaseItem.h>
       
    27 
       
    28 //CONSTANTS
       
    29 
       
    30 // MACROS
       
    31 
       
    32 // DATA TYPES
       
    33 
       
    34 // FUNCTION PROTOTYPES
       
    35 
       
    36 // FORWARD DECLARATIONS
       
    37 class CDiagPluginWaitingDialogWrapper;
       
    38 class MDiagBatteryChargerTestCallBackInterface;
       
    39 
       
    40 
       
    41 // CLASS DEFINITION
       
    42 /**
       
    43 * CDiagBatteryChargerCableTestEngine
       
    44 *
       
    45 * Engine class of the Battery charger cable test plug-in
       
    46 */    
       
    47 class CDiagBatteryChargerCableTestEngine : public CActive
       
    48     {
       
    49     
       
    50 public: //New functions
       
    51     static CDiagBatteryChargerCableTestEngine* NewL(
       
    52         MDiagBatteryChargerTestCallBackInterface& aInterface,
       
    53         TBool aIsSinglePluginExecution);
       
    54     
       
    55     /**
       
    56     * C++ destructor
       
    57     */
       
    58     ~CDiagBatteryChargerCableTestEngine();
       
    59     
       
    60 public: // external functions
       
    61     /**
       
    62     * The plug-in class uses this function to start the Battery charger test
       
    63     */
       
    64     void RunBatteryChargerTestL();
       
    65 
       
    66 private:
       
    67 
       
    68     /**
       
    69     * Standard c++ constructor
       
    70     */
       
    71     CDiagBatteryChargerCableTestEngine(MDiagBatteryChargerTestCallBackInterface& aInterface,
       
    72                                        TBool aIsSinglePluginExecution);
       
    73     
       
    74     /**
       
    75     * Symbian second phase constructor
       
    76     */
       
    77     void ConstructL();
       
    78     
       
    79     
       
    80 private: //internal functions
       
    81     
       
    82     /**
       
    83     * To report the result to the plug-in class
       
    84     */
       
    85     void ReportResultToPluginL(CDiagResultsDatabaseItem::TResult aResult);
       
    86     
       
    87     /**
       
    88     *   Detect the Battery charger status
       
    89     *   @param none
       
    90     *   @return ETrue - If the charger was detected
       
    91     *           EFalse - If the charger was not detected
       
    92     */    
       
    93     TBool CheckIfChargerDetected();
       
    94 
       
    95 
       
    96     /**
       
    97     * Ask user to connect charger and press OK
       
    98     *   @param aUserResponse - Dialog response will be returned via this parameter.
       
    99     *   @return ETrue - If dialog was dismissed by end user.
       
   100     *       EFalse - If dialog was deleted.
       
   101     */
       
   102     TBool ConnectAndPressOkL( TInt& aUserResponse ); 
       
   103     
       
   104     /**
       
   105     * Ask user to remove all cables and press OK    
       
   106     *   @param aUserResponse - Dialog response will be returned via this parameter.
       
   107     *   @return ETrue  - If dialog was dismissed by end user.
       
   108     *           EFalse - If dialog was deleted.
       
   109     */
       
   110     TBool RemoveAllCablesL( TInt& aUserResponse );  
       
   111 
       
   112     /**
       
   113     * Display "No cable detected. Try again?" prompt
       
   114     *   @param aUserResponse - Dialog response will be returned via this parameter.
       
   115     *   @return ETrue - If dialog was dismissed by end user.
       
   116     *       EFalse - If dialog was deleted.
       
   117     */
       
   118     TBool AskIfRetryL( TInt& aUserResponse );
       
   119 
       
   120    
       
   121     /**
       
   122     * Displays a query dialog with header.
       
   123     *   @param aDialogResourceId - Resource ID of the dialog to display
       
   124     *   @param aUserResponse - Dialog response will be returned via this parameter.
       
   125     *   @return ETrue - If dialog was dismissed by end user.
       
   126     *           EFalse - If dialog was deleted.
       
   127     */    
       
   128     TBool DisplayQueryDialogWithHeaderL( 
       
   129         TInt aDialogResourceId,
       
   130         TInt& aUserResponse );
       
   131     
       
   132 private:    // from CActive
       
   133 
       
   134     /**
       
   135     * Handle active object completion event, used to handle internal trigger in our 
       
   136     * plug-in
       
   137     */
       
   138     void RunL();
       
   139     
       
   140     /**
       
   141     * Handle cancel
       
   142     */
       
   143     void DoCancel();
       
   144     
       
   145 private: // data
       
   146 
       
   147     /**
       
   148     * Reference of the callback interface between the plug-in class
       
   149     * and the engine class.
       
   150     */
       
   151     MDiagBatteryChargerTestCallBackInterface& iInterface;
       
   152     
       
   153     
       
   154     /**
       
   155     * Wrapper to display waiting dialog. This helps to identify if the dialog
       
   156     * was dismissed by end-user or by object deletion.
       
   157     * Ownership: This class.
       
   158     */
       
   159     CDiagPluginWaitingDialogWrapper* iWaitingDialogWrapper;
       
   160     
       
   161     /**
       
   162     *   This flag indicates if the plugin is run in single test execution mode.
       
   163     */
       
   164     TBool iIsSinglePluginExecution;
       
   165     
       
   166     };
       
   167 
       
   168 #endif //DIAGBATTERYCHARGERCABLETESTENGINE_H
       
   169 
       
   170 // End of File