bluez5: autoconnect device profiles on startup

Auto-connect all paired & trusted devices on startup.
Since devices that already connected or powering off would reject the connecting requests, it should be fine with this behavior.
Also reconnect remaining profiles if only partial profiles are connected.
This commit is contained in:
Huang-Huang Bao 2021-03-26 12:53:04 +08:00 committed by Wim Taymans
parent 4112b34f4d
commit 34c9f24d2a
5 changed files with 168 additions and 86 deletions

View file

@ -1504,7 +1504,15 @@ impl_init(const struct spa_handle_factory *factory,
return -EINVAL;
}
this->bt_dev->settings = filter_bluez_device_setting(this, info);
if (info) {
int profiles;
this->bt_dev->settings = filter_bluez_device_setting(this, info);
if ((str = spa_dict_lookup(info, "bluez5.reconnect-profiles")) != NULL)
profiles = spa_bt_profiles_from_json_array(str);
if (str == NULL || profiles < 0)
profiles = SPA_BT_PROFILE_NULL;
this->bt_dev->reconnect_profiles = profiles;
}
this->device.iface = SPA_INTERFACE_INIT(
SPA_TYPE_INTERFACE_Device,