Ubuntu Platform API  2.1.0
A library helping with tight integration into the Ubuntu platform
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
haptic.h File Reference
#include <ubuntu/status.h>
#include <ubuntu/visibility.h>
#include <stdint.h>
+ Include dependency graph for haptic.h:

Go to the source code of this file.

Macros

#define MAX_PATTERN_SIZE   6
 

Typedefs

typedef void UASensorsHaptic
 Opaque type that models the haptics device. More...
 

Functions

UBUNTU_DLL_PUBLIC UASensorsHapticua_sensors_haptic_new ()
 Create a new object for accessing the haptics device. More...
 
UBUNTU_DLL_PUBLIC UStatus ua_sensors_haptic_enable (UASensorsHaptic *sensor)
 Enables the supplied haptics device. More...
 
UBUNTU_DLL_PUBLIC UStatus ua_sensors_haptic_disable (UASensorsHaptic *sensor)
 Disables the supplied haptics device. More...
 
UBUNTU_DLL_PUBLIC UStatus ua_sensors_haptic_vibrate_once (UASensorsHaptic *sensor, uint32_t duration)
 Run the vibrator for a fixed duration. More...
 
UBUNTU_DLL_PUBLIC UStatus ua_sensors_haptic_vibrate_with_pattern (UASensorsHaptic *sensor, uint32_t pattern[MAX_PATTERN_SIZE], uint32_t repeat)
 Run the vibrator with a pattern and repeat a precise number of times. More...
 

Macro Definition Documentation

#define MAX_PATTERN_SIZE   6

Definition at line 77 of file haptic.h.

Typedef Documentation

typedef void UASensorsHaptic

Opaque type that models the haptics device.

Definition at line 35 of file haptic.h.

Function Documentation

UBUNTU_DLL_PUBLIC UStatus ua_sensors_haptic_disable ( UASensorsHaptic sensor)

Disables the supplied haptics device.

Returns
U_STATUS_SUCCESS if successful or U_STATUS_ERROR if an error occured.
Parameters
[in]sensorThe sensor instance to be disabled.
UBUNTU_DLL_PUBLIC UStatus ua_sensors_haptic_enable ( UASensorsHaptic sensor)

Enables the supplied haptics device.

Returns
U_STATUS_SUCCESS if successful or U_STATUS_ERROR if an error occured.
Parameters
[in]sensorThe sensor instance to be enabled.
UBUNTU_DLL_PUBLIC UASensorsHaptic* ua_sensors_haptic_new ( )

Create a new object for accessing the haptics device.

Returns
A new instance or NULL in case of errors.
UBUNTU_DLL_PUBLIC UStatus ua_sensors_haptic_vibrate_once ( UASensorsHaptic sensor,
uint32_t  duration 
)

Run the vibrator for a fixed duration.

Returns
U_STATUS_SUCCESS if pushed correctly, U_STATUS_ERROR if the pattern limit is invalid or the actuator cannot be activated.
Parameters
[in]sensorHaptic device to activate.
[in]durationHow long should the vibrator stay on.
UBUNTU_DLL_PUBLIC UStatus ua_sensors_haptic_vibrate_with_pattern ( UASensorsHaptic sensor,
uint32_t  pattern[MAX_PATTERN_SIZE],
uint32_t  repeat 
)

Run the vibrator with a pattern and repeat a precise number of times.

Returns
U_STATUS_SUCCESS if pushed correctly, U_STATUS_ERROR if the pattern limit is invalid or the actuator cannot be activated.
Parameters
[in]sensorHaptic device to activate.
[in]patternAn array of uint32_t durations for which to keep the vibrator on or off. The first value indicates how long to keep the vibrator on for, the second value how long to keep it off for, and so on until the end of the array.
[in]repeatHow many times to repeat the whole pattern for.