devicediagnostics/diagplugins/diagbatterychargerplugin/inc/diagbatterychargercableengine.h
branchRCL_3
changeset 58 5b858729772b
equal deleted inserted replaced
57:6757f1e2efd2 58:5b858729772b
       
     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 when RunL leaves
       
   142     */
       
   143     TInt RunError( TInt aError );
       
   144     
       
   145     /**
       
   146     * Handle cancel
       
   147     */
       
   148     void DoCancel();
       
   149     
       
   150 private: // data
       
   151 
       
   152     /**
       
   153     * Reference of the callback interface between the plug-in class
       
   154     * and the engine class.
       
   155     */
       
   156     MDiagBatteryChargerTestCallBackInterface& iInterface;
       
   157     
       
   158     
       
   159     /**
       
   160     * Wrapper to display waiting dialog. This helps to identify if the dialog
       
   161     * was dismissed by end-user or by object deletion.
       
   162     * Ownership: This class.
       
   163     */
       
   164     CDiagPluginWaitingDialogWrapper* iWaitingDialogWrapper;
       
   165     
       
   166     /**
       
   167     *   This flag indicates if the plugin is run in single test execution mode.
       
   168     */
       
   169     TBool iIsSinglePluginExecution;
       
   170     
       
   171     };
       
   172 
       
   173 #endif //DIAGBATTERYCHARGERCABLETESTENGINE_H
       
   174 
       
   175 // End of File