Remove dbus-glib-1 dependency
[platform/core/api/serial.git] / src / serial.c
index 1772bcc..7c5d783 100644 (file)
@@ -21,8 +21,6 @@
 #include <stdio.h>
 #include <stdbool.h>
 #include <dbus/dbus.h>
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-lowlevel.h>
 #include <unistd.h>
 #include <sys/un.h>
 #include <sys/socket.h>
@@ -231,7 +229,6 @@ int serial_create(serial_h * serial)
 {
        DBG("%s\n", __FUNCTION__);
 
-       GError *error = NULL;
        DBusError dbus_error;
        serial_s *pHandle = NULL;
 
@@ -245,14 +242,12 @@ int serial_create(serial_h * serial)
        g_type_init();
 #endif
 
-       pHandle->client_bus = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
-       if (error) {
-               ERR("Couldn't connect to the System bus[%s]", error->message);
-               g_error_free(error);
+       dbus_connection = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
+       if (!dbus_connection) {
+               ERR("Couldn't connect to the System bus");
                g_free(pHandle);
                return SERIAL_ERROR_OPERATION_FAILED;
        }
-       dbus_connection = dbus_g_connection_get_connection(pHandle->client_bus);
 
        /* Add the filter for network client functions */
        dbus_error_init(&dbus_error);
@@ -265,6 +260,8 @@ int serial_create(serial_h * serial)
                return SERIAL_ERROR_OPERATION_FAILED;
        }
 
+       pHandle->client_bus = dbus_connection;
+
        *serial = (serial_h) pHandle;
 
        return SERIAL_ERROR_NONE;
@@ -322,7 +319,7 @@ int serial_destroy(serial_h serial)
        }
 
        if (pHandle->client_bus != NULL) {
-               dbus_g_connection_unref(pHandle->client_bus);
+               dbus_connection_unref(pHandle->client_bus);
                pHandle->client_bus = NULL;
        }