Commit 1ae5d533 authored by Emilio Pozuelo Monfort's avatar Emilio Pozuelo Monfort Committed by Thomas Haller

bluez: add support for BlueZ 5

At this moment we only support one of BlueZ 4 and 5,
which has to be defined at build time.

Patch rewritten by Thomas Haller <thaller@redhat.com>
Signed-off-by: Thomas Haller's avatarThomas Haller <thaller@redhat.com>
parent 1013caba
......@@ -49,14 +49,6 @@ NetworkManager_LDADD = libNetworkManager.la $(top_builddir)/libgsystem.la $(LIBN
noinst_LTLIBRARIES = libNetworkManager.la
nm_sources = \
bluez-manager/nm-bluez-adapter.c \
bluez-manager/nm-bluez-adapter.h \
bluez-manager/nm-bluez-common.h \
bluez-manager/nm-bluez-device.c \
bluez-manager/nm-bluez-device.h \
bluez-manager/nm-bluez-manager.c \
bluez-manager/nm-bluez-manager.h \
\
config/nm-config.c \
config/nm-config.h \
config/nm-config-device.c \
......@@ -266,6 +258,23 @@ nm_sources = \
NetworkManagerUtils.c \
NetworkManagerUtils.h
nm_sources += \
bluez-manager/nm-bluez-common.h \
bluez-manager/nm-bluez-device.h \
bluez-manager/nm-bluez-manager.h
if WITH_BLUEZ5
nm_sources += \
bluez-manager/nm-bluez5-device.c \
bluez-manager/nm-bluez5-manager.c
else
nm_sources += \
bluez-manager/nm-bluez-adapter.h \
bluez-manager/nm-bluez-adapter.c \
bluez-manager/nm-bluez-device.c \
bluez-manager/nm-bluez-manager.c
endif
if WITH_MODEM_MANAGER_1
nm_sources += \
modem-manager/nm-modem-broadband.c \
......
......@@ -21,17 +21,31 @@
#ifndef NM_BLUEZ_COMMON_H
#define NM_BLUEZ_COMMON_H
#include <config.h>
#define BLUETOOTH_CONNECT_DUN "dun"
#define BLUETOOTH_CONNECT_NAP "nap"
#define BLUEZ_SERVICE "org.bluez"
#define BLUEZ_MANAGER_PATH "/"
#define OBJECT_MANAGER_INTERFACE "org.freedesktop.DBus.ObjectManager"
#if WITH_BLUEZ5
#define BLUEZ_ADAPTER_INTERFACE "org.bluez.Adapter1"
#define BLUEZ_DEVICE_INTERFACE "org.bluez.Device1"
#define BLUEZ_NETWORK_INTERFACE "org.bluez.Network1"
#else
#define BLUEZ_MANAGER_INTERFACE "org.bluez.Manager"
#define BLUEZ_ADAPTER_INTERFACE "org.bluez.Adapter"
#define BLUEZ_DEVICE_INTERFACE "org.bluez.Device"
#define BLUEZ_SERIAL_INTERFACE "org.bluez.Serial"
#define BLUEZ_NETWORK_INTERFACE "org.bluez.Network"
#endif /* WITH_BLUEZ */
#endif /* NM_BLUEZ_COMMON_H */
......@@ -297,6 +297,7 @@ bluez_connect_cb (DBusGProxy *proxy,
else if (!device || !strlen (device)) {
g_simple_async_result_set_error (result, G_IO_ERROR, G_IO_ERROR_FAILED,
"Invalid argument received");
g_free (device);
} else {
g_simple_async_result_set_op_res_gpointer (result,
g_strdup (device),
......
......@@ -25,6 +25,7 @@
#include <glib-object.h>
#include <gio/gio.h>
#include <config.h>
#include "nm-connection.h"
#include "nm-connection-provider.h"
......@@ -58,7 +59,11 @@ typedef struct {
GType nm_bluez_device_get_type (void);
NMBluezDevice *nm_bluez_device_new (const char *path, NMConnectionProvider *provider);
NMBluezDevice *nm_bluez_device_new (const char *path
#if ! WITH_BLUEZ5
, NMConnectionProvider *provider
#endif
);
const char *nm_bluez_device_get_path (NMBluezDevice *self);
......
......@@ -25,6 +25,7 @@
#include <glib.h>
#include <glib-object.h>
#include <config.h>
#include "nm-connection-provider.h"
G_BEGIN_DECLS
......@@ -60,7 +61,13 @@ typedef struct {
GType nm_bluez_manager_get_type (void);
NMBluezManager *nm_bluez_manager_get (NMConnectionProvider *provider);
NMBluezManager *nm_bluez_manager_get (
#if WITH_BLUEZ5
void
#else
NMConnectionProvider *provider
#endif
);
void nm_bluez_manager_query_devices (NMBluezManager *manager);
......
This diff is collapsed.
This diff is collapsed.
......@@ -4452,7 +4452,11 @@ nm_manager_new (NMSettings *settings,
G_CALLBACK (rfkill_manager_rfkill_changed_cb),
singleton);
priv->bluez_mgr = nm_bluez_manager_get (NM_CONNECTION_PROVIDER (priv->settings));
priv->bluez_mgr = nm_bluez_manager_get (
#if ! WITH_BLUEZ5
NM_CONNECTION_PROVIDER (priv->settings)
#endif
);
g_signal_connect (priv->bluez_mgr,
NM_BLUEZ_MANAGER_BDADDR_ADDED,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment