epoc32/include/hwrmvibra.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 hwrmvibra.h
     1 /*
       
     2 * Copyright (c) 2002-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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  This file contains the header of the 
       
    15 *                CHWRMVibra class.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef HWRMVIBRA_H
       
    21 #define HWRMVIBRA_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32base.h>
       
    25 
       
    26 // CONSTANTS
       
    27 
       
    28 /**
       
    29 * Minimum allowed intensity setting for vibra. When intensity is negative, 
       
    30 * the vibra motor rotates in the negative direction.
       
    31 */
       
    32 const TInt KHWRMVibraMinIntensity = -100;
       
    33 
       
    34 /**
       
    35 * Minimum allowed intensity setting for vibra pulse.
       
    36 */
       
    37 const TInt KHWRMVibraMinPulseIntensity = 1;
       
    38 
       
    39 /**
       
    40 * Maximum allowed intensity setting for vibra. When intensity is positive, 
       
    41 * the vibra motor rotates in the positive direction. Value 0 effectively 
       
    42 * stops the vibra.
       
    43 */
       
    44 const TInt KHWRMVibraMaxIntensity = 100;
       
    45 
       
    46 /**
       
    47 * Maximum allowed duration value in milliseconds. Maximum vibrating time 
       
    48 * supported by device is declared in KVibraCtrlMaxTime cenrep-key.
       
    49 *
       
    50 * Note that duration probably has device specific
       
    51 * maximum duration that is much lower.
       
    52 */
       
    53 const TInt KHWRMVibraMaxDuration = (KMaxTInt / 1000) - 1;
       
    54 
       
    55 /**
       
    56 * KHWRMVibraInfiniteDuration specifies, that vibrating should continue maximum 
       
    57 * vibrating time supported by device if vibrating is not explicitly stopped.
       
    58 *
       
    59 */
       
    60 const TInt KHWRMVibraInfiniteDuration = 0;
       
    61 
       
    62 // FORWARD DECLARATIONS
       
    63 class MHWRMVibraObserver;
       
    64 class MHWRMVibraFeedbackObserver;
       
    65 
       
    66 // CLASS DECLARATIONS
       
    67 
       
    68 /**
       
    69 * The class used to control the device vibra.
       
    70 *
       
    71 * HW Resource Manager Vibra API is a library API providing ability to control
       
    72 * the device vibra. The API provides also methods to retrieve the current settings
       
    73 * of the vibration feature in the user profile and the current status of the vibra. 
       
    74 *
       
    75 * The type of HW Resource Manager Vibra API is a synchronous method call meaning 
       
    76 * the method call will block the client application. However, e.g. StartVibraL methods do 
       
    77 * return right after device vibration has successfully been started. Callback is intended only
       
    78 * for observing vibra and feedback on/off changes. The API is meant for all 
       
    79 * applications which need to control the device vibra.
       
    80 *
       
    81 * The API consist of the classes CHWRMVibra, MHWRMVibraObserver and MHWRMVibraFeedbackObserver. 
       
    82 * If the client requires up-to-date status information, it should also provide callback pointer
       
    83 * of the MHWRMVibraObserver implementing class for the NewL-method and explicitly set feedback observer.
       
    84 *
       
    85 * Usage:
       
    86 *
       
    87 * @code
       
    88 * #include <HWRMVibra.h>  // link against HWRMVibraClient.lib
       
    89 *
       
    90 * // A CHWRMVibra instance can be created by using NewL() or NewLC() methods. 
       
    91 * // Up-to-date status information not required, no callbacks.
       
    92 * CHWRMVibra* vibra = CHWRMVibra::NewL();
       
    93 *
       
    94 * // After this, vibra can be directly controlled via the provided class methods. 
       
    95 * vibra->StartVibraL(5000); // Start vibra for five seconds
       
    96 * vibra->StopVibraL(); // Immediately stop vibra
       
    97 *
       
    98 * // To clean up, delete the created object:
       
    99 * delete vibra;
       
   100 * @endcode
       
   101 *
       
   102 *  @lib HWRMVIBRACLIENT.DLL
       
   103 *  @since S60 3.0
       
   104 */
       
   105 class CHWRMVibra : public CBase
       
   106     {
       
   107     public: // enums
       
   108         /**
       
   109         * Vibration setting in the user profile.
       
   110         */
       
   111         enum TVibraModeState 
       
   112             {
       
   113             EVibraModeUnknown = 0, ///< Not initialized yet or there is an error condion.
       
   114             EVibraModeON,          ///< Vibration setting in the user profile is on.
       
   115             EVibraModeOFF          ///< Vibration setting in the user profile is off.
       
   116             };
       
   117 
       
   118         /**
       
   119         * Status of the vibration feature
       
   120         */
       
   121         enum TVibraStatus 
       
   122             {
       
   123             EVibraStatusUnknown = 0, ///< Vibra is not initialized yet or status is uncertain 
       
   124                                      ///< because of an error condition.
       
   125             EVibraStatusNotAllowed,  ///< Vibra is set off in the user profile or some
       
   126                                      ///< application is specifically blocking vibra.
       
   127             EVibraStatusStopped,     ///< Vibra is stopped.
       
   128             EVibraStatusOn           ///< Vibra is on.
       
   129             };
       
   130             
       
   131         /**
       
   132         * Tactile feedback vibration setting in the user profile.
       
   133         */
       
   134         enum TVibraFeedbackModeState 
       
   135             {
       
   136             EVibraFeedbackModeUnknown = 0, ///< Not initialized yet or there is an error condion.
       
   137             EVibraFeedbackModeON,          ///< Feedback vibration setting in the user profile is on.
       
   138             EVibraFeedbackModeOFF          ///< Feedback vibration setting in the user profile is off.
       
   139             };
       
   140 
       
   141     public:  // Constructors
       
   142         
       
   143         /**
       
   144         * Two-phased constructor.
       
   145         *
       
   146         * @return A pointer to a new instance of the CHWRMVibra class.
       
   147         *
       
   148         * @leave KErrNotSupported Device doesn't support vibration feature.
       
   149         * @leave KErrNoMemory There is a memory allocation failure. 
       
   150         */
       
   151         IMPORT_C static CHWRMVibra* NewL();
       
   152         
       
   153         /**
       
   154         * Two-phased constructor.
       
   155         * Leaves instance to cleanup stack.
       
   156         *
       
   157         * @return A pointer to a new instance of the CHWRMVibra class.
       
   158         *
       
   159         * @leave KErrNotSupported Device doesn't support vibration feature.
       
   160         * @leave KErrNoMemory There is a memory allocation failure. 
       
   161         */
       
   162         IMPORT_C static CHWRMVibra* NewLC();
       
   163 
       
   164         /**
       
   165         * Two-phased constructor.
       
   166         * Use this method for creating a vibra client with callbacks.
       
   167         *
       
   168         * @param aCallback Pointer to callback instance
       
   169         * @return A pointer to a new instance of the CHWRMVibra class.
       
   170         *
       
   171         * @leave KErrNotSupported Device doesn't support vibration feature.
       
   172         * @leave KErrNoMemory There is a memory allocation failure. 
       
   173         */
       
   174         IMPORT_C static CHWRMVibra* NewL(MHWRMVibraObserver* aCallback);
       
   175         
       
   176         /**
       
   177         * Two-phased constructor. 
       
   178         * Use this method for creating a vibra client with callbacks.
       
   179         * Leaves instance to cleanup stack.
       
   180         *
       
   181         * @param aCallback Pointer to callback instance
       
   182         * @return A pointer to a new instance of the CHWRMVibra class.
       
   183         *
       
   184         * @leave KErrNotSupported Device doesn't support vibration feature.
       
   185         * @leave KErrNoMemory There is a memory allocation failure. 
       
   186         */
       
   187         IMPORT_C static CHWRMVibra* NewLC(MHWRMVibraObserver* aCallback);
       
   188 
       
   189     public: // New functions
       
   190 
       
   191     	/**
       
   192     	* Reserves vibration feature exclusively for this client.
       
   193     	* A higher priority (not process or thread priority, but the priority defined
       
   194     	* in the internal vibra policy of the HW Resource Manager) client may cause 
       
   195     	* lower priority client reservation to be temporarily suspended. Commands 
       
   196     	* can still be issued in suspended state, but they will not be acted upon 
       
   197     	* unless suspension is lifted within specified duration.
       
   198     	* The suspended client will not get any notification about suspension and
       
   199     	* neither from resumption of reservation.
       
   200     	* If vibra is already reserved by a higher or equal priority application, 
       
   201     	* reserving will still succeed, but reservation is immediately suspended.
       
   202     	*
       
   203     	* Calling this method is equal to call ReserveVibraL(EFalse, EFalse),
       
   204     	* i.e. any previously frozen state will not be restored and CCoeEnv
       
   205     	* background/foreground status is always used to control further reservations.
       
   206     	*
       
   207     	* @leave KErrAccessDenied No CCoeEnv present.
       
   208     	* @leave KErrNotReady Trying to reserve while on background.
       
   209         * @leave KErrNoMemory There is a memory allocation failure. 
       
   210     	*/
       
   211     	virtual void ReserveVibraL()=0;
       
   212     	
       
   213     	/**
       
   214     	* Reserves vibration feature exclusively for this client.
       
   215     	* A higher priority (not process or thread priority, but the priority defined
       
   216     	* in the internal vibra policy of the HW Resource Manager) client may cause 
       
   217     	* lower priority client reservation to be temporarily suspended. Commands 
       
   218     	* can still be issued in suspended state, but they will not be acted upon 
       
   219     	* unless suspension is lifted within specified duration.
       
   220     	* The suspended client will not get any notification about suspension and
       
   221     	* neither from resumption of reservation.
       
   222     	* If vibra is already reserved by a higher or equal priority application, 
       
   223     	* reserving will still succeed, but reservation is immediately suspended.
       
   224     	*
       
   225     	*
       
   226     	* @param aRestoreState If ETrue, the state frozen on last release will be
       
   227     	*                      restored upon successful reservation.
       
   228     	*                      I.e. if vibra was on when it was released by this 
       
   229         *                      client the last time, it would continue the vibrating
       
   230         *                      upon successful reservation.
       
   231     	*                      For the first reservation of each session this 
       
   232         *                      parameter is always considered EFalse regardless of 
       
   233         *                      what is supplied, as there is no previous frozen state
       
   234         *                      to restore.
       
   235     	* @param aForceNoCCoeEnv If EFalse, then reservation requires that this client
       
   236         *                        has the keyboard focus at the time of reservation and
       
   237         *                        vibra will be automatically released and re-reserved 
       
   238         *                        based on the keyboard focus status of this client. 
       
   239         *                        This also implies that CCoeEnv::Static() != NULL is 
       
   240         *                        required.
       
   241     	*                        If ETrue, the client will not require CCoeEnv to be 
       
   242         *                        present nor does it automatically reserve/release vibra 
       
   243     	*                        by depending on foreground/background status of the 
       
   244         *                        client.
       
   245     	*                        Only trusted clients are allowed to set this flag to
       
   246         *                        ETrue. A client is considered trusted if it has nonstandard
       
   247         *                        priority defined in the internal vibra policy of the 
       
   248         *                        HW Resource Manager. A client can be defined trusted
       
   249         *                        only by S60 or a product.
       
   250     	*
       
   251     	* @leave KErrAccessDenied Parameter aForceNoCCoeEnv is ETrue and client is not
       
   252     	*                         trusted.
       
   253     	* @leave KErrBadHandle Parameter aForceNoCCoeEnv is EFalse and no CCoeEnv present.
       
   254     	* @leave KErrNotReady Trying to reserve while on background and parameter 
       
   255         *                     aForceNoCCoeEnv is EFalse.
       
   256         * @leave KErrNoMemory There is a memory allocation failure. 
       
   257     	*/
       
   258     	virtual void ReserveVibraL(TBool aRestoreState, TBool aForceNoCCoeEnv)=0;
       
   259 
       
   260     	/**
       
   261     	* Releases vibration feature if it was previously reserved for this client.
       
   262     	* If this client has not reserved vibration feature, does nothing.
       
   263     	* If vibra is on when it is released and no other client has a suspended 
       
   264     	* reservation, vibra is stopped.
       
   265     	*/
       
   266     	virtual void ReleaseVibra()=0;
       
   267 
       
   268 
       
   269         /**
       
   270         * Starts the device vibration feature with the product specific default
       
   271         * intensity.
       
   272         * If StartVibraL is called again before the first vibration completes
       
   273         * then the first vibration is interrupted and the second vibrations
       
   274         * starts immediately -- i.e. The periods of vibration are not cumulative.
       
   275         *
       
   276         * The vibration can be interrupted with the method StopVibraL before
       
   277         * the specified interval has elapsed. 
       
   278         *
       
   279         * Vibra settings of the vibration feature in the user profile 
       
   280         * must be active. 
       
   281         *
       
   282         * Note: The device may have implementation defined or hardware imposed
       
   283         *       limits to the duration of the vibration feature. In such 
       
   284         *       circumstances any vibration will cut off at that limit even if
       
   285         *       the duration parameter is greater than the limit.
       
   286         *
       
   287         * @param aDuration Duration of the vibration measured in milliseconds. 
       
   288         *                  A value of KHWRMVibraInfiniteDuration specifies that 
       
   289         *                  the vibration should continue indefinetely and should 
       
   290         *                  be stopped with a call to StopVibraL. Duration 
       
   291         *                  usually has device specific maximum value.
       
   292         *
       
   293         * @leave KErrArgument Duration is invalid.
       
   294         * @leave KErrAccessDenied Vibration setting in the user profile is not set.
       
   295         * @leave KErrBadHandle Vibra session has been invalidated.
       
   296         * @leave KErrLocked Vibra is locked down because too much continuous use
       
   297         *                   or explicitly blocked by for example some vibration 
       
   298         *                   sensitive accessory.
       
   299         * @leave KErrTimedOut Timeout occurred in controlling vibra.
       
   300         * @leave KErrInUse Vibra is not reserved to this client but it is
       
   301         *                  reserved to some other client.
       
   302         * @leave KErrNoMemory There is a memory allocation failure. 
       
   303         * @leave KErrGeneral There is a hardware error.
       
   304         *
       
   305         * @see MHWRMVibraObserver
       
   306         */
       
   307         virtual void StartVibraL(TInt aDuration)=0;
       
   308 		
       
   309         /**
       
   310         * Starts the device vibration feature. If StartVibraL is called again before
       
   311         * the first vibration completes then the first vibration is interrupted
       
   312         * and the second vibrations starts immediately -- i.e. The periods of
       
   313         * vibration are not cumulative.
       
   314         *
       
   315         * The vibration can be interrupted with the method StopVibraL before
       
   316         * the specified interval has elapsed.
       
   317         *
       
   318         * Vibra settings of the vibration feature in the user profile 
       
   319         * must be active. 
       
   320         *
       
   321         * Note: The device may have implementation defined or hardware imposed
       
   322         *       limits to the duration of the vibration feature. In such 
       
   323         *       circumstances any vibration will cut off at that limit even if
       
   324         *       the duration parameter is greater than the limit.
       
   325         *
       
   326         * @param aDuration Duration of the vibration measured in milliseconds. 
       
   327         *                  A value of KHWRMVibraInfiniteDuration specifies that 
       
   328         *                  the vibration should continue indefinetely and should 
       
   329         *                  be stopped with a call to StopVibraL. Duration 
       
   330         *                  usually has device specific maximum value.
       
   331         * @param aIntensity Intensity of the vibra in decimal is KHWRMVibraMinIntensity
       
   332         *                   to KHWRMVibraMaxIntensity,
       
   333         *                   which shows the percentage of the vibra motor full
       
   334         *                   rotation speed. When intensity is negative, 
       
   335         *                   the vibra motor rotates in the negative direction.
       
   336         *                   When intensity is positive, the vibra motor rotates
       
   337         *                   in the positive direction. Value 0 stops the vibra.
       
   338         *                   NOTE: The device might have hardware-imposed limits
       
   339         *                         on supported vibra intensity values, so actual
       
   340         *                         effect might vary between different hardware.
       
   341         *
       
   342         * @leave KErrNotSupported The device doesn't support user-defined 
       
   343         *                         vibra intensity.
       
   344         * @leave KErrArgument One of the parameters is out of range.
       
   345         * @leave KErrAccessDenied Vibration setting in the user profile
       
   346         *                         is not set.
       
   347         * @leave KErrBadHandle Vibra session has been invalidated.
       
   348         * @leave KErrLocked Vibra is locked down because too much continuous use
       
   349         *                   or explicitly blocked by for example some vibration
       
   350         *                   sensitive accessory.
       
   351         * @leave KErrTimedOut Timeout occurred in controlling vibra.
       
   352         * @leave KErrInUse Vibra is not reserved to this client but it is
       
   353         *                  reserved to some other client.
       
   354         * @leave KErrNoMemory There is a memory allocation failure. 
       
   355         * @leave KErrGeneral There is a hardware error.
       
   356         *
       
   357         * @see MHWRMVibraObserver
       
   358         */
       
   359 	    virtual void StartVibraL(TInt aDuration, TInt aIntensity)=0;
       
   360 	    
       
   361 	    /**
       
   362         * Interrupts the device vibration that is started with the StartVibraL
       
   363         * method immediately.
       
   364         *
       
   365         * @leave KErrBadHandle Vibra session has been invalidated.
       
   366         * @leave KErrTimedOut Timeout occurred in controlling vibra.
       
   367         * @leave KErrInUse Vibra is not reserved to this client but it is
       
   368         *                  reserved to some other client.
       
   369         * @leave KErrNoMemory There is a memory allocation failure. 
       
   370         * @leave KErrGeneral There is a hardware error.
       
   371         *
       
   372         * @see MHWRMVibraObserver
       
   373         */		
       
   374         virtual void StopVibraL()=0; 
       
   375 		
       
   376         /**
       
   377         * This method retrieves the current settings of the vibration feature
       
   378         * in the user profile. The developer can check the Vibra settings 
       
   379         * in the profile and if there is no Vibra active but it is needed by 
       
   380         * the client application then the user can be informed.
       
   381         *
       
   382         * @return TVibraModeState indicating the current vibra mode setting.
       
   383         *
       
   384         * @see TVibraModeState
       
   385         * @see MHWRMVibraObserver
       
   386         */
       
   387         virtual TVibraModeState VibraSettings() const=0;
       
   388 
       
   389         /**
       
   390         * This method retrieves the current vibra status. 
       
   391         *
       
   392         * @return TVibraStatus indicating the current vibra status
       
   393         * 
       
   394         * @see TVibraStatus
       
   395         * @see MHWRMVibraObserver
       
   396         */
       
   397         virtual TVibraStatus VibraStatus() const=0;
       
   398         
       
   399         /**
       
   400         * This method is intended only for firmware build time configured 
       
   401         * privileged clients.
       
   402         *
       
   403         * Executes a tactile feedback vibration pulse with product 
       
   404         * specific default intensity and duration.
       
   405         * If PulseVibraL is called before ongoing vibration completes and 
       
   406         * PulseVibraL calling client has higher priority than executing client,
       
   407         * pulse request is accepted. Also possible vibra-reservations are bypassed.
       
   408         * If client calling PulseVibraL has lower or equal priority 
       
   409         * than executing client, ongoing vibration is not affected.
       
   410         *
       
   411         * Tactile feedback vibration settings of the vibration feature in the 
       
   412         * user profile must be active. 
       
   413         *
       
   414         * Note: The device may have implementation defined or hardware imposed
       
   415         *       limits to the duration of the vibration feature. In such 
       
   416         *       circumstances any vibration will cut off at that limit even if
       
   417         *       the duration parameter is greater than the limit.
       
   418         *
       
   419         * @param aDuration Duration of the vibration measured in milliseconds. 
       
   420         *                  Duration can have maximum value
       
   421         *                  of KHWRMVibraMaxDuration.
       
   422         *
       
   423         * @leave KErrAccessDenied Vibration setting in the user profile is not set
       
   424         *                         or client is not privileged to use pulse feature. 
       
   425         * @leave KErrBadHandle Vibra session has been invalidated.
       
   426         * @leave KErrLocked Vibra is locked down because too much continuous use
       
   427         *                   or explicitly blocked by for example some vibration 
       
   428         *                   sensitive accessory.
       
   429         * @leave KErrTimedOut Timeout occurred in controlling vibra.
       
   430         * @leave KErrInUse Vibra is not reserved to this client but it is
       
   431         *                  reserved to some other client or ongoing vibration
       
   432         *                  has been requested by higher priority client.
       
   433         * @leave KErrNoMemory There is a memory allocation failure. 
       
   434         * @leave KErrGeneral There is a hardware error.
       
   435         *
       
   436         * @see MHWRMVibraFeedbackObserver
       
   437         */
       
   438         virtual void PulseVibraL()=0;
       
   439 		
       
   440         /**
       
   441         * This method is intended only for firmware build time configured 
       
   442         * privileged clients.
       
   443         *
       
   444         * Executes a tactile feedback vibration pulse with product 
       
   445         * specific default intensity and specified duration.
       
   446         * If PulseVibraL is called before ongoing vibration completes and 
       
   447         * PulseVibraL calling client has higher priority than executing client,
       
   448         * pulse request is accepted. Also possible vibra-reservations are bypassed.
       
   449         * If client calling PulseVibraL has lower or equal priority 
       
   450         * than executing client, ongoing vibration is not affected.
       
   451         *
       
   452         * Tactile feedback vibration settings of the vibration feature in the 
       
   453         * user profile must be active. 
       
   454         *
       
   455         * Note: The device may have implementation defined or hardware imposed
       
   456         *       limits to the duration of the vibration feature. In such 
       
   457         *       circumstances any vibration will cut off at that limit even if
       
   458         *       the duration parameter is greater than the limit.
       
   459         *
       
   460         * @param aDuration Duration of the vibration measured in milliseconds. 
       
   461         *                  Duration can have maximum value
       
   462         *                  of KHWRMVibraMaxDuration.
       
   463         *
       
   464         * @leave KErrArgument One of the parameters is out of range.
       
   465         * @leave KErrAccessDenied Vibration setting in the user profile is not set
       
   466         *                         or client is not privileged to use pulse feature. 
       
   467         * @leave KErrBadHandle Vibra session has been invalidated.
       
   468         * @leave KErrLocked Vibra is locked down because too much continuous use
       
   469         *                   or explicitly blocked by for example some vibration 
       
   470         *                   sensitive accessory.
       
   471         * @leave KErrTimedOut Timeout occurred in controlling vibra.
       
   472         * @leave KErrInUse Vibra is not reserved to this client but it is
       
   473         *                  reserved to some other client or ongoing vibration
       
   474         *                  has been requested by higher priority client.
       
   475         * @leave KErrNoMemory There is a memory allocation failure. 
       
   476         * @leave KErrGeneral There is a hardware error.
       
   477         *
       
   478         * @see MHWRMVibraFeedbackObserver
       
   479         */
       
   480         virtual void PulseVibraL(TInt aDuration)=0;
       
   481 		
       
   482         /**
       
   483         * This method is intended only for firmware build time configured 
       
   484         * privileged clients.
       
   485         *
       
   486         * Executes a tactile feedback vibration pulse.
       
   487         * If PulseVibraL is called before ongoing vibration completes and 
       
   488         * PulseVibraL calling client has higher priority than executing client,
       
   489         * pulse request is accepted. Also possible vibra-reservations are bypassed.
       
   490         * If client calling PulseVibraL has lower or equal priority 
       
   491         * than executing client, ongoing vibration is not affected.
       
   492         *
       
   493         * Tactile feedback vibration settings of the vibration feature in the 
       
   494         * user profile must be active. 
       
   495         *
       
   496         * Note: The device may have implementation defined or hardware imposed
       
   497         *       limits to the duration of the vibration feature. In such 
       
   498         *       circumstances any vibration will cut off at that limit even if
       
   499         *       the duration parameter is greater than the limit.
       
   500         *
       
   501         * @param aDuration Duration of the vibration measured in milliseconds. 
       
   502         *                  Duration can have maximum value
       
   503         *                  of KHWRMVibraMaxDuration.
       
   504         * @param aIntensity Intensity of the pulse in decimal is KHWRMVibraMinPulseIntensity
       
   505         *                   to KHWRMVibraMaxIntensity, which shows the percentage 
       
   506         *                   of the vibra motor full rotation speed. 
       
   507         *                   NOTE: The device might have hardware-imposed limits
       
   508         *                         on supported vibra intensity values, so actual
       
   509         *                         effect might vary between different hardware.
       
   510         *
       
   511         * @leave KErrNotSupported The device doesn't support user-defined 
       
   512         *                         vibra intensity.
       
   513         * @leave KErrArgument One of the parameters is out of range.
       
   514         * @leave KErrAccessDenied Vibration setting in the user profile is not set
       
   515         *                         or client is not privileged to use pulse feature. 
       
   516         * @leave KErrBadHandle Vibra session has been invalidated.
       
   517         * @leave KErrLocked Vibra is locked down because too much continuous use
       
   518         *                   or explicitly blocked by for example some vibration 
       
   519         *                   sensitive accessory.
       
   520         * @leave KErrTimedOut Timeout occurred in controlling vibra.
       
   521         * @leave KErrInUse Vibra is not reserved to this client but it is
       
   522         *                  reserved to some other client or ongoing vibration
       
   523         *                  has been requested by higher priority client.
       
   524         * @leave KErrNoMemory There is a memory allocation failure. 
       
   525         * @leave KErrGeneral There is a hardware error.
       
   526         *
       
   527         * @see MHWRMVibraFeedbackObserver
       
   528         */
       
   529         virtual void PulseVibraL(TInt aDuration, TInt aIntensity)=0;
       
   530 		
       
   531         /**
       
   532         * Use this method for setting feedback observer.
       
   533         *
       
   534         * @param aCallback Pointer to callback instance
       
   535         */
       
   536         virtual void SetFeedbackObserver(MHWRMVibraFeedbackObserver* aCallback)=0;
       
   537 
       
   538         /**
       
   539         * This method retrieves the current settings of the feedback vibration feature
       
   540         * in the user profile. The developer can check the feedback vibration settings 
       
   541         * in the profile and if there is no feedback vibration active but it is needed by 
       
   542         * the client application then the user can be informed. However, client needs to 
       
   543         * explicitly register to listen these changes via SetFeedbackObserver-method.
       
   544         *
       
   545         * @return TVibraFeedbackModeState indicating the current vibra feedback mode setting.
       
   546         *
       
   547         * @see TVibraFeedbackModeState
       
   548         * @see MHWRMVibraFeedbackObserver
       
   549         */
       
   550         virtual TVibraFeedbackModeState VibraFeedbackSettings() const=0;
       
   551     };
       
   552     
       
   553 /**
       
   554 * A callback interface for vibra status reporting.
       
   555 *
       
   556 * If the client requires up-to-date status information, the client needs 
       
   557 * to derive a class from the MHWRMVibraObserver interface and implement 
       
   558 * the VibraModeChanged() and VibraStatusChanged() methods. 
       
   559 * 
       
   560 * A callback object header example:
       
   561 *
       
   562 * @code 
       
   563 * // INCLUDES
       
   564 * #include <HWRMVibra.h> // Link against HWRMVibraClient.lib.
       
   565 *
       
   566 * class CTest : public CBase, 
       
   567 *               public MHWRMVibraObserver    
       
   568 *    {
       
   569 *    public:
       
   570 *        CTest();
       
   571 *        ~CTest();
       
   572 *                       
       
   573 *        void ConstructL();
       
   574 *        static CTest* NewL();
       
   575 *                
       
   576 *        // from MHWRMVibraObserver
       
   577 *        virtual void VibraModeChanged(CHWRMVibra::TVibraModeState aStatus);
       
   578 *        virtual void VibraStatusChanged(CHWRMVibra::TVibraStatus aStatus);
       
   579 *
       
   580 *    private:
       
   581 *        CHWRMVibra* iVibra;
       
   582 *    };
       
   583 * @endcode
       
   584 *
       
   585 * A callback method implementation example:
       
   586 *
       
   587 * @code
       
   588 * void CTest::VibraStatusChanged(CHWRMVibra::TVibraStatus aStatus)
       
   589 *    {
       
   590 *    switch ( aStatus )
       
   591 *        {
       
   592 *        case CHWRMVibra::EVibraStatusUnknown:
       
   593 *            RDebug::Print(_L("### Vibra state changed: EVibraStatusUnknown"));
       
   594 *            break;
       
   595 *        case CHWRMVibra::EVibraStatusNotAllowed:
       
   596 *            RDebug::Print(_L("### Vibra state changed: EVibraStatusNotAllowed"));
       
   597 *            break;
       
   598 *        case CHWRMVibra::EVibraStatusStopped:
       
   599 *            RDebug::Print(_L("### Vibra state changed: EVibraStatusStopped"));
       
   600 *            break;
       
   601 *        case CHWRMVibra::EVibraStatusOn:
       
   602 *            RDebug::Print(_L("### Vibra state changed: EVibraStatusOn"));
       
   603 *            break;
       
   604 *        default:
       
   605 *            RDebug::Print(_L("### Vibra state changed: UNDEFINED !"));
       
   606 *            break;
       
   607 *        }
       
   608 *    }
       
   609 * @endcode
       
   610 *
       
   611 * @since S60 3.0
       
   612 */
       
   613 class MHWRMVibraObserver
       
   614     {    
       
   615     public:
       
   616         
       
   617         /** 
       
   618         * Called when the vibration setting in the user profile is changed.
       
   619         *
       
   620         * @param aStatus Indicates the new setting.
       
   621         *
       
   622         * @see CHWRMVibra::TVibraModeState
       
   623         */
       
   624         virtual void VibraModeChanged(CHWRMVibra::TVibraModeState aStatus) = 0;
       
   625         
       
   626         /** 
       
   627         * Called when the device vibration feature state changes
       
   628         *
       
   629         * @param aStatus Indicates vibra status.
       
   630         *
       
   631         * @see CHWRMVibra::TVibraStatus
       
   632 		*/
       
   633         virtual void VibraStatusChanged(CHWRMVibra::TVibraStatus aStatus) = 0;
       
   634 	};
       
   635 
       
   636 /**
       
   637 * A callback interface for tactile feedback vibra mode reporting.
       
   638 *
       
   639 * If the client requires up-to-date status information, the client needs 
       
   640 * to derive a class from the MHWRMVibraFeedbackObserver interface and implement 
       
   641 * the VibraFeedbackModeChanged() method. In order to register for callback, client
       
   642 * needs to call SetFeedbackObserver-method.
       
   643 * 
       
   644 * A callback object header example:
       
   645 *
       
   646 * @code 
       
   647 * // INCLUDES
       
   648 * #include <HWRMVibra.h> // Link against HWRMVibraClient.lib.
       
   649 *
       
   650 * class CTest : public CBase, 
       
   651 *               public MHWRMVibraFeedbackObserver    
       
   652 *    {
       
   653 *    public:
       
   654 *        CTest();
       
   655 *        ~CTest();
       
   656 *                       
       
   657 *        void ConstructL();
       
   658 *        static CTest* NewL();
       
   659 *                
       
   660 *        // from MHWRMVibraFeedbackObserver
       
   661 *        virtual void VibraFeedbackModeChanged(CHWRMVibra::TVibraFeedbackModeState aMode);
       
   662 *
       
   663 *    private:
       
   664 *        CHWRMVibra* iVibra;
       
   665 *    };
       
   666 * @endcode
       
   667 *
       
   668 * A callback method implementation example:
       
   669 *
       
   670 * @code
       
   671 * 
       
   672 * #include <HWRMVibra.h>  // link against HWRMVibraClient.lib
       
   673 *
       
   674 * // A CHWRMVibra instance can be created by using NewL() or NewLC() methods. 
       
   675 * CHWRMVibra* vibra = CHWRMVibra::NewL();
       
   676 *
       
   677 * // Request notification of feedback setting change
       
   678 * vibra->SetFeedbackObserver(this); 
       
   679 *
       
   680 * // To clean up, delete the created object:
       
   681 * delete vibra;
       
   682 * 
       
   683 * void CTest::VibraFeedbackModeChanged(CHWRMVibra::TVibraFeedbackModeState aMode)
       
   684 *    {
       
   685 *    switch ( aMode )
       
   686 *        {
       
   687 *        case CHWRMVibra::EVibraFeedbackModeUnknown:
       
   688 *            RDebug::Print(_L("### Feedback vibration mode : EVibraFeedbackModeUnknown"));
       
   689 *            break;
       
   690 *        case CHWRMVibra::EVibraFeedbackModeON:
       
   691 *            RDebug::Print(_L("### Feedback vibration mode : EVibraFeedbackModeON"));
       
   692 *            break;
       
   693 *        case CHWRMVibra::EVibraFeedbackModeOFF:
       
   694 *            RDebug::Print(_L("### Feedback vibration mode : EVibraFeedbackModeOFF"));
       
   695 *            break;
       
   696 *        default:
       
   697 *            break;
       
   698 *        }
       
   699 *    }
       
   700 * @endcode
       
   701 *
       
   702 * @since S60 5.0
       
   703 */
       
   704 class MHWRMVibraFeedbackObserver
       
   705     {    
       
   706     public:
       
   707         
       
   708         /** 
       
   709         * Called when the tactile feedback vibration setting in the user profile is changed.
       
   710         *
       
   711         * @param aMode Indicates the new setting.
       
   712         *
       
   713         * @see CHWRMVibra::TVibraFeedbackModeState
       
   714         */
       
   715         virtual void VibraFeedbackModeChanged(CHWRMVibra::TVibraFeedbackModeState aMode) = 0;
       
   716 	};
       
   717 
       
   718 
       
   719 #endif      // HWRMVIBRA_H   
       
   720             
       
   721 // End of File