Skip to content

Conversation

@Thalley
Copy link
Contributor

@Thalley Thalley commented May 12, 2025

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.

}

/* Ignore return value as scanning may already be stopped */
(void)bt_le_scan_stop();
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@Thalley Thalley force-pushed the bap_broadcast_assistant_loop_fix branch from 9ac999f to 37f9989 Compare June 13, 2025 13:10
@Thalley Thalley requested a review from Copilot June 13, 2025 13:36
Copy link

Copilot AI left a 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>
@Thalley Thalley force-pushed the bap_broadcast_assistant_loop_fix branch from 37f9989 to ebdb3a6 Compare June 16, 2025 11:38
@sonarqubecloud
Copy link

@fabiobaltieri fabiobaltieri merged commit 117dca0 into zephyrproject-rtos:main Jun 18, 2025
23 checks passed
@github-project-automation github-project-automation bot moved this from In Review to Done in Bluetooth LE Audio Jun 18, 2025
@Thalley Thalley deleted the bap_broadcast_assistant_loop_fix branch June 18, 2025 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants