capi-system-device: Add no vibrator model case 11/35911/2 accepted/tizen/common/20150227.103002 accepted/tizen/mobile/20150227.121911 accepted/tizen/tv/20150227.120411 accepted/tizen/wearable/20150302.083927 submit/tizen/20150227.083647
authorJiyoung Yun <jy910.yun@samsung.com>
Thu, 26 Feb 2015 04:26:23 +0000 (13:26 +0900)
committerJiyoung Yun <jy910.yun@samsung.com>
Fri, 27 Feb 2015 08:31:57 +0000 (00:31 -0800)
If there is no vibrator device,
deviced does not provide dbus methods of vibrator.
In this case, haptic_get_count api will return zero.

Change-Id: I2bbd7125d707bb31c4782b107656fd180b362fe4
Signed-off-by: Jiyoung Yun <jy910.yun@samsung.com>
include/haptic.h
src/haptic.c

index 30d5cc5..307b632 100755 (executable)
@@ -70,7 +70,8 @@ int device_haptic_get_count(int *device_number);
  *
  * @remarks You must close the Haptic API using device_haptic_close().
  *
- * @param[in] device_index The index of device what you want to vibrate
+ * @param[in] device_index The index of device what you want to vibrate \n
+ *                         The index starts from @c 0.
  * @param[out] device_handle The handle of vibrator
  *
  * @return @c 0 on success,
index 6d70a62..b7d8b58 100644 (file)
@@ -54,7 +54,13 @@ int device_haptic_get_count(int *device_number)
        ret = dbus_method_sync(DEVICED_BUS_NAME,
                        DEVICED_PATH_HAPTIC, DEVICED_INTERFACE_HAPTIC,
                        METHOD_GET_COUNT, NULL, NULL);
-       if (ret < 0)
+       /**
+        * there is no haptic method in no vibration model.
+        * so -ENOTSUP means that haptic count is zero.
+        */
+       if (ret == -ENOTSUP)
+               ret = 0;
+       else if (ret < 0)
                return errno_to_device_error(ret);
 
        *device_number = ret;