From 26272320cf0cf2d34c7272d72f62e95c18907fa9 Mon Sep 17 00:00:00 2001 From: Sungguk Na Date: Thu, 25 May 2017 19:34:13 +0900 Subject: [PATCH] Change argument of gpio gdbus method - 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 --- include/peripheral_internal.h | 3 +-- src/peripheral_gdbus_gpio.c | 25 ++++++++++--------------- src/peripheral_gpio.c | 8 -------- src/peripheral_io.xml | 21 ++++++++++----------- 4 files changed, 21 insertions(+), 36 deletions(-) diff --git a/include/peripheral_internal.h b/include/peripheral_internal.h index 85263aa..34f09b0 100644 --- a/include/peripheral_internal.h +++ b/include/peripheral_internal.h @@ -22,8 +22,7 @@ */ struct _peripheral_gpio_s { int pin; - peripheral_gpio_direction_e direction; - peripheral_gpio_edge_e edge; + uint handle; }; /** diff --git a/src/peripheral_gdbus_gpio.c b/src/peripheral_gdbus_gpio.c index 0bbe4f7..721b3d4 100644 --- a/src/peripheral_gdbus_gpio.c +++ b/src/peripheral_gdbus_gpio.c @@ -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) { diff --git a/src/peripheral_gpio.c b/src/peripheral_gpio.c index 2b3bd20..e49477c 100644 --- a/src/peripheral_gpio.c +++ b/src/peripheral_gpio.c @@ -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; } diff --git a/src/peripheral_io.xml b/src/peripheral_io.xml index abc3679..2480f92 100644 --- a/src/peripheral_io.xml +++ b/src/peripheral_io.xml @@ -3,50 +3,49 @@ - - + - + - + - + - + - + - + - + - + - + -- 2.7.4