enable/disable bluetooth through ConnMan instead of BlueZ 20/30820/2 accepted/tizen/common/20141126.215848 accepted/tizen/mobile/20141128.013213 submit/tizen/20141126.105856
authorCorentin Lecouvey <corentin.lecouvey@open.eurogiciel.org>
Tue, 25 Nov 2014 14:05:58 +0000 (15:05 +0100)
committerCorentin Lecouvey <corentin.lecouvey@open.eurogiciel.org>
Tue, 25 Nov 2014 14:10:56 +0000 (15:10 +0100)
Bluetooth can not be enabled on Tizen Common because of RFkill
blocks bluetooth. ConnMan manages RFkill and so call its DBus API
to enable/disable bluetooth adapter fixes this problem.

Change-Id: I277bf12536b6ae95a2d4a4a086b3d2dd63b69f40
Signed-off-by: Corentin Lecouvey <corentin.lecouvey@open.eurogiciel.org>
bt-core/bt_core.c
bt-core/bt_core.h
packaging/bluetooth-frwk.spec

index d3b518f..bb7d943 100644 (file)
@@ -114,18 +114,19 @@ static GError *bt_core_error(BtCoreError error, const char *err_msg)
        return g_error_new(BT_CORE_ERROR, error, err_msg, NULL);
 }
 
-static DBusGProxy *_bt_get_adapter_proxy(void)
+static DBusGProxy *_bt_get_connman_proxy(void)
 {
        DBusGProxy *proxy;
-       char *adapter_path = NULL;
 
        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, BT_BLUEZ_NAME,
-                       BT_BLUEZ_HCI_PATH, BT_PROPERTIES_INTERFACE);
+       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;
@@ -137,16 +138,15 @@ static int _bt_power_adapter(gboolean powered)
        GError *error = NULL;
        DBusGProxy *proxy;
 
-       proxy = _bt_get_adapter_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("send power state: %d to bluez", powered);
+       BT_DBG("set power property state: %d to connman", powered);
 
-       dbus_g_proxy_call(proxy, "Set", &error,
-                               G_TYPE_STRING, BT_ADAPTER_INTERFACE,
+       dbus_g_proxy_call(proxy, "SetProperty", &error,
                                G_TYPE_STRING, "Powered",
                                G_TYPE_VALUE, &state,
                                G_TYPE_INVALID, G_TYPE_INVALID);
index 0aeaf64..4194b17 100644 (file)
@@ -48,10 +48,9 @@ extern "C" {
                } \
        } while (0)
 
-#define BT_BLUEZ_NAME "org.bluez"
-#define BT_BLUEZ_HCI_PATH "/org/bluez/hci0"
-#define BT_ADAPTER_INTERFACE "org.bluez.Adapter1"
-#define BT_PROPERTIES_INTERFACE "org.freedesktop.DBus.Properties"
+#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"
index 4959ee9..597246a 100644 (file)
@@ -71,6 +71,7 @@ This package is Bluetooth Service daemon to manage BT services.
 Summary:    Bluetooth Core daemon
 Group:      Network & Connectivity/Bluetooth
 Requires:   %{name} = %{version}-%{release}
+Requires:   connman
 
 %description core
 This package is Bluetooth core daemon to manage activation / deactivation.