Tizen Native API
5.5
|
The Haptic API provides functions to control vibration.
#include <device/haptic.h>
The Haptic API provides the way to control vibration functionality of a device. It allows the management of the device's vibrator parameters, such as the vibration count and level.
This API is related with the following features:
It is recommended to design feature related codes in your application for reliability.
You can check if a device supports the related features for this API by using System Information, thereby controlling the procedure of your application.
To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.
More details on featuring your application can be found from feature element description.
Functions | |
int | device_haptic_get_count (int *device_number) |
Gets the number of vibrators. | |
int | device_haptic_open (int device_index, haptic_device_h *device_handle) |
Opens a haptic-vibration device. | |
int | device_haptic_close (haptic_device_h device_handle) |
Closes a haptic-vibration device. | |
int | device_haptic_vibrate (haptic_device_h device_handle, int duration, int feedback, haptic_effect_h *effect_handle) |
Vibrates during the specified time with a constant intensity. | |
int | device_haptic_stop (haptic_device_h device_handle, haptic_effect_h effect_handle) |
Stops all vibration effects which are being played. | |
Typedefs | |
typedef void * | haptic_device_h |
The haptic device handle. | |
typedef void * | haptic_effect_h |
The haptic effect handle. |
typedef void* haptic_device_h |
The haptic device handle.
typedef void* haptic_effect_h |
The haptic effect handle.
int device_haptic_close | ( | haptic_device_h | device_handle | ) |
Closes a haptic-vibration device.
Internally, it disconnects the connection to the vibrator.
[in] | device_handle | The device handle from device_haptic_open() |
0
on success, otherwise a negative error value DEVICE_ERROR_NONE | Successful |
DEVICE_ERROR_INVALID_PARAMETER | Invalid parameter |
DEVICE_ERROR_PERMISSION_DENIED | Permission denied |
DEVICE_ERROR_OPERATION_FAILED | Operation failed |
DEVICE_ERROR_NOT_SUPPORTED | Not supported device |
int device_haptic_get_count | ( | int * | device_number | ) |
Gets the number of vibrators.
[in] | device_number | The number of vibrators |
0
on success, otherwise a negative error value DEVICE_ERROR_NONE | Successful |
DEVICE_ERROR_INVALID_PARAMETER | Invalid parameter |
DEVICE_ERROR_PERMISSION_DENIED | Permission denied |
DEVICE_ERROR_OPERATION_FAILED | Operation failed |
DEVICE_ERROR_NOT_SUPPORTED | Not supported device |
int device_haptic_open | ( | int | device_index, |
haptic_device_h * | device_handle | ||
) |
Opens a haptic-vibration device.
Internally, it makes a connection to the vibrator.
[in] | device_index | The index of device what you want to vibrate The index starts from 0 |
[out] | device_handle | The handle of vibrator |
0
on success, otherwise a negative error value DEVICE_ERROR_NONE | Successful |
DEVICE_ERROR_INVALID_PARAMETER | Invalid parameter |
DEVICE_ERROR_PERMISSION_DENIED | Permission denied |
DEVICE_ERROR_OPERATION_FAILED | Operation failed |
DEVICE_ERROR_NOT_SUPPORTED | Not supported device |
int device_haptic_stop | ( | haptic_device_h | device_handle, |
haptic_effect_h | effect_handle | ||
) |
Stops all vibration effects which are being played.
This function can be used to stop all effects started by device_haptic_vibrate().
[in] | device_handle | The device handle from device_haptic_open() |
[in] | effect_handle | The effect handle from device_haptic_vibrate() |
0
on success, otherwise a negative error value DEVICE_ERROR_NONE | Successful |
DEVICE_ERROR_INVALID_PARAMETER | Invalid parameter |
DEVICE_ERROR_PERMISSION_DENIED | Permission denied |
DEVICE_ERROR_OPERATION_FAILED | Operation failed |
DEVICE_ERROR_NOT_SUPPORTED | Not supported device |
int device_haptic_vibrate | ( | haptic_device_h | device_handle, |
int | duration, | ||
int | feedback, | ||
haptic_effect_h * | effect_handle | ||
) |
Vibrates during the specified time with a constant intensity.
This function can be used to start monotonous vibration for the specified time.
0
(zero). [in] | device_handle | The device handle from device_haptic_open() |
[in] | duration | The play duration in milliseconds |
[in] | feedback | The amount of the intensity variation (0 ~ 100 ) |
[out] | effect_handle | The pointer to the variable that will receive a handle to the playing effect |
0
on success, otherwise a negative error value DEVICE_ERROR_NONE | Successful |
DEVICE_ERROR_INVALID_PARAMETER | Invalid parameter |
DEVICE_ERROR_PERMISSION_DENIED | Permission denied |
DEVICE_ERROR_OPERATION_FAILED | Operation failed |
DEVICE_ERROR_NOT_SUPPORTED | Not supported device |