bluez: improve profile description

This commit is contained in:
Wim Taymans 2020-07-03 16:25:46 +02:00
parent 471c1a071c
commit 8ad769b943

View file

@ -257,25 +257,49 @@ static int impl_enum_params(void *object, int seq,
SPA_PARAM_PROFILE_name, SPA_POD_String("Off"));
break;
case 1:
if (!(device->connected_profiles &
(SPA_BT_PROFILE_A2DP_SINK | SPA_BT_PROFILE_A2DP_SOURCE)))
{
uint32_t profile = device->connected_profiles &
(SPA_BT_PROFILE_A2DP_SINK | SPA_BT_PROFILE_A2DP_SOURCE);
const char *description;
if (profile == 0)
goto next;
else if (profile == SPA_BT_PROFILE_A2DP_SINK)
description = "High Fidelity Playback (A2DP Sink)";
else if (profile == SPA_BT_PROFILE_A2DP_SOURCE)
description = "High Fidelity Capture (A2DP Source)";
else
description = "High Fidelity Duplex (A2DP Source/Sink)";
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_ParamProfile, id,
SPA_PARAM_PROFILE_index, SPA_POD_Int(1),
SPA_PARAM_PROFILE_name, SPA_POD_String("A2DP"),
SPA_PARAM_PROFILE_description, SPA_POD_String("High Fidelity (A2DP)"));
SPA_PARAM_PROFILE_description, SPA_POD_String(description));
break;
}
case 2:
if (!(device->connected_profiles &
(SPA_BT_PROFILE_HEADSET_HEAD_UNIT | SPA_BT_PROFILE_HEADSET_AUDIO_GATEWAY)))
{
uint32_t profile = device->connected_profiles &
(SPA_BT_PROFILE_HEADSET_HEAD_UNIT | SPA_BT_PROFILE_HEADSET_AUDIO_GATEWAY);
const char *description;
if (profile == 0)
goto next;
else if (profile == SPA_BT_PROFILE_HEADSET_HEAD_UNIT)
description = "Headset Head Unit (HSP/HFP)";
else if (profile == SPA_BT_PROFILE_HEADSET_AUDIO_GATEWAY)
description = "Headset Audio Gateway (HSP/HFP)";
else
description = "Headset Audio (HSP/HFP)";
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_ParamProfile, id,
SPA_PARAM_PROFILE_index, SPA_POD_Int(2),
SPA_PARAM_PROFILE_name, SPA_POD_String("HSP/HFP"),
SPA_PARAM_PROFILE_description, SPA_POD_String("Headset Audio (HSP/HFP)"));
SPA_PARAM_PROFILE_description, SPA_POD_String(description));
break;
}
default:
return 0;
}