/**
* @ingroup CAPI_SYSTEM_DEVICE_MODULE
* @defgroup CAPI_SYSTEM_DEVICE_HAPTIC_MODULE Haptic
- * @brief The Haptic API provides functions to control a vibrator.
+ * @brief The Haptic API provides functions to control vibration.
*
* @section CAPI_SYSTEM_DEVICE_HAPTIC_MODULE_HEADER Required Header
* \#include <device/haptic.h> \n
* 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.
*
+ * @section CAPI_SYSTEM_DEVICE_HAPTIC_MODULE__FEATURE Related Features
+ * This API is related with the following features:\n
+ * - %http://tizen.org/feature/feedback.vibration\n
+ *
+ * It is recommended to design feature related codes in your application for reliability.\n
+ *
+ * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n
+ *
+ * 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.\n
+ *
+ * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tizen-studio/native-tools/configuring-your-app/manifest-text-editor#feature"><b>Feature List</b>.</a>
+ *
+ *
*/
/**
#define METHOD_STOP_DEVICE "StopDevice"
#define METHOD_VIBRATE_MONOTONE "VibrateMonotone"
+#define VIBRATION_FEATURE "http://tizen.org/feature/feedback.vibration"
+
enum feedback_e {
HAPTIC_FEEDBACK_MIN = 0,
HAPTIC_FEEDBACK_MAX = 100,
static dd_list *handle_list;
+static int is_haptic_supported(void)
+{
+ int ret;
+ bool haptic_avail;
+
+ ret = system_info_get_platform_bool(VIBRATION_FEATURE, &haptic_avail);
+ if (ret < 0) {
+ _E("Failed to get value of haptic feature");
+ return false;
+ } else if (ret == 0 && !haptic_avail) {
+ _D("Haptic is not supported");
+ return false;
+ } else
+ return true;
+}
+
int device_haptic_get_count(int *device_number)
{
int ret;
if (!device_number)
return DEVICE_ERROR_INVALID_PARAMETER;
+ ret = is_haptic_supported();
+ if (!ret)
+ return DEVICE_ERROR_NOT_SUPPORTED;
+
/* request to deviced to get haptic count */
ret = dbus_method_sync(VIBRATOR_BUS_NAME,
VIBRATOR_PATH_HAPTIC, VIBRATOR_INTERFACE_HAPTIC,
if (!device_handle)
return DEVICE_ERROR_INVALID_PARAMETER;
+ ret = is_haptic_supported();
+ if (!ret)
+ return DEVICE_ERROR_NOT_SUPPORTED;
+
snprintf(str_index, sizeof(str_index), "%d", device_index);
arr[0] = str_index;
if (!device_handle)
return DEVICE_ERROR_INVALID_PARAMETER;
+ ret = is_haptic_supported();
+ if (!ret)
+ return DEVICE_ERROR_NOT_SUPPORTED;
+
DD_LIST_FOREACH(handle_list, elem, temp) {
if (temp->handle != handle->handle)
continue;
if (feedback < HAPTIC_FEEDBACK_MIN || feedback > HAPTIC_FEEDBACK_MAX)
return DEVICE_ERROR_INVALID_PARAMETER;
+ ret = is_haptic_supported();
+ if (!ret)
+ return DEVICE_ERROR_NOT_SUPPORTED;
+
priority = HAPTIC_PRIORITY_MIN;
DD_LIST_FOREACH(handle_list, elem, temp) {
if (!device_handle)
return DEVICE_ERROR_INVALID_PARAMETER;
+ ret = is_haptic_supported();
+ if (!ret)
+ return DEVICE_ERROR_NOT_SUPPORTED;
+
DD_LIST_FOREACH(handle_list, elem, temp) {
if (temp != handle)
continue;