devicediagnostics/diagplugins/diagvibrateplugin/inc/diagvibrateplugin.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:  CDiagVibratePugin derives from CDiagTestPluginBase and 
       
    15 *                  is the access point to run the vibrate test.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef __DIAGVIBRATEPLUGIN_H__
       
    21 #define __DIAGVIBRATEPLUGIN_H__
       
    22 
       
    23 // INCLUDES
       
    24 #include <DiagTestPluginBase.h>         //CDiagTestPluginBase
       
    25 #include <AknProgressDialog.h>          //MProgressDialogCallback
       
    26 
       
    27 #include "diagvibratepluginobserver.h"  //MDiagVibratePluginObserver
       
    28 
       
    29 // CONSTANTS
       
    30 
       
    31 // MACROS
       
    32 
       
    33 // DATA TYPES
       
    34 
       
    35 // FUNCTION PROTOTYPES
       
    36 
       
    37 // FORWARD DECLARATIONS
       
    38 class CDiagVibratePluginEngine;
       
    39 
       
    40 // CLASS DEFINITION
       
    41 class CDiagVibratePlugin : public CDiagTestPluginBase, 
       
    42                            public MDiagVibratePluginObserver,
       
    43                            public MProgressDialogCallback
       
    44 
       
    45     {
       
    46     public: // Constructors and destructor
       
    47 
       
    48         /**
       
    49         * Symbian OS two-phased constructor
       
    50         * @return MDiagPlugin*
       
    51         */
       
    52         static MDiagPlugin* NewL( TAny* aInitParams );
       
    53 
       
    54         /**
       
    55         * Destructor
       
    56         */
       
    57         virtual ~CDiagVibratePlugin();
       
    58 
       
    59     public: // From CDiagTestPluginBase
       
    60 
       
    61         /**
       
    62         * @see CDiagTestPluginBase::Visible()
       
    63         */
       
    64         virtual TBool IsVisible() const;
       
    65 
       
    66         /**
       
    67         * @see CDiagTestPluginBase::RunMode()
       
    68         */
       
    69         virtual TRunMode RunMode() const;
       
    70 
       
    71         /**
       
    72         * @see CDiagTestPluginBase::TotalSteps()
       
    73         */
       
    74         virtual TUint TotalSteps() const;
       
    75 
       
    76         /**
       
    77         * @see CDiagTestPluginBase::GetPluginNameL
       
    78         */
       
    79         virtual HBufC* GetPluginNameL( TNameLayoutType aLayoutType ) const;
       
    80 
       
    81         /**
       
    82         * @see CDiagTestPluginBase::Uid
       
    83         */
       
    84         virtual TUid Uid() const;
       
    85 
       
    86     public: // from MDiagVibratePluginObserver
       
    87 
       
    88         /**
       
    89          * Inform vibrate status changes
       
    90          *
       
    91          * @param aStatus Status of the vibrate engine
       
    92          */
       
    93         virtual void VibraStatusChanged( TVibrateStatus aStatus );
       
    94 
       
    95     private: // from CDiagTestPluginBase
       
    96 
       
    97         /**
       
    98         * Handle plug-in execution.
       
    99         * @see CDiagTestPluginBase::DoRunTestL
       
   100         */
       
   101         void DoRunTestL();
       
   102 
       
   103         /**
       
   104         * Clean up
       
   105         * @see CDiagTestPluginBase::DoStopAndCleanupL
       
   106         */
       
   107         void DoStopAndCleanupL();
       
   108 
       
   109     private: // from CActive
       
   110     
       
   111         /**
       
   112         * Handle active object completion event
       
   113         */
       
   114         virtual void RunL();
       
   115     
       
   116         /**
       
   117         * Handle cancel
       
   118         */
       
   119         virtual void DoCancel();
       
   120     
       
   121     private: // from MProgressDialogCallback
       
   122         
       
   123         /**
       
   124         * Called when the progress dialog is dismissed.
       
   125         *
       
   126         * @param aButtonId - indicate which button made dialog to dismiss
       
   127         */
       
   128         virtual void DialogDismissedL( TInt aButtonId );
       
   129     
       
   130     private: 
       
   131 
       
   132         /**
       
   133         * C++ default constructor.
       
   134         */
       
   135         CDiagVibratePlugin( CDiagPluginConstructionParam* aInitParams  );
       
   136 
       
   137         /**
       
   138         * Symbian OS default constructor.
       
   139         *
       
   140         */
       
   141         void ConstructL();
       
   142 
       
   143    private:    // data
       
   144     
       
   145         /**  enum for the vibrate plugin internal state */
       
   146         enum TState
       
   147             {
       
   148             EStateUnknown = 0,
       
   149             EStateFailed,
       
   150             EStateCancelled,
       
   151             EStateSkipped,
       
   152             EStateIdle,
       
   153             EStateVibrating,
       
   154             EStateUserQuery,
       
   155             EStateBlocked,
       
   156             EStateRestart
       
   157             };
       
   158 
       
   159     private:    // private functions
       
   160     
       
   161         /**
       
   162         * Makes sure vibrate is enabled in the profile
       
   163         */
       
   164         TInt SetVibrateSettingOnL();
       
   165 
       
   166         /**
       
   167         * Sets the vibration setting to its original value
       
   168         */
       
   169         void SetVibrateSettingToOriginalValueL();
       
   170 
       
   171         /**
       
   172         * Checks if the charger is connected
       
   173         */
       
   174         TBool IsChargerConnected() const;
       
   175 
       
   176         /**
       
   177         * Sets the state
       
   178         * @param aState State to be set
       
   179         */
       
   180         void SetState( CDiagVibratePlugin::TState aState );
       
   181         
       
   182         /**
       
   183         * Displays disconnect charger dlg
       
   184         * @return TBool
       
   185         */
       
   186         TBool DisplayDisconnectChargerQueryL();
       
   187         
       
   188         /**
       
   189         * Displays vibrating progress dialog
       
   190         */
       
   191         void ShowVibratingNoteL();
       
   192         
       
   193         /**
       
   194         * Gets vibration time in seconds from CR
       
   195         */
       
   196         void ReadVibrationTimeL();
       
   197         
       
   198         /*
       
   199         * confirmation query for activating the vibration in profile.
       
   200         */
       
   201         TInt ShowActivateConfNoteL();
       
   202        
       
   203     private: // data
       
   204 
       
   205         /**
       
   206         * Vibrate plugin engine
       
   207         * own
       
   208         */
       
   209         CDiagVibratePluginEngine* iEngine;
       
   210 
       
   211         /**
       
   212         * Progress Dialog
       
   213         * own
       
   214         */
       
   215         CAknProgressDialog* iProgressDialog;
       
   216 
       
   217         /**
       
   218         * State of the vibrate plugin
       
   219         */
       
   220         TState iState;
       
   221         
       
   222         /**
       
   223         * Indicates if the profile vibrate setting was 
       
   224         * temporalily set active 
       
   225         */
       
   226         TBool iVibrateSettingUpdated;
       
   227         
       
   228         /**
       
   229         * Original profile vibrate setting
       
   230         */
       
   231         TBool iOrigVibrateSetting;
       
   232         
       
   233         /**
       
   234         * Vibration time in seconds
       
   235         */
       
   236         TInt iVibrationTime;        
       
   237         
       
   238     };
       
   239 
       
   240 #endif // __DIAGVIBRATEPLUGIN_H__
       
   241 
       
   242 // End of File