From: seungku kim Date: Mon, 8 Jun 2015 11:06:18 +0000 (+0900) Subject: 3.0 specific patch: fix build error X-Git-Tag: submit/tizen_wearable/20150609.051121 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Ftags%2Fsubmit%2Ftizen_wearable%2F20150609.051121;p=platform%2Fcore%2Fconnectivity%2Fbluetooth-frwk.git 3.0 specific patch: fix build error Change-Id: I6c5ea3c9272e68fa2de2509375d8457d7ab21a3a --- diff --git a/bt-api/bt-common.c b/bt-api/bt-common.c index 59341f6..9d22e43 100644 --- a/bt-api/bt-common.c +++ b/bt-api/bt-common.c @@ -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 */ diff --git a/bt-core/bt-core-adapter.c b/bt-core/bt-core-adapter.c index e85c2cb..a7707b0 100644 --- a/bt-core/bt-core-adapter.c +++ b/bt-core/bt-core-adapter.c @@ -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; diff --git a/bt-core/include/bt-core-adapter.h b/bt-core/include/bt-core-adapter.h index 54b7fc7..57703dc 100644 --- a/bt-core/include/bt-core-adapter.h +++ b/bt-core/include/bt-core-adapter.h @@ -33,6 +33,15 @@ 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, diff --git a/bt-core/include/bt-core-dbus-handler.h b/bt-core/include/bt-core-dbus-handler.h index 95695da..8c9b7da 100644 --- a/bt-core/include/bt-core-dbus-handler.h +++ b/bt-core/include/bt-core-dbus-handler.h @@ -28,6 +28,9 @@ #include #include #include +#include +#include +#include #include #include