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