Tizen Native API
3.0
|
The Haptic API provides functions to control a vibrator.
Required Header
#include <device/haptic.h>
Overview
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.
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. |
Function Documentation
int device_haptic_close | ( | haptic_device_h | device_handle | ) |
Closes a haptic-vibration device.
Internally, it disconnects the connection to the vibrator.
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/haptic
- Parameters:
-
[in] device_handle The device handle from device_haptic_open()
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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
- See also:
- device_haptic_open()
int device_haptic_get_count | ( | int * | device_number | ) |
Gets the number of vibrators.
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/haptic
- Parameters:
-
[in] device_number The number of vibrators
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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.
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/haptic
- Remarks:
- You must close the Haptic API using device_haptic_close().
- Parameters:
-
[in] device_index The index of device what you want to vibrate
The index starts from0
[out] device_handle The handle of vibrator
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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
- See also:
- device_haptic_close()
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().
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/haptic
- Parameters:
-
[in] device_handle The device handle from device_haptic_open() [in] effect_handle The effect handle from device_haptic_vibrate()
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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
- See also:
- device_haptic_vibrate()
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.
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/haptic
- Remarks:
- feedback level is reserved for auto changing to save variable in the settings.
-
effect_handle effect_handle value can be
0
(zero).
- Parameters:
-
[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
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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
- See also:
- device_haptic_stop()