diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c index 28dc6d845..e3cfcda5a 100644 --- a/src/modules/bluetooth/bluetooth-util.c +++ b/src/modules/bluetooth/bluetooth-util.c @@ -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); diff --git a/src/modules/bluetooth/bluetooth-util.h b/src/modules/bluetooth/bluetooth-util.h index e471e0d6d..fb4a2110d 100644 --- a/src/modules/bluetooth/bluetooth-util.h +++ b/src/modules/bluetooth/bluetooth-util.h @@ -162,5 +162,6 @@ char *pa_bluetooth_cleanup_name(const char *name); pa_bool_t pa_bluetooth_uuid_has(pa_bluetooth_uuid *uuids, const char *uuid); pa_bt_audio_state_t pa_bt_audio_state_from_string(const char* value); +const char *pa_bt_profile_to_string(enum profile profile); #endif diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c index 547aea3f3..f005b8682 100644 --- a/src/modules/bluetooth/module-bluetooth-device.c +++ b/src/modules/bluetooth/module-bluetooth-device.c @@ -1654,21 +1654,6 @@ static void connect_ports(struct userdata *u, void *sink_or_source_new_data, pa_ } } -static const char *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"; - default: - pa_assert_not_reached(); - } -} - static int sink_set_port_cb(pa_sink *s, pa_device_port *p) { return 0; } @@ -1688,7 +1673,7 @@ static int add_sink(struct userdata *u) { u->sink = u->hsp.sco_sink; p = pa_proplist_new(); - pa_proplist_sets(p, "bluetooth.protocol", profile_to_string(u->profile)); + pa_proplist_sets(p, "bluetooth.protocol", pa_bt_profile_to_string(u->profile)); pa_proplist_update(u->sink->proplist, PA_UPDATE_MERGE, p); pa_proplist_free(p); } else { @@ -1699,7 +1684,7 @@ static int add_sink(struct userdata *u) { data.driver = __FILE__; data.module = u->module; pa_sink_new_data_set_sample_spec(&data, &u->sample_spec); - pa_proplist_sets(data.proplist, "bluetooth.protocol", profile_to_string(u->profile)); + pa_proplist_sets(data.proplist, "bluetooth.protocol", pa_bt_profile_to_string(u->profile)); if (u->profile == PROFILE_HSP) pa_proplist_sets(data.proplist, PA_PROP_DEVICE_INTENDED_ROLES, "phone"); data.card = u->card; @@ -1760,7 +1745,7 @@ static int add_source(struct userdata *u) { if (USE_SCO_OVER_PCM(u)) { u->source = u->hsp.sco_source; - pa_proplist_sets(u->source->proplist, "bluetooth.protocol", profile_to_string(u->profile)); + pa_proplist_sets(u->source->proplist, "bluetooth.protocol", pa_bt_profile_to_string(u->profile)); } else { pa_source_new_data data; pa_bool_t b; @@ -1769,7 +1754,7 @@ static int add_source(struct userdata *u) { data.driver = __FILE__; data.module = u->module; pa_source_new_data_set_sample_spec(&data, &u->sample_spec); - pa_proplist_sets(data.proplist, "bluetooth.protocol", profile_to_string(u->profile)); + pa_proplist_sets(data.proplist, "bluetooth.protocol", pa_bt_profile_to_string(u->profile)); if (u->profile == PROFILE_HSP) pa_proplist_sets(data.proplist, PA_PROP_DEVICE_INTENDED_ROLES, "phone");