summaryrefslogtreecommitdiff
path: root/src/modules/bluetooth/bluetooth-util.c
diff options
context:
space:
mode:
authorMikel Astiz <mikel.astiz@bmw-carit.de>2012-12-10 08:30:39 +0100
committerTanu Kaskinen <tanuk@iki.fi>2012-12-19 12:31:48 +0200
commitf035ffe3c02867cd551b6caf9ded6484412f9f28 (patch)
treeb359bdf149ba86e9aa02d551b4dd2bf778359baa /src/modules/bluetooth/bluetooth-util.c
parent439745505a338afc7936abf77111e030b734b805 (diff)
downloadpulseaudio-f035ffe3c02867cd551b6caf9ded6484412f9f28.tar.gz
bluetooth: Add transport hooks into pa_bluetooth_hook_t
Add the transport-handling hooks to the centralized list of hooks in pa_bluetooth_hook_t. These are intended to replace the now deprecated transport-specific hook list in pa_bluetooth_transport_hook_t.
Diffstat (limited to 'src/modules/bluetooth/bluetooth-util.c')
-rw-r--r--src/modules/bluetooth/bluetooth-util.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
index 9df3f9d3b..132a50e24 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -204,6 +204,8 @@ static void device_free(pa_bluetooth_device *d) {
d->transports[i] = NULL;
pa_hashmap_remove(d->discovery->transports, t->path);
+ t->state = PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED;
+ pa_hook_fire(&d->discovery->hooks[PA_BLUETOOTH_HOOK_TRANSPORT_STATE_CHANGED], t);
pa_hook_fire(&t->hooks[PA_BLUETOOTH_TRANSPORT_HOOK_REMOVED], NULL);
transport_free(t);
}
@@ -504,6 +506,7 @@ static int parse_audio_property(pa_bluetooth_device *d, const char *interface, D
if (pa_streq(key, "State")) {
pa_bt_audio_state_t state = pa_bt_audio_state_from_string(value);
+ pa_bluetooth_transport_state_t old_state;
pa_log_debug("Device %s interface %s property 'State' changed to value '%s'", d->path, interface, value);
@@ -522,7 +525,11 @@ static int parse_audio_property(pa_bluetooth_device *d, const char *interface, D
if (!transport)
break;
+ old_state = transport->state;
transport->state = pa_bt_audio_state_to_transport_state(state);
+
+ if (transport->state != old_state)
+ pa_hook_fire(&d->discovery->hooks[PA_BLUETOOTH_HOOK_TRANSPORT_STATE_CHANGED], transport);
}
break;
@@ -815,6 +822,7 @@ static int pa_bluetooth_transport_parse_property(pa_bluetooth_transport *t, DBus
if (pa_streq(key, "NREC") && t->nrec != value) {
t->nrec = value;
pa_log_debug("Transport %s: Property 'NREC' changed to %s.", t->path, t->nrec ? "True" : "False");
+ pa_hook_fire(&t->device->discovery->hooks[PA_BLUETOOTH_HOOK_TRANSPORT_NREC_CHANGED], t);
pa_hook_fire(&t->hooks[PA_BLUETOOTH_TRANSPORT_HOOK_NREC_CHANGED], NULL);
}
@@ -1251,6 +1259,8 @@ static DBusMessage *endpoint_clear_configuration(DBusConnection *c, DBusMessage
pa_log_debug("Clearing transport %s profile %d", t->path, t->profile);
t->device->transports[t->profile] = NULL;
pa_hashmap_remove(y->transports, t->path);
+ t->state = PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED;
+ pa_hook_fire(&y->hooks[PA_BLUETOOTH_HOOK_TRANSPORT_STATE_CHANGED], t);
pa_hook_fire(&t->hooks[PA_BLUETOOTH_TRANSPORT_HOOK_REMOVED], NULL);
transport_free(t);
}