bluez5: bap: Enable control of Broadcast Encryption

Add "encryption" parameter to bluez5.bcast_source.config entry in
the configuration file. This allows the user to control the use of
Broadcast encryption.
This commit is contained in:
Vlad Pruteanu 2024-05-30 11:04:45 +03:00 committed by Wim Taymans
parent acd5bf60b9
commit 34b17a6269
2 changed files with 7 additions and 0 deletions

View file

@ -430,6 +430,7 @@ Example:
bluez5.bcast_source.config = [
{
"broadcast_code": [ 1, 2, 104, 5, 83, 241, 65, 90, 162, 101, 187, 175, 198, 234, 3, 184 ],
"encryption: false,
"bis": [
{ # BIS configuration
"qos_preset": "16_2_1", # QOS preset name from table Table 6.4 from BAP_v1.0.1.

View file

@ -176,6 +176,7 @@ struct spa_bt_bis {
struct spa_bt_big {
struct spa_list link;
int broadcast_code[BROADCAST_CODE_LEN];
bool encryption;
int presentation_delay;
struct spa_list bis_list;
int big_id;
@ -5370,6 +5371,7 @@ static void configure_bis(struct spa_bt_monitor *monitor,
append_basic_variant_dict_entry(&qos_dict, "MSE", DBUS_TYPE_BYTE, "y", &mse);
append_basic_variant_dict_entry(&qos_dict, "Timeout", DBUS_TYPE_UINT16, "q", &timeout);
append_basic_array_variant_dict_entry(&qos_dict, "BCode", "ay", "y", DBUS_TYPE_BYTE, big->broadcast_code, BROADCAST_CODE_LEN);
append_basic_variant_dict_entry(&qos_dict, "Encryption", DBUS_TYPE_BYTE, "y", &big->encryption);
append_basic_variant_dict_entry(&qos_dict, "Interval", DBUS_TYPE_UINT32, "u", &qos.interval);
append_basic_variant_dict_entry(&qos_dict, "Framing", DBUS_TYPE_BYTE, "y", &qos.framing);
append_basic_variant_dict_entry(&qos_dict, "PHY", DBUS_TYPE_BYTE, "y", &qos.phy);
@ -6176,6 +6178,10 @@ static void parse_broadcast_source_config(struct spa_bt_monitor *monitor, const
goto parse_failed;
spa_log_debug(monitor->log, "big_entry->broadcast_code[%d] %d", cursor, big_entry->broadcast_code[cursor]);
}
} else if (spa_streq(key, "encryption")) {
if (spa_json_get_bool(&it[1], &big_entry->encryption) <= 0)
goto parse_failed;
spa_log_debug(monitor->log, "big_entry->encryption %d", big_entry->encryption);
} else if (spa_streq(key, "bis")) {
if (spa_json_enter_array(&it[1], &it_array[1]) <= 0)
goto parse_failed;