Skip to content

Commit 1dd59ea

Browse files
Thalleydleach02
authored andcommitted
Bluetooth: Audio: Remove BT_AUDIO_BROADCAST_CODE_SIZE
Removed the LE Audio specific definition and instead refer to the value defined by iso.h as it is ISO/Core that defines this size, and not BAP/Audio. Signed-off-by: Emil Gydesen <[email protected]>
1 parent 0705a63 commit 1dd59ea

File tree

25 files changed

+60
-60
lines changed

25 files changed

+60
-60
lines changed

doc/releases/migration-guide-4.0.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,9 @@ Bluetooth Audio
395395
instances of :c:func:`bt_cap_initiator_broadcast_get_id` and
396396
:c:func:`bt_bap_broadcast_source_get_id` has been removed(:github:`80228`)
397397

398+
* ``BT_AUDIO_BROADCAST_CODE_SIZE`` has been removed and ``BT_ISO_BROADCAST_CODE_SIZE`` should be
399+
used instead. (:github:`80217`)
400+
398401
Bluetooth Classic
399402
=================
400403

include/zephyr/bluetooth/audio/audio.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ extern "C" {
4949
#define BT_AUDIO_PD_MAX 0xFFFFFFU
5050
/** Indicates that the unicast server does not have a preference for any retransmission number */
5151
#define BT_AUDIO_RTN_PREF_NONE 0xFFU
52-
/** Maximum size of the broadcast code in octets */
53-
#define BT_AUDIO_BROADCAST_CODE_SIZE 16
54-
5552
/** The minimum size of a Broadcast Name as defined by Bluetooth Assigned Numbers */
5653
#define BT_AUDIO_BROADCAST_NAME_LEN_MIN 4
5754
/** The maximum size of a Broadcast Name as defined by Bluetooth Assigned Numbers */

include/zephyr/bluetooth/audio/bap.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ struct bt_bap_scan_delegator_recv_state {
572572
*
573573
* Only valid if encrypt_state is @ref BT_BAP_BIG_ENC_STATE_BCODE_REQ
574574
*/
575-
uint8_t bad_code[BT_AUDIO_BROADCAST_CODE_SIZE];
575+
uint8_t bad_code[BT_ISO_BROADCAST_CODE_SIZE];
576576

577577
/** Number of subgroups */
578578
uint8_t num_subgroups;
@@ -652,7 +652,7 @@ struct bt_bap_scan_delegator_cb {
652652
*/
653653
void (*broadcast_code)(struct bt_conn *conn,
654654
const struct bt_bap_scan_delegator_recv_state *recv_state,
655-
const uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE]);
655+
const uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]);
656656
/**
657657
* @brief Broadcast Isochronous Stream synchronize request
658658
*
@@ -2058,7 +2058,7 @@ struct bt_bap_broadcast_source_param {
20582058
* The string "Broadcast Code" shall be
20592059
* [42 72 6F 61 64 63 61 73 74 20 43 6F 64 65 00 00]
20602060
*/
2061-
uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE];
2061+
uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE];
20622062

20632063
#if defined(CONFIG_BT_ISO_TEST_PARAMS) || defined(__DOXYGEN__)
20642064
/**
@@ -2298,7 +2298,8 @@ int bt_bap_broadcast_sink_create(struct bt_le_per_adv_sync *pa_sync, uint32_t br
22982298
* @return 0 in case of success or negative value in case of error.
22992299
*/
23002300
int bt_bap_broadcast_sink_sync(struct bt_bap_broadcast_sink *sink, uint32_t indexes_bitfield,
2301-
struct bt_bap_stream *streams[], const uint8_t broadcast_code[16]);
2301+
struct bt_bap_stream *streams[],
2302+
const uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]);
23022303

23032304
/**
23042305
* @brief Stop audio broadcast sink.
@@ -2799,7 +2800,7 @@ int bt_bap_broadcast_assistant_mod_src(
27992800
*/
28002801
int bt_bap_broadcast_assistant_set_broadcast_code(
28012802
struct bt_conn *conn, uint8_t src_id,
2802-
const uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE]);
2803+
const uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]);
28032804

28042805
/**
28052806
* @brief Remove a source from the server.

include/zephyr/bluetooth/audio/cap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ struct bt_cap_initiator_broadcast_create_param {
482482
* The string "Broadcast Code" shall be
483483
* [42 72 6F 61 64 63 61 73 74 20 43 6F 64 65 00 00]
484484
*/
485-
uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE];
485+
uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE];
486486

487487
#if defined(CONFIG_BT_ISO_TEST_PARAMS) || defined(__DOXYGEN__)
488488
/**

samples/bluetooth/bap_broadcast_sink/src/main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ static const struct bt_audio_codec_cap codec_cap = BT_AUDIO_CODEC_CAP_LC3(
148148
static const uint32_t bis_index_mask = BIT_MASK(ARRAY_SIZE(streams));
149149
static uint32_t requested_bis_sync;
150150
static uint32_t bis_index_bitfield;
151-
static uint8_t sink_broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE];
151+
static uint8_t sink_broadcast_code[BT_ISO_BROADCAST_CODE_SIZE];
152152

153153
uint64_t total_rx_iso_packet_count; /* This value is exposed to test code */
154154

@@ -966,13 +966,13 @@ static int pa_sync_term_req_cb(struct bt_conn *conn,
966966

967967
static void broadcast_code_cb(struct bt_conn *conn,
968968
const struct bt_bap_scan_delegator_recv_state *recv_state,
969-
const uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE])
969+
const uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE])
970970
{
971971
printk("Broadcast code received for %p\n", recv_state);
972972

973973
req_recv_state = recv_state;
974974

975-
(void)memcpy(sink_broadcast_code, broadcast_code, BT_AUDIO_BROADCAST_CODE_SIZE);
975+
(void)memcpy(sink_broadcast_code, broadcast_code, BT_ISO_BROADCAST_CODE_SIZE);
976976

977977
k_sem_give(&sem_broadcast_code_received);
978978
}

samples/bluetooth/bap_broadcast_source/src/main.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727
#include <zephyr/sys_clock.h>
2828
#include <zephyr/toolchain.h>
2929

30-
BUILD_ASSERT(strlen(CONFIG_BROADCAST_CODE) <= BT_AUDIO_BROADCAST_CODE_SIZE,
31-
"Invalid broadcast code");
30+
BUILD_ASSERT(strlen(CONFIG_BROADCAST_CODE) <= BT_ISO_BROADCAST_CODE_SIZE, "Invalid broadcast code");
3231

3332
/* Zephyr Controller works best while Extended Advertising interval to be a multiple
3433
* of the ISO Interval minus 10 ms (max. advertising random delay). This is

samples/bluetooth/cap_acceptor/src/cap_acceptor_broadcast.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ ATOMIC_DEFINE(flags, FLAG_NUM);
5454

5555
static struct broadcast_sink {
5656
const struct bt_bap_scan_delegator_recv_state *req_recv_state;
57-
uint8_t sink_broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE];
57+
uint8_t sink_broadcast_code[BT_ISO_BROADCAST_CODE_SIZE];
5858
struct bt_bap_broadcast_sink *bap_broadcast_sink;
5959
struct bt_cap_stream broadcast_stream;
6060
struct bt_le_per_adv_sync *pa_sync;
@@ -424,14 +424,14 @@ static int pa_sync_term_req_cb(struct bt_conn *conn,
424424

425425
static void broadcast_code_cb(struct bt_conn *conn,
426426
const struct bt_bap_scan_delegator_recv_state *recv_state,
427-
const uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE])
427+
const uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE])
428428
{
429429
LOG_INF("Broadcast code received for %p", recv_state);
430430

431431
broadcast_sink.req_recv_state = recv_state;
432432

433433
(void)memcpy(broadcast_sink.sink_broadcast_code, broadcast_code,
434-
BT_AUDIO_BROADCAST_CODE_SIZE);
434+
BT_ISO_BROADCAST_CODE_SIZE);
435435

436436
atomic_set_bit(flags, FLAG_BROADCAST_CODE_RECEIVED);
437437
}

subsys/bluetooth/audio/bap_broadcast_assistant.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <zephyr/bluetooth/gatt.h>
2525
#include <zephyr/bluetooth/att.h>
2626
#include <zephyr/bluetooth/hci_types.h>
27+
#include <zephyr/bluetooth/iso.h>
2728
#include <zephyr/bluetooth/l2cap.h>
2829
#include <zephyr/bluetooth/buf.h>
2930
#include <zephyr/bluetooth/uuid.h>
@@ -262,8 +263,7 @@ static int parse_recv_state(const void *data, uint16_t length,
262263
return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN);
263264
}
264265

265-
broadcast_code = net_buf_simple_pull_mem(&buf,
266-
BT_AUDIO_BROADCAST_CODE_SIZE);
266+
broadcast_code = net_buf_simple_pull_mem(&buf, BT_ISO_BROADCAST_CODE_SIZE);
267267
(void)memcpy(recv_state->bad_code, broadcast_code,
268268
sizeof(recv_state->bad_code));
269269
}
@@ -1446,7 +1446,7 @@ int bt_bap_broadcast_assistant_mod_src(struct bt_conn *conn,
14461446

14471447
int bt_bap_broadcast_assistant_set_broadcast_code(
14481448
struct bt_conn *conn, uint8_t src_id,
1449-
const uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE])
1449+
const uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE])
14501450
{
14511451
struct bt_bap_bass_cp_broadcase_code *cp;
14521452
struct bap_broadcast_assistant_instance *inst;
@@ -1479,10 +1479,9 @@ int bt_bap_broadcast_assistant_set_broadcast_code(
14791479
cp->opcode = BT_BAP_BASS_OP_BROADCAST_CODE;
14801480
cp->src_id = src_id;
14811481

1482-
(void)memcpy(cp->broadcast_code, broadcast_code,
1483-
BT_AUDIO_BROADCAST_CODE_SIZE);
1482+
(void)memcpy(cp->broadcast_code, broadcast_code, BT_ISO_BROADCAST_CODE_SIZE);
14841483

1485-
LOG_HEXDUMP_DBG(cp->broadcast_code, BT_AUDIO_BROADCAST_CODE_SIZE, "broadcast code:");
1484+
LOG_HEXDUMP_DBG(cp->broadcast_code, BT_ISO_BROADCAST_CODE_SIZE, "broadcast code:");
14861485

14871486
return bt_bap_broadcast_assistant_common_cp(conn, &att_buf);
14881487
}

subsys/bluetooth/audio/bap_broadcast_sink.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1157,7 +1157,8 @@ int bt_bap_broadcast_sink_create(struct bt_le_per_adv_sync *pa_sync, uint32_t br
11571157
}
11581158

11591159
int bt_bap_broadcast_sink_sync(struct bt_bap_broadcast_sink *sink, uint32_t indexes_bitfield,
1160-
struct bt_bap_stream *streams[], const uint8_t broadcast_code[16])
1160+
struct bt_bap_stream *streams[],
1161+
const uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE])
11611162
{
11621163
struct bt_iso_big_sync_param param;
11631164
struct bt_audio_codec_cfg *codec_cfgs[CONFIG_BT_BAP_BROADCAST_SNK_STREAM_COUNT] = {NULL};

subsys/bluetooth/audio/bap_endpoint.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ struct bt_bap_broadcast_source {
122122
/* The codec specific configured data for each stream in the subgroup */
123123
struct bt_audio_broadcast_stream_data stream_data[BROADCAST_STREAM_CNT];
124124
#endif /* CONFIG_BT_AUDIO_CODEC_CFG_MAX_DATA_SIZE > 0 */
125-
uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE];
125+
uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE];
126126

127127
/* The complete codec specific configured data for each stream in the subgroup.
128128
* This contains both the subgroup and the BIS-specific data for each stream.

0 commit comments

Comments
 (0)