3.0 specific patch: fix build error 28/40728/1 submit/tizen_mobile/20150609.051101 submit/tizen_tv/20150609.051113 submit/tizen_wearable/20150609.051121
authorseungku kim <seungku.kim@samsung.com>
Mon, 8 Jun 2015 11:06:18 +0000 (20:06 +0900)
committerseungku kim <seungku.kim@samsung.com>
Mon, 8 Jun 2015 11:06:18 +0000 (20:06 +0900)
Change-Id: I6c5ea3c9272e68fa2de2509375d8457d7ab21a3a

bt-api/bt-common.c
bt-core/bt-core-adapter.c
bt-core/include/bt-core-adapter.h
bt-core/include/bt-core-dbus-handler.h

index 59341f6..9d22e43 100644 (file)
@@ -1673,8 +1673,6 @@ BT_EXPORT_API int bluetooth_register_callback(bluetooth_cb_func_ptr callback_ptr
                return ret;
        }
 
-       _bt_generate_cookie();
-
        _bt_set_user_data(BT_COMMON, (void *)callback_ptr, user_data);
 
        /* Register All events */
index e85c2cb..a7707b0 100644 (file)
@@ -41,6 +41,8 @@ static gboolean is_recovery_mode = FALSE;
 static int bt_status_before[BT_MODE_MAX] = { VCONFKEY_BT_STATUS_OFF, };
 static int bt_le_status_before[BT_MODE_MAX] = { 0, };
 
+static DBusGConnection *conn = NULL;
+
 static void __bt_core_set_status(bt_status_t status)
 {
        adapter_status = status;
@@ -136,6 +138,53 @@ static int __execute_command(const char *cmd, char *const arg_list[])
        return 0;
 }
 
+static DBusGProxy *_bt_get_connman_proxy(void)
+{
+       DBusGProxy *proxy;
+
+       if (conn == NULL) {
+               conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL);
+               retv_if(conn == NULL, NULL);
+       }
+
+       proxy = dbus_g_proxy_new_for_name(conn,
+                       CONNMAN_DBUS_NAME,
+                       CONNMAN_BLUETOOTH_TECHNOLOGY_PATH,
+                       CONNMAN_BLUETOTOH_TECHNOLOGY_INTERFACE);
+       retv_if(proxy == NULL, NULL);
+
+       return proxy;
+}
+
+static int _bt_power_adapter(gboolean powered)
+{
+       GValue state = { 0 };
+       GError *error = NULL;
+       DBusGProxy *proxy;
+
+       proxy = _bt_get_connman_proxy();
+       retv_if(proxy == NULL, BLUETOOTH_ERROR_INTERNAL);
+
+       g_value_init(&state, G_TYPE_BOOLEAN);
+       g_value_set_boolean(&state, powered);
+
+       BT_DBG("set power property state: %d to connman", powered);
+
+       dbus_g_proxy_call(proxy, "SetProperty", &error,
+                               G_TYPE_STRING, "Powered",
+                               G_TYPE_VALUE, &state,
+                               G_TYPE_INVALID, G_TYPE_INVALID);
+
+       if (error != NULL) {
+               BT_ERR("Powered set err: \n [%s]", error->message);
+               g_error_free(error);
+               g_value_unset(&state);
+               return BLUETOOTH_ERROR_INTERNAL;
+       }
+       return BLUETOOTH_ERROR_NONE;
+}
+
+
 int _bt_enable_adapter(void)
 {
        int ret;
index 54b7fc7..57703dc 100644 (file)
 extern "C" {
 #endif
 
+#define CONNMAN_DBUS_NAME "net.connman"
+#define CONNMAN_BLUETOOTH_TECHNOLOGY_PATH "/net/connman/technology/bluetooth"
+#define CONNMAN_BLUETOTOH_TECHNOLOGY_INTERFACE "net.connman.Technology"
+
+#define BT_CORE_NAME "org.projectx.bt_core"
+#define BT_CORE_PATH "/org/projectx/bt_core"
+
+#define BT_CORE_TYPE (bt_core_get_type())
+
 typedef enum {
        BT_DEACTIVATED,
        BT_ACTIVATED,
index 95695da..8c9b7da 100644 (file)
@@ -28,6 +28,9 @@
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <dlog.h>
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+#include <dbus/dbus-glib-lowlevel.h>
 #include <glib.h>
 #include <gio/gio.h>