Package: android.hardware.vibrator@1.0

IVibrator

interface IVibrator

Methods

on

on (uint32_t timeoutMs)
generates (Status vibratorOnRet)

Turn on vibrator

This function must only be called after the previous timeout has expired or was canceled(through off()).

Details
Parameters
timeoutMs
Generates
vibratorOnRet
whether vibrator command was successful or not.

off

off ()
generates (Status vibratorOffRet)

Turn off vibrator

Cancel a previously-started vibration, if any.

Details
Generates
vibratorOffRet
whether vibrator command was successful or not.

supportsAmplitudeControl

supportsAmplitudeControl ()
generates (bool supports)

Returns whether the vibrator supports changes to its vibrational amplitude.

Details
Generates
supports

setAmplitude

setAmplitude (uint8_t amplitude)
generates (Status status)

Sets the motor's vibrational amplitude.

Changes the force being produced by the underlying motor.

Details
Parameters
amplitude
The unitless force setting.Note that this number must be between 1 and 255, inclusive.If the motor does not have exactly 255 steps, it must do it's best to map it onto the number of steps it does have.
Generates
status
Whether the command was successful or not.Must return Status::UNSUPPORTED_OPERATION if setting the amplitude is not supported by the device.

perform

perform (Effect effect, EffectStrength strength)
generates (Status status, uint32_t lengthMs)

Fire off a predefined haptic event.

Details
Parameters
effect
strength
Generates
status
Whether the effect was successfully performed or not.Must return Status::UNSUPPORTED_OPERATION is the effect is not supported.
lengthMs
The length of time the event is expected to take in milliseconds.This doesn't need to be perfectly accurate, but should be a reasonable approximation.Should be a positive, non-zero value if the returned status is Status::OK, and set to 0 otherwise.