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 UASensorsHaptic * | ua_sensors_haptic_new ()
| Create a new object for accessing the haptics device. Ownership is transfered to caller. More...
UBUNTU_DLL_PUBLIC void | ua_sensors_haptic_destroy (UASensorsHaptic *sensor)
| Destroys the given sensor instance and releases all resources held by the instance. 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 87 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 void ua_sensors_haptic_destroy | ( | UASensorsHaptic * | sensor | ) |

Destroys the given sensor instance and releases all resources held by the instance.

Parameters

  [in] | sensor | The instance to be destroyed.

Postcondition
  All resources held by the instance are released. The result of any operation invoked on the destroyed instance are undefined.

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] | sensor | The 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] | sensor | The sensor instance to be enabled.

UBUNTU_DLL_PUBLIC UASensorsHaptic* ua_sensors_haptic_new | ( |  | ) |

Create a new object for accessing the haptics device. Ownership is transfered to caller.

See also
  ua_sensors_haptic_destroy

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] | sensor | Haptic device to activate.
  [in] | duration | How 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] | sensor | Haptic device to activate.
  [in] | pattern | An 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] | repeat | How many times to repeat the whole pattern for.