device: don't include header of bluetooth plugin in nm-device.h

The plugins may use stuff from core, but not the other way around.
Including "bluetooth/nm-bluez-common.h" is wrong.

The UUID argument is always "nap" in the NAP case. We don't need
the flexibility that it might be anything else. Just drop it.

As far as NMDevice is concerned, it anyway wouldn't (or shouldn't
know what the uuid is. It says register, and NMBluez5Manager should
figure out the details.
This commit is contained in:
Thomas Haller 2017-05-31 22:55:03 +02:00 committed by Lubomir Rintel
parent 29a0876db6
commit 1be01bd51f
3 changed files with 7 additions and 10 deletions

View file

@ -89,7 +89,6 @@ static void device_usable (NMBluezDevice *device, GParamSpec *pspec, NMBluez5Man
typedef struct {
char *path;
char *addr;
char *uuid;
NMDevice *device;
CList network_servers;
} NetworkServer;
@ -126,7 +125,7 @@ _network_server_unregister (NMBluez5Manager *self, NetworkServer *network_server
{
NMBluez5ManagerPrivate *priv = NM_BLUEZ5_MANAGER_GET_PRIVATE (self);
if (!network_server->uuid) {
if (!network_server->device) {
/* Not connected. */
return;
}
@ -140,12 +139,11 @@ _network_server_unregister (NMBluez5Manager *self, NetworkServer *network_server
network_server->path,
NM_BLUEZ5_NETWORK_SERVER_INTERFACE,
"Unregister",
g_variant_new ("(s)", network_server->uuid),
g_variant_new ("(s)", BLUETOOTH_CONNECT_NAP),
NULL,
G_DBUS_CALL_FLAGS_NONE,
-1, NULL, NULL, NULL);
g_clear_pointer (&network_server->uuid, g_free);
g_clear_object (&network_server->device);
}
@ -170,7 +168,8 @@ network_server_is_available (const NMBtVTableNetworkServer *vtable,
static gboolean
network_server_register_bridge (const NMBtVTableNetworkServer *vtable,
const char *addr, const char *uuid, NMDevice *device)
const char *addr,
NMDevice *device)
{
NMBluez5Manager *self = NETWORK_SERVER_VTABLE_GET_NM_BLUEZ5_MANAGER (vtable);
NMBluez5ManagerPrivate *priv = NM_BLUEZ5_MANAGER_GET_PRIVATE (self);
@ -191,13 +190,12 @@ network_server_register_bridge (const NMBtVTableNetworkServer *vtable,
network_server->path,
NM_BLUEZ5_NETWORK_SERVER_INTERFACE,
"Register",
g_variant_new ("(ss)", uuid, nm_device_get_iface (device)),
g_variant_new ("(ss)", BLUETOOTH_CONNECT_NAP, nm_device_get_iface (device)),
NULL,
G_DBUS_CALL_FLAGS_NONE,
-1, NULL, NULL, NULL);
network_server->device = g_object_ref (device);
network_server->uuid = g_strdup (uuid);
return TRUE;
}

View file

@ -70,7 +70,6 @@
#include "nm-arping-manager.h"
#include "nm-connectivity.h"
#include "nm-dbus-interface.h"
#include "bluetooth/nm-bluez-common.h"
#include "nm-device-logging.h"
_LOG_DECLARE_SELF (NMDevice);
@ -4405,7 +4404,6 @@ bt_network_server_register (NMDevice *self)
return FALSE;
return nm_bt_vtable_network_server->register_bridge (nm_bt_vtable_network_server,
nm_setting_bluetooth_get_bdaddr (s_bt),
BLUETOOTH_CONNECT_NAP,
self);
}

View file

@ -710,7 +710,8 @@ struct _NMBtVTableNetworkServer {
gboolean (*is_available) (const NMBtVTableNetworkServer *vtable,
const char *addr);
gboolean (*register_bridge) (const NMBtVTableNetworkServer *vtable,
const char *addr, const char *uuid, NMDevice *device);
const char *addr,
NMDevice *device);
gboolean (*unregister_bridge) (const NMBtVTableNetworkServer *vtable,
NMDevice *device);
};