bluez: set bluez profile property when emitting node

We need to expose the bluetooth profile in the nodes so that external
applications know how to handle them.
This commit is contained in:
Julian Bouzas 2019-08-30 12:13:49 -04:00 committed by Wim Taymans
parent 3142d3b979
commit ddd2a97f7e
3 changed files with 23 additions and 1 deletions

View file

@ -74,11 +74,12 @@ struct impl {
static void emit_node (struct impl *this, struct spa_bt_transport *t, const char *factory_name)
{
struct spa_device_object_info info;
struct spa_dict_item items[1];
struct spa_dict_item items[2];
char transport[32];
snprintf(transport, sizeof(transport), "pointer:%p", t);
items[0] = SPA_DICT_ITEM_INIT(SPA_KEY_API_BLUEZ5_TRANSPORT, transport);
items[1] = SPA_DICT_ITEM_INIT(SPA_KEY_API_BLUEZ5_PROFILE, spa_bt_profile_name(t->profile));
info = SPA_DEVICE_OBJECT_INFO_INIT();
info.type = SPA_TYPE_INTERFACE_Node;

View file

@ -138,6 +138,26 @@ static inline enum spa_bt_profile spa_bt_profile_from_uuid(const char *uuid)
return 0;
}
static inline const char *spa_bt_profile_name (enum spa_bt_profile profile) {
switch (profile) {
case SPA_BT_PROFILE_A2DP_SOURCE:
return "a2dp-source";
case SPA_BT_PROFILE_A2DP_SINK:
return "a2dp-sink";
case SPA_BT_PROFILE_HSP_HS:
return "hsp-hs";
case SPA_BT_PROFILE_HSP_AG:
return "hsp-ag";
case SPA_BT_PROFILE_HFP_HF:
return "hfp-hf";
case SPA_BT_PROFILE_HFP_AG:
return "hfp-ag";
default:
break;
}
return "unknown";
}
struct spa_bt_monitor;
struct spa_bt_adapter {