resourcemgmt/hwresourcesmgr/vibra/inc/HWRMVibraImpl.h
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 /*
       
     2 * Copyright (c) 2005-2009 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:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef HWRMVIBRAIMPL_H
       
    21 #define HWRMVIBRAIMPL_H
       
    22 
       
    23 // INCLUDES
       
    24 #include "HWRMClient.h"
       
    25 #include "HWRMVibra.h"
       
    26 #include "HWRMVibraProfileObserver.h"
       
    27 #include "hwrmuipluginservice.h"
       
    28 
       
    29 
       
    30 // CONSTANTS
       
    31 
       
    32 // MACROS
       
    33 
       
    34 // DATA TYPES
       
    35 
       
    36 // FUNCTION PROTOTYPES
       
    37 
       
    38 // FORWARD DECLARATIONS
       
    39 class CHWRMVibraStatusObserver;
       
    40 class CHwrmUiPluginHandler;
       
    41 // CLASS DECLARATION
       
    42 
       
    43 /**
       
    44 *  Class of the vibra client side session.
       
    45 *
       
    46 */
       
    47 NONSHARABLE_CLASS(CHWRMVibraImpl) : public CHWRMVibra,
       
    48                                     public MHWRMVibraProfileObserver,
       
    49 					                public MHwrmForegroundObserver
       
    50     {
       
    51     public:  // Constructors and destructor
       
    52         
       
    53         // Implementations are always constructed
       
    54         // by CHWRMVibra::NewL or CHWRMVibra::NewLC.
       
    55 
       
    56         /**
       
    57         * Destructor.
       
    58         */
       
    59         virtual ~CHWRMVibraImpl();
       
    60 
       
    61     public: // New functions
       
    62 
       
    63     public: // Functions from base classes
       
    64        
       
    65         // From CHWRMVibra
       
    66 		void SetFeedbackObserver(MHWRMVibraFeedbackObserver* aCallback);
       
    67         void ReserveVibraL();
       
    68         void ReserveVibraL(TBool aRestoreState, TBool aForceNoCCoeEnv);
       
    69     	void ReleaseVibra();
       
    70     	void StartVibraL(TInt aDuration);
       
    71         void StartVibraL(TInt aDuration, TInt aIntensity);
       
    72 	    void StopVibraL(void);
       
    73 	   	void PulseVibraL();
       
    74 	    void PulseVibraL(TInt aDuration);
       
    75 	    void PulseVibraL(TInt aDuration, TInt aIntensity);
       
    76         CHWRMVibra::TVibraModeState VibraSettings(void) const;
       
    77         TVibraStatus VibraStatus() const;
       
    78         CHWRMVibra::TVibraFeedbackModeState VibraFeedbackSettings() const;
       
    79         
       
    80         // From MHWRMVibraProfileObserver
       
    81         void VibraModeChange(CHWRMVibra::TVibraModeState aNewState);
       
    82         void VibraFeedbackModeChange(CHWRMVibra::TVibraFeedbackModeState newState);
       
    83         
       
    84         // From MHWRMForegroundObserver
       
    85 		void HandleGainingForeground();
       
    86 		void HandleLosingForeground();
       
    87 
       
    88 
       
    89     protected:  // New functions
       
    90         
       
    91     protected:  // Functions from base classes
       
    92 
       
    93     private:
       
    94 
       
    95         /**
       
    96         * C++ default constructor.
       
    97         */
       
    98         CHWRMVibraImpl();
       
    99 
       
   100         /**
       
   101         * By default Symbian 2nd phase constructor is private.
       
   102         */
       
   103         void ConstructL(MHWRMVibraObserver* aCallback);
       
   104 
       
   105     	/**
       
   106     	* Opens the vibra session.
       
   107     	* This method must be called before any other methods can be called.
       
   108     	*/
       
   109     	void OpenL();
       
   110 
       
   111     	/**
       
   112     	* Closes the session. 
       
   113     	*/
       
   114     	void Close();
       
   115 
       
   116         /**
       
   117         * Do actual reservation. For parameters, see ReserveVibraL
       
   118         */        
       
   119         void DoReserveVibraL(TBool aRestoreState, TBool aForceNoCCoeEnv);
       
   120         
       
   121         /**
       
   122         * Do actual release
       
   123         */
       
   124     	void DoReleaseVibra();
       
   125 
       
   126     public:     // Data
       
   127     
       
   128     protected:  // Data
       
   129 
       
   130     private:    // Data
       
   131 
       
   132         RHWRMClient                	iClient;              	// HWRM server client
       
   133         MHWRMVibraObserver*        	iCallback;            	// Client listening events. Not owned
       
   134         MHWRMVibraFeedbackObserver* iFeedbackCallback;   	// Client listening feedback events. Not owned
       
   135         mutable TVibraModeState		iVibraSetting;        	// Current Profile Vibra Setting, cached for speed
       
   136         mutable TVibraFeedbackModeState    	iVibraFeedbackSetting;	// Current Profile feedback vibration setting, cached for speed
       
   137         CHWRMVibraStatusObserver*  	iStatusObserver;      	// Vibra status observer pointer. Owned.
       
   138         CHWRMVibraProfileObserver* 	iProfileObserver;     	// Vibra profile observer pointer. Owned.
       
   139         CHwrmUiPluginHandler*    	iUiPluginHandler; 		//
       
   140         
       
   141         TBool                      	iReserved;            	// Flag to indicate if vibra is reserved currently.
       
   142         TBool                      	iAutoReserving;       	// Flag to indicate if vibra is being autoreserved
       
   143                                                          	// and autoreleased on background/foreground transitions.
       
   144                                                          
       
   145         TBool                      	iPrivilegedClient;   	// Flag to indicate if this client can ignore profile settings                                                      
       
   146 
       
   147     public:     // Friend classes
       
   148 
       
   149         friend class CHWRMVibra;
       
   150 
       
   151     protected:  // Friend classes
       
   152 
       
   153     private:    // Friend classes
       
   154 
       
   155     };
       
   156     
       
   157 #endif      // HWRMVIBRAIMPL_H   
       
   158             
       
   159 // End of File