Bluetooth: CAP: Fix dependency on BT_BAP_STREAM

The CAP commander used bt_audio_valid_ltv which required
BT_BAP_STREAM to be enabled, but the CAP Commander does not
need BT_BAP_STREAM to be enabled.

Moved the function to audio.c which is always compiled for
the CAP Commander, thus removing the requirement for
BT_BAP_STREAM and the accompanying bt_bap_stream.c file.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
Emil Gydesen 2024-08-22 13:52:32 +02:00 committed by Fabio Baltieri
commit f500f7c22f
8 changed files with 15 additions and 28 deletions

View file

@ -97,6 +97,17 @@ uint8_t bt_audio_get_chan_count(enum bt_audio_location chan_allocation)
#endif
}
static bool valid_ltv_cb(struct bt_data *data, void *user_data)
{
/* just return true to continue parsing as bt_data_parse will validate for us */
return true;
}
bool bt_audio_valid_ltv(const uint8_t *data, uint8_t data_len)
{
return bt_audio_data_parse(data, data_len, valid_ltv_cb, NULL) == 0;
}
#if defined(CONFIG_BT_CONN)
static uint8_t bt_audio_security_check(const struct bt_conn *conn)

View file

@ -77,3 +77,5 @@ static inline const char *bt_audio_dir_str(enum bt_audio_dir dir)
return "Unknown";
}
bool bt_audio_valid_ltv(const uint8_t *data, uint8_t data_len);

View file

@ -33,6 +33,7 @@
LOG_MODULE_REGISTER(bt_bap_broadcast_source, CONFIG_BT_BAP_BROADCAST_SOURCE_LOG_LEVEL);
#include "audio_internal.h"
#include "bap_iso.h"
#include "bap_endpoint.h"
#include "bap_stream.h"

View file

@ -208,17 +208,6 @@ enum bt_bap_ascs_reason bt_audio_verify_qos(const struct bt_audio_codec_qos *qos
return BT_BAP_ASCS_REASON_NONE;
}
static bool valid_ltv_cb(struct bt_data *data, void *user_data)
{
/* just return true to continue parsing as bt_data_parse will validate for us */
return true;
}
bool bt_audio_valid_ltv(const uint8_t *data, uint8_t data_len)
{
return bt_audio_data_parse(data, data_len, valid_ltv_cb, NULL) == 0;
}
bool bt_audio_valid_codec_cfg(const struct bt_audio_codec_cfg *codec_cfg)
{
if (codec_cfg == NULL) {

View file

@ -31,7 +31,6 @@ void bt_audio_codec_qos_to_iso_qos(struct bt_iso_chan_io_qos *io,
void bt_bap_stream_detach(struct bt_bap_stream *stream);
enum bt_bap_ascs_reason bt_audio_verify_qos(const struct bt_audio_codec_qos *qos);
bool bt_audio_valid_ltv(const uint8_t *data, uint8_t data_len);
bool bt_audio_valid_codec_cfg(const struct bt_audio_codec_cfg *codec_cfg);
bool bt_bap_stream_can_disconnect(const struct bt_bap_stream *stream);

View file

@ -28,6 +28,7 @@
#include <zephyr/sys/check.h>
#include <zephyr/sys/util.h>
#include "audio_internal.h"
#include "bap_endpoint.h"
#include "bap_internal.h"
#include "cap_internal.h"

View file

@ -1,14 +0,0 @@
# Temporary override
#
# Copyright (c) 2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
#
config BT_BAP_STREAM
# Override until someone fixes the UT build system
bool
default y
# Include Zephyr's Kconfig.
source "Kconfig.zephyr"

View file

@ -8,8 +8,6 @@
add_library(uut STATIC
${ZEPHYR_BASE}/subsys/bluetooth/audio/audio.c
${ZEPHYR_BASE}/subsys/bluetooth/audio/bap_iso.c
${ZEPHYR_BASE}/subsys/bluetooth/audio/bap_stream.c
${ZEPHYR_BASE}/subsys/bluetooth/audio/cap_commander.c
${ZEPHYR_BASE}/subsys/bluetooth/audio/cap_common.c
${ZEPHYR_BASE}/subsys/logging/log_minimal.c