Bluetooth: BAP: Move pac record discovery to new callback
Add a new pac_record callback that is used to report the found PAC records during BAP discovery, rather than calling the discovery callback with optional values. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
5d498d78ad
commit
1c304d9d23
6 changed files with 111 additions and 90 deletions
|
@ -576,7 +576,7 @@ static void add_remote_sink(struct bt_bap_ep *ep)
|
|||
printk("Could not add sink ep\n");
|
||||
}
|
||||
|
||||
static void print_remote_codec(struct bt_codec *codec_capabilities, enum bt_audio_dir dir)
|
||||
static void print_remote_codec(const struct bt_codec *codec_capabilities, enum bt_audio_dir dir)
|
||||
{
|
||||
printk("codec_capabilities %p dir 0x%02x\n", codec_capabilities, dir);
|
||||
|
||||
|
@ -584,18 +584,13 @@ static void print_remote_codec(struct bt_codec *codec_capabilities, enum bt_audi
|
|||
}
|
||||
|
||||
static void discover_sinks_cb(struct bt_conn *conn, int err, enum bt_audio_dir dir,
|
||||
struct bt_codec *codec, struct bt_bap_ep *ep)
|
||||
struct bt_bap_ep *ep)
|
||||
{
|
||||
if (err != 0 && err != BT_ATT_ERR_ATTRIBUTE_NOT_FOUND) {
|
||||
printk("Discovery failed: %d\n", err);
|
||||
return;
|
||||
}
|
||||
|
||||
if (codec != NULL) {
|
||||
print_remote_codec(codec, dir);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ep != NULL) {
|
||||
add_remote_sink(ep);
|
||||
|
||||
|
@ -612,18 +607,13 @@ static void discover_sinks_cb(struct bt_conn *conn, int err, enum bt_audio_dir d
|
|||
}
|
||||
|
||||
static void discover_sources_cb(struct bt_conn *conn, int err, enum bt_audio_dir dir,
|
||||
struct bt_codec *codec, struct bt_bap_ep *ep)
|
||||
struct bt_bap_ep *ep)
|
||||
{
|
||||
if (err != 0 && err != BT_ATT_ERR_ATTRIBUTE_NOT_FOUND) {
|
||||
printk("Discovery failed: %d\n", err);
|
||||
return;
|
||||
}
|
||||
|
||||
if (codec != NULL) {
|
||||
print_remote_codec(codec, dir);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ep != NULL) {
|
||||
add_remote_source(ep);
|
||||
|
||||
|
@ -721,9 +711,15 @@ static void available_contexts_cb(struct bt_conn *conn,
|
|||
printk("snk ctx %u src ctx %u\n", snk_ctx, src_ctx);
|
||||
}
|
||||
|
||||
static void pac_record_cb(struct bt_conn *conn, enum bt_audio_dir dir, const struct bt_codec *codec)
|
||||
{
|
||||
print_remote_codec(codec, dir);
|
||||
}
|
||||
|
||||
static struct bt_bap_unicast_client_cb unicast_client_cbs = {
|
||||
.location = unicast_client_location_cb,
|
||||
.available_contexts = available_contexts_cb,
|
||||
.pac_record = pac_record_cb,
|
||||
};
|
||||
|
||||
static int init(void)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue