diff options
author | João Paulo Rechi Vita <jprvita@openbossa.org> | 2014-09-10 11:48:33 +0200 |
---|---|---|
committer | Tanu Kaskinen <tanu.kaskinen@linux.intel.com> | 2014-09-11 14:00:15 +0300 |
commit | b1a09ebf7ea3ba9471d2376b2b42fc252897278d (patch) | |
tree | 058ab5bbce79a10b98503b213b6e958d49d3f435 /src/modules/bluetooth/backend-ofono.c | |
parent | 8f838b1f31b45db68303d45918e6fd4fc7018dcb (diff) |
bluetooth: Handle CardRemoved signal
Diffstat (limited to 'src/modules/bluetooth/backend-ofono.c')
-rw-r--r-- | src/modules/bluetooth/backend-ofono.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/modules/bluetooth/backend-ofono.c b/src/modules/bluetooth/backend-ofono.c index fe4e2cae8..3f409417b 100644 --- a/src/modules/bluetooth/backend-ofono.c +++ b/src/modules/bluetooth/backend-ofono.c @@ -269,6 +269,24 @@ fail: hf_audio_card_free(card); } +static void hf_audio_agent_card_removed(pa_bluetooth_backend *backend, const char *path) { + struct hf_audio_card *card; + + pa_assert(backend); + pa_assert(path); + + pa_log_debug("HF card removed: %s", path); + + card = pa_hashmap_remove(backend->cards, path); + if (!card) + return; + + if (card->transport) + pa_bluetooth_transport_unlink(card->transport); + + hf_audio_card_free(card); +} + static void hf_audio_agent_get_cards_reply(DBusPendingCall *pending, void *userdata) { DBusMessage *r; pa_dbus_pending *p; @@ -444,6 +462,15 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *da dbus_message_iter_recurse(&arg_i, &props_i); hf_audio_agent_card_found(backend, p, &props_i); + } else if (dbus_message_is_signal(m, "org.ofono.HandsfreeAudioManager", "CardRemoved")) { + const char *p; + + if (!dbus_message_get_args(m, &err, DBUS_TYPE_OBJECT_PATH, &p, DBUS_TYPE_INVALID)) { + pa_log_error("Failed to parse org.ofono.HandsfreeAudioManager.CardRemoved: %s", err.message); + goto fail; + } + + hf_audio_agent_card_removed(backend, p); } fail: |