Skip to content
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

nimble/audio: Add LE Audio event listener and BASE parser #1708

Merged
merged 2 commits into from
Feb 28, 2024

Conversation

MariuszSkamra
Copy link
Contributor

This adds dedicated event listener for LE Audio events and BASE parser implementation along with unit tests.

@MariuszSkamra
Copy link
Contributor Author

The CI is failing with false negative result

nimble/host/audio/include/host/audio/ble_audio.h Outdated Show resolved Hide resolved
uint16_t svc_data_len;

/** Optional Public Broadcast Announcement data */
struct ble_audio_bcst_public *pub;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
struct ble_audio_bcst_public *pub;
struct ble_audio_pub_bcst_announce *pub_announce_data;

I think it's not too long and bit more descriptive.

nimble/host/audio/include/host/audio/ble_audio.h Outdated Show resolved Hide resolved
nimble/host/audio/include/host/audio/ble_audio.h Outdated Show resolved Hide resolved
nimble/host/audio/src/ble_audio.c Show resolved Hide resolved
nimble/host/audio/src/ble_audio.c Outdated Show resolved Hide resolved
Comment on lines 312 to 320
if (group->num_subgroups < 1) {
BLE_HS_LOG_DEBUG("Rule 1 violation: There shall be at least one subgroup.\n");
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We know the rules, but it imho looks a bit weird :) And don't we want to return early here, like in other errors? I think BASE with no subgroups as just as bad as empty one - both don't follow spec. Maybe something like this?

Suggested change
if (group->num_subgroups < 1) {
BLE_HS_LOG_DEBUG("Rule 1 violation: There shall be at least one subgroup.\n");
}
if (group->num_subgroups < 1) {
BLE_HS_LOG_ERROR("Invalid BASE: no subgroups!\n");
return BLE_HS_EINVAL;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I was considering that, probably you're right.
I was thinking about this as an Advertising data that display to the user - when you parse e.g. Complete Name, Service Data and Appearance. When you fail to parse Service data I think you still want to report the Complete Name and Appearance.
Let's wait for 3rd eye pair to look at this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest BLE_HS_LOG_ERROR here and return as @KKopyscinski suggested.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like @MariuszSkamra error message better, so just change DEBUG to ERROR here.

nimble/host/audio/syscfg.yml Show resolved Hide resolved
nimble/host/include/host/ble_audio_common.h Outdated Show resolved Hide resolved
@MariuszSkamra
Copy link
Contributor Author

Rebased

offset++;

if (subgroup->num_bis < 1) {
BLE_HS_LOG_DEBUG("Rule 2 violation: There shall be at least one BIS per"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same, change DEBUG to ERROR and return BLE_HS_EINVAL

}
}

if (!evl) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe to avoid nesting,

if (evl) {
return BLE_HS_EALREADY;
}

}

if (!evl) {
rc = BLE_HS_ENOENT;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe just return BLE_HS_ENOENT;

to avoid nesting.

This adds BASE parser implementation along with unit tests.
This adds dedicated event listener for LE Audio events.
Copy link
Contributor

@rymanluk rymanluk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rymanluk rymanluk merged commit a3cef58 into apache:master Feb 28, 2024
16 of 17 checks passed
@MariuszSkamra MariuszSkamra deleted the audio_base_parser branch February 28, 2024 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants