[PATCH v2 3/4] bluetooth: Create NULL backend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Jo??o Paulo Rechi Vita <jprvita@xxxxxxxxxxxxx>

---
 configure.ac                         | 16 ++++++++++++++++
 src/Makefile.am                      |  3 ++-
 src/modules/bluetooth/backend-null.c | 37 ++++++++++++++++++++++++++++++++++++
 src/modules/bluetooth/bluez5-util.c  |  5 +++++
 src/modules/bluetooth/bluez5-util.h  |  4 ++++
 5 files changed, 64 insertions(+), 1 deletion(-)
 create mode 100644 src/modules/bluetooth/backend-null.c

diff --git a/configure.ac b/configure.ac
index dc2298d..33e4214 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1028,6 +1028,21 @@ AS_IF([test "x$HAVE_BLUEZ_4" = "x1" || test "x$HAVE_BLUEZ_5" = "x1"], HAVE_BLUEZ
 AC_SUBST(HAVE_BLUEZ)
 AM_CONDITIONAL([HAVE_BLUEZ], [test "x$HAVE_BLUEZ" = x1])
 
+## Bluetooth Headset profiles backend ##
+
+AC_ARG_WITH(bluetooth_headset_backend,
+AS_HELP_STRING([--with-bluetooth-headset-backend=<null>],[Backend for Bluetooth headset profiles (null)]))
+if test -z "$with_bluetooth_headset_backend" ; then
+    BLUETOOTH_HEADSET_BACKEND=null
+else
+    BLUETOOTH_HEADSET_BACKEND=$with_bluetooth_headset_backend
+fi
+
+AS_IF([test "x$BLUETOOTH_HEADSET_BACKEND" != "xnull"],
+    [AC_MSG_ERROR([*** Invalid Bluetooth Headset backend])])
+
+AC_SUBST(BLUETOOTH_HEADSET_BACKEND)
+
 #### UDEV support (optional) ####
 
 AC_ARG_ENABLE([udev],
@@ -1497,6 +1512,7 @@ echo "
     Enable D-Bus:                  ${ENABLE_DBUS}
       Enable BlueZ 4:              ${ENABLE_BLUEZ_4}
       Enable BlueZ 5:              ${ENABLE_BLUEZ_5}
+        headset backed:            ${BLUETOOTH_HEADSET_BACKEND}
     Enable udev:                   ${ENABLE_UDEV}
       Enable HAL->udev compat:     ${ENABLE_HAL_COMPAT}
     Enable systemd login:          ${ENABLE_SYSTEMD}
diff --git a/src/Makefile.am b/src/Makefile.am
index 21eb365..3ceaddc 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2099,7 +2099,8 @@ module_bluez4_device_la_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS) $(SBC_CFLAGS)
 libbluez5_util_la_SOURCES = \
 		modules/bluetooth/bluez5-util.c \
 		modules/bluetooth/bluez5-util.h \
-		modules/bluetooth/a2dp-codecs.h
+		modules/bluetooth/a2dp-codecs.h \
+		modules/bluetooth/backend- at BLUETOOTH_HEADSET_BACKEND@.c
 libbluez5_util_la_LDFLAGS = -avoid-version
 libbluez5_util_la_LIBADD = $(MODULE_LIBADD) $(DBUS_LIBS)
 libbluez5_util_la_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS)
diff --git a/src/modules/bluetooth/backend-null.c b/src/modules/bluetooth/backend-null.c
new file mode 100644
index 0000000..f8a145b
--- /dev/null
+++ b/src/modules/bluetooth/backend-null.c
@@ -0,0 +1,37 @@
+/***
+  This file is part of PulseAudio.
+
+  Copyright 2013 Jo??o Paulo Rechi Vita
+
+  PulseAudio is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License as
+  published by the Free Software Foundation; either version 2.1 of the
+  License, or (at your option) any later version.
+
+  PulseAudio 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 Lesser General Public
+  License along with PulseAudio; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+  USA.
+***/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <pulsecore/log.h>
+
+#include "bluez5-util.h"
+
+pa_bluetooth_backend *pa_bluetooth_backend_new(pa_core *c) {
+    pa_log_debug("Bluetooth Headset Backend API support disabled");
+    return NULL;
+}
+
+void pa_bluetooth_backend_free(pa_bluetooth_backend *b) {
+    /* Nothing to do here */
+}
diff --git a/src/modules/bluetooth/bluez5-util.c b/src/modules/bluetooth/bluez5-util.c
index adb8351..93677b4 100644
--- a/src/modules/bluetooth/bluez5-util.c
+++ b/src/modules/bluetooth/bluez5-util.c
@@ -87,6 +87,7 @@ struct pa_bluetooth_discovery {
     pa_hashmap *devices;
     pa_hashmap *transports;
 
+    pa_bluetooth_backend *backend;
     PA_LLIST_HEAD(pa_dbus_pending, pending);
 };
 
@@ -1590,6 +1591,7 @@ pa_bluetooth_discovery* pa_bluetooth_discovery_get(pa_core *c) {
 
     endpoint_init(y, PA_BLUETOOTH_PROFILE_A2DP_SINK);
     endpoint_init(y, PA_BLUETOOTH_PROFILE_A2DP_SOURCE);
+    y->backend = pa_bluetooth_backend_new(c);
 
     get_managed_objects(y);
 
@@ -1631,6 +1633,9 @@ void pa_bluetooth_discovery_unref(pa_bluetooth_discovery *y) {
         pa_hashmap_free(y->transports);
     }
 
+    if (y->backend)
+        pa_bluetooth_backend_free(y->backend);
+
     if (y->connection) {
 
         if (y->matches_added)
diff --git a/src/modules/bluetooth/bluez5-util.h b/src/modules/bluetooth/bluez5-util.h
index 0121733..67377e9 100644
--- a/src/modules/bluetooth/bluez5-util.h
+++ b/src/modules/bluetooth/bluez5-util.h
@@ -35,6 +35,7 @@ typedef struct pa_bluetooth_transport pa_bluetooth_transport;
 typedef struct pa_bluetooth_device pa_bluetooth_device;
 typedef struct pa_bluetooth_adapter pa_bluetooth_adapter;
 typedef struct pa_bluetooth_discovery pa_bluetooth_discovery;
+typedef struct pa_bluetooth_backend pa_bluetooth_backend;
 
 typedef enum pa_bluetooth_hook {
     PA_BLUETOOTH_HOOK_DEVICE_CONNECTION_CHANGED,          /* Call data: pa_bluetooth_device */
@@ -105,6 +106,9 @@ struct pa_bluetooth_adapter {
     bool valid;
 };
 
+pa_bluetooth_backend *pa_bluetooth_backend_new(pa_core *c);
+void pa_bluetooth_backend_free(pa_bluetooth_backend *b);
+
 pa_bluetooth_transport *pa_bluetooth_transport_new(pa_bluetooth_device *d, const char *owner, const char *path,
                                                    pa_bluetooth_profile_t p, const uint8_t *config, size_t size);
 
-- 
1.9.3



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux