revise the bug about getting device status 69/15169/1
authorjy910.yun <jy910.yun@samsung.com>
Fri, 7 Jun 2013 07:10:54 +0000 (16:10 +0900)
committerKrzysztof Sasiak <k.sasiak@samsung.com>
Thu, 16 Jan 2014 15:26:26 +0000 (16:26 +0100)
before changing, system-server pass wrong parameter to get_status function

Change-Id: I14613d0995b0e7def173079674a24c86afb8322e
Signed-off-by: jy910.yun <jy910.yun@samsung.com>
src/deviced/haptic-module.h
src/haptic/haptic.c
src/shared/haptic.c

index 06f1e8a..5f2e4fb 100644 (file)
@@ -64,8 +64,8 @@ typedef enum
  */
 typedef enum
 {
-    HAPTIC_MODULE_STATE_PLAYING = 0,
-    HAPTIC_MODULE_STATE_STOP,
+    HAPTIC_MODULE_STATE_STOP = 0,
+    HAPTIC_MODULE_STATE_PLAYING,
 } haptic_module_state;
 
 /* Error and Return value codes */
index 961233c..cb5f9a6 100644 (file)
@@ -241,8 +241,7 @@ static DBusMessage *edbus_get_state(E_DBus_Object *obj, DBusMessage *msg)
        DBusMessageIter iter;
        DBusMessage *reply;
        DBusError err;
-       unsigned int handle;
-       int state, ret;
+       int index, state, ret;
 
        if (!plugin_intf || !plugin_intf->get_device_state) {
                ret = -EFAULT;
@@ -250,12 +249,12 @@ static DBusMessage *edbus_get_state(E_DBus_Object *obj, DBusMessage *msg)
        }
 
        dbus_error_init(&err);
-       if (!dbus_message_get_args(msg, &err, DBUS_TYPE_UINT32, &handle, DBUS_TYPE_INVALID)) {
+       if (!dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID)) {
                ret = -EINVAL;
                goto exit;
        }
 
-       ret = plugin_intf->get_device_state(handle, &state);
+       ret = plugin_intf->get_device_state(index, &state);
        if (ret < 0)
                _E("fail to get device state : %d", ret);
        else
@@ -454,7 +453,7 @@ static struct edbus_method {
        { "StopDevice",         "u",   "i", edbus_stop_device },
        { "VibrateMonotone", "uiii",   "i", edbus_vibrate_monotone },
        { "VibrateBuffer", "uayiii",   "i", edbus_vibrate_buffer },
-       { "GetState",           "u",   "i", edbus_get_state },
+       { "GetState",           "i",   "i", edbus_get_state },
        { "GetDuration",      "uay",   "i", edbus_get_duration },
        { "CreateEffect",    "iayi", "ayi", edbus_create_effect },
        { "SaveBinary",       "sis",   "i", edbus_save_binary },
index 6360a0e..af44a58 100644 (file)
@@ -583,7 +583,7 @@ API int haptic_get_effect_state(haptic_device_h device_handle, haptic_effect_h e
 {
        DBusError err;
        DBusMessage *msg;
-       char str_handle[32];
+       char str_index[32];
        char *arr[1];
        int ret, ret_val;
 
@@ -603,12 +603,12 @@ API int haptic_get_effect_state(haptic_device_h device_handle, haptic_effect_h e
                return HAPTIC_ERROR_INVALID_PARAMETER;
        }
 
-       snprintf(str_handle, sizeof(str_handle), "%u", device_handle);
-       arr[0] = str_handle;
+       snprintf(str_index, sizeof(str_index), "%d", HAPTIC_DEVICE_0);
+       arr[0] = str_index;
 
        /* request to deviced to open haptic device */
        msg = deviced_dbus_method_sync(BUS_NAME, DEVICED_PATH_HAPTIC, DEVICED_INTERFACE_HAPTIC,
-                       METHOD_GET_STATE, "u", arr);
+                       METHOD_GET_STATE, "i", arr);
        if (!msg)
                return HAPTIC_ERROR_OPERATION_FAILED;