bluetooth: Move profile_to_string() to bluetooth-util

Move the function to the utility library where the enum is defined. At
same time avoid using the default clause in order to make sure the
compiler will complain if the enum type gets extended.
This commit is contained in:
Mikel Astiz 2012-12-14 15:14:31 +01:00 committed by Tanu Kaskinen
parent d6d6770a04
commit f5a4626ffb
3 changed files with 22 additions and 19 deletions

View file

@ -93,6 +93,23 @@ pa_bt_audio_state_t pa_bt_audio_state_from_string(const char* value) {
return PA_BT_AUDIO_STATE_INVALID;
}
const char *pa_bt_profile_to_string(enum profile profile) {
switch(profile) {
case PROFILE_A2DP:
return "a2dp";
case PROFILE_A2DP_SOURCE:
return "a2dp_source";
case PROFILE_HSP:
return "hsp";
case PROFILE_HFGW:
return "hfgw";
case PROFILE_OFF:
pa_assert_not_reached();
}
pa_assert_not_reached();
}
static int profile_from_interface(const char *interface, enum profile *p) {
pa_assert(interface);
pa_assert(p);