API published in: S60 3rd Ed
Link against: hwrmvibraclient.lib
Required Capabilities
None
#include <hwrmvibra.h>
HW Resource Manager Vibra API is a library API providing ability to control the device vibra. The API provides also methods to retrieve the current settings of the vibration feature in the user profile and the current status of the vibra.
The type of HW Resource Manager Vibra API is a synchronous method call meaning the method call will block the client application. The API is meant for all applications which need to control the device vibra.
The API consist of the classes CHWRMVibra and MHWRMVibraObserver. If the client requires up-to-date status information, it should also provide callback pointer of the MHWRMVibraObserver implementing class for the NewL-method.
Usage:
#include <HWRMVibra.h> // link against HWRMVibraClient.lib // A CHWRMVibra instance can be created by using NewL() or NewLC() methods. // Up-to-date status information not required, no callbacks. CHWRMVibra* vibra = CHWRMVibra::NewL(); // After this, vibra can be directly controlled via the provided class methods. vibra->StartVibraL(5000); // Start vibra for five seconds vibra->StopVibraL(); // Immediately stop vibra // To clean up, delete the created object: delete vibra;
Public Types |
|
enum | TVibraModeState { EVibraModeUnknown = 0, EVibraModeON, EVibraModeOFF } |
Vibration setting in the user profile. More... |
|
enum | TVibraStatus { EVibraStatusUnknown = 0, EVibraStatusNotAllowed, EVibraStatusStopped, EVibraStatusOn } |
Status of the vibration feature. More... |
|
Public Member Functions |
|
virtual void | ReserveVibraL ()=0 |
Reserves vibration feature exclusively for this client. |
|
virtual void | ReserveVibraL (TBool aRestoreState, TBool aForceNoCCoeEnv)=0 |
Reserves vibration feature exclusively for this client. |
|
virtual void | ReleaseVibra ()=0 |
Releases vibration feature if it was previously reserved for this client. |
|
virtual void | StartVibraL (TInt aDuration)=0 |
Starts the device vibration feature with the product specific default intensity. |
|
virtual void | StartVibraL (TInt aDuration, TInt aIntensity)=0 |
Starts the device vibration feature. |
|
virtual void | StopVibraL ()=0 |
Interrupts the device vibration that is started with the StartVibraL method immediately. |
|
virtual TVibraModeState | VibraSettings () const =0 |
This method retrieves the current settings of the vibration feature in the user profile. |
|
virtual TVibraStatus | VibraStatus () const =0 |
This method retrieves the current vibra status. |
|
Static Public Member Functions |
|
static IMPORT_C CHWRMVibra * | NewL () |
Two-phased constructor. |
|
static IMPORT_C CHWRMVibra * | NewLC () |
Two-phased constructor. |
|
static IMPORT_C CHWRMVibra * | NewL (MHWRMVibraObserver *aCallback) |
Two-phased constructor. |
|
static IMPORT_C CHWRMVibra * | NewLC (MHWRMVibraObserver *aCallback) |
Two-phased constructor. |
|
Vibration setting in the user profile. |
|
Status of the vibration feature. |
|
Two-phased constructor. Use this method for creating a vibra client with callbacks.
|
|
Two-phased constructor.
|
|
Two-phased constructor. Use this method for creating a vibra client with callbacks. Leaves instance to cleanup stack.
|
|
Two-phased constructor. Leaves instance to cleanup stack.
|
|
Releases vibration feature if it was previously reserved for this client. If this client has not reserved vibration feature, does nothing. If vibra is on when it is released and no other client has a suspended reservation, vibra is stopped. |
|
Reserves vibration feature exclusively for this client. A higher priority client may cause lower priority client reservation to be temporarily suspended. Commands can still be issued in suspended state, but they will not be acted upon unless suspension is lifted within specified duration. The suspended client will not get any notification about suspension. If vibra is already reserved by a higher or equal priority application, reserving will still succeed, but reservation is immediately suspended.
|
|
Reserves vibration feature exclusively for this client. A higher priority client may cause lower priority client reservation to be temporarily suspended. Commands can still be issued in suspended state, but they will not be acted upon unless suspension is lifted within specified duration. The suspended client will not get any notification about suspension. If vibra is already reserved by a higher or equal priority application, reserving will still succeed, but reservation is immediately suspended. Calling this method is equal to call ReserveVibraL(EFalse, EFalse), i.e. any previously frozen state will not be restored and CCoeEnv background/foreground status is always used to control further reservations.
|
|
Starts the device vibration feature. If StartVibraL is called again before the first vibration completes then the first vibration is interrupted and the second vibrations starts immediately -- i.e. The periods of vibration are not cumulative. The vibration can be interrupted with the method StopVibraL before the specified interval has elapsed. Vibra settings of the vibration feature in the user profile must be active. Note: The device may have implementation defined or hardware imposed limits to the duration of the vibration feature. In such circumstances any vibration will cut off at that limit even if the duration parameter is greater than the limit.
|
|
Starts the device vibration feature with the product specific default intensity. If StartVibraL is called again before the first vibration completes then the first vibration is interrupted and the second vibrations starts immediately -- i.e. The periods of vibration are not cumulative. The vibration can be interrupted with the method StopVibraL before the specified interval has elapsed. Vibra settings of the vibration feature in the user profile must be active. Note: The device may have implementation defined or hardware imposed limits to the duration of the vibration feature. In such circumstances any vibration will cut off at that limit even if the duration parameter is greater than the limit.
|
|
Interrupts the device vibration that is started with the StartVibraL method immediately.
|
|
This method retrieves the current settings of the vibration feature in the user profile. The developer can check the Vibra settings in the profile and if there is no Vibra active but it is needed by the client application then the user can be informed.
|
|
This method retrieves the current vibra status.
|