diff options
-rw-r--r-- | Makefile.am | 5 | ||||
-rw-r--r-- | acinclude.m4 | 6 | ||||
-rw-r--r-- | attrib/main.c | 59 | ||||
-rw-r--r-- | attrib/manager.c | 70 | ||||
-rw-r--r-- | attrib/manager.h | 25 |
5 files changed, 165 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am index 65d43126..92d436da 100644 --- a/Makefile.am +++ b/Makefile.am @@ -168,6 +168,11 @@ builtin_modules += service builtin_sources += plugins/service.c endif +if ATTRIBPLUGIN +builtin_modules += attrib +builtin_sources += attrib/main.c attrib/manager.h attrib/manager.c +endif + builtin_modules += hciops builtin_sources += plugins/hciops.c diff --git a/acinclude.m4 b/acinclude.m4 index f5fdd666..22c2e2c0 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -168,6 +168,7 @@ AC_DEFUN([AC_ARG_BLUEZ], [ network_enable=yes service_enable=yes pnat_enable=no + attrib_enable=no tracer_enable=no tools_enable=yes hidd_enable=no @@ -220,6 +221,10 @@ AC_DEFUN([AC_ARG_BLUEZ], [ pnat_enable=${enableval} ]) + AC_ARG_ENABLE(attrib, AC_HELP_STRING([--enable-attrib], [enable attrib plugin]), [ + attrib_enable=${enableval} + ]) + AC_ARG_ENABLE(gstreamer, AC_HELP_STRING([--enable-gstreamer], [enable GStreamer support]), [ gstreamer_enable=${enableval} ]) @@ -330,6 +335,7 @@ AC_DEFUN([AC_ARG_BLUEZ], [ AM_CONDITIONAL(SERIALPLUGIN, test "${serial_enable}" = "yes") AM_CONDITIONAL(NETWORKPLUGIN, test "${network_enable}" = "yes") AM_CONDITIONAL(SERVICEPLUGIN, test "${service_enable}" = "yes") + AM_CONDITIONAL(ATTRIBPLUGIN, test "${attrib_enable}" = "yes") AM_CONDITIONAL(ECHOPLUGIN, test "no" = "yes") AM_CONDITIONAL(PNATPLUGIN, test "${pnat_enable}" = "yes") AM_CONDITIONAL(TRACER, test "${tracer_enable}" = "yes") diff --git a/attrib/main.c b/attrib/main.c new file mode 100644 index 00000000..274fc268 --- /dev/null +++ b/attrib/main.c @@ -0,0 +1,59 @@ +/* + * + * BlueZ - Bluetooth protocol stack for Linux + * + * Copyright (C) 2004-2010 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 + * + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <errno.h> + +#include <gdbus.h> + +#include "plugin.h" +#include "manager.h" + +static DBusConnection *connection; + +static int attrib_init(void) +{ + connection = dbus_bus_get(DBUS_BUS_SYSTEM, NULL); + if (connection == NULL) + return -EIO; + + if (attrib_manager_init(connection) < 0) { + dbus_connection_unref(connection); + return -EIO; + } + + return 0; +} + +static void attrib_exit(void) +{ + attrib_manager_exit(); + + dbus_connection_unref(connection); +} + +BLUETOOTH_PLUGIN_DEFINE(attrib, VERSION, + BLUETOOTH_PLUGIN_PRIORITY_DEFAULT, attrib_init, attrib_exit) diff --git a/attrib/manager.c b/attrib/manager.c new file mode 100644 index 00000000..d08a83b4 --- /dev/null +++ b/attrib/manager.c @@ -0,0 +1,70 @@ +/* + * + * BlueZ - Bluetooth protocol stack for Linux + * + * Copyright (C) 2004-2010 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 + * + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <errno.h> + +#include <bluetooth/bluetooth.h> +#include <bluetooth/hci.h> +#include <gdbus.h> + +#include "log.h" +#include "../src/adapter.h" + +#include "manager.h" + +static DBusConnection *connection = NULL; + +static int server_probe(struct btd_adapter *adapter) +{ + return 0; +} + +static void server_remove(struct btd_adapter *adapter) +{ +} + +static struct btd_adapter_driver attrib_server_driver = { + .name = "attribute-server", + .probe = server_probe, + .remove = server_remove, +}; + +int attrib_manager_init(DBusConnection *conn) +{ + connection = dbus_connection_ref(conn); + + btd_register_adapter_driver(&attrib_server_driver); + + return 0; +} + +void attrib_manager_exit(void) +{ + btd_unregister_adapter_driver(&attrib_server_driver); + + dbus_connection_unref(connection); +} diff --git a/attrib/manager.h b/attrib/manager.h new file mode 100644 index 00000000..770c132f --- /dev/null +++ b/attrib/manager.h @@ -0,0 +1,25 @@ +/* + * + * BlueZ - Bluetooth protocol stack for Linux + * + * Copyright (C) 2004-2010 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 + * + */ + +int attrib_manager_init(DBusConnection *conn); +void attrib_manager_exit(void); |