-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Bluetooth: CAP: Commander Reception start procedure #69593
Bluetooth: CAP: Commander Reception start procedure #69593
Conversation
44daaaf
to
008977c
Compare
008977c
to
8b7017d
Compare
include/zephyr/bluetooth/audio/cap.h
Outdated
* | ||
* @param conn Pointer to the connection where the error | ||
* occurred. NULL if @p err is 0 or if cancelled by | ||
* bt_cap_initiator_unucast_audio_cancel() |
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.
* bt_cap_initiator_unucast_audio_cancel() | |
* bt_cap_commander_cancel() |
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.
@kruithofa you may also have missed this one
tests/bluetooth/audio/cap_commander/uut/bap_broadcast_assistant.c
Outdated
Show resolved
Hide resolved
0e78935
to
c11044f
Compare
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.
Some additional comments, and some comments still remaining from previous review
2986d41
to
fcb5de1
Compare
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.
A few minor comments (and some old comments that are still missing responses
return false; | ||
} | ||
|
||
if (start_param->num_subgroups > CONFIG_BT_BAP_BASS_MAX_SUBGROUPS) { |
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.
if (start_param->num_subgroups > CONFIG_BT_BAP_BASS_MAX_SUBGROUPS) { | |
CHECKIF(start_param->num_subgroups > CONFIG_BT_BAP_BASS_MAX_SUBGROUPS) { |
CHECKIF(!valid_bis_syncs(start_param->subgroups[j].bis_sync)) { | ||
LOG_DBG("param->param[%zu].subgroup[%zu].bis_sync is invalid", i, | ||
j); | ||
} |
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 should also consider validating that the bis_sync
of each subgroup are distinct, e.g. subgroup 1 and 2 cannot both have index 0x02.
This can be done by something like
uint32_t total_bis_sync = 0U;
for (...) {
if (total_bis_sync & start_param->subgroups[j].bis_sync != 0) {
/* invalid parameters */
}
total_bis_sync |= start_param->subgroups[j].bis_sync;
}
if (start_param->subgroups[j].metadata_len > | ||
CONFIG_BT_AUDIO_CODEC_CFG_MAX_METADATA_SIZE) { |
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.
Since metadata is always LTV encoded, we could (should?) check if it's valid. You can use bt_audio_valid_ltv
for that
fcb5de1
to
de76a25
Compare
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.
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.
That creates conflicts in other unittests. Instead I'll compile in the complete bap_stream.c file (even though that adds a lot that we do not need)
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.
That creates conflicts in other unittests.
Oh :O What conflicts? Adding an implementation of a single function seems unlikely to cause such issues.
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.
There are some other unittests which include the original bap_stream.c (from subsys/bluetooth/audio), which causes multiple definitions of a function.
d4062b6
to
3c908dc
Compare
Add the CAP commander reception start procedure which starts reception on one or more CAP acceptors With the implementation of broadcast reception start procedure we also need some mockups for unit testing Signed-off-by: Andries Kruithof <[email protected]>
3c908dc
to
bcc1205
Compare
#if defined(CONFIG_BT_BAP_BROADCAST_ASSISTANT) | ||
struct cap_broadcast_reception_start { | ||
|
||
bt_addr_le_t addr; | ||
uint8_t adv_sid; | ||
uint32_t broadcast_id; | ||
uint16_t pa_interval; | ||
uint8_t num_subgroups; | ||
struct bt_bap_bass_subgroup subgroups[CONFIG_BT_BAP_BASS_MAX_SUBGROUPS]; | ||
}; | ||
#endif /* CONFIG_BT_BAP_BROADCAST_ASSISTANT */ |
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.
#if defined(CONFIG_BT_BAP_BROADCAST_ASSISTANT) | |
struct cap_broadcast_reception_start { | |
bt_addr_le_t addr; | |
uint8_t adv_sid; | |
uint32_t broadcast_id; | |
uint16_t pa_interval; | |
uint8_t num_subgroups; | |
struct bt_bap_bass_subgroup subgroups[CONFIG_BT_BAP_BASS_MAX_SUBGROUPS]; | |
}; | |
#endif /* CONFIG_BT_BAP_BROADCAST_ASSISTANT */ | |
#if defined(CONFIG_BT_BAP_BROADCAST_ASSISTANT) | |
struct cap_broadcast_reception_start { | |
bt_addr_le_t addr; | |
uint8_t adv_sid; | |
uint32_t broadcast_id; | |
uint16_t pa_interval; | |
uint8_t num_subgroups; | |
struct bt_bap_bass_subgroup subgroups[CONFIG_BT_BAP_BASS_MAX_SUBGROUPS]; | |
}; | |
#endif /* CONFIG_BT_BAP_BROADCAST_ASSISTANT */ |
Didn't consider that we'd have to move this out of the union to pass it on as an argument, but of course that's required.
It's OK as is, but you can also revert this if you like
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.
I think I like it this way, and it can be argued that the union is more readable if we move all structs outside of it
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.
LGTM
Add the CAP commander reception start procedure which starts reception on one or more CAP acceptors
fixes #64358