bluetooth: Use transport state instead of profile states

The transport state also reflects the state of the audio interface. The
state redundancy can thus be minimized by always using the first one,
and avoiding the use of profile-specific states with the exception of
finding out the initial state of a transport.
This commit is contained in:
Mikel Astiz 2012-12-14 15:14:37 +01:00 committed by Tanu Kaskinen
parent 468c67bb62
commit d2bd3aa444
2 changed files with 14 additions and 3 deletions

View file

@ -2094,7 +2094,7 @@ static int card_set_profile(pa_card *c, pa_card_profile *new_profile) {
if (*d != PROFILE_OFF) {
const pa_bluetooth_device *device = u->device;
if (device->profile_state[*d] < PA_BT_AUDIO_STATE_CONNECTED) {
if (!device->transports[*d]) {
pa_log_warn("Profile not connected, refused to switch profile to %s", new_profile->name);
return -PA_ERR_IO;
}
@ -2357,7 +2357,7 @@ static int add_card(struct userdata *u) {
d = PA_CARD_PROFILE_DATA(u->card->active_profile);
if (*d != PROFILE_OFF && (device->profile_state[*d] < PA_BT_AUDIO_STATE_CONNECTED)) {
if (*d != PROFILE_OFF && !device->transports[*d]) {
pa_log_warn("Default profile not connected, selecting off profile");
u->card->active_profile = pa_hashmap_get(u->card->profiles, "off");
u->card->save_profile = FALSE;