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

Bluetooth: CAP: Add support for doing just disable for unicast stop #74187

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion include/zephyr/bluetooth/audio/cap.h
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,9 @@ struct bt_cap_unicast_audio_stop_param {

/** Array of streams to stop */
struct bt_cap_stream **streams;

/** Whether to release the streams after they have stopped */
bool release;
};

/**
Expand Down Expand Up @@ -379,7 +382,10 @@ int bt_cap_initiator_unicast_audio_update(const struct bt_cap_unicast_audio_upda
*
* @param param Stop parameters.
*
* @return 0 on success or negative error value on failure.
* @return 0 on success
* @retval -EBUSY if a CAP procedure is already in progress
* @retval -EINVAL if any parameter is invalid
* @retval -EALREADY if no state changes will occur
*/
int bt_cap_initiator_unicast_audio_stop(const struct bt_cap_unicast_audio_stop_param *param);

Expand Down
4 changes: 2 additions & 2 deletions subsys/bluetooth/audio/bap_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ void bt_bap_stream_detach(struct bt_bap_stream *stream)
{
const bool is_broadcast = bt_bap_stream_is_broadcast(stream);

LOG_DBG("stream %p", stream);
LOG_DBG("stream %p conn %p ep %p", stream, (void *)stream->conn, (void *)stream->ep);

if (stream->conn != NULL) {
bt_conn_unref(stream->conn);
Expand Down Expand Up @@ -587,7 +587,7 @@ int bt_bap_stream_config(struct bt_conn *conn, struct bt_bap_stream *stream, str
codec_cfg, codec_cfg ? codec_cfg->id : 0, codec_cfg ? codec_cfg->cid : 0,
codec_cfg ? codec_cfg->vid : 0);

CHECKIF(conn == NULL || stream == NULL || codec_cfg == NULL) {
CHECKIF(conn == NULL || stream == NULL || codec_cfg == NULL || ep == NULL) {
LOG_DBG("NULL value(s) supplied)");
return -EINVAL;
}
Expand Down
10 changes: 10 additions & 0 deletions subsys/bluetooth/audio/cap_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ void bt_cap_common_set_subproc(enum bt_cap_common_subproc_type subproc_type)
active_proc.subproc_type = subproc_type;
}

bool bt_cap_common_proc_is_type(enum bt_cap_common_proc_type proc_type)
{
return active_proc.proc_type == proc_type;
}

bool bt_cap_common_subproc_is_type(enum bt_cap_common_subproc_type subproc_type)
{
return active_proc.subproc_type == subproc_type;
Expand Down Expand Up @@ -122,7 +127,12 @@ void bt_cap_common_abort_proc(struct bt_conn *conn, int err)
return;
}

#if defined(CONFIG_BT_CAP_INITIATOR_UNICAST)
LOG_DBG("Aborting proc %d with subproc %d for %p: %d", active_proc.proc_type,
active_proc.subproc_type, (void *)conn, err);
#else /* !CONFIG_BT_CAP_INITIATOR_UNICAST */
LOG_DBG("Aborting proc %d for %p: %d", active_proc.proc_type, (void *)conn, err);
#endif /* CONFIG_BT_CAP_INITIATOR_UNICAST */

active_proc.err = err;
active_proc.failed_conn = conn;
Expand Down
Loading
Loading