Skip to content

Commit f500f7c

Browse files
Thalleyfabiobaltieri
authored andcommitted
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>
1 parent fff9c32 commit f500f7c

File tree

8 files changed

+15
-28
lines changed

8 files changed

+15
-28
lines changed

subsys/bluetooth/audio/audio.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,17 @@ uint8_t bt_audio_get_chan_count(enum bt_audio_location chan_allocation)
9797
#endif
9898
}
9999

100+
static bool valid_ltv_cb(struct bt_data *data, void *user_data)
101+
{
102+
/* just return true to continue parsing as bt_data_parse will validate for us */
103+
return true;
104+
}
105+
106+
bool bt_audio_valid_ltv(const uint8_t *data, uint8_t data_len)
107+
{
108+
return bt_audio_data_parse(data, data_len, valid_ltv_cb, NULL) == 0;
109+
}
110+
100111
#if defined(CONFIG_BT_CONN)
101112

102113
static uint8_t bt_audio_security_check(const struct bt_conn *conn)

subsys/bluetooth/audio/audio_internal.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,5 @@ static inline const char *bt_audio_dir_str(enum bt_audio_dir dir)
7777

7878
return "Unknown";
7979
}
80+
81+
bool bt_audio_valid_ltv(const uint8_t *data, uint8_t data_len);

subsys/bluetooth/audio/bap_broadcast_source.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
LOG_MODULE_REGISTER(bt_bap_broadcast_source, CONFIG_BT_BAP_BROADCAST_SOURCE_LOG_LEVEL);
3535

36+
#include "audio_internal.h"
3637
#include "bap_iso.h"
3738
#include "bap_endpoint.h"
3839
#include "bap_stream.h"

subsys/bluetooth/audio/bap_stream.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -208,17 +208,6 @@ enum bt_bap_ascs_reason bt_audio_verify_qos(const struct bt_audio_codec_qos *qos
208208
return BT_BAP_ASCS_REASON_NONE;
209209
}
210210

211-
static bool valid_ltv_cb(struct bt_data *data, void *user_data)
212-
{
213-
/* just return true to continue parsing as bt_data_parse will validate for us */
214-
return true;
215-
}
216-
217-
bool bt_audio_valid_ltv(const uint8_t *data, uint8_t data_len)
218-
{
219-
return bt_audio_data_parse(data, data_len, valid_ltv_cb, NULL) == 0;
220-
}
221-
222211
bool bt_audio_valid_codec_cfg(const struct bt_audio_codec_cfg *codec_cfg)
223212
{
224213
if (codec_cfg == NULL) {

subsys/bluetooth/audio/bap_stream.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ void bt_audio_codec_qos_to_iso_qos(struct bt_iso_chan_io_qos *io,
3131
void bt_bap_stream_detach(struct bt_bap_stream *stream);
3232

3333
enum bt_bap_ascs_reason bt_audio_verify_qos(const struct bt_audio_codec_qos *qos);
34-
bool bt_audio_valid_ltv(const uint8_t *data, uint8_t data_len);
3534
bool bt_audio_valid_codec_cfg(const struct bt_audio_codec_cfg *codec_cfg);
3635
bool bt_bap_stream_can_disconnect(const struct bt_bap_stream *stream);
3736

subsys/bluetooth/audio/cap_commander.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <zephyr/sys/check.h>
2929
#include <zephyr/sys/util.h>
3030

31+
#include "audio_internal.h"
3132
#include "bap_endpoint.h"
3233
#include "bap_internal.h"
3334
#include "cap_internal.h"

tests/bluetooth/audio/cap_commander/Kconfig

Lines changed: 0 additions & 14 deletions
This file was deleted.

tests/bluetooth/audio/cap_commander/uut/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
add_library(uut STATIC
1010
${ZEPHYR_BASE}/subsys/bluetooth/audio/audio.c
11-
${ZEPHYR_BASE}/subsys/bluetooth/audio/bap_iso.c
12-
${ZEPHYR_BASE}/subsys/bluetooth/audio/bap_stream.c
1311
${ZEPHYR_BASE}/subsys/bluetooth/audio/cap_commander.c
1412
${ZEPHYR_BASE}/subsys/bluetooth/audio/cap_common.c
1513
${ZEPHYR_BASE}/subsys/logging/log_minimal.c

0 commit comments

Comments
 (0)