gdbus: change file name prefix "peripheral_bus_gdbus" to "peripheral_gdbus" 68/160968/1
authorSegwon <segwon.han@samsung.com>
Tue, 21 Nov 2017 02:33:51 +0000 (11:33 +0900)
committerSegwon <segwon.han@samsung.com>
Tue, 21 Nov 2017 02:33:51 +0000 (11:33 +0900)
Change-Id: I155f9155a39745093e553eb2830a7b1198515469
Signed-off-by: Segwon <segwon.han@samsung.com>
23 files changed:
CMakeLists.txt
src/daemon/include/peripheral_bus_gdbus_gpio.h [deleted file]
src/daemon/include/peripheral_bus_gdbus_i2c.h [deleted file]
src/daemon/include/peripheral_bus_gdbus_pwm.h [deleted file]
src/daemon/include/peripheral_bus_gdbus_spi.h [deleted file]
src/daemon/include/peripheral_bus_gdbus_uart.h [deleted file]
src/daemon/include/peripheral_gdbus_gpio.h [new file with mode: 0644]
src/daemon/include/peripheral_gdbus_i2c.h [new file with mode: 0644]
src/daemon/include/peripheral_gdbus_pwm.h [new file with mode: 0644]
src/daemon/include/peripheral_gdbus_spi.h [new file with mode: 0644]
src/daemon/include/peripheral_gdbus_uart.h [new file with mode: 0644]
src/daemon/peripheral_bus.c
src/daemon/peripheral_bus_gdbus_gpio.c [deleted file]
src/daemon/peripheral_bus_gdbus_i2c.c [deleted file]
src/daemon/peripheral_bus_gdbus_pwm.c [deleted file]
src/daemon/peripheral_bus_gdbus_spi.c [deleted file]
src/daemon/peripheral_bus_gdbus_uart.c [deleted file]
src/daemon/peripheral_gdbus_gpio.c [new file with mode: 0644]
src/daemon/peripheral_gdbus_i2c.c [new file with mode: 0644]
src/daemon/peripheral_gdbus_pwm.c [new file with mode: 0644]
src/daemon/peripheral_gdbus_spi.c [new file with mode: 0644]
src/daemon/peripheral_gdbus_uart.c [new file with mode: 0644]
src/daemon/peripheral_handle_gpio.c

index 947f185e373705c0eb063fd7def0e6c59ff04e2d..bddedcbc4174d175e85349313c30f167da2dbdd6 100644 (file)
@@ -23,11 +23,11 @@ SET(PERIPHERAL-BUS "peripheral-bus")
 SET(SRCS
        src/daemon/peripheral_bus.c
        src/daemon/peripheral_bus_util.c
-       src/daemon/peripheral_bus_gdbus_gpio.c
-       src/daemon/peripheral_bus_gdbus_i2c.c
-       src/daemon/peripheral_bus_gdbus_pwm.c
-       src/daemon/peripheral_bus_gdbus_spi.c
-       src/daemon/peripheral_bus_gdbus_uart.c
+       src/daemon/peripheral_gdbus_gpio.c
+       src/daemon/peripheral_gdbus_i2c.c
+       src/daemon/peripheral_gdbus_pwm.c
+       src/daemon/peripheral_gdbus_spi.c
+       src/daemon/peripheral_gdbus_uart.c
        src/daemon/peripheral_handle_pwm.c
        src/daemon/peripheral_handle_i2c.c
        src/daemon/peripheral_handle_gpio.c
diff --git a/src/daemon/include/peripheral_bus_gdbus_gpio.h b/src/daemon/include/peripheral_bus_gdbus_gpio.h
deleted file mode 100644 (file)
index 6036c99..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __PERIPHERAL_BUS_GDBUS_GPIO_H__
-#define __PERIPHERAL_BUS_GDBUS_GPIO_H__
-
-#include "peripheral_io_gdbus.h"
-
-gboolean handle_gpio_open(
-               PeripheralIoGdbusGpio *gpio,
-               GDBusMethodInvocation *invocation,
-               GUnixFDList *fd_list,
-               gint pin,
-               gpointer user_data);
-
-#endif /* __PERIPHERAL_BUS_GDBUS_GPIO_H__ */
diff --git a/src/daemon/include/peripheral_bus_gdbus_i2c.h b/src/daemon/include/peripheral_bus_gdbus_i2c.h
deleted file mode 100644 (file)
index b098b04..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __PERIPHERAL_BUS_GDBUS_I2C_H__
-#define __PERIPHERAL_BUS_GDBUS_I2C_H__
-
-#include "peripheral_io_gdbus.h"
-
-gboolean handle_i2c_open(
-               PeripheralIoGdbusI2c *i2c,
-               GDBusMethodInvocation *invocation,
-               GUnixFDList *fd_list,
-               gint bus,
-               gint address,
-               gpointer user_data);
-
-#endif /* __PERIPHERAL_BUS_GDBUS_I2C_H__ */
diff --git a/src/daemon/include/peripheral_bus_gdbus_pwm.h b/src/daemon/include/peripheral_bus_gdbus_pwm.h
deleted file mode 100644 (file)
index 650e7d6..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __PERIPHERAL_BUS_GDBUS_PWM_H__
-#define __PERIPHERAL_BUS_GDBUS_PWM_H__
-
-#include "peripheral_io_gdbus.h"
-
-gboolean handle_pwm_open(
-               PeripheralIoGdbusPwm *pwm,
-               GDBusMethodInvocation *invocation,
-               GUnixFDList *fd_list,
-               gint chip,
-               gint pin,
-               gpointer user_data);
-
-#endif /* __PERIPHERAL_BUS_GDBUS_PWM_H__ */
diff --git a/src/daemon/include/peripheral_bus_gdbus_spi.h b/src/daemon/include/peripheral_bus_gdbus_spi.h
deleted file mode 100644 (file)
index 199e632..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __PERIPHERAL_BUS_GDBUS_SPI_H__
-#define __PERIPHERAL_BUS_GDBUS_SPI_H__
-
-#include "peripheral_io_gdbus.h"
-
-gboolean handle_spi_open(
-               PeripheralIoGdbusSpi *spi,
-               GDBusMethodInvocation *invocation,
-               GUnixFDList *fd_list,
-               gint bus,
-               gint cs,
-               gpointer user_data);
-
-#endif /* __PERIPHERAL_BUS_GDBUS_SPI_H__ */
diff --git a/src/daemon/include/peripheral_bus_gdbus_uart.h b/src/daemon/include/peripheral_bus_gdbus_uart.h
deleted file mode 100644 (file)
index 7cfbfa0..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __PERIPHERAL_BUS_GDBUS_UART_H__
-#define __PERIPHERAL_BUS_GDBUS_UART_H__
-
-#include "peripheral_io_gdbus.h"
-
-gboolean handle_uart_open(
-               PeripheralIoGdbusUart *uart,
-               GDBusMethodInvocation *invocation,
-               GUnixFDList *fd_list,
-               gint port,
-               gpointer user_data);
-
-#endif /* __PERIPHERAL_BUS_GDBUS_UART_H__ */
diff --git a/src/daemon/include/peripheral_gdbus_gpio.h b/src/daemon/include/peripheral_gdbus_gpio.h
new file mode 100644 (file)
index 0000000..2d396ab
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __PERIPHERAL_GDBUS_GPIO_H__
+#define __PERIPHERAL_GDBUS_GPIO_H__
+
+#include "peripheral_io_gdbus.h"
+
+gboolean handle_gpio_open(
+               PeripheralIoGdbusGpio *gpio,
+               GDBusMethodInvocation *invocation,
+               GUnixFDList *fd_list,
+               gint pin,
+               gpointer user_data);
+
+#endif /* __PERIPHERAL_GDBUS_GPIO_H__ */
diff --git a/src/daemon/include/peripheral_gdbus_i2c.h b/src/daemon/include/peripheral_gdbus_i2c.h
new file mode 100644 (file)
index 0000000..cad264d
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __PERIPHERAL_GDBUS_I2C_H__
+#define __PERIPHERAL_GDBUS_I2C_H__
+
+#include "peripheral_io_gdbus.h"
+
+gboolean handle_i2c_open(
+               PeripheralIoGdbusI2c *i2c,
+               GDBusMethodInvocation *invocation,
+               GUnixFDList *fd_list,
+               gint bus,
+               gint address,
+               gpointer user_data);
+
+#endif /* __PERIPHERAL_GDBUS_I2C_H__ */
diff --git a/src/daemon/include/peripheral_gdbus_pwm.h b/src/daemon/include/peripheral_gdbus_pwm.h
new file mode 100644 (file)
index 0000000..4ffae5e
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __PERIPHERAL_GDBUS_PWM_H__
+#define __PERIPHERAL_GDBUS_PWM_H__
+
+#include "peripheral_io_gdbus.h"
+
+gboolean handle_pwm_open(
+               PeripheralIoGdbusPwm *pwm,
+               GDBusMethodInvocation *invocation,
+               GUnixFDList *fd_list,
+               gint chip,
+               gint pin,
+               gpointer user_data);
+
+#endif /* __PERIPHERAL_GDBUS_PWM_H__ */
diff --git a/src/daemon/include/peripheral_gdbus_spi.h b/src/daemon/include/peripheral_gdbus_spi.h
new file mode 100644 (file)
index 0000000..687528c
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __PERIPHERAL_GDBUS_SPI_H__
+#define __PERIPHERAL_GDBUS_SPI_H__
+
+#include "peripheral_io_gdbus.h"
+
+gboolean handle_spi_open(
+               PeripheralIoGdbusSpi *spi,
+               GDBusMethodInvocation *invocation,
+               GUnixFDList *fd_list,
+               gint bus,
+               gint cs,
+               gpointer user_data);
+
+#endif /* __PERIPHERAL_GDBUS_SPI_H__ */
diff --git a/src/daemon/include/peripheral_gdbus_uart.h b/src/daemon/include/peripheral_gdbus_uart.h
new file mode 100644 (file)
index 0000000..64bd84c
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __PERIPHERAL_GDBUS_UART_H__
+#define __PERIPHERAL_GDBUS_UART_H__
+
+#include "peripheral_io_gdbus.h"
+
+gboolean handle_uart_open(
+               PeripheralIoGdbusUart *uart,
+               GDBusMethodInvocation *invocation,
+               GUnixFDList *fd_list,
+               gint port,
+               gpointer user_data);
+
+#endif /* __PERIPHERAL_GDBUS_UART_H__ */
index 7f6643467e23cdb2e36e1d28b79de84938e584e3..d4c038fe130b760a43be3f5884d24008c5015d76 100644 (file)
 #include "peripheral_io_gdbus.h"
 #include "peripheral_bus.h"
 #include "peripheral_log.h"
-#include "peripheral_bus_gdbus_gpio.h"
-#include "peripheral_bus_gdbus_i2c.h"
-#include "peripheral_bus_gdbus_pwm.h"
-#include "peripheral_bus_gdbus_spi.h"
-#include "peripheral_bus_gdbus_uart.h"
+#include "peripheral_gdbus_gpio.h"
+#include "peripheral_gdbus_i2c.h"
+#include "peripheral_gdbus_pwm.h"
+#include "peripheral_gdbus_spi.h"
+#include "peripheral_gdbus_uart.h"
 
 #include "privilege_checker.h"
 
diff --git a/src/daemon/peripheral_bus_gdbus_gpio.c b/src/daemon/peripheral_bus_gdbus_gpio.c
deleted file mode 100644 (file)
index b27793c..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <peripheral_io.h>
-#include <gio/gunixfdlist.h>
-
-#include "peripheral_io_gdbus.h"
-#include "peripheral_bus.h"
-#include "peripheral_handle_gpio.h"
-#include "peripheral_log.h"
-#include "peripheral_bus_util.h"
-#include "peripheral_bus_gdbus_gpio.h"
-
-static void __gpio_on_name_vanished(GDBusConnection *connection,
-               const gchar     *name,
-               gpointer         user_data)
-{
-       pb_data_h gpio_handle = (pb_data_h)user_data;
-       _D("appid [%s] vanished ", name);
-
-       g_bus_unwatch_name(gpio_handle->watch_id);
-       peripheral_bus_gpio_close(gpio_handle);
-}
-
-gboolean handle_gpio_open(
-               PeripheralIoGdbusGpio *gpio,
-               GDBusMethodInvocation *invocation,
-               GUnixFDList *fd_list,
-               gint pin,
-               gpointer user_data)
-{
-       peripheral_error_e ret = PERIPHERAL_ERROR_NONE;
-       peripheral_bus_s *pb_data = (peripheral_bus_s*)user_data;
-       pb_data_h gpio_handle = NULL;
-
-       GUnixFDList *gpio_fd_list = NULL;
-
-       ret = peripheral_bus_check_privilege(invocation, pb_data);
-       if (ret != 0) {
-               _E("Permission denied.");
-               ret = PERIPHERAL_ERROR_PERMISSION_DENIED;
-               goto out;
-       }
-
-       if ((ret = peripheral_bus_gpio_open(pin, &gpio_handle, user_data)) < PERIPHERAL_ERROR_NONE)
-               goto out;
-
-       gpio_handle->watch_id = g_bus_watch_name(G_BUS_TYPE_SYSTEM,
-                       g_dbus_method_invocation_get_sender(invocation),
-                       G_BUS_NAME_WATCHER_FLAGS_NONE,
-                       NULL,
-                       __gpio_on_name_vanished,
-                       gpio_handle,
-                       NULL);
-
-out:
-       peripheral_io_gdbus_gpio_complete_open(gpio, invocation, gpio_fd_list, GPOINTER_TO_UINT(gpio_handle), ret);
-
-       return true;
-}
\ No newline at end of file
diff --git a/src/daemon/peripheral_bus_gdbus_i2c.c b/src/daemon/peripheral_bus_gdbus_i2c.c
deleted file mode 100644 (file)
index 5d06d7a..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <peripheral_io.h>
-
-#include "peripheral_io_gdbus.h"
-#include "peripheral_bus.h"
-#include "peripheral_handle_i2c.h"
-#include "peripheral_log.h"
-#include "peripheral_bus_util.h"
-#include "peripheral_bus_gdbus_i2c.h"
-
-static void __i2c_on_name_vanished(GDBusConnection *connection,
-               const gchar     *name,
-               gpointer         user_data)
-{
-       pb_data_h i2c_handle = (pb_data_h)user_data;
-       _D("appid [%s] vanished ", name);
-
-       g_bus_unwatch_name(i2c_handle->watch_id);
-       peripheral_bus_i2c_close(i2c_handle);
-}
-
-gboolean handle_i2c_open(
-               PeripheralIoGdbusI2c *i2c,
-               GDBusMethodInvocation *invocation,
-               GUnixFDList *fd_list,
-               gint bus,
-               gint address,
-               gpointer user_data)
-{
-       peripheral_bus_s *pb_data = (peripheral_bus_s*)user_data;
-       peripheral_error_e ret = PERIPHERAL_ERROR_NONE;
-       pb_data_h i2c_handle = NULL;
-
-       GUnixFDList *i2c_fd_list = NULL;
-
-       ret = peripheral_bus_check_privilege(invocation, pb_data);
-       if (ret != 0) {
-               _E("Permission denied.");
-               ret = PERIPHERAL_ERROR_PERMISSION_DENIED;
-               goto out;
-       }
-
-       if ((ret = peripheral_bus_i2c_open(bus, address, &i2c_handle, user_data)) < PERIPHERAL_ERROR_NONE)
-               goto out;
-
-       i2c_handle->watch_id = g_bus_watch_name(G_BUS_TYPE_SYSTEM,
-                       g_dbus_method_invocation_get_sender(invocation),
-                       G_BUS_NAME_WATCHER_FLAGS_NONE,
-                       NULL,
-                       __i2c_on_name_vanished,
-                       i2c_handle,
-                       NULL);
-
-out:
-       peripheral_io_gdbus_i2c_complete_open(i2c, invocation, i2c_fd_list, GPOINTER_TO_UINT(i2c_handle), ret);
-
-       return true;
-}
diff --git a/src/daemon/peripheral_bus_gdbus_pwm.c b/src/daemon/peripheral_bus_gdbus_pwm.c
deleted file mode 100644 (file)
index b44babc..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <peripheral_io.h>
-
-#include "peripheral_io_gdbus.h"
-#include "peripheral_bus.h"
-#include "peripheral_handle_pwm.h"
-#include "peripheral_log.h"
-#include "peripheral_bus_util.h"
-#include "peripheral_bus_gdbus_pwm.h"
-
-static void __pwm_on_name_vanished(GDBusConnection *connection,
-               const gchar     *name,
-               gpointer         user_data)
-{
-       pb_data_h pwm_handle = (pb_data_h)user_data;
-       _D("appid [%s] vanished ", name);
-
-       g_bus_unwatch_name(pwm_handle->watch_id);
-       peripheral_bus_pwm_close(pwm_handle);
-}
-
-gboolean handle_pwm_open(
-               PeripheralIoGdbusPwm *pwm,
-               GDBusMethodInvocation *invocation,
-               GUnixFDList *fd_list,
-               gint chip,
-               gint pin,
-               gpointer user_data)
-{
-       peripheral_bus_s *pb_data = (peripheral_bus_s*)user_data;
-       peripheral_error_e ret = PERIPHERAL_ERROR_NONE;
-       pb_data_h pwm_handle = NULL;
-
-       GUnixFDList *pwm_fd_list = NULL;
-
-       ret = peripheral_bus_check_privilege(invocation, pb_data);
-       if (ret != 0) {
-               _E("Permission denied.");
-               ret = PERIPHERAL_ERROR_PERMISSION_DENIED;
-               goto out;
-       }
-
-       if ((ret = peripheral_bus_pwm_open(chip, pin, &pwm_handle, user_data)) <  PERIPHERAL_ERROR_NONE)
-               goto out;
-
-       pwm_handle->watch_id = g_bus_watch_name(G_BUS_TYPE_SYSTEM,
-                       g_dbus_method_invocation_get_sender(invocation),
-                       G_BUS_NAME_WATCHER_FLAGS_NONE,
-                       NULL,
-                       __pwm_on_name_vanished,
-                       pwm_handle,
-                       NULL);
-
-out:
-       peripheral_io_gdbus_pwm_complete_open(pwm, invocation, pwm_fd_list, GPOINTER_TO_UINT(pwm_handle), ret);
-
-       return true;
-}
diff --git a/src/daemon/peripheral_bus_gdbus_spi.c b/src/daemon/peripheral_bus_gdbus_spi.c
deleted file mode 100644 (file)
index 447f34e..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <peripheral_io.h>
-
-#include "peripheral_io_gdbus.h"
-#include "peripheral_bus.h"
-#include "peripheral_handle_spi.h"
-#include "peripheral_log.h"
-#include "peripheral_bus_util.h"
-#include "peripheral_bus_gdbus_spi.h"
-
-static void __spi_on_name_vanished(GDBusConnection *connection,
-               const gchar     *name,
-               gpointer         user_data)
-{
-       pb_data_h spi_handle = (pb_data_h)user_data;
-       _D("appid [%s] vanished ", name);
-
-       g_bus_unwatch_name(spi_handle->watch_id);
-       peripheral_bus_spi_close(spi_handle);
-}
-
-gboolean handle_spi_open(
-               PeripheralIoGdbusSpi *spi,
-               GDBusMethodInvocation *invocation,
-               GUnixFDList *fd_list,
-               gint bus,
-               gint cs,
-               gpointer user_data)
-{
-       peripheral_bus_s *pb_data = (peripheral_bus_s*)user_data;
-       peripheral_error_e ret = PERIPHERAL_ERROR_NONE;
-       pb_data_h spi_handle = NULL;
-
-       GUnixFDList *spi_fd_list = NULL;
-
-       ret = peripheral_bus_check_privilege(invocation, pb_data);
-       if (ret != 0) {
-               _E("Permission denied.");
-               ret = PERIPHERAL_ERROR_PERMISSION_DENIED;
-               goto out;
-       }
-
-       if ((ret = peripheral_bus_spi_open(bus, cs, &spi_handle, user_data)) < PERIPHERAL_ERROR_NONE)
-               goto out;
-
-       spi_handle->watch_id = g_bus_watch_name(G_BUS_TYPE_SYSTEM,
-                       g_dbus_method_invocation_get_sender(invocation),
-                       G_BUS_NAME_WATCHER_FLAGS_NONE,
-                       NULL,
-                       __spi_on_name_vanished,
-                       spi_handle,
-                       NULL);
-
-out:
-       peripheral_io_gdbus_spi_complete_open(spi, invocation, spi_fd_list, GPOINTER_TO_UINT(spi_handle), ret);
-
-       return true;
-}
-
diff --git a/src/daemon/peripheral_bus_gdbus_uart.c b/src/daemon/peripheral_bus_gdbus_uart.c
deleted file mode 100644 (file)
index d895d98..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <peripheral_io.h>
-
-#include "peripheral_io_gdbus.h"
-#include "peripheral_bus.h"
-#include "peripheral_handle_uart.h"
-#include "peripheral_log.h"
-#include "peripheral_bus_util.h"
-#include "peripheral_bus_gdbus_uart.h"
-
-static void __uart_on_name_vanished(GDBusConnection *connection,
-               const gchar     *name,
-               gpointer         user_data)
-{
-       pb_data_h uart_handle = (pb_data_h)user_data;
-       _D("appid [%s] vanished ", name);
-
-       g_bus_unwatch_name(uart_handle->watch_id);
-       peripheral_bus_uart_close(uart_handle);
-}
-
-gboolean handle_uart_open(
-               PeripheralIoGdbusUart *uart,
-               GDBusMethodInvocation *invocation,
-               GUnixFDList *fd_list,
-               gint port,
-               gpointer user_data)
-{
-       peripheral_bus_s *pb_data = (peripheral_bus_s*)user_data;
-       peripheral_error_e ret = PERIPHERAL_ERROR_NONE;
-       pb_data_h uart_handle = NULL;
-
-       GUnixFDList *uart_fd_list = NULL;
-
-       ret = peripheral_bus_check_privilege(invocation, pb_data);
-       if (ret != 0) {
-               _E("Permission denied.");
-               ret = PERIPHERAL_ERROR_PERMISSION_DENIED;
-               goto out;
-       }
-
-       if ((ret = peripheral_bus_uart_open(port, &uart_handle, user_data)) < PERIPHERAL_ERROR_NONE)
-               goto out;
-
-       uart_handle->watch_id = g_bus_watch_name(G_BUS_TYPE_SYSTEM,
-                       g_dbus_method_invocation_get_sender(invocation),
-                       G_BUS_NAME_WATCHER_FLAGS_NONE,
-                       NULL,
-                       __uart_on_name_vanished,
-                       uart_handle,
-                       NULL);
-
-out:
-       peripheral_io_gdbus_uart_complete_open(uart, invocation, uart_fd_list, GPOINTER_TO_UINT(uart_handle), ret);
-
-       return true;
-}
diff --git a/src/daemon/peripheral_gdbus_gpio.c b/src/daemon/peripheral_gdbus_gpio.c
new file mode 100644 (file)
index 0000000..685c826
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <peripheral_io.h>
+#include <gio/gunixfdlist.h>
+
+#include "peripheral_io_gdbus.h"
+#include "peripheral_bus.h"
+#include "peripheral_handle_gpio.h"
+#include "peripheral_log.h"
+#include "peripheral_bus_util.h"
+#include "peripheral_gdbus_gpio.h"
+
+static void __gpio_on_name_vanished(GDBusConnection *connection,
+               const gchar     *name,
+               gpointer         user_data)
+{
+       pb_data_h gpio_handle = (pb_data_h)user_data;
+       _D("appid [%s] vanished ", name);
+
+       g_bus_unwatch_name(gpio_handle->watch_id);
+       peripheral_bus_gpio_close(gpio_handle);
+}
+
+gboolean handle_gpio_open(
+               PeripheralIoGdbusGpio *gpio,
+               GDBusMethodInvocation *invocation,
+               GUnixFDList *fd_list,
+               gint pin,
+               gpointer user_data)
+{
+       peripheral_error_e ret = PERIPHERAL_ERROR_NONE;
+       peripheral_bus_s *pb_data = (peripheral_bus_s*)user_data;
+       pb_data_h gpio_handle = NULL;
+
+       GUnixFDList *gpio_fd_list = NULL;
+
+       ret = peripheral_bus_check_privilege(invocation, pb_data);
+       if (ret != 0) {
+               _E("Permission denied.");
+               ret = PERIPHERAL_ERROR_PERMISSION_DENIED;
+               goto out;
+       }
+
+       if ((ret = peripheral_bus_gpio_open(pin, &gpio_handle, user_data)) < PERIPHERAL_ERROR_NONE)
+               goto out;
+
+       gpio_handle->watch_id = g_bus_watch_name(G_BUS_TYPE_SYSTEM,
+                       g_dbus_method_invocation_get_sender(invocation),
+                       G_BUS_NAME_WATCHER_FLAGS_NONE,
+                       NULL,
+                       __gpio_on_name_vanished,
+                       gpio_handle,
+                       NULL);
+
+out:
+       peripheral_io_gdbus_gpio_complete_open(gpio, invocation, gpio_fd_list, GPOINTER_TO_UINT(gpio_handle), ret);
+
+       return true;
+}
\ No newline at end of file
diff --git a/src/daemon/peripheral_gdbus_i2c.c b/src/daemon/peripheral_gdbus_i2c.c
new file mode 100644 (file)
index 0000000..5272fc7
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <peripheral_io.h>
+
+#include "peripheral_io_gdbus.h"
+#include "peripheral_bus.h"
+#include "peripheral_handle_i2c.h"
+#include "peripheral_log.h"
+#include "peripheral_bus_util.h"
+#include "peripheral_gdbus_i2c.h"
+
+static void __i2c_on_name_vanished(GDBusConnection *connection,
+               const gchar     *name,
+               gpointer         user_data)
+{
+       pb_data_h i2c_handle = (pb_data_h)user_data;
+       _D("appid [%s] vanished ", name);
+
+       g_bus_unwatch_name(i2c_handle->watch_id);
+       peripheral_bus_i2c_close(i2c_handle);
+}
+
+gboolean handle_i2c_open(
+               PeripheralIoGdbusI2c *i2c,
+               GDBusMethodInvocation *invocation,
+               GUnixFDList *fd_list,
+               gint bus,
+               gint address,
+               gpointer user_data)
+{
+       peripheral_bus_s *pb_data = (peripheral_bus_s*)user_data;
+       peripheral_error_e ret = PERIPHERAL_ERROR_NONE;
+       pb_data_h i2c_handle = NULL;
+
+       GUnixFDList *i2c_fd_list = NULL;
+
+       ret = peripheral_bus_check_privilege(invocation, pb_data);
+       if (ret != 0) {
+               _E("Permission denied.");
+               ret = PERIPHERAL_ERROR_PERMISSION_DENIED;
+               goto out;
+       }
+
+       if ((ret = peripheral_bus_i2c_open(bus, address, &i2c_handle, user_data)) < PERIPHERAL_ERROR_NONE)
+               goto out;
+
+       i2c_handle->watch_id = g_bus_watch_name(G_BUS_TYPE_SYSTEM,
+                       g_dbus_method_invocation_get_sender(invocation),
+                       G_BUS_NAME_WATCHER_FLAGS_NONE,
+                       NULL,
+                       __i2c_on_name_vanished,
+                       i2c_handle,
+                       NULL);
+
+out:
+       peripheral_io_gdbus_i2c_complete_open(i2c, invocation, i2c_fd_list, GPOINTER_TO_UINT(i2c_handle), ret);
+
+       return true;
+}
diff --git a/src/daemon/peripheral_gdbus_pwm.c b/src/daemon/peripheral_gdbus_pwm.c
new file mode 100644 (file)
index 0000000..7c40024
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <peripheral_io.h>
+
+#include "peripheral_io_gdbus.h"
+#include "peripheral_bus.h"
+#include "peripheral_handle_pwm.h"
+#include "peripheral_log.h"
+#include "peripheral_bus_util.h"
+#include "peripheral_gdbus_pwm.h"
+
+static void __pwm_on_name_vanished(GDBusConnection *connection,
+               const gchar     *name,
+               gpointer         user_data)
+{
+       pb_data_h pwm_handle = (pb_data_h)user_data;
+       _D("appid [%s] vanished ", name);
+
+       g_bus_unwatch_name(pwm_handle->watch_id);
+       peripheral_bus_pwm_close(pwm_handle);
+}
+
+gboolean handle_pwm_open(
+               PeripheralIoGdbusPwm *pwm,
+               GDBusMethodInvocation *invocation,
+               GUnixFDList *fd_list,
+               gint chip,
+               gint pin,
+               gpointer user_data)
+{
+       peripheral_bus_s *pb_data = (peripheral_bus_s*)user_data;
+       peripheral_error_e ret = PERIPHERAL_ERROR_NONE;
+       pb_data_h pwm_handle = NULL;
+
+       GUnixFDList *pwm_fd_list = NULL;
+
+       ret = peripheral_bus_check_privilege(invocation, pb_data);
+       if (ret != 0) {
+               _E("Permission denied.");
+               ret = PERIPHERAL_ERROR_PERMISSION_DENIED;
+               goto out;
+       }
+
+       if ((ret = peripheral_bus_pwm_open(chip, pin, &pwm_handle, user_data)) <  PERIPHERAL_ERROR_NONE)
+               goto out;
+
+       pwm_handle->watch_id = g_bus_watch_name(G_BUS_TYPE_SYSTEM,
+                       g_dbus_method_invocation_get_sender(invocation),
+                       G_BUS_NAME_WATCHER_FLAGS_NONE,
+                       NULL,
+                       __pwm_on_name_vanished,
+                       pwm_handle,
+                       NULL);
+
+out:
+       peripheral_io_gdbus_pwm_complete_open(pwm, invocation, pwm_fd_list, GPOINTER_TO_UINT(pwm_handle), ret);
+
+       return true;
+}
diff --git a/src/daemon/peripheral_gdbus_spi.c b/src/daemon/peripheral_gdbus_spi.c
new file mode 100644 (file)
index 0000000..d8b590d
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <peripheral_io.h>
+
+#include "peripheral_io_gdbus.h"
+#include "peripheral_bus.h"
+#include "peripheral_handle_spi.h"
+#include "peripheral_log.h"
+#include "peripheral_bus_util.h"
+#include "peripheral_gdbus_spi.h"
+
+static void __spi_on_name_vanished(GDBusConnection *connection,
+               const gchar     *name,
+               gpointer         user_data)
+{
+       pb_data_h spi_handle = (pb_data_h)user_data;
+       _D("appid [%s] vanished ", name);
+
+       g_bus_unwatch_name(spi_handle->watch_id);
+       peripheral_bus_spi_close(spi_handle);
+}
+
+gboolean handle_spi_open(
+               PeripheralIoGdbusSpi *spi,
+               GDBusMethodInvocation *invocation,
+               GUnixFDList *fd_list,
+               gint bus,
+               gint cs,
+               gpointer user_data)
+{
+       peripheral_bus_s *pb_data = (peripheral_bus_s*)user_data;
+       peripheral_error_e ret = PERIPHERAL_ERROR_NONE;
+       pb_data_h spi_handle = NULL;
+
+       GUnixFDList *spi_fd_list = NULL;
+
+       ret = peripheral_bus_check_privilege(invocation, pb_data);
+       if (ret != 0) {
+               _E("Permission denied.");
+               ret = PERIPHERAL_ERROR_PERMISSION_DENIED;
+               goto out;
+       }
+
+       if ((ret = peripheral_bus_spi_open(bus, cs, &spi_handle, user_data)) < PERIPHERAL_ERROR_NONE)
+               goto out;
+
+       spi_handle->watch_id = g_bus_watch_name(G_BUS_TYPE_SYSTEM,
+                       g_dbus_method_invocation_get_sender(invocation),
+                       G_BUS_NAME_WATCHER_FLAGS_NONE,
+                       NULL,
+                       __spi_on_name_vanished,
+                       spi_handle,
+                       NULL);
+
+out:
+       peripheral_io_gdbus_spi_complete_open(spi, invocation, spi_fd_list, GPOINTER_TO_UINT(spi_handle), ret);
+
+       return true;
+}
+
diff --git a/src/daemon/peripheral_gdbus_uart.c b/src/daemon/peripheral_gdbus_uart.c
new file mode 100644 (file)
index 0000000..06d028b
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <peripheral_io.h>
+
+#include "peripheral_io_gdbus.h"
+#include "peripheral_bus.h"
+#include "peripheral_handle_uart.h"
+#include "peripheral_log.h"
+#include "peripheral_bus_util.h"
+#include "peripheral_gdbus_uart.h"
+
+static void __uart_on_name_vanished(GDBusConnection *connection,
+               const gchar     *name,
+               gpointer         user_data)
+{
+       pb_data_h uart_handle = (pb_data_h)user_data;
+       _D("appid [%s] vanished ", name);
+
+       g_bus_unwatch_name(uart_handle->watch_id);
+       peripheral_bus_uart_close(uart_handle);
+}
+
+gboolean handle_uart_open(
+               PeripheralIoGdbusUart *uart,
+               GDBusMethodInvocation *invocation,
+               GUnixFDList *fd_list,
+               gint port,
+               gpointer user_data)
+{
+       peripheral_bus_s *pb_data = (peripheral_bus_s*)user_data;
+       peripheral_error_e ret = PERIPHERAL_ERROR_NONE;
+       pb_data_h uart_handle = NULL;
+
+       GUnixFDList *uart_fd_list = NULL;
+
+       ret = peripheral_bus_check_privilege(invocation, pb_data);
+       if (ret != 0) {
+               _E("Permission denied.");
+               ret = PERIPHERAL_ERROR_PERMISSION_DENIED;
+               goto out;
+       }
+
+       if ((ret = peripheral_bus_uart_open(port, &uart_handle, user_data)) < PERIPHERAL_ERROR_NONE)
+               goto out;
+
+       uart_handle->watch_id = g_bus_watch_name(G_BUS_TYPE_SYSTEM,
+                       g_dbus_method_invocation_get_sender(invocation),
+                       G_BUS_NAME_WATCHER_FLAGS_NONE,
+                       NULL,
+                       __uart_on_name_vanished,
+                       uart_handle,
+                       NULL);
+
+out:
+       peripheral_io_gdbus_uart_complete_open(uart, invocation, uart_fd_list, GPOINTER_TO_UINT(uart_handle), ret);
+
+       return true;
+}
index 6ac8d20bff79f34392917918d4004d93d054bd66..6ee068d2d0707cb7f7078a75150a4ae15fc4b809 100644 (file)
@@ -25,7 +25,6 @@
 
 #include "peripheral_interface_gpio.h"
 #include "peripheral_bus.h"
-#include "peripheral_bus_gdbus_gpio.h"
 #include "peripheral_log.h"
 #include "peripheral_bus_util.h"