diff options
author | Dan Williams <dcbw@redhat.com> | 2014-06-16 11:04:06 -0500 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2014-10-16 13:24:31 +0200 |
commit | 616d032c62f0d02be7ec29ff012c45c284f397a8 (patch) | |
tree | 79a9e895f19694532e425a5eb49d37bef05a008d | |
parent | 2a10b58fad810aca1a041cd37b00241ace9be0c7 (diff) | |
download | NetworkManager-616d032c62f0d02be7ec29ff012c45c284f397a8.tar.gz |
bluez: split out errors
We'll use them from more places than nm nm-bt-device.c in the future.
(cherry picked from commit 5254ac456ecd2f5ef76b0a1937f52b75e319f204)
-rw-r--r-- | src/devices/bluetooth/Makefile.am | 4 | ||||
-rw-r--r-- | src/devices/bluetooth/nm-bt-error.c | 33 | ||||
-rw-r--r-- | src/devices/bluetooth/nm-bt-error.h | 35 | ||||
-rw-r--r-- | src/devices/bluetooth/nm-device-bt.c | 13 | ||||
-rw-r--r-- | src/devices/bluetooth/nm-device-bt.h | 6 |
5 files changed, 73 insertions, 18 deletions
diff --git a/src/devices/bluetooth/Makefile.am b/src/devices/bluetooth/Makefile.am index 639a1ad7a2..4342d4bcdf 100644 --- a/src/devices/bluetooth/Makefile.am +++ b/src/devices/bluetooth/Makefile.am @@ -24,7 +24,7 @@ AM_CPPFLAGS = \ GLIB_GENERATED = nm-bt-enum-types.h nm-bt-enum-types.c GLIB_MKENUMS_H_FLAGS = --identifier-prefix NM GLIB_MKENUMS_C_FLAGS = --identifier-prefix NM -nm_bt_enum_types_sources = $(srcdir)/nm-device-bt.h +nm_bt_enum_types_sources = $(srcdir)/nm-bt-error.h nm-device-bt-glue.h: $(top_srcdir)/introspection/nm-device-bt.xml dbus-binding-tool --prefix=nm_device_bt --mode=glib-server --output=$@ $< @@ -47,6 +47,8 @@ libnm_device_plugin_bluetooth_la_SOURCES = \ nm-bluez4-manager.h \ nm-bluez5-manager.c \ nm-bluez5-manager.h \ + nm-bt-error.h \ + nm-bt-error.c \ \ nm-device-bt.c \ nm-device-bt.h \ diff --git a/src/devices/bluetooth/nm-bt-error.c b/src/devices/bluetooth/nm-bt-error.c new file mode 100644 index 0000000000..d014a107c3 --- /dev/null +++ b/src/devices/bluetooth/nm-bt-error.c @@ -0,0 +1,33 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* NetworkManager -- Network link manager + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Copyright (C) 2014 Red Hat, Inc. + */ + +#include <glib.h> +#include "nm-bt-error.h" + +GQuark +nm_bt_error_quark (void) +{ + static GQuark quark = 0; + if (!quark) + quark = g_quark_from_static_string ("nm-bt-error"); + return quark; +} + + diff --git a/src/devices/bluetooth/nm-bt-error.h b/src/devices/bluetooth/nm-bt-error.h new file mode 100644 index 0000000000..fa3a95705e --- /dev/null +++ b/src/devices/bluetooth/nm-bt-error.h @@ -0,0 +1,35 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* NetworkManager -- Network link manager + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Copyright (C) 2014 Red Hat, Inc. + */ + +#ifndef _NM_BLUEZ5_ERROR_H_ +#define _NM_BLUEZ5_ERROR_H_ + +typedef enum { + NM_BT_ERROR_CONNECTION_NOT_BT = 0, /*< nick=ConnectionNotBt >*/ + NM_BT_ERROR_CONNECTION_INVALID, /*< nick=ConnectionInvalid >*/ + NM_BT_ERROR_CONNECTION_INCOMPATIBLE, /*< nick=ConnectionIncompatible >*/ + NM_BT_ERROR_DUN_CONNECT_FAILED, /*< nick=DunConnectFailed >*/ +} NMBtError; + +#define NM_BT_ERROR (nm_bt_error_quark ()) +GQuark nm_bt_error_quark (void); + +#endif /* _NM_BT_ERROR_H_ */ + diff --git a/src/devices/bluetooth/nm-device-bt.c b/src/devices/bluetooth/nm-device-bt.c index 6e1a399d6b..ca3deb29b9 100644 --- a/src/devices/bluetooth/nm-device-bt.c +++ b/src/devices/bluetooth/nm-device-bt.c @@ -46,6 +46,8 @@ #include "NetworkManagerUtils.h" #include "nm-bt-enum-types.h" #include "nm-utils.h" +#include "nm-bt-error.h" +#include "nm-bt-enum-types.h" #define MM_OLD_DBUS_SERVICE "org.freedesktop.ModemManager" #define MM_NEW_DBUS_SERVICE "org.freedesktop.ModemManager1" @@ -94,17 +96,6 @@ enum { static guint signals[LAST_SIGNAL] = { 0 }; -#define NM_BT_ERROR (nm_bt_error_quark ()) - -static GQuark -nm_bt_error_quark (void) -{ - static GQuark quark = 0; - if (!quark) - quark = g_quark_from_static_string ("nm-bt-error"); - return quark; -} - guint32 nm_device_bt_get_capabilities (NMDeviceBt *self) { g_return_val_if_fail (NM_IS_DEVICE_BT (self), NM_BT_CAPABILITY_NONE); diff --git a/src/devices/bluetooth/nm-device-bt.h b/src/devices/bluetooth/nm-device-bt.h index 83732bc09e..ac5b115db5 100644 --- a/src/devices/bluetooth/nm-device-bt.h +++ b/src/devices/bluetooth/nm-device-bt.h @@ -34,12 +34,6 @@ G_BEGIN_DECLS #define NM_IS_DEVICE_BT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_BT)) #define NM_DEVICE_BT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_BT, NMDeviceBtClass)) -typedef enum { - NM_BT_ERROR_CONNECTION_NOT_BT = 0, /*< nick=ConnectionNotBt >*/ - NM_BT_ERROR_CONNECTION_INVALID, /*< nick=ConnectionInvalid >*/ - NM_BT_ERROR_CONNECTION_INCOMPATIBLE, /*< nick=ConnectionIncompatible >*/ -} NMBtError; - #define NM_DEVICE_BT_NAME "name" #define NM_DEVICE_BT_CAPABILITIES "bt-capabilities" #define NM_DEVICE_BT_DEVICE "bt-device" |