bluez 5: Load the native headset backend if the oFono one is unavailable

This implements some autodetect if both headset backends are compiled in:
First we try to contact the oFono service, if that's not working,
then we start the native backend instead.

Likewise if the oFono service is going offline/online, we load/unload
the native backend accordingly.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
This commit is contained in:
David Henningsson 2014-11-03 12:13:20 +01:00
parent 1ffede3c85
commit aea3518569
3 changed files with 28 additions and 11 deletions

View file

@ -861,6 +861,18 @@ static void parse_interfaces_and_properties(pa_bluetooth_discovery *y, DBusMessa
return;
}
void pa_bluetooth_discovery_set_ofono_running(pa_bluetooth_discovery *y, bool is_running) {
pa_assert(y);
pa_log_debug("oFono is running: %s", pa_yes_no(is_running));
if (is_running && y->native_backend) {
pa_bluetooth_native_backend_free(y->native_backend);
y->native_backend = NULL;
}
else if (!is_running && !y->native_backend)
y->native_backend = pa_bluetooth_native_backend_new(y->core, y);
}
static void get_managed_objects_reply(DBusPendingCall *pending, void *userdata) {
pa_dbus_pending *p;
pa_bluetooth_discovery *y;