resourcemgmt/hwresourcesmgr/extendedlight/inc/HWRMExtendedLightImpl.h
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 /*
       
     2 * Copyright (c) 2006-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 
       
    21 /**
       
    22  @file
       
    23  @internalTechnology 
       
    24 */
       
    25 
       
    26 #ifndef HWRMEXTENDEDLIGHTIMPL_H
       
    27 #define HWRMEXTENDEDLIGHTIMPL_H
       
    28 
       
    29 #include "HWRMClient.h"
       
    30 #include "HWRMExtendedLight.h"
       
    31 #include "hwrmuipluginservice.h"
       
    32 
       
    33 class CHWRMExtendedLightStatusObserver;
       
    34 class CHwrmUiPluginHandler;
       
    35 
       
    36 /**
       
    37 *  Class of the extended light client side session.
       
    38 *
       
    39 */
       
    40 NONSHARABLE_CLASS(CHWRMExtendedLightImpl) : public CHWRMExtendedLight,					                        
       
    41 					                        public MHwrmForegroundObserver
       
    42     {
       
    43     public:  // Constructors and destructor
       
    44         
       
    45         // Implementations are always constructed
       
    46         // by CHWRMExtendedLight::NewL or CHWRMExtendedLight::NewLC.
       
    47 
       
    48         /**
       
    49         * Destructor.
       
    50         */
       
    51         virtual ~CHWRMExtendedLightImpl();
       
    52 
       
    53     public: // New functions
       
    54 
       
    55     public: // Functions from base classes
       
    56        
       
    57         // From CHWRMExtendedLight
       
    58     	void ReserveLightL(TInt aTarget);
       
    59         void ReserveLightL(TInt aTarget, 
       
    60                            TBool aRestoreState, 
       
    61                            TBool aForceNoCCoeEnv);
       
    62     	void ReleaseLight(TInt aTarget);
       
    63     	
       
    64     	void LightOnL(TInt aTarget);
       
    65 		void LightOnL(TInt aTarget, 
       
    66                       TInt aDuration);
       
    67 		void LightOnL(TInt aTarget, 
       
    68                       TInt aDuration, 
       
    69                       TInt aIntensity,
       
    70                       TBool aFadeIn);
       
    71 
       
    72 		void LightBlinkL(TInt aTarget);
       
    73 		void LightBlinkL(TInt aTarget, 
       
    74 		                 TInt aDuration);
       
    75 		void LightBlinkL(TInt aTarget, 
       
    76 		                 TInt aDuration, 
       
    77 		                 TInt aOnDuration, 
       
    78 		                 TInt aOffDuration, 
       
    79 		                 TInt aIntensity);
       
    80 		void LightOffL(TInt aTarget);
       
    81 		void LightOffL(TInt aTarget, 
       
    82                        TInt aDuration);
       
    83 		void LightOffL(TInt aTarget, 
       
    84                        TInt aDuration, 
       
    85                        TBool aFadeOut);
       
    86 
       
    87         CHWRMExtendedLight::TLightStatus LightStatus(TInt aTarget) const;
       
    88         TInt SupportedTargets() const;                
       
    89 		
       
    90 		// From MHWRMForegroundObserver
       
    91 		void HandleGainingForeground();
       
    92 		void HandleLosingForeground();		
       
    93 
       
    94 
       
    95     protected:  // New functions
       
    96         
       
    97     protected:  // Functions from base classes
       
    98 
       
    99     private:
       
   100 
       
   101         /**
       
   102         * C++ default constructor.
       
   103         */
       
   104         CHWRMExtendedLightImpl();
       
   105 
       
   106         /**
       
   107         * By default Symbian 2nd phase constructor is private.
       
   108         */
       
   109         void ConstructL(MHWRMExtendedLightObserver* aCallback, TInt aPermittedTargets = -1);
       
   110 
       
   111     	/**
       
   112     	* Opens the Light session.
       
   113     	* This method must be called before any other methods can be called.
       
   114     	*/
       
   115     	void OpenL(TInt aPermittedTargets = -1);
       
   116 
       
   117     	/**
       
   118     	* Closes the session. 
       
   119     	*/
       
   120     	void Close();
       
   121     	
       
   122     	/**
       
   123     	* Checks the validity of common API call parameters.
       
   124     	* Also checks the session handle.
       
   125     	*
       
   126     	* @param aTarget    aTarget parameter of API call
       
   127     	* @param aDuration  aDuration parameter of API call
       
   128     	* @param aIntensity aIntensity parameter of API call
       
   129     	* @leave KErrArgument   If parameters not valid
       
   130     	* @leave KErrBadHandle  If session handle is invalid. 
       
   131     	*/
       
   132     	void CheckCommonParametersL(TInt aTarget, TInt aDuration, TInt aIntensity) const;
       
   133         
       
   134     	/**
       
   135     	* Checks the validity of duration type API call parameters
       
   136     	*
       
   137     	* @param aDuration  aDuration parameter of API call
       
   138     	*/
       
   139     	void CheckDurationParameterL(TInt aDuration) const;
       
   140     	
       
   141     	/**
       
   142     	* Checks the validity of target type API call parameters.
       
   143     	*
       
   144     	* @param aTarget  aTarget parameter of API call
       
   145     	*/
       
   146     	void CheckTargetParameterL(TInt aTarget) const;
       
   147     	
       
   148         /**
       
   149         * Do actual reservation. For parameters, see ReserveLightL
       
   150         */        
       
   151         void DoReserveLightL(TInt aTarget, TBool aRestoreState, TBool aForceNoCCoeEnv);
       
   152         
       
   153         /**
       
   154         * Do actual release
       
   155         */
       
   156     	void DoReleaseLight(TInt aTarget);
       
   157 
       
   158         /**
       
   159         * Send set color request to HWRM Server
       
   160         * aSetColor - specifies whether it is called for set color or default color.
       
   161         */
       
   162 
       
   163         void DoSetLightColorL(TBool aSetColor, TInt aTarget, TUint8 aRed=0, TUint8 aGreen=0, TUint8 aBlue=0);
       
   164 
       
   165         void DoLightOnWithColorL(TInt aTarget, TInt aDuration, TInt aIntensity, TBool aFadeIn,
       
   166                                  const THWRMLightColor& aRGBParam);
       
   167 
       
   168         void DoLightBlinkWithColorL(TInt aTarget, TInt aDuration, TInt aOnDuration, 
       
   169                                 TInt aOffDuration, TInt aIntensity, const THWRMLightColor& aRGBParam);
       
   170 
       
   171 
       
   172 
       
   173     public:     // Data
       
   174     
       
   175     protected:  // Data
       
   176 
       
   177     private:    // Data
       
   178 
       
   179         RHWRMClient                        iClient;           // HWRM server client
       
   180         MHWRMExtendedLightObserver*        iCallback;         // Client listening events. Not owned
       
   181         CHWRMExtendedLightStatusObserver*  iStatusObserver;   // Light status observer pointer. Owned.
       
   182         CHwrmUiPluginHandler*            iUiPluginHandler; //
       
   183 
       
   184         TInt                       iReserved;         // Bitmask to indicate what targets are reserved currently.
       
   185         TInt                       iAutoReserving;    // Bitmask to indicate what targets are being autoreserved.
       
   186                                                       // and autoreleased on background/foreground transitions.
       
   187         
       
   188         TInt                       iSupportedTargets; // Supported targets mask.
       
   189         
       
   190     public:     // Friend classes
       
   191 
       
   192         friend class CHWRMExtendedLight;
       
   193         friend class CHWRMEnhancedLight;
       
   194 
       
   195 
       
   196     protected:  // Friend classes
       
   197 
       
   198     private:    // Friend classes
       
   199 
       
   200     };          
       
   201     
       
   202 #endif      // HWRMEXTENDEDLIGHTIMPL_H   
       
   203             
       
   204 // End of File