- in the past, when Lib was closed, gdbus disconnected and the daemon received a disconnection callback.
- the problem is gdbus disconnection callback is called late
- if App repeat open and close, daemon get the problem of handling open before close is processed.
Change-Id: If358b283389eebc5dfe97f6c182defef37acfce4
Signed-off-by: Segwon <segwon.han@samsung.com>
gint pin,
gpointer user_data);
+gboolean peripheral_gdbus_gpio_close(
+ PeripheralIoGdbusGpio *gpio,
+ GDBusMethodInvocation *invocation,
+ gint handle,
+ gpointer user_data);
+
#endif /* __PERIPHERAL_GDBUS_GPIO_H__ */
gint address,
gpointer user_data);
+gboolean peripheral_gdbus_i2c_close(
+ PeripheralIoGdbusI2c *i2c,
+ GDBusMethodInvocation *invocation,
+ gint handle,
+ gpointer user_data);
+
#endif /* __PERIPHERAL_GDBUS_I2C_H__ */
gint pin,
gpointer user_data);
+gboolean peripheral_gdbus_pwm_close(
+ PeripheralIoGdbusPwm *pwm,
+ GDBusMethodInvocation *invocation,
+ gint handle,
+ gpointer user_data);
+
#endif /* __PERIPHERAL_GDBUS_PWM_H__ */
gint cs,
gpointer user_data);
+gboolean peripheral_gdbus_spi_close(
+ PeripheralIoGdbusSpi *spi,
+ GDBusMethodInvocation *invocation,
+ gint handle,
+ gpointer user_data);
+
#endif /* __PERIPHERAL_GDBUS_SPI_H__ */
gint port,
gpointer user_data);
+gboolean peripheral_gdbus_uart_close(
+ PeripheralIoGdbusUart *uart,
+ GDBusMethodInvocation *invocation,
+ gint handle,
+ gpointer user_data);
+
#endif /* __PERIPHERAL_GDBUS_UART_H__ */
if (gpio_fd_list != NULL)
g_object_unref(gpio_fd_list);
+ return true;
+}
+
+gboolean peripheral_gdbus_gpio_close(
+ PeripheralIoGdbusGpio *gpio,
+ GDBusMethodInvocation *invocation,
+ gint handle,
+ gpointer user_data)
+{
+ int ret = PERIPHERAL_ERROR_NONE;
+
+ peripheral_h gpio_handle = GUINT_TO_POINTER(handle);
+
+ g_bus_unwatch_name(gpio_handle->watch_id);
+ ret = peripheral_handle_gpio_destroy(gpio_handle);
+
+ peripheral_io_gdbus_gpio_complete_close(gpio, invocation, ret);
+
return true;
}
\ No newline at end of file
return true;
}
+
+gboolean peripheral_gdbus_i2c_close(
+ PeripheralIoGdbusI2c *i2c,
+ GDBusMethodInvocation *invocation,
+ gint handle,
+ gpointer user_data)
+{
+ int ret = PERIPHERAL_ERROR_NONE;
+
+ peripheral_h i2c_handle = GUINT_TO_POINTER(handle);
+
+ g_bus_unwatch_name(i2c_handle->watch_id);
+ ret = peripheral_handle_i2c_destroy(i2c_handle);
+
+ peripheral_io_gdbus_i2c_complete_close(i2c, invocation, ret);
+
+ return true;
+}
\ No newline at end of file
return true;
}
+
+gboolean peripheral_gdbus_pwm_close(
+ PeripheralIoGdbusPwm *pwm,
+ GDBusMethodInvocation *invocation,
+ gint handle,
+ gpointer user_data)
+{
+ int ret = PERIPHERAL_ERROR_NONE;
+
+ peripheral_h pwm_handle = GUINT_TO_POINTER(handle);
+
+ g_bus_unwatch_name(pwm_handle->watch_id);
+ ret = peripheral_handle_pwm_destroy(pwm_handle);
+
+ peripheral_io_gdbus_pwm_complete_close(pwm, invocation, ret);
+
+ return true;
+}
\ No newline at end of file
return true;
}
+gboolean peripheral_gdbus_spi_close(
+ PeripheralIoGdbusSpi *spi,
+ GDBusMethodInvocation *invocation,
+ gint handle,
+ gpointer user_data)
+{
+ int ret = PERIPHERAL_ERROR_NONE;
+
+ peripheral_h spi_handle = GUINT_TO_POINTER(handle);
+
+ g_bus_unwatch_name(spi_handle->watch_id);
+ ret = peripheral_handle_spi_destroy(spi_handle);
+
+ peripheral_io_gdbus_spi_complete_close(spi, invocation, ret);
+
+ return true;
+}
\ No newline at end of file
return true;
}
+
+gboolean peripheral_gdbus_uart_close(
+ PeripheralIoGdbusUart *uart,
+ GDBusMethodInvocation *invocation,
+ gint handle,
+ gpointer user_data)
+{
+ int ret = PERIPHERAL_ERROR_NONE;
+
+ peripheral_h uart_handle = GUINT_TO_POINTER(handle);
+
+ g_bus_unwatch_name(uart_handle->watch_id);
+ ret = peripheral_handle_uart_destroy(uart_handle);
+
+ peripheral_io_gdbus_uart_complete_close(uart, invocation, ret);
+
+ return true;
+}
\ No newline at end of file
<arg type="u" name="handle" direction="out"/>
<arg type="i" name="result" direction="out"/>
</method>
+ <method name="Close">
+ <arg type="u" name="handle" direction="in"/>
+ <arg type="i" name="result" direction="out"/>
+ </method>
</interface>
<interface name="org.tizen.peripheral_io.i2c">
<method name="Open">
<arg type="u" name="handle" direction="out"/>
<arg type="i" name="result" direction="out"/>
</method>
+ <method name="Close">
+ <arg type="u" name="handle" direction="in"/>
+ <arg type="i" name="result" direction="out"/>
+ </method>
</interface>
<interface name="org.tizen.peripheral_io.pwm">
<method name="Open">
<arg type="u" name="handle" direction="out"/>
<arg type="i" name="result" direction="out"/>
</method>
+ <method name="Close">
+ <arg type="u" name="handle" direction="in"/>
+ <arg type="i" name="result" direction="out"/>
+ </method>
</interface>
<interface name="org.tizen.peripheral_io.uart">
<method name="Open">
<arg type="u" name="handle" direction="out"/>
<arg type="i" name="result" direction="out"/>
</method>
+ <method name="Close">
+ <arg type="u" name="handle" direction="in"/>
+ <arg type="i" name="result" direction="out"/>
+ </method>
</interface>
<interface name="org.tizen.peripheral_io.spi">
<method name="Open">
<arg type="u" name="handle" direction="out"/>
<arg type="i" name="result" direction="out"/>
</method>
+ <method name="Close">
+ <arg type="u" name="handle" direction="in"/>
+ <arg type="i" name="result" direction="out"/>
+ </method>
</interface>
</node>
"handle-open",
G_CALLBACK(peripheral_gdbus_gpio_open),
info);
+ g_signal_connect(info->gpio_skeleton,
+ "handle-close",
+ G_CALLBACK(peripheral_gdbus_gpio_close),
+ info);
manager = g_dbus_object_manager_server_new(PERIPHERAL_GDBUS_GPIO_PATH);
"handle-open",
G_CALLBACK(peripheral_gdbus_i2c_open),
info);
+ g_signal_connect(info->i2c_skeleton,
+ "handle-close",
+ G_CALLBACK(peripheral_gdbus_i2c_close),
+ info);
manager = g_dbus_object_manager_server_new(PERIPHERAL_GDBUS_I2C_PATH);
"handle-open",
G_CALLBACK(peripheral_gdbus_pwm_open),
info);
+ g_signal_connect(info->pwm_skeleton,
+ "handle-close",
+ G_CALLBACK(peripheral_gdbus_pwm_close),
+ info);
manager = g_dbus_object_manager_server_new(PERIPHERAL_GDBUS_PWM_PATH);
"handle-open",
G_CALLBACK(peripheral_gdbus_uart_open),
info);
+ g_signal_connect(info->uart_skeleton,
+ "handle-close",
+ G_CALLBACK(peripheral_gdbus_uart_close),
+ info);
manager = g_dbus_object_manager_server_new(PERIPHERAL_GDBUS_UART_PATH);
"handle-open",
G_CALLBACK(peripheral_gdbus_spi_open),
info);
+ g_signal_connect(info->spi_skeleton,
+ "handle-close",
+ G_CALLBACK(peripheral_gdbus_spi_close),
+ info);
manager = g_dbus_object_manager_server_new(PERIPHERAL_GDBUS_SPI_PATH);