[pulseaudio-discuss] [PATCHv2 24/60] bluetooth: Create infrastrucure for bluetooth hooks
jprvita at gmail.com
jprvita at gmail.com
Mon Aug 12 21:54:02 PDT 2013
From: João Paulo Rechi Vita <jprvita at openbossa.org>
Create a pa_bluetooth_hook enum type and API to get pa_hooks from the
opaque pa_bluetooth_discovery struct.
---
src/modules/bluetooth/bluez5-util.c | 12 ++++++++++++
src/modules/bluetooth/bluez5-util.h | 6 ++++++
2 files changed, 18 insertions(+)
diff --git a/src/modules/bluetooth/bluez5-util.c b/src/modules/bluetooth/bluez5-util.c
index d60f63c..380f899 100644
--- a/src/modules/bluetooth/bluez5-util.c
+++ b/src/modules/bluetooth/bluez5-util.c
@@ -43,8 +43,16 @@ struct pa_bluetooth_discovery {
pa_core *core;
pa_dbus_connection *connection;
bool filter_added;
+ pa_hook hooks[PA_BLUETOOTH_HOOK_MAX];
};
+pa_hook* pa_bluetooth_discovery_hook(pa_bluetooth_discovery *y, pa_bluetooth_hook_t hook) {
+ pa_assert(y);
+ pa_assert(PA_REFCNT_VALUE(y) > 0);
+
+ return &y->hooks[hook];
+}
+
static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *userdata) {
pa_bluetooth_discovery *y;
DBusError err;
@@ -92,6 +100,7 @@ pa_bluetooth_discovery* pa_bluetooth_discovery_get(pa_core *c) {
pa_bluetooth_discovery *y;
DBusError err;
DBusConnection *conn;
+ unsigned i;
if ((y = pa_shared_get(c, "bluetooth-discovery")))
return pa_bluetooth_discovery_ref(y);
@@ -100,6 +109,9 @@ pa_bluetooth_discovery* pa_bluetooth_discovery_get(pa_core *c) {
PA_REFCNT_INIT(y);
y->core = c;
+ for (i = 0; i < PA_BLUETOOTH_HOOK_MAX; i++)
+ pa_hook_init(&y->hooks[i], y);
+
pa_shared_set(c, "bluetooth-discovery", y);
dbus_error_init(&err);
diff --git a/src/modules/bluetooth/bluez5-util.h b/src/modules/bluetooth/bluez5-util.h
index 56602bf..afbd8e9 100644
--- a/src/modules/bluetooth/bluez5-util.h
+++ b/src/modules/bluetooth/bluez5-util.h
@@ -26,6 +26,12 @@
typedef struct pa_bluetooth_discovery pa_bluetooth_discovery;
+typedef enum pa_bluetooth_hook {
+ PA_BLUETOOTH_HOOK_MAX
+} pa_bluetooth_hook_t;
+
+pa_hook* pa_bluetooth_discovery_hook(pa_bluetooth_discovery *y, pa_bluetooth_hook_t hook);
+
pa_bluetooth_discovery* pa_bluetooth_discovery_get(pa_core *core);
pa_bluetooth_discovery* pa_bluetooth_discovery_ref(pa_bluetooth_discovery *y);
void pa_bluetooth_discovery_unref(pa_bluetooth_discovery *y);
--
1.7.11.7
More information about the pulseaudio-discuss
mailing list