-
Notifications
You must be signed in to change notification settings - Fork 8.1k
bluetooth: add macros for BT_BAP_PAST_SERVICE_DATA #95487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -132,6 +132,7 @@ static void bap_broadcast_assistant_recv_state_cb( | |||||||||||
char le_addr[BT_ADDR_LE_STR_LEN]; | ||||||||||||
char bad_code[33]; | ||||||||||||
bool is_bad_code; | ||||||||||||
struct bt_le_ext_adv_info info; | ||||||||||||
|
||||||||||||
if (err != 0) { | ||||||||||||
bt_shell_error("BASS recv state read failed (%d)", err); | ||||||||||||
|
@@ -176,11 +177,14 @@ static void bap_broadcast_assistant_recv_state_cb( | |||||||||||
} | ||||||||||||
|
||||||||||||
if (per_adv_sync && IS_ENABLED(CONFIG_BT_PER_ADV_SYNC_TRANSFER_SENDER)) { | ||||||||||||
uint8_t past_flags = BT_BAP_PAST_FLAG_NO_MATCH_ADV_EXT_IND; | ||||||||||||
uint8_t src_id = state->src_id; | ||||||||||||
|
||||||||||||
bt_shell_print("Sending PAST"); | ||||||||||||
|
||||||||||||
err = bt_le_per_adv_sync_transfer(per_adv_sync, | ||||||||||||
conn, | ||||||||||||
BT_UUID_BASS_VAL); | ||||||||||||
conn, | ||||||||||||
BT_BAP_PAST_SERVICE_DATA(past_flags, src_id)); | ||||||||||||
|
||||||||||||
if (err != 0) { | ||||||||||||
bt_shell_error("Could not transfer periodic adv sync: %d", err); | ||||||||||||
|
@@ -213,10 +217,16 @@ static void bap_broadcast_assistant_recv_state_cb( | |||||||||||
|
||||||||||||
if (ext_adv != NULL && IS_ENABLED(CONFIG_BT_PER_ADV) && | ||||||||||||
IS_ENABLED(CONFIG_BT_PER_ADV_SYNC_TRANSFER_SENDER)) { | ||||||||||||
uint8_t past_flags = BT_BAP_PAST_FLAG_NO_MATCH_ADV_EXT_IND; | ||||||||||||
|
||||||||||||
bt_le_ext_adv_get_info(ext_adv, &info); | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Our coding guidelines require that all functions that may return an error, shall have the return value checked, so this must be
Suggested change
In cases like this where it should never fail unless something terribly has happened, I'd test this with an ASSERT
Suggested change
This also applies to the other cases in this PR |
||||||||||||
uint8_t src_id = info.sid; | ||||||||||||
|
||||||||||||
bt_shell_print("Sending local PAST"); | ||||||||||||
|
||||||||||||
err = bt_le_per_adv_set_info_transfer(ext_adv, conn, | ||||||||||||
BT_UUID_BASS_VAL); | ||||||||||||
err = bt_le_per_adv_set_info_transfer(ext_adv, | ||||||||||||
conn, | ||||||||||||
BT_BAP_PAST_SERVICE_DATA(past_flags, src_id)); | ||||||||||||
|
||||||||||||
if (err != 0) { | ||||||||||||
bt_shell_error("Could not transfer per adv set info: %d", err); | ||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -120,6 +120,7 @@ static void bap_broadcast_assistant_recv_state_cb( | |||||||||||||||||||
{ | ||||||||||||||||||||
char le_addr[BT_ADDR_LE_STR_LEN]; | ||||||||||||||||||||
char bad_code[BT_ISO_BROADCAST_CODE_SIZE * 2 + 1]; | ||||||||||||||||||||
struct bt_le_ext_adv_info info; | ||||||||||||||||||||
|
||||||||||||||||||||
if (err != 0) { | ||||||||||||||||||||
FAIL("BASS recv state read failed (%d)\n", err); | ||||||||||||||||||||
|
@@ -179,8 +180,16 @@ static void bap_broadcast_assistant_recv_state_cb( | |||||||||||||||||||
|
||||||||||||||||||||
#if defined(CONFIG_BT_PER_ADV_SYNC_TRANSFER_SENDER) | ||||||||||||||||||||
if (state->pa_sync_state == BT_BAP_PA_STATE_INFO_REQ) { | ||||||||||||||||||||
err = bt_le_per_adv_sync_transfer(g_pa_sync, conn, | ||||||||||||||||||||
BT_UUID_BASS_VAL); | ||||||||||||||||||||
uint8_t past_flags = BT_BAP_PAST_FLAG_NO_MATCH_ADV_EXT_IND; | ||||||||||||||||||||
|
||||||||||||||||||||
bt_le_per_adv_sync_get_info(g_pa_sync, &info); | ||||||||||||||||||||
uint8_t src_id = info.sid; | ||||||||||||||||||||
|
||||||||||||||||||||
|
||||||||||||||||||||
err = bt_le_per_adv_sync_transfer(g_pa_sync, | ||||||||||||||||||||
conn, | ||||||||||||||||||||
BT_BAP_PAST_SERVICE_DATA(past_flags, src_id)); | ||||||||||||||||||||
Comment on lines
+186
to
+191
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||
|
||||||||||||||||||||
if (err != 0) { | ||||||||||||||||||||
FAIL("Could not transfer periodic adv sync: %d\n", err); | ||||||||||||||||||||
return; | ||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -487,6 +487,8 @@ bap_broadcast_assistant_recv_state_cb(struct bt_conn *conn, int err, | |||||||||||||||||||||||
char le_addr[BT_ADDR_LE_STR_LEN]; | ||||||||||||||||||||||||
char bad_code[BT_ISO_BROADCAST_CODE_SIZE * 2 + 1]; | ||||||||||||||||||||||||
size_t acceptor_count = get_dev_cnt() - 2; | ||||||||||||||||||||||||
struct bt_le_ext_adv_info info; | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
|
||||||||||||||||||||||||
if (err != 0) { | ||||||||||||||||||||||||
FAIL("BASS recv state read failed (%d)\n", err); | ||||||||||||||||||||||||
|
@@ -534,7 +536,15 @@ bap_broadcast_assistant_recv_state_cb(struct bt_conn *conn, int err, | |||||||||||||||||||||||
|
||||||||||||||||||||||||
#if defined(CONFIG_BT_PER_ADV_SYNC_TRANSFER_SENDER) | ||||||||||||||||||||||||
if (state->pa_sync_state == BT_BAP_PA_STATE_INFO_REQ) { | ||||||||||||||||||||||||
err = bt_le_per_adv_sync_transfer(g_pa_sync, conn, BT_UUID_BASS_VAL); | ||||||||||||||||||||||||
uint8_t past_flags = BT_BAP_PAST_FLAG_NO_MATCH_ADV_EXT_IND; | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
bt_le_per_adv_sync_get_info(g_pa_sync, &info); | ||||||||||||||||||||||||
uint8_t src_id = info.sid; | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
err = bt_le_per_adv_sync_transfer(g_pa_sync, | ||||||||||||||||||||||||
conn, | ||||||||||||||||||||||||
BT_BAP_PAST_SERVICE_DATA(past_flags, src_id)); | ||||||||||||||||||||||||
Comment on lines
+541
to
+546
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for feedback. The defintion looks like this:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, this is on me. It's not the We need to store the |
||||||||||||||||||||||||
|
||||||||||||||||||||||||
if (err != 0) { | ||||||||||||||||||||||||
FAIL("Could not transfer periodic adv sync: %d\n", err); | ||||||||||||||||||||||||
return; | ||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a 100-line maximum in Zephy, so we could do
else I would put the
|
on the first line