Change argument of gpio gdbus method 09/131109/1
authorSungguk Na <sungguk.na@samsung.com>
Thu, 25 May 2017 10:34:13 +0000 (19:34 +0900)
committerSungguk Na <sungguk.na@samsung.com>
Thu, 25 May 2017 10:34:13 +0000 (19:34 +0900)
- The gpio methods will pass handle instead of device informations.
- Some arguments of gpio handle are removed.

Change-Id: I6a0910cbd5e03878c17e5c6426850dbd2865ada4
Signed-off-by: Sungguk Na <sungguk.na@samsung.com>
include/peripheral_internal.h
src/peripheral_gdbus_gpio.c
src/peripheral_gpio.c
src/peripheral_io.xml

index 85263aa5111c14c8553706a9cfbe0c4c0c03e705..34f09b0f75552fed7734718dd4881178578ac954 100644 (file)
@@ -22,8 +22,7 @@
  */
 struct _peripheral_gpio_s {
        int pin;
-       peripheral_gpio_direction_e direction;
-       peripheral_gpio_edge_e edge;
+       uint handle;
 };
 
 /**
index 0bbe4f738276e23151e99c154acb5141458c9c41..721b3d4448e4eb29d21f5b5c21308fbc45e5689a 100644 (file)
@@ -89,8 +89,7 @@ int peripheral_gdbus_gpio_open(peripheral_gpio_h gpio)
        if (peripheral_io_gdbus_gpio_call_open_sync(
                        gpio_proxy,
                        gpio->pin,
-                       (gint*)&gpio->edge,
-                       (gint*)&gpio->direction,
+                       &gpio->handle,
                        &ret,
                        NULL,
                        &error) == FALSE) {
@@ -111,7 +110,7 @@ int peripheral_gdbus_gpio_close(peripheral_gpio_h gpio)
 
        if (peripheral_io_gdbus_gpio_call_close_sync(
                        gpio_proxy,
-                       gpio->pin,
+                       gpio->handle,
                        &ret,
                        NULL,
                        &error) == FALSE) {
@@ -132,7 +131,7 @@ int peripheral_gdbus_gpio_get_direction(peripheral_gpio_h gpio, peripheral_gpio_
 
        if (peripheral_io_gdbus_gpio_call_get_direction_sync(
                        gpio_proxy,
-                       gpio->pin,
+                       gpio->handle,
                        (gint*)direction,
                        &ret,
                        NULL,
@@ -141,7 +140,6 @@ int peripheral_gdbus_gpio_get_direction(peripheral_gpio_h gpio, peripheral_gpio_
                g_error_free(error);
                return PERIPHERAL_ERROR_UNKNOWN;
        }
-       gpio->direction = *direction;
 
        return ret;
 }
@@ -155,7 +153,7 @@ int peripheral_gdbus_gpio_set_direction(peripheral_gpio_h gpio, peripheral_gpio_
 
        if (peripheral_io_gdbus_gpio_call_set_direction_sync(
                        gpio_proxy,
-                       gpio->pin,
+                       gpio->handle,
                        direction,
                        &ret,
                        NULL,
@@ -164,7 +162,6 @@ int peripheral_gdbus_gpio_set_direction(peripheral_gpio_h gpio, peripheral_gpio_
                g_error_free(error);
                return PERIPHERAL_ERROR_UNKNOWN;
        }
-       gpio->direction = direction;
 
        return ret;
 }
@@ -178,7 +175,7 @@ int peripheral_gdbus_gpio_read(peripheral_gpio_h gpio, int *value)
 
        if (peripheral_io_gdbus_gpio_call_read_sync(
                        gpio_proxy,
-                       gpio->pin,
+                       gpio->handle,
                        value,
                        &ret,
                        NULL,
@@ -200,7 +197,7 @@ int peripheral_gdbus_gpio_write(peripheral_gpio_h gpio, int value)
 
        if (peripheral_io_gdbus_gpio_call_write_sync(
                        gpio_proxy,
-                       gpio->pin,
+                       gpio->handle,
                        value,
                        &ret,
                        NULL,
@@ -222,7 +219,7 @@ int peripheral_gdbus_gpio_get_edge_mode(peripheral_gpio_h gpio, peripheral_gpio_
 
        if (peripheral_io_gdbus_gpio_call_get_edge_mode_sync(
                        gpio_proxy,
-                       gpio->pin,
+                       gpio->handle,
                        (int*)edge,
                        &ret,
                        NULL,
@@ -231,7 +228,6 @@ int peripheral_gdbus_gpio_get_edge_mode(peripheral_gpio_h gpio, peripheral_gpio_
                g_error_free(error);
                return PERIPHERAL_ERROR_UNKNOWN;
        }
-       gpio->edge = *edge;
 
        return ret;
 }
@@ -245,7 +241,7 @@ int peripheral_gdbus_gpio_set_edge_mode(peripheral_gpio_h gpio, peripheral_gpio_
 
        if (peripheral_io_gdbus_gpio_call_set_edge_mode_sync(
                        gpio_proxy,
-                       gpio->pin,
+                       gpio->handle,
                        edge,
                        &ret,
                        NULL,
@@ -254,7 +250,6 @@ int peripheral_gdbus_gpio_set_edge_mode(peripheral_gpio_h gpio, peripheral_gpio_
                g_error_free(error);
                return PERIPHERAL_ERROR_UNKNOWN;
        }
-       gpio->edge = edge;
 
        return ret;
 }
@@ -268,7 +263,7 @@ int peripheral_gdbus_gpio_register_cb(peripheral_gpio_h gpio, gpio_isr_cb callba
 
        if (peripheral_io_gdbus_gpio_call_register_irq_sync(
                        gpio_proxy,
-                       gpio->pin,
+                       gpio->handle,
                        &ret,
                        NULL,
                        &error) == FALSE) {
@@ -289,7 +284,7 @@ int peripheral_gdbus_gpio_unregister_cb(peripheral_gpio_h gpio)
 
        if (peripheral_io_gdbus_gpio_call_unregister_irq_sync(
                        gpio_proxy,
-                       gpio->pin,
+                       gpio->handle,
                        &ret,
                        NULL,
                        &error) == FALSE) {
index 2b3bd20ac16f610a5d13c5658f96d07af32eda05..e49477c6da9f9ee8b2e0e0090c247f94b9fa0f30 100644 (file)
@@ -176,8 +176,6 @@ int peripheral_gpio_get_direction(peripheral_gpio_h gpio, peripheral_gpio_direct
                return PERIPHERAL_ERROR_INVALID_PARAMETER;
 
        ret = peripheral_gdbus_gpio_get_direction(gpio, direction);
-       if (ret == PERIPHERAL_ERROR_NONE)
-               gpio->direction = (*direction);
 
        return ret;
 }
@@ -199,8 +197,6 @@ int peripheral_gpio_set_direction(peripheral_gpio_h gpio, peripheral_gpio_direct
 
        /* call gpio_set_direction */
        ret = peripheral_gdbus_gpio_set_direction(gpio, direction);
-       if (ret == PERIPHERAL_ERROR_NONE)
-               gpio->direction = direction;
 
        return ret;
 }
@@ -251,8 +247,6 @@ int peripheral_gpio_get_edge_mode(peripheral_gpio_h gpio, peripheral_gpio_edge_e
                return PERIPHERAL_ERROR_INVALID_PARAMETER;
 
        ret = peripheral_gdbus_gpio_get_edge_mode(gpio, edge);
-       if (ret == PERIPHERAL_ERROR_NONE)
-               gpio->edge = (*edge);
 
        return ret;
 }
@@ -273,8 +267,6 @@ int peripheral_gpio_set_edge_mode(peripheral_gpio_h gpio, peripheral_gpio_edge_e
 
        /* call gpio_set_edge_mode */
        ret = peripheral_gdbus_gpio_set_edge_mode(gpio, edge);
-       if (ret == PERIPHERAL_ERROR_NONE)
-               gpio->edge = edge;
 
        return ret;
 }
index abc367982738da87851ae1dd222fad3ad8e67cbe..2480f92a115caa5da353a3e98b4e2db52bc21a6e 100644 (file)
@@ -3,50 +3,49 @@
        <interface name="org.tizen.peripheral_io.gpio">
                <method name="Open">
                        <arg type="i" name="pin" direction="in"/>
-                       <arg type="i" name="edge" direction="out"/>
-                       <arg type="i" name="direction" direction="out"/>
+                       <arg type="u" name="handle" direction="out"/>
                        <arg type="i" name="result" direction="out"/>
                </method>
                <method name="Close">
-                       <arg type="i" name="pin" direction="in"/>
+                       <arg type="u" name="handle" direction="in"/>
                        <arg type="i" name="result" direction="out"/>
                </method>
                <method name="GetDirection">
-                       <arg type="i" name="pin" direction="in"/>
+                       <arg type="u" name="handle" direction="in"/>
                        <arg type="i" name="direction" direction="out"/>
                        <arg type="i" name="result" direction="out"/>
                </method>
                <method name="SetDirection">
-                       <arg type="i" name="pin" direction="in"/>
+                       <arg type="u" name="handle" direction="in"/>
                        <arg type="i" name="direction" direction="in"/>
                        <arg type="i" name="result" direction="out"/>
                </method>
                <method name="Read">
-                       <arg type="i" name="pin" direction="in"/>
+                       <arg type="u" name="handle" direction="in"/>
                        <arg type="i" name="value" direction="out"/>
                        <arg type="i" name="result" direction="out"/>
                </method>
                <method name="Write">
-                       <arg type="i" name="pin" direction="in"/>
+                       <arg type="u" name="handle" direction="in"/>
                        <arg type="i" name="value" direction="in"/>
                        <arg type="i" name="result" direction="out"/>
                </method>
                <method name="GetEdgeMode">
-                       <arg type="i" name="pin" direction="in"/>
+                       <arg type="u" name="handle" direction="in"/>
                        <arg type="i" name="edge" direction="out"/>
                        <arg type="i" name="result" direction="out"/>
                </method>
                <method name="SetEdgeMode">
-                       <arg type="i" name="pin" direction="in"/>
+                       <arg type="u" name="handle" direction="in"/>
                        <arg type="i" name="edge" direction="in"/>
                        <arg type="i" name="result" direction="out"/>
                </method>
                <method name="RegisterIrq">
-                       <arg type="i" name="pin" direction="in"/>
+                       <arg type="u" name="handle" direction="in"/>
                        <arg type="i" name="result" direction="out"/>
                </method>
                <method name="UnregisterIrq">
-                       <arg type="i" name="pin" direction="in"/>
+                       <arg type="u" name="handle" direction="in"/>
                        <arg type="i" name="result" direction="out"/>
                </method>
                <signal name='GpioChanged'>