VibrationController

Since: BlackBerry 10.0.0

#include <bb/device/VibrationController>

To link against this class, add the following line to your .pro file: LIBS += -lbbdevice

Allows control of vibration.

The VibrationController class allows control of device vibration.

Only one vibration request is supported at one time, device-wide. Further vibration requests supercede the previous vibration request. For example, if process A requests a vibration, then 1 second later process B requests a 5 second vibration, process A's vibration request is terminated after only 1 second, and process B's request plays for 5 seconds.

Note that the maximum time allowed for a vibration is 5000ms (5 seconds). Durations requested for longer will be truncated to 5000ms.

Vibration is not supported in all cases on all devices. Use isSupported() to determine whether you can use this class to control vibration.


Overview

Properties Index

boolsupported [read-only]

Public Functions Index

VibrationController (QObject *parent=0)
virtual ~VibrationController ()
Q_INVOKABLE boolisSupported () const

Public Slots Index

voidstart (unsigned int intensity=100)
voidstart (unsigned int intensity, unsigned int milliseconds)
voidstop ()

Properties

bool supported[read-only]

Whether you can make the device vibrate.

Since:

BlackBerry 10.0.0

Public Functions

VibrationController (

Construct a VibrationController instance.

Parameters
parent

If not 0, the supplied parent will be responsible for deleting this instance.

Since:

BlackBerry 10.0.0

virtual~VibrationController ()

Destructor.

This has no affect on in-progress vibrations.

Since:

BlackBerry 10.0.0

Q_INVOKABLE bool isSupported ()

Check whether you can make the device vibrate.

Return:

Returns true if you can make the device vibrate, false otherwise.

Since:

BlackBerry 10.0.0

Public Slots

void start (
  • unsigned intintensity)

Make the device vibrate.

Parameters
intensity

Intensity of the vibration, from 1 to 100.

Warning!

Intensity value is currently ignored. All values treated as 100.

Since:

BlackBerry 10.0.0

void start (
  • unsigned intintensity,
  • unsigned intmilliseconds )

Make the device vibrate.

Parameters
intensity

Intensity of the vibration, from 1 to 100.

milliseconds

Duration of the vibration, in milliseconds.

Warning!

Intensity value is currently ignored. All values treated as 100. Milliseconds greater than 5000 will be truncated to 5000.

Since:

BlackBerry 10.0.0

void stop ()

Stop any in-progress vibration.

This function lets you cancel any in-progress vibration.

Since:

BlackBerry 10.0.0

Last modified: 2014-09-30



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus