card: Add card profile availability

Some cards are capable to announce if a specific profile is available or
not, effectively predicting whether a profile switch would fail or would
likely succeed. This can for example be useful for a UI that would gray
out any unavailable profile.

In addition, this information can be useful for internal modules
implementing automatic profile-switching policies, such as
module-switch-on-port-available or module-bluetooth-policy.

In particular, this information is essential when a port is associated
to multiple card profiles and therefore the port availability flag does
not provide enough information. The port "bluetooth-output" falls into
this category, for example, since it doesn't distinguish HSP/HFP from
A2DP.
This commit is contained in:
Mikel Astiz 2013-02-18 09:10:31 +01:00 committed by Tanu Kaskinen
parent 8851644a3c
commit afd33da56a
3 changed files with 25 additions and 0 deletions

View file

@ -43,6 +43,7 @@ typedef struct pa_card_profile {
char *description;
unsigned priority;
pa_available_t available; /* PA_AVAILABLE_UNKNOWN, PA_AVAILABLE_NO or PA_AVAILABLE_YES */
/* We probably want to have different properties later on here */
unsigned n_sinks;
@ -101,6 +102,9 @@ typedef struct pa_card_new_data {
pa_card_profile *pa_card_profile_new(const char *name, const char *description, size_t extra);
void pa_card_profile_free(pa_card_profile *c);
/* The profile's available status has changed */
void pa_card_profile_set_available(pa_card_profile *c, pa_available_t available);
pa_card_new_data *pa_card_new_data_init(pa_card_new_data *data);
void pa_card_new_data_set_name(pa_card_new_data *data, const char *name);
void pa_card_new_data_set_profile(pa_card_new_data *data, const char *profile);