Bluetooth: audio: Add possibility to use static broadcast id
Removed the generation of broadcast id inside the stack. It is now up to the application to generate this by itself. The CAP sample has been modified to allow either a static broadcast, or a random one. All of this is handled in the application. Signed-off-by: Fredrik Danebjer <frdn@demant.com>
This commit is contained in:
parent
7e72d46e2e
commit
f970b066d2
25 changed files with 112 additions and 232 deletions
|
@ -321,18 +321,6 @@ static int setup_broadcast_source(struct bt_bap_broadcast_source **source, bool
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void test_broadcast_source_get_id(struct bt_bap_broadcast_source *source,
|
||||
uint32_t *broadcast_id_out)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = bt_bap_broadcast_source_get_id(source, broadcast_id_out);
|
||||
if (err != 0) {
|
||||
FAIL("Unable to get broadcast ID: %d\n", err);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void test_broadcast_source_get_base(struct bt_bap_broadcast_source *source,
|
||||
struct net_buf_simple *base_buf)
|
||||
{
|
||||
|
@ -373,7 +361,11 @@ static int setup_extended_adv(struct bt_bap_broadcast_source *source, struct bt_
|
|||
return err;
|
||||
}
|
||||
|
||||
test_broadcast_source_get_id(source, &broadcast_id);
|
||||
err = bt_rand(&broadcast_id, BT_AUDIO_BROADCAST_ID_SIZE);
|
||||
if (err) {
|
||||
printk("Unable to generate broadcast ID: %d\n", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
/* Setup extended advertising data */
|
||||
net_buf_simple_add_le16(&ad_buf, BT_UUID_BROADCAST_AUDIO_VAL);
|
||||
|
|
|
@ -249,9 +249,9 @@ static void setup_extended_adv_data(struct bt_cap_broadcast_source *source,
|
|||
uint32_t broadcast_id;
|
||||
int err;
|
||||
|
||||
err = bt_cap_initiator_broadcast_get_id(source, &broadcast_id);
|
||||
if (err != 0) {
|
||||
FAIL("Unable to get broadcast ID: %d\n", err);
|
||||
err = bt_rand(&broadcast_id, BT_AUDIO_BROADCAST_ID_SIZE);
|
||||
if (err) {
|
||||
FAIL("Unable to generate broadcast ID: %d\n", err);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1055,9 +1055,9 @@ static void setup_extended_adv_data(struct bt_cap_broadcast_source *source,
|
|||
uint32_t broadcast_id;
|
||||
int err;
|
||||
|
||||
err = bt_cap_initiator_broadcast_get_id(source, &broadcast_id);
|
||||
if (err != 0) {
|
||||
FAIL("Unable to get broadcast ID: %d\n", err);
|
||||
err = bt_rand(&broadcast_id, BT_AUDIO_BROADCAST_ID_SIZE);
|
||||
if (err) {
|
||||
FAIL("Unable to generate broadcast ID: %d\n", err);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -135,10 +135,9 @@ static int setup_extended_adv_data(struct bt_cap_broadcast_source *source,
|
|||
uint32_t broadcast_id;
|
||||
int err;
|
||||
|
||||
err = bt_cap_initiator_broadcast_get_id(source, &broadcast_id);
|
||||
if (err != 0) {
|
||||
printk("Unable to get broadcast ID: %d\n", err);
|
||||
|
||||
err = bt_rand(&broadcast_id, BT_AUDIO_BROADCAST_ID_SIZE);
|
||||
if (err) {
|
||||
FAIL("Unable to generate broadcast ID: %d\n", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue