diff options
44 files changed, 87 insertions, 130 deletions
diff --git a/audio/Makefile.am b/audio/Makefile.am index 841617ea..21d48860 100644 --- a/audio/Makefile.am +++ b/audio/Makefile.am @@ -14,7 +14,7 @@ libaudio_la_SOURCES = main.c \ libaudio_la_LDFLAGS = -module -avoid-version -export-symbols-regex bluetooth_plugin_desc LDADD = $(top_builddir)/common/libhelper.a \ - @GLIB_LIBS@ @DBUS_LIBS@ @BLUEZ_LIBS@ + @GDBUS_LIBS@ @GLIB_LIBS@ @DBUS_LIBS@ @BLUEZ_LIBS@ if ALSA alsadir = $(libdir)/alsa-lib @@ -52,7 +52,7 @@ libgstbluetooth_la_CFLAGS = @GSTREAMER_CFLAGS@ @SBC_CFLAGS@ endif endif -AM_CFLAGS = @BLUEZ_CFLAGS@ @DBUS_CFLAGS@ @GLIB_CFLAGS@ +AM_CFLAGS = @BLUEZ_CFLAGS@ @DBUS_CFLAGS@ @GLIB_CFLAGS@ @GDBUS_CFLAGS@ INCLUDES = -I$(top_srcdir)/common -I$(top_srcdir)/hcid -I$(top_srcdir)/sdpd diff --git a/audio/avdtp.c b/audio/avdtp.c index 3c35bfc1..300898e2 100644 --- a/audio/avdtp.c +++ b/audio/avdtp.c @@ -34,12 +34,12 @@ #include <signal.h> #include <netinet/in.h> -#include <glib.h> - #include <bluetooth/bluetooth.h> #include <bluetooth/sdp.h> -#include "dbus.h" +#include <glib.h> +#include <dbus/dbus.h> + #include "dbus-service.h" #include "logging.h" diff --git a/audio/control.c b/audio/control.c index a6976d05..cffcf517 100644 --- a/audio/control.c +++ b/audio/control.c @@ -37,15 +37,14 @@ #include <fcntl.h> #include <netinet/in.h> -#include <glib.h> -#include <dbus/dbus.h> - #include <bluetooth/bluetooth.h> #include <bluetooth/sdp.h> #include <bluetooth/sdp_lib.h> #include <bluetooth/l2cap.h> -#include "dbus.h" +#include <glib.h> +#include <dbus/dbus.h> + #include "dbus-helper.h" #include "dbus-service.h" #include "logging.h" diff --git a/audio/device.c b/audio/device.c index 0debe220..c385c7ca 100644 --- a/audio/device.c +++ b/audio/device.c @@ -32,16 +32,15 @@ #include <sys/stat.h> #include <netinet/in.h> -#include <glib.h> -#include <dbus/dbus.h> - #include <bluetooth/bluetooth.h> #include <bluetooth/hci.h> #include <bluetooth/hci_lib.h> #include <bluetooth/sdp.h> #include <bluetooth/sdp_lib.h> -#include "dbus.h" +#include <glib.h> +#include <dbus/dbus.h> + #include "dbus-helper.h" #include "logging.h" #include "textfile.h" diff --git a/audio/headset.c b/audio/headset.c index 859a87ba..2d635110 100644 --- a/audio/headset.c +++ b/audio/headset.c @@ -47,10 +47,8 @@ #include <bluetooth/sdp_lib.h> #include <glib.h> - #include <dbus/dbus.h> -#include "dbus.h" #include "dbus-helper.h" #include "logging.h" #include "device.h" diff --git a/audio/main.c b/audio/main.c index 5b4e395b..ef606223 100644 --- a/audio/main.c +++ b/audio/main.c @@ -31,8 +31,7 @@ #include <bluetooth/bluetooth.h> #include <glib.h> - -#include "dbus.h" +#include <dbus/dbus.h> #include "plugin.h" #include "dbus-service.h" diff --git a/audio/sink.c b/audio/sink.c index b44f8de6..b755759d 100644 --- a/audio/sink.c +++ b/audio/sink.c @@ -29,12 +29,11 @@ #include <stdint.h> #include <errno.h> +#include <bluetooth/bluetooth.h> + #include <glib.h> #include <dbus/dbus.h> -#include <bluetooth/bluetooth.h> - -#include "dbus.h" #include "dbus-helper.h" #include "logging.h" diff --git a/common/Makefile.am b/common/Makefile.am index a90df324..5352d34f 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -2,9 +2,9 @@ noinst_LIBRARIES = libhelper.a libhelper_a_SOURCES = oui.h oui.c textfile.h textfile.c \ - logging.h logging.c error.h error.c dbus.h dbus.c \ - dbus-helper.h dbus-helper.c glib-helper.h glib-helper.c \ - sdp-xml.h sdp-xml.c sdp-glib.c + logging.h logging.c error.h error.c \ + dbus-helper.h dbus-helper.c \ + glib-helper.h glib-helper.c sdp-xml.h sdp-xml.c sdp-glib.c noinst_PROGRAMS = test_textfile diff --git a/common/dbus-helper.h b/common/dbus-helper.h index 57c3d09b..6c3c3a89 100644 --- a/common/dbus-helper.h +++ b/common/dbus-helper.h @@ -20,8 +20,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * */ + #include <stdarg.h> -#include <dbus.h> +#include <dbus/dbus.h> #define DBUS_TYPE_STRING_ARRAY_AS_STRING (DBUS_TYPE_ARRAY_AS_STRING DBUS_TYPE_STRING_AS_STRING) #define DBUS_TYPE_BYTE_ARRAY_AS_STRING (DBUS_TYPE_ARRAY_AS_STRING DBUS_TYPE_BYTE_AS_STRING) @@ -93,3 +94,14 @@ dbus_bool_t dbus_connection_emit_property_changed(DBusConnection *conn, const char *interface, const char *name, int type, void *value); + +static inline DBusHandlerResult send_message_and_unref(DBusConnection *conn, + DBusMessage *msg) +{ + if (msg) { + dbus_connection_send(conn, msg, NULL); + dbus_message_unref(msg); + } + + return DBUS_HANDLER_RESULT_HANDLED; +} diff --git a/common/dbus.h b/common/dbus.h deleted file mode 100644 index 5976a479..00000000 --- a/common/dbus.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * - * BlueZ - Bluetooth protocol stack for Linux - * - * Copyright (C) 2004-2008 Marcel Holtmann <marcel@holtmann.org> - * - * - * 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 St, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -#ifndef __H_BLUEZ_DBUS_H__ -#define __H_BLUEZ_DBUS_H__ - -#include <dbus/dbus.h> -#include <glib.h> - -typedef void (*name_cb_t)(const char *name, void *user_data); - -guint name_listener_add(DBusConnection *connection, const char *name, - name_cb_t func, void *user_data); -int name_listener_remove(DBusConnection *connection, const char *name, - name_cb_t func, void *user_data); -gboolean name_listener_id_remove(guint id); -int name_listener_indicate_disconnect(DBusConnection *connection); - -static inline DBusHandlerResult send_message_and_unref(DBusConnection *conn, DBusMessage *msg) -{ - if (msg) { - dbus_connection_send(conn, msg, NULL); - dbus_message_unref(msg); - } - - return DBUS_HANDLER_RESULT_HANDLED; -} - -#endif /* __H_BLUEZ_DBUS_H__ */ diff --git a/daemon/database.c b/daemon/database.c index 23c9381c..b7d5562d 100644 --- a/daemon/database.c +++ b/daemon/database.c @@ -36,8 +36,9 @@ #include <dbus/dbus.h> +#include <gdbus.h> + #include "dbus-helper.h" -#include "dbus.h" #include "sdp-xml.h" #include "logging.h" diff --git a/daemon/main.c b/daemon/main.c index 7479d25e..0c735c35 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -41,7 +41,6 @@ #include "dbus-helper.h" -#include "dbus.h" #include "logging.h" #include "sdpd.h" diff --git a/gdbus/Makefile.am b/gdbus/Makefile.am index 0a481277..937b1d7f 100644 --- a/gdbus/Makefile.am +++ b/gdbus/Makefile.am @@ -1,7 +1,7 @@ noinst_LTLIBRARIES = libgdbus.la -libgdbus_la_SOURCES = gdbus.h mainloop.c +libgdbus_la_SOURCES = gdbus.h mainloop.c watch.c AM_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ diff --git a/gdbus/gdbus.h b/gdbus/gdbus.h index a9f2aa51..d1902a52 100644 --- a/gdbus/gdbus.h +++ b/gdbus/gdbus.h @@ -40,6 +40,15 @@ gboolean g_dbus_set_disconnect_function(DBusConnection *connection, GDBusDisconnectFunction function, void *user_data, DBusFreeFunction destroy); +typedef void (*name_cb_t)(const char *name, void *user_data); + +guint name_listener_add(DBusConnection *connection, const char *name, + name_cb_t func, void *user_data); +int name_listener_remove(DBusConnection *connection, const char *name, + name_cb_t func, void *user_data); +gboolean name_listener_id_remove(guint id); +int name_listener_indicate_disconnect(DBusConnection *connection); + #ifdef __cplusplus } #endif diff --git a/common/dbus.c b/gdbus/watch.c index 4ea56c9f..80be3a6a 100644 --- a/common/dbus.c +++ b/gdbus/watch.c @@ -26,27 +26,16 @@ #endif #include <stdio.h> -#include <errno.h> -#include <fcntl.h> -#include <unistd.h> #include <string.h> -#include <stdlib.h> -#include <stdint.h> #include <glib.h> - #include <dbus/dbus.h> -#ifdef NEED_DBUS_WATCH_GET_UNIX_FD -#define dbus_watch_get_unix_fd dbus_watch_get_fd -#endif - -#ifdef HAVE_DBUS_GLIB -#include <dbus/dbus-glib-lowlevel.h> -#endif +#include "gdbus.h" -#include "dbus.h" -#include "logging.h" +#define info(fmt...) +#define error(fmt...) +#define debug(fmt...) static guint listener_id = 0; static GSList *name_listeners = NULL; diff --git a/hcid/adapter.c b/hcid/adapter.c index 4be0f914..4bc7245e 100644 --- a/hcid/adapter.c +++ b/hcid/adapter.c @@ -48,8 +48,9 @@ #include <dbus/dbus.h> +#include <gdbus.h> + #include "hcid.h" -#include "dbus.h" #include "adapter.h" #include "device.h" diff --git a/hcid/agent.c b/hcid/agent.c index 772a56ee..e7bf7d96 100644 --- a/hcid/agent.c +++ b/hcid/agent.c @@ -41,7 +41,8 @@ #include <dbus/dbus.h> -#include "dbus.h" +#include <gdbus.h> + #include "dbus-helper.h" #include "hcid.h" #include "dbus-common.h" diff --git a/hcid/dbus-common.c b/hcid/dbus-common.c index 7aa7b6d1..7a28555d 100644 --- a/hcid/dbus-common.c +++ b/hcid/dbus-common.c @@ -52,7 +52,6 @@ #include <gdbus.h> #include "hcid.h" -#include "dbus.h" #include "dbus-helper.h" #include "dbus-error.h" #include "manager.h" diff --git a/hcid/dbus-database.c b/hcid/dbus-database.c index 9519975e..370b7658 100644 --- a/hcid/dbus-database.c +++ b/hcid/dbus-database.c @@ -40,7 +40,8 @@ #include <dbus/dbus.h> -#include "dbus.h" +#include <gdbus.h> + #include "dbus-helper.h" #include "hcid.h" #include "sdpd.h" diff --git a/hcid/dbus-error.c b/hcid/dbus-error.c index 20a55c5c..876082a4 100644 --- a/hcid/dbus-error.c +++ b/hcid/dbus-error.c @@ -34,7 +34,7 @@ #include <bluetooth/sdp.h> #include "hcid.h" -#include "dbus.h" +#include "dbus-helper.h" #include "dbus-common.h" #include "dbus-error.h" #include "error.h" diff --git a/hcid/dbus-hci.c b/hcid/dbus-hci.c index 2d21c905..ec4e0f50 100644 --- a/hcid/dbus-hci.c +++ b/hcid/dbus-hci.c @@ -45,8 +45,9 @@ #include <dbus/dbus.h> +#include <gdbus.h> + #include "hcid.h" -#include "dbus.h" #include "textfile.h" #include "manager.h" #include "adapter.h" diff --git a/hcid/dbus-sdp.c b/hcid/dbus-sdp.c index eceb889d..0b3bc85e 100644 --- a/hcid/dbus-sdp.c +++ b/hcid/dbus-sdp.c @@ -49,7 +49,8 @@ #include <dbus/dbus.h> -#include "dbus.h" +#include <gdbus.h> + #include "dbus-helper.h" #include "hcid.h" #include "textfile.h" diff --git a/hcid/dbus-security.c b/hcid/dbus-security.c index 6b680c70..2e4a8bfe 100644 --- a/hcid/dbus-security.c +++ b/hcid/dbus-security.c @@ -42,9 +42,9 @@ #include <dbus/dbus.h> -#include "adapter.h" +#include <gdbus.h> -#include "dbus.h" +#include "adapter.h" #include "dbus-helper.h" #include "hcid.h" #include "dbus-common.h" diff --git a/hcid/dbus-service.c b/hcid/dbus-service.c index 192ff738..59228a9d 100644 --- a/hcid/dbus-service.c +++ b/hcid/dbus-service.c @@ -45,7 +45,6 @@ #include <dbus/dbus.h> -#include "dbus.h" #include "dbus-helper.h" #include "hcid.h" #include "server.h" diff --git a/hcid/dbus-test.c b/hcid/dbus-test.c index 37c5c2be..d683a901 100644 --- a/hcid/dbus-test.c +++ b/hcid/dbus-test.c @@ -38,7 +38,8 @@ #include <dbus/dbus.h> -#include "dbus.h" +#include <gdbus.h> + #include "dbus-helper.h" #include "hcid.h" #include "dbus-common.h" diff --git a/hcid/manager.c b/hcid/manager.c index c4288278..0d438217 100644 --- a/hcid/manager.c +++ b/hcid/manager.c @@ -43,10 +43,11 @@ #include <dbus/dbus.h> +#include <gdbus.h> + #include "hcid.h" #include "sdpd.h" #include "adapter.h" -#include "dbus.h" #include "dbus-helper.h" #include "dbus-common.h" #include "error.h" diff --git a/hcid/plugin.c b/hcid/plugin.c index 2a8f4375..f99966bf 100644 --- a/hcid/plugin.c +++ b/hcid/plugin.c @@ -34,10 +34,8 @@ #include <bluetooth/bluetooth.h> -#include "dbus.h" #include "logging.h" -#include "dbus-service.h" #include "plugin.h" static GSList *plugins = NULL; diff --git a/input/Makefile.am b/input/Makefile.am index 52a46a74..a514b629 100644 --- a/input/Makefile.am +++ b/input/Makefile.am @@ -10,12 +10,12 @@ libinput_la_SOURCES = main.c \ fakehid.c fakehid.h LDADD = $(top_builddir)/common/libhelper.a \ - @GLIB_LIBS@ @DBUS_LIBS@ @BLUEZ_LIBS@ + @GDBUS_LIBS@ @GLIB_LIBS@ @DBUS_LIBS@ @BLUEZ_LIBS@ endif AM_LDFLAGS = -module -avoid-version -export-symbols-regex bluetooth_plugin_desc -AM_CFLAGS = @BLUEZ_CFLAGS@ @DBUS_CFLAGS@ @GLIB_CFLAGS@ +AM_CFLAGS = @BLUEZ_CFLAGS@ @DBUS_CFLAGS@ @GLIB_CFLAGS@ @GDBUS_CFLAGS@ INCLUDES = -I$(top_srcdir)/common -I$(top_srcdir)/hcid diff --git a/input/device.c b/input/device.c index ab4e59c7..151ce08c 100644 --- a/input/device.c +++ b/input/device.c @@ -40,10 +40,8 @@ #include <bluetooth/sdp.h> #include <glib.h> - #include <dbus/dbus.h> -#include "dbus.h" #include "dbus-helper.h" #include "logging.h" #include "textfile.h" diff --git a/input/main.c b/input/main.c index c9432c21..b57286b2 100644 --- a/input/main.c +++ b/input/main.c @@ -29,7 +29,8 @@ #include <bluetooth/bluetooth.h> -#include "dbus.h" +#include <glib.h> +#include <dbus/dbus.h> #include "plugin.h" #include "dbus-service.h" diff --git a/input/manager.c b/input/manager.c index 1c024c9c..11e14514 100644 --- a/input/manager.c +++ b/input/manager.c @@ -42,7 +42,6 @@ #include <dbus/dbus.h> -#include "dbus.h" #include "dbus-helper.h" #include "logging.h" #include "textfile.h" diff --git a/input/server.c b/input/server.c index ff7cdbfd..5e29e99f 100644 --- a/input/server.c +++ b/input/server.c @@ -38,13 +38,14 @@ #include <bluetooth/hci_lib.h> #include <glib.h> +#include <dbus/dbus.h> #include "logging.h" -#include "dbus.h" #include "device.h" #include "server.h" #include "storage.h" +#include "dbus-helper.h" #include "dbus-service.h" static const char* HID_UUID = "00001124-0000-1000-8000-00805f9b34fb"; diff --git a/network/Makefile.am b/network/Makefile.am index 5218ce6f..e4b5b317 100644 --- a/network/Makefile.am +++ b/network/Makefile.am @@ -10,12 +10,12 @@ libnetwork_la_SOURCES = main.c \ connection.h connection.c common.h common.c LDADD = $(top_builddir)/common/libhelper.a \ - @GLIB_LIBS@ @DBUS_LIBS@ @BLUEZ_LIBS@ + @GDBUS_LIBS@ @GLIB_LIBS@ @DBUS_LIBS@ @BLUEZ_LIBS@ endif AM_LDFLAGS = -module -avoid-version -export-symbols-regex bluetooth_plugin_desc -AM_CFLAGS = @BLUEZ_CFLAGS@ @DBUS_CFLAGS@ @GLIB_CFLAGS@ +AM_CFLAGS = @BLUEZ_CFLAGS@ @DBUS_CFLAGS@ @GLIB_CFLAGS@ @GDBUS_CFLAGS@ INCLUDES = -I$(top_srcdir)/common -I$(top_srcdir)/hcid -I$(top_srcdir)/sdpd diff --git a/network/connection.c b/network/connection.c index b5ef61ba..466dd203 100644 --- a/network/connection.c +++ b/network/connection.c @@ -41,7 +41,6 @@ #include <glib.h> #include "logging.h" -#include "dbus.h" #include "dbus-helper.h" #include "textfile.h" #include "glib-helper.h" diff --git a/network/main.c b/network/main.c index c84ba59b..f710080f 100644 --- a/network/main.c +++ b/network/main.c @@ -29,7 +29,8 @@ #include <sys/socket.h> #include <bluetooth/bluetooth.h> -#include "dbus.h" +#include <glib.h> +#include <dbus/dbus.h> #include "plugin.h" #include "dbus-service.h" diff --git a/network/manager.c b/network/manager.c index 2ad0a97d..14bea175 100644 --- a/network/manager.c +++ b/network/manager.c @@ -40,7 +40,6 @@ #include <glib.h> -#include "dbus.h" #include "dbus-helper.h" #include "logging.h" #include "textfile.h" diff --git a/network/server.c b/network/server.c index 046b20b3..f4fb5176 100644 --- a/network/server.c +++ b/network/server.c @@ -45,7 +45,6 @@ #include <glib.h> #include "logging.h" -#include "dbus.h" #include "error.h" #include "textfile.h" #include "dbus-helper.h" diff --git a/plugins/Makefile.am b/plugins/Makefile.am index a2a521dc..c403e835 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -11,7 +11,7 @@ libecho_la_SOURCES = echo.c AM_LDFLAGS = -module -avoid-version -export-symbols-regex bluetooth_plugin_desc -AM_CFLAGS = @BLUEZ_CFLAGS@ @DBUS_CFLAGS@ @GLIB_CFLAGS@ +AM_CFLAGS = @BLUEZ_CFLAGS@ @DBUS_CFLAGS@ @GLIB_CFLAGS@ @GDBUS_CFLAGS@ INCLUDES = -I$(top_srcdir)/common -I$(top_srcdir)/hcid diff --git a/plugins/echo.c b/plugins/echo.c index 1aa15681..2c549089 100644 --- a/plugins/echo.c +++ b/plugins/echo.c @@ -34,7 +34,7 @@ #include <glib.h> -#include "dbus.h" +#include <gdbus.h> #include "plugin.h" #include "server.h" diff --git a/plugins/storage.c b/plugins/storage.c index 7930d268..9e65a1ad 100644 --- a/plugins/storage.c +++ b/plugins/storage.c @@ -27,7 +27,6 @@ #include <bluetooth/bluetooth.h> -#include "dbus.h" #include "plugin.h" #include "logging.h" diff --git a/serial/Makefile.am b/serial/Makefile.am index 226ba030..2f2286bf 100644 --- a/serial/Makefile.am +++ b/serial/Makefile.am @@ -9,12 +9,12 @@ libserial_la_SOURCES = main.c \ storage.h storage.c LDADD = $(top_builddir)/common/libhelper.a \ - @GLIB_LIBS@ @DBUS_LIBS@ @BLUEZ_LIBS@ + @GDBUS_LIBS@ @GLIB_LIBS@ @DBUS_LIBS@ @BLUEZ_LIBS@ endif AM_LDFLAGS = -module -avoid-version -export-symbols-regex bluetooth_plugin_desc -AM_CFLAGS = @BLUEZ_CFLAGS@ @DBUS_CFLAGS@ @GLIB_CFLAGS@ +AM_CFLAGS = @BLUEZ_CFLAGS@ @DBUS_CFLAGS@ @GLIB_CFLAGS@ @GDBUS_CFLAGS@ INCLUDES = -I$(top_srcdir)/common -I$(top_srcdir)/hcid -I$(top_srcdir)/sdpd diff --git a/serial/main.c b/serial/main.c index 57a65f88..b4533a01 100644 --- a/serial/main.c +++ b/serial/main.c @@ -30,10 +30,11 @@ #include <sys/types.h> #include <bluetooth/bluetooth.h> + +#include <glib.h> #include <dbus/dbus.h> #include "plugin.h" -#include "dbus.h" #include "dbus-service.h" #include "manager.h" diff --git a/serial/manager.c b/serial/manager.c index 54e052da..a10e1631 100644 --- a/serial/manager.c +++ b/serial/manager.c @@ -40,8 +40,6 @@ #include <sys/types.h> #include <sys/un.h> -#include <glib.h> - #include <bluetooth/bluetooth.h> #include <bluetooth/hci.h> #include <bluetooth/hci_lib.h> @@ -49,7 +47,10 @@ #include <bluetooth/sdp_lib.h> #include <bluetooth/rfcomm.h> -#include "dbus.h" +#include <glib.h> + +#include <gdbus.h> + #include "dbus-helper.h" #include "logging.h" #include "textfile.h" diff --git a/serial/port.c b/serial/port.c index f2c0eb61..98b751be 100644 --- a/serial/port.c +++ b/serial/port.c @@ -36,12 +36,13 @@ #include <sys/stat.h> #include <fcntl.h> -#include <glib.h> - #include <bluetooth/bluetooth.h> #include <bluetooth/rfcomm.h> -#include "dbus.h" +#include <glib.h> + +#include <gdbus.h> + #include "dbus-helper.h" #include "logging.h" |