haptic.h
Go to the documentation of this file.
/*
* Copyright © 2014 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Authored by: Ricardo Mendoza <ricardo.mendoza@canonical.com>
*/
#ifndef UBUNTU_APPLICATION_SENSORS_HAPTIC_H_
#define UBUNTU_APPLICATION_SENSORS_HAPTIC_H_
#include <ubuntu/status.h>
#include <ubuntu/visibility.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef void UASensorsHaptic;
UBUNTU_DLL_PUBLIC UASensorsHaptic*
ua_sensors_haptic_new();
UBUNTU_DLL_PUBLIC void
ua_sensors_haptic_destroy(UASensorsHaptic* sensor);
UBUNTU_DLL_PUBLIC UStatus
ua_sensors_haptic_enable(
UASensorsHaptic* sensor);
UBUNTU_DLL_PUBLIC UStatus
ua_sensors_haptic_disable(
UASensorsHaptic* sensor);
UBUNTU_DLL_PUBLIC UStatus
ua_sensors_haptic_vibrate_once(
UASensorsHaptic* sensor,
uint32_t duration);
#define MAX_PATTERN_SIZE 6
UBUNTU_DLL_PUBLIC UStatus
ua_sensors_haptic_vibrate_with_pattern(
UASensorsHaptic* sensor,
uint32_t pattern[MAX_PATTERN_SIZE],
uint32_t repeat);
#ifdef __cplusplus
}
#endif
#endif /* UBUNTU_APPLICATION_SENSORS_HAPTIC_H_ */
ua_sensors_haptic_enable
UBUNTU_DLL_PUBLIC UStatus ua_sensors_haptic_enable(UASensorsHaptic *sensor)
Enables the supplied haptics device.
UbuntuStatus
UbuntuStatus
Indicates the status of an operation.
Definition: status.h:26
visibility.h
UASensorsHaptic
void UASensorsHaptic
Opaque type that models the haptics device.
Definition: haptic.h:35
ua_sensors_haptic_vibrate_with_pattern
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.
ua_sensors_haptic_vibrate_once
UBUNTU_DLL_PUBLIC UStatus ua_sensors_haptic_vibrate_once(UASensorsHaptic *sensor, uint32_t duration)
Run the vibrator for a fixed duration.
ua_sensors_haptic_destroy
UBUNTU_DLL_PUBLIC void ua_sensors_haptic_destroy(UASensorsHaptic *sensor)
Destroys the given sensor instance and releases all resources held by the instance.
status.h
UBUNTU_DLL_PUBLIC
#define UBUNTU_DLL_PUBLIC
Definition: visibility.h:26
MAX_PATTERN_SIZE
#define MAX_PATTERN_SIZE
Definition: haptic.h:87
ua_sensors_haptic_new
UBUNTU_DLL_PUBLIC UASensorsHaptic * ua_sensors_haptic_new()
Create a new object for accessing the haptics device. Ownership is transfered to caller.
ua_sensors_haptic_disable
UBUNTU_DLL_PUBLIC UStatus ua_sensors_haptic_disable(UASensorsHaptic *sensor)
Disables the supplied haptics device.