bluez: split out errors

We'll use them from more places than nm nm-bt-device.c in the future.
This commit is contained in:
Dan Williams
2014-06-16 11:04:06 -05:00
committed by Thomas Haller
parent ec84e4f00a
commit 5254ac456e
5 changed files with 73 additions and 18 deletions

View File

@@ -20,7 +20,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=$@ $<
@@ -43,6 +43,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 \

View File

@@ -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;
}

View File

@@ -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_ */

View File

@@ -44,6 +44,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_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);

View File

@@ -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"