Skip to content

Commit

Permalink
shared/bap: add bt_bap_cancel_select to cancel ongoing pac select
Browse files Browse the repository at this point in the history
Add function and PAC ops for canceling a previously initiated
SelectProperties() call.
  • Loading branch information
pv authored and Vudentz committed Mar 25, 2024
1 parent 150bd6e commit 6849c64
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/shared/bap.c
Expand Up @@ -5180,6 +5180,18 @@ int bt_bap_select(struct bt_bap_pac *lpac, struct bt_bap_pac *rpac,
return 0;
}

void bt_bap_cancel_select(struct bt_bap_pac *lpac, bt_bap_pac_select_t func,
void *user_data)
{
if (!lpac || !func)
return;

if (!lpac->ops || !lpac->ops->cancel_select)
return;

lpac->ops->cancel_select(lpac, func, user_data, lpac->user_data);
}

static struct bt_bap_stream *bap_bcast_stream_new(struct bt_bap *bap,
struct bt_bap_pac *lpac,
struct bt_bap_pac *rpac,
Expand Down
5 changes: 5 additions & 0 deletions src/shared/bap.h
Expand Up @@ -72,6 +72,8 @@ struct bt_bap_pac_ops {
int (*select)(struct bt_bap_pac *lpac, struct bt_bap_pac *rpac,
uint32_t chan_alloc, struct bt_bap_pac_qos *qos,
bt_bap_pac_select_t cb, void *cb_data, void *user_data);
void (*cancel_select)(struct bt_bap_pac *lpac,
bt_bap_pac_select_t cb, void *cb_data, void *user_data);
int (*config)(struct bt_bap_stream *stream, struct iovec *cfg,
struct bt_bap_qos *qos, bt_bap_pac_config_t cb,
void *user_data);
Expand Down Expand Up @@ -160,6 +162,9 @@ int bt_bap_select(struct bt_bap_pac *lpac, struct bt_bap_pac *rpac,
int *count, bt_bap_pac_select_t func,
void *user_data);

void bt_bap_cancel_select(struct bt_bap_pac *lpac, bt_bap_pac_select_t func,
void *user_data);

struct bt_bap_stream *bt_bap_stream_new(struct bt_bap *bap,
struct bt_bap_pac *lpac,
struct bt_bap_pac *rpac,
Expand Down

0 comments on commit 6849c64

Please sign in to comment.