summaryrefslogtreecommitdiff
path: root/src/modules/bluetooth/bluez5-util.c
diff options
context:
space:
mode:
authorJoão Paulo Rechi Vita <jprvita@openbossa.org>2013-09-18 16:16:56 -0500
committerTanu Kaskinen <tanu.kaskinen@linux.intel.com>2013-09-29 16:54:36 +0300
commit19a23cef109dda8e1b0aa29fe3675b75e2ca2e6b (patch)
treee68f4cc6474615122f20e50e24d5d3b0260a984a /src/modules/bluetooth/bluez5-util.c
parentdcc28a23f962890a497cd7012c794929df74d907 (diff)
bluetooth: Create infrastrucure for bluetooth hooks
Create a pa_bluetooth_hook enum type and API to get pa_hooks from the opaque pa_bluetooth_discovery struct.
Diffstat (limited to 'src/modules/bluetooth/bluez5-util.c')
-rw-r--r--src/modules/bluetooth/bluez5-util.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/modules/bluetooth/bluez5-util.c b/src/modules/bluetooth/bluez5-util.c
index 36f1b264c..bfb335946 100644
--- a/src/modules/bluetooth/bluez5-util.c
+++ b/src/modules/bluetooth/bluez5-util.c
@@ -44,8 +44,16 @@ struct pa_bluetooth_discovery {
pa_dbus_connection *connection;
bool filter_added;
bool matches_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;
@@ -93,6 +101,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);
@@ -101,6 +110,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);