Add support for the adc device 11/184511/4 accepted/tizen/unified/20180822.164540 submit/tizen/20180821.133358
authorKonrad Kuchciak <k.kuchciak@samsung.com>
Wed, 18 Jul 2018 10:09:42 +0000 (12:09 +0200)
committerKonrad Kuchciak <k.kuchciak@samsung.com>
Tue, 21 Aug 2018 08:04:00 +0000 (10:04 +0200)
Change-Id: Iec76628712a5efc6a00c726b98ebaa6c2e5da966
Signed-off-by: Konrad Kuchciak <k.kuchciak@samsung.com>
13 files changed:
CMakeLists.txt
include/gdbus/peripheral_gdbus_adc.h [new file with mode: 0644]
include/handle/peripheral_handle.h
include/handle/peripheral_handle_adc.h [new file with mode: 0644]
include/interface/peripheral_interface_adc.h [new file with mode: 0644]
include/util/peripheral_board.h
packaging/org.tizen.peripheral_io.conf
src/gdbus/peripheral_gdbus_adc.c [new file with mode: 0644]
src/gdbus/peripheral_io.xml
src/handle/peripheral_handle_adc.c [new file with mode: 0644]
src/interface/peripheral_interface_adc.c [new file with mode: 0644]
src/peripheral_bus.c
src/util/peripheral_board.c

index 366f33137e5f75241668751c7c3cee5b5bdf1cce..ccb4bbca35dcbfbff2d465993866d24e42571420 100644 (file)
@@ -29,10 +29,12 @@ SET(SRCS
        src/gdbus/peripheral_gdbus_gpio.c
        src/gdbus/peripheral_gdbus_i2c.c
        src/gdbus/peripheral_gdbus_pwm.c
+       src/gdbus/peripheral_gdbus_adc.c
        src/gdbus/peripheral_gdbus_spi.c
        src/gdbus/peripheral_gdbus_uart.c
        src/handle/peripheral_handle_common.c
        src/handle/peripheral_handle_pwm.c
+       src/handle/peripheral_handle_adc.c
        src/handle/peripheral_handle_i2c.c
        src/handle/peripheral_handle_gpio.c
        src/handle/peripheral_handle_uart.c
@@ -40,6 +42,7 @@ SET(SRCS
        src/interface/peripheral_interface_gpio.c
        src/interface/peripheral_interface_i2c.c
        src/interface/peripheral_interface_pwm.c
+       src/interface/peripheral_interface_adc.c
        src/interface/peripheral_interface_uart.c
        src/interface/peripheral_interface_spi.c
        src/util/peripheral_board.c
diff --git a/include/gdbus/peripheral_gdbus_adc.h b/include/gdbus/peripheral_gdbus_adc.h
new file mode 100644 (file)
index 0000000..f13a0e8
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2018 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_ADC_H__
+#define __PERIPHERAL_GDBUS_ADC_H__
+
+#include "peripheral_io_gdbus.h"
+
+gboolean peripheral_gdbus_adc_open(
+               PeripheralIoGdbusAdc *adc,
+               GDBusMethodInvocation *invocation,
+               GUnixFDList *fd_list,
+               gint device,
+               gint channel,
+               gpointer user_data);
+
+gboolean peripheral_gdbus_adc_close(
+               PeripheralIoGdbusAdc *adc,
+               GDBusMethodInvocation *invocation,
+               gint handle,
+               gpointer user_data);
+
+#endif /* __PERIPHERAL_GDBUS_ADC_H__ */
index 60e316c7e401c704b8b95daadf91a544ded710bf..73e57c76a6f93bccfd7f7b3bbc385b34e6dcb9a7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016-2018 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.
@@ -28,6 +28,7 @@ typedef struct {
        GList *gpio_list;
        GList *i2c_list;
        GList *pwm_list;
+       GList *adc_list;
        GList *uart_list;
        GList *spi_list;
        /* gdbus variable */
@@ -35,6 +36,7 @@ typedef struct {
        PeripheralIoGdbusGpio *gpio_skeleton;
        PeripheralIoGdbusI2c *i2c_skeleton;
        PeripheralIoGdbusPwm *pwm_skeleton;
+       PeripheralIoGdbusAdc *adc_skeleton;
        PeripheralIoGdbusUart *uart_skeleton;
        PeripheralIoGdbusSpi *spi_skeleton;
 } peripheral_info_s;
@@ -53,6 +55,11 @@ typedef struct {
        int pin;
 } peripheral_handle_pwm_s;
 
+typedef struct {
+       int device;
+       int channel;
+} peripheral_handle_adc_s;
+
 typedef struct {
        int port;
 } peripheral_handle_uart_s;
@@ -69,6 +76,7 @@ typedef struct {
                peripheral_handle_gpio_s gpio;
                peripheral_handle_i2c_s i2c;
                peripheral_handle_pwm_s pwm;
+               peripheral_handle_adc_s adc;
                peripheral_handle_uart_s uart;
                peripheral_handle_spi_s spi;
        } type;
diff --git a/include/handle/peripheral_handle_adc.h b/include/handle/peripheral_handle_adc.h
new file mode 100644 (file)
index 0000000..a108a15
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2018 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_HANDLE_ADC_H__
+#define __PERIPHERAL_HANDLE_ADC_H__
+
+int peripheral_handle_adc_create(int device, int channel, peripheral_h *handle, gpointer user_data);
+int peripheral_handle_adc_destroy(peripheral_h handle);
+
+#endif /* __PERIPHERAL_HANDLE_ADC_H__ */
diff --git a/include/interface/peripheral_interface_adc.h b/include/interface/peripheral_interface_adc.h
new file mode 100644 (file)
index 0000000..dd01769
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2018 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_INTERFACE_ADC_H__
+#define __PERIPHERAL_INTERFACE_ADC_H__
+
+#include <gio/gunixfdlist.h>
+
+int peripheral_interface_adc_fd_list_create(int device, int channel, GUnixFDList **list_out);
+void peripheral_interface_adc_fd_list_destroy(GUnixFDList *list);
+
+#endif /* __PERIPHERAL_INTERFACE_ADC_H__ */
index 25d1297b04aae28c9b6f0f121165a3c413722587..2f2aa41e606e1769eab4d810fe04c0f1d19dd752 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017-2018 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.
@@ -34,6 +34,7 @@ typedef enum {
        PB_BOARD_DEV_GPIO = 0,
        PB_BOARD_DEV_I2C,
        PB_BOARD_DEV_PWM,
+       PB_BOARD_DEV_ADC,
        PB_BOARD_DEV_UART,
        PB_BOARD_DEV_SPI,
        PB_BOARD_DEV_MAX,
index 8d5374e5d4a077bcbe8e8fa197fd309a159755f1..567c5f3d8c7ff6f14fdfb076d43715146b109abf 100644 (file)
@@ -17,6 +17,8 @@
                       send_interface="org.tizen.peripheral_io.i2c"/>
                <allow send_destination="org.tizen.peripheral_io"
                       send_interface="org.tizen.peripheral_io.pwm"/>
+               <allow send_destination="org.tizen.peripheral_io"
+                      send_interface="org.tizen.peripheral_io.adc"/>
                <allow send_destination="org.tizen.peripheral_io"
                       send_interface="org.tizen.peripheral_io.uart"/>
                <allow send_destination="org.tizen.peripheral_io"
diff --git a/src/gdbus/peripheral_gdbus_adc.c b/src/gdbus/peripheral_gdbus_adc.c
new file mode 100644 (file)
index 0000000..a88fa78
--- /dev/null
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2018 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_log.h"
+#include "peripheral_privilege.h"
+#include "peripheral_io_gdbus.h"
+#include "peripheral_handle.h"
+#include "peripheral_handle_adc.h"
+#include "peripheral_interface_adc.h"
+#include "peripheral_gdbus_adc.h"
+
+static void __adc_on_name_vanished(GDBusConnection *connection,
+               const gchar *name,
+               gpointer user_data)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_h adc_handle = (peripheral_h)user_data;
+       _D("appid [%s] vanished ", name);
+
+       g_bus_unwatch_name(adc_handle->watch_id);
+
+       ret = peripheral_handle_adc_destroy(adc_handle);
+       if (ret != PERIPHERAL_ERROR_NONE)
+               _E("Failed to destroy adc handle");
+}
+
+gboolean peripheral_gdbus_adc_open(
+               PeripheralIoGdbusAdc *adc,
+               GDBusMethodInvocation *invocation,
+               GUnixFDList *fd_list,
+               gint device,
+               gint channel,
+               gpointer user_data)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_info_s *info = (peripheral_info_s*)user_data;
+       peripheral_h adc_handle = NULL;
+       GUnixFDList *adc_fd_list = NULL;
+
+       ret = peripheral_privilege_check(invocation, info->connection);
+       if (ret != 0) {
+               _E("Permission denied.");
+               ret = PERIPHERAL_ERROR_PERMISSION_DENIED;
+               goto out;
+       }
+
+       ret = peripheral_interface_adc_fd_list_create(device, channel, &adc_fd_list);
+       if (ret != PERIPHERAL_ERROR_NONE) {
+               _E("Failed to create adc fd list");
+               goto out;
+       }
+
+       ret = peripheral_handle_adc_create(device, channel, &adc_handle, user_data);
+       if (ret != PERIPHERAL_ERROR_NONE) {
+               _E("Failed to create adc handle");
+               goto out;
+       }
+
+       adc_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,
+                       __adc_on_name_vanished,
+                       adc_handle,
+                       NULL);
+
+out:
+       peripheral_io_gdbus_adc_complete_open(adc, invocation, adc_fd_list, GPOINTER_TO_UINT(adc_handle), ret);
+       peripheral_interface_adc_fd_list_destroy(adc_fd_list);
+
+       return true;
+}
+
+gboolean peripheral_gdbus_adc_close(
+               PeripheralIoGdbusAdc *adc,
+               GDBusMethodInvocation *invocation,
+               gint handle,
+               gpointer user_data)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_h adc_handle = GUINT_TO_POINTER(handle);
+
+       g_bus_unwatch_name(adc_handle->watch_id);
+
+       ret = peripheral_handle_adc_destroy(adc_handle);
+       if (ret != PERIPHERAL_ERROR_NONE)
+               _E("Failed to destroy adc handle");
+
+       peripheral_io_gdbus_adc_complete_close(adc, invocation, ret);
+
+       return true;
+}
index 00c49e764e393ffcd361d93fd8e0471a26706c9f..db72361e9134ea6ed74611c98dee39c8d2405390 100644 (file)
                        <arg type="i" name="result" direction="out"/>
                </method>
        </interface>
+       <interface name="org.tizen.peripheral_io.adc">
+               <method name="Open">
+                       <annotation name="org.gtk.GDBus.C.UnixFD" value="true"/>
+                       <arg type="i" name="device" direction="in"/>
+                       <arg type="i" name="channel" direction="in"/>
+                       <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">
                        <annotation name="org.gtk.GDBus.C.UnixFD" value="true"/>
diff --git a/src/handle/peripheral_handle_adc.c b/src/handle/peripheral_handle_adc.c
new file mode 100644 (file)
index 0000000..7147d0e
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2018 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_handle_common.h"
+
+static bool __peripheral_handle_adc_is_creatable(int device, int channel, peripheral_info_s *info)
+{
+       pb_board_dev_s *adc = NULL;
+       peripheral_h handle;
+       GList *link;
+
+       RETV_IF(info == NULL, false);
+       RETV_IF(info->board == NULL, false);
+
+       adc = peripheral_bus_board_find_device(PB_BOARD_DEV_ADC, info->board, device, channel);
+       if (adc == NULL) {
+               _E("Not supported ADC device : %d, channel : %d", device, channel);
+               return false;
+       }
+
+       link = info->adc_list;
+       while (link) {
+               handle = (peripheral_h)link->data;
+               if (handle->type.adc.device == device && handle->type.adc.channel == channel) {
+                       _E("Resource is in use, device : %d, channel : %d", device, channel);
+                       return false;
+               }
+               link = g_list_next(link);
+       }
+
+       return true;
+}
+
+int peripheral_handle_adc_destroy(peripheral_h handle)
+{
+       RETVM_IF(handle == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid adc handle");
+
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       ret = peripheral_handle_free(handle);
+       if (ret != PERIPHERAL_ERROR_NONE)
+               _E("Failed to free adc handle");
+
+       return ret;
+}
+
+int peripheral_handle_adc_create(int device, int channel, peripheral_h *handle, gpointer user_data)
+{
+       RETVM_IF(device < 0, PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid adc device");
+       RETVM_IF(channel < 0, PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid adc channel");
+       RETVM_IF(handle == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid adc handle");
+
+       peripheral_info_s *info = (peripheral_info_s*)user_data;
+
+       peripheral_h adc_handle = NULL;
+       bool is_handle_creatable = false;
+
+       is_handle_creatable = __peripheral_handle_adc_is_creatable(device, channel, info);
+       if (is_handle_creatable == false) {
+               _E("device : %d, channel : 0x%x is not available", device, channel);
+               return PERIPHERAL_ERROR_RESOURCE_BUSY;
+       }
+
+       adc_handle = peripheral_handle_new(&info->adc_list);
+       if (adc_handle == NULL) {
+               _E("peripheral_handle_new error");
+               return PERIPHERAL_ERROR_OUT_OF_MEMORY;
+       }
+
+       adc_handle->list = &info->adc_list;
+       adc_handle->type.adc.device = device;
+       adc_handle->type.adc.channel = channel;
+
+       *handle = adc_handle;
+
+       return PERIPHERAL_ERROR_NONE;
+}
diff --git a/src/interface/peripheral_interface_adc.c b/src/interface/peripheral_interface_adc.c
new file mode 100644 (file)
index 0000000..b58afaa
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2018 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 <sys/ioctl.h>
+
+#include "peripheral_interface_adc.h"
+#include "peripheral_interface_common.h"
+
+static int __peripheral_interface_adc_fd_open(int device, int channel, int *fd_out)
+{
+       RETVM_IF(device < 0, PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid adc device");
+       RETVM_IF(channel < 0, PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid adc channel");
+       RETVM_IF(fd_out == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid fd_out for adc");
+
+       int fd;
+       char path[MAX_BUF_LEN] = {0, };
+
+       snprintf(path, MAX_BUF_LEN, "/sys/bus/iio/devices/iio:device%d/in_voltage%d_raw", device, channel);
+       fd = open(path, O_RDWR);
+       IF_ERROR_RETURN(fd < 0);
+
+       *fd_out = fd;
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int peripheral_interface_adc_fd_list_create(int device, int channel, GUnixFDList **list_out)
+{
+       RETVM_IF(device < 0, PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid adc device");
+       RETVM_IF(channel < 0, PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid adc channel");
+
+       int ret;
+
+       GUnixFDList *list = NULL;
+       int fd = -1;
+
+
+       ret = __peripheral_interface_adc_fd_open(device, channel, &fd);
+       if (ret != PERIPHERAL_ERROR_NONE) {
+               _E("Failed to open adc fd");
+       }
+
+       list = g_unix_fd_list_new();
+       if (list == NULL) {
+               _E("Failed to create adc fd list");
+               ret = PERIPHERAL_ERROR_OUT_OF_MEMORY;
+               goto out;
+       }
+
+       /* Do not change the order of the fd list */
+       g_unix_fd_list_append(list, fd, NULL);
+
+       *list_out = list;
+
+out:
+       close(fd);
+
+       return ret;
+}
+
+void peripheral_interface_adc_fd_list_destroy(GUnixFDList *list)
+{
+       if (list != NULL)
+               g_object_unref(list);
+}
index e7ddcfbe7e953d96eb6018616c9058d6c6fbdab9..00995278848924fca5c7323c867b065344941467 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016-2018 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.
 #include "peripheral_gdbus_gpio.h"
 #include "peripheral_gdbus_i2c.h"
 #include "peripheral_gdbus_pwm.h"
+#include "peripheral_gdbus_adc.h"
 #include "peripheral_gdbus_spi.h"
 #include "peripheral_gdbus_uart.h"
 
 #define PERIPHERAL_GDBUS_GPIO_PATH     "/Org/Tizen/Peripheral_io/Gpio"
 #define PERIPHERAL_GDBUS_I2C_PATH      "/Org/Tizen/Peripheral_io/I2c"
 #define PERIPHERAL_GDBUS_PWM_PATH      "/Org/Tizen/Peripheral_io/Pwm"
+#define PERIPHERAL_GDBUS_ADC_PATH      "/Org/Tizen/Peripheral_io/Adc"
 #define PERIPHERAL_GDBUS_UART_PATH     "/Org/Tizen/Peripheral_io/Uart"
 #define PERIPHERAL_GDBUS_SPI_PATH      "/Org/Tizen/Peripheral_io/Spi"
 #define PERIPHERAL_GDBUS_NAME          "org.tizen.peripheral_io"
@@ -145,6 +147,41 @@ static gboolean __pwm_init(peripheral_info_s *info)
        return true;
 }
 
+static gboolean __adc_init(peripheral_info_s *info)
+{
+       GDBusObjectManagerServer *manager;
+       gboolean ret = FALSE;
+       GError *error = NULL;
+
+       /* Add interface to default object path */
+       info->adc_skeleton = peripheral_io_gdbus_adc_skeleton_new();
+       g_signal_connect(info->adc_skeleton,
+                       "handle-open",
+                       G_CALLBACK(peripheral_gdbus_adc_open),
+                       info);
+       g_signal_connect(info->adc_skeleton,
+                       "handle-close",
+                       G_CALLBACK(peripheral_gdbus_adc_close),
+                       info);
+
+       manager = g_dbus_object_manager_server_new(PERIPHERAL_GDBUS_ADC_PATH);
+
+       /* Set connection to 'manager' */
+       g_dbus_object_manager_server_set_connection(manager, info->connection);
+
+       /* Export 'manager' interface on peripheral-io DBUS */
+       ret = g_dbus_interface_skeleton_export(
+               G_DBUS_INTERFACE_SKELETON(info->adc_skeleton),
+               info->connection, PERIPHERAL_GDBUS_ADC_PATH, &error);
+
+       if (ret == FALSE) {
+               _E("Can not skeleton_export %s", error->message);
+               g_error_free(error);
+       }
+
+       return true;
+}
+
 static gboolean __uart_init(peripheral_info_s *info)
 {
        GDBusObjectManagerServer *manager;
@@ -232,6 +269,9 @@ static void on_bus_acquired(GDBusConnection *connection,
        if (__pwm_init(info) == FALSE)
                _E("Can not signal connect");
 
+       if (__adc_init(info) == FALSE)
+               _E("Can not signal connect");
+
        if (__uart_init(info) == FALSE)
                _E("Can not signal connect");
 
index 171b1f81b3c196eb108f16d8e20355050a8ad328..c173854d8d841da81a1874db2e855751d2ed4434 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017-2018 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.
@@ -54,6 +54,8 @@ static int peripheral_bus_board_get_device_type(char *string)
                return PB_BOARD_DEV_I2C;
        else if (0 == strncmp(string, "pwm", strlen("pwm")))
                return PB_BOARD_DEV_PWM;
+       else if (0 == strncmp(string, "adc", strlen("adc")))
+               return PB_BOARD_DEV_ADC;
        else if (0 == strncmp(string, "uart", strlen("uart")))
                return PB_BOARD_DEV_UART;
        else if (0 == strncmp(string, "spi", strlen("spi")))
@@ -74,6 +76,9 @@ static void peripheral_bus_board_ini_parse_key(pb_board_dev_e type, char *string
        case PB_BOARD_DEV_PWM:
                sscanf(string, "%*50[^0-9]%d%*50[^0-9]%d", &args[0], &args[1]);
                break;
+       case PB_BOARD_DEV_ADC:
+               sscanf(string, "%*50[^0-9]%d%*50[^0-9]%d%*50[^0-9]", &args[0], &args[1]);
+               break;
        case PB_BOARD_DEV_UART:
                sscanf(string, "%*50[^0-9]%d", &args[0]);
                break;