-
Notifications
You must be signed in to change notification settings - Fork 8.4k
samples: Bluetooth: BAP: BA: Reset states and modify error checking #89835
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
samples: Bluetooth: BAP: BA: Reset states and modify error checking #89835
Conversation
7b37db5 to
b0bb06a
Compare
b0bb06a to
9ac999f
Compare
| } | ||
|
|
||
| /* Ignore return value as scanning may already be stopped */ | ||
| (void)bt_le_scan_stop(); |
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.
Nit: May want to check for -EALREADY.
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 did consider that, but as far as I can tell, the function does not return -EALREADY if not scanning.
I guess it's related to this part in the BT Core spec:
Disabling scanning when it is disabled has no effect.
9ac999f to
37f9989
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.
Pull Request Overview
This PR improves the reset functionality and error handling for Bluetooth Broadcast Assistant operations by resetting connection and PA sync states, adding proper mutex and semaphore checks, and cleaning up text and error messages.
- Updated error checking using __ASSERT_NO_MSG and refined semaphore timeouts
- Added missing include directives and relocated variable declarations to ensure proper reset behavior
- Modified the reset function to better handle disconnection and PA sync termination events
Comments suppressed due to low confidence (1)
samples/bluetooth/bap_broadcast_assistant/src/main.c:75
- The semaphore 'sem_pa_sync_terminted' appears to have a typo; consider renaming it to 'sem_pa_sync_terminated' for clarity and consistency.
static K_SEM_DEFINE(sem_pa_sync_terminted, 0, 1);
Modify the reset function to also reset the connection and PA sync states. Modify and add missing checks for mutex locks to use ASSERT when using K_FOREVER, as they should never fail/timeout. Cleanup some text and error checks. Ensure that the add_src_param is reset for each loop iteration as well. Modify so that we use K_FOREVER fewer places. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
37f9989 to
ebdb3a6
Compare
|



Modify the reset function to also reset the connection and PA sync states.
Modify and add missing checks for mutex locks to use ASSERT when using K_FOREVER, as they should never fail/timeout.
Cleanup some text and error checks.
Ensure that the add_src_param is reset for each loop iteration as well.