CVibraControl Class Reference

API published in: S60 2nd Ed
API deprecated in: S60 3rd Ed

Link against: vibractrl.lib

Capability Information

Required Capabilities

None


#include <vibractrl.h>

Detailed Description

Interface that is used to control the device vibration feature.

This class provides the ability to control the device vibration feature. Vibration might be used in a game to signal a collision or explosion or for giving tactile feedback to gaming events, such as a ball hitting a wall (shaking).

Deprecated:
since Series 60 3.0 - Use HWRM Vibra API instead (HWRMVibra.h)

Public Types

enum   TVibraModeState { EVibraModeON = 0, EVibraModeOFF, EVibraModeUnknown }
  Vibration setting in the user profile. More...
enum   TVibraRequestStatus {
  EVibraRequestOK = 0, EVibraRequestFail, EVibraRequestNotAllowed, EVibraRequestStopped,
  EVibraRequestUnableToStop, EVibraRequestUnknown
}
  Status of the vibrating setting request. More...
enum   TVibraCtrlPanic { EPanicUnableToGetVibraSetting, EPanicVibraGeneral }
  Internal panic codes. More...

Public Member Functions

virtual  ~CVibraControl ()
  Destructor.
virtual void  StartVibraL (TUint16 aDuration)=0
  Starts the device vibration feature with factory-defined intensity.
virtual void  StopVibraL (void)=0
  Interrupts the device vibration that is started with the StartVibra method immediately.
virtual TVibraModeState  VibraSettings (void) const =0
  This method retrieves the current settings of the vibration feature in the user profile.
virtual void  StartVibraL (TUint16 aDuration, TInt aIntensity)=0
  Starts the device vibration feature.

Protected Member Functions

  CVibraControl ()
  C++ default constructor.

Member Enumeration Documentation

enum CVibraControl::TVibraCtrlPanic
 

Internal panic codes.

Deprecated:
since Series 60 3.0
Enumerator:
EPanicUnableToGetVibraSetting 
EPanicVibraGeneral 
enum CVibraControl::TVibraModeState
 

Vibration setting in the user profile.

Deprecated:
since Series 60 3.0
Enumerator:
EVibraModeON 
EVibraModeOFF 
EVibraModeUnknown 
enum CVibraControl::TVibraRequestStatus
 

Status of the vibrating setting request.

Deprecated:
since Series 60 3.0
Enumerator:
EVibraRequestOK 
EVibraRequestFail 
EVibraRequestNotAllowed 
EVibraRequestStopped 
EVibraRequestUnableToStop 
EVibraRequestUnknown 

Constructor & Destructor Documentation

virtual CVibraControl::~CVibraControl  )  [virtual]
 

Destructor.

Deprecated:
since Series 60 3.0
CVibraControl::CVibraControl  )  [protected]
 

C++ default constructor.

See also:
VibraFactory
Deprecated:
since Series 60 3.0

Member Function Documentation

virtual void CVibraControl::StartVibraL TUint16  aDuration,
TInt  aIntensity
[pure virtual]
 

Starts the device vibration feature.

The method does not block, but returns immediately so that the vibration happens simultaneously as the game continues to run. If StartVibra 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 StopVibra before the specified interval has elasped.

Vibra settings of the vibration feature in the user profile must be active. If no, vibration is not activated.

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.

Parameters:
aDuration  Duration of the vibration measured in milliseconds. A value of 0 specifies that the vibration should continue indefinitly and should be stopped with a call to StopVibra.
aIntensity  Intensity of the vibra in decimal is -100 to 100, which shows the percentage of the vibra motor full rotation speed. When intensity is negative, the vibra motor rotates in the negative direction. When intensity is positive, the vibra motor rotates in the positive direction. Value 0 stops the vibra.
Exceptions:
KErrGeneral  Unable to start vibra. KErrNotSupported Device doesn't support user-defined intensity or vibration feature is not supported. KErrArgument One of the parameters is out of range.
See also:
MVibraControlObserver
Deprecated:
since Series 60 3.0
virtual void CVibraControl::StartVibraL TUint16  aDuration  )  [pure virtual]
 

Starts the device vibration feature with factory-defined intensity.

The method does not block, but returns immediately so that the vibration happens simultaneously as the game continues to run. If StartVibra 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 StopVibra before the specified interval has elasped.

Vibra settings of the vibration feature in the user profile must be active. If no, vibration is not activated.

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.

Parameters:
aDuration  Duration of the vibration measured in milliseconds. A value of 0 specifies that the vibration should continue indefinitly and should be stopped with a call to StopVibra.
Exceptions:
KErrGeneral  Unable to start vibra. KErrNotSupported Device doesn't support vibration feature.
See also:
MVibraControlObserver
Deprecated:
since Series 60 3.0
virtual void CVibraControl::StopVibraL void   )  [pure virtual]
 

Interrupts the device vibration that is started with the StartVibra method immediately.

Exceptions:
KErrNotSupported  Device doesn't support vibration feature.
See also:
MVibraControlObserver
Deprecated:
since Series 60 3.0
virtual TVibraModeState CVibraControl::VibraSettings void   )  const [pure virtual]
 

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 game then the user can be informed, or asked if he wants to enable the Vibra during the game.

Returns:
TVibraModeState with the possible states EvibraModeON, EVibraModeOFF or, if an error occurs, EVibraModeUnknown
Deprecated:
since Series 60 3.0

The documentation for this class was generated from the following file:

Copyright © Nokia Corporation 2001-2008
Back to top