Bluetooth: BAP: Remove num_caps from BAP discover params

The field is not needed and no longer used.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
Emil Gydesen 2023-03-23 09:26:31 +01:00 committed by Carles Cufí
commit 0b10498fb1
6 changed files with 21 additions and 28 deletions

View file

@ -1249,9 +1249,6 @@ struct bt_bap_unicast_client_discover_params {
/** Capabilities type */
enum bt_audio_dir dir;
/** Number of capabilities found */
uint8_t num_caps;
/** Number of endpoints found */
uint8_t num_eps;

View file

@ -574,11 +574,9 @@ static void add_remote_sink(struct bt_bap_ep *ep, uint8_t index)
sinks[index].ep = ep;
}
static void print_remote_codec(struct bt_codec *codec_capabilities, int index,
enum bt_audio_dir dir)
static void print_remote_codec(struct bt_codec *codec_capabilities, enum bt_audio_dir dir)
{
printk("#%u: codec_capabilities %p dir 0x%02x\n",
index, codec_capabilities, dir);
printk("codec_capabilities %p dir 0x%02x\n", codec_capabilities, dir);
print_codec_capabilities(codec_capabilities);
}
@ -593,7 +591,7 @@ static void discover_sinks_cb(struct bt_conn *conn, int err, struct bt_codec *co
}
if (codec != NULL) {
print_remote_codec(codec, params->num_caps, params->dir);
print_remote_codec(codec, params->dir);
return;
}
@ -624,7 +622,7 @@ static void discover_sources_cb(struct bt_conn *conn, int err, struct bt_codec *
}
if (codec != NULL) {
print_remote_codec(codec, params->num_caps, params->dir);
print_remote_codec(codec, params->dir);
return;
}

View file

@ -3488,6 +3488,7 @@ static uint8_t unicast_client_read_func(struct bt_conn *conn, uint8_t err,
struct bt_pacs_read_rsp *rsp;
struct net_buf_simple *buf;
int cb_err = err;
uint8_t i;
params = CONTAINER_OF(read, struct bt_bap_unicast_client_discover_params, read);
@ -3533,13 +3534,13 @@ static uint8_t unicast_client_read_func(struct bt_conn *conn, uint8_t err,
goto fail;
}
while (rsp->num_pac) {
for (i = 0U; i < rsp->num_pac; i++) {
struct bt_pac_codec *pac_codec;
struct bt_pac_ltv_data *meta, *cc;
void *cc_ltv, *meta_ltv;
struct bt_codec codec;
LOG_DBG("pac #%u", params->num_caps);
LOG_DBG("pac #%u", i);
if (buf->len < sizeof(*pac_codec)) {
LOG_ERR("Malformed PAC: remaining len %u expected %zu",
@ -3595,12 +3596,11 @@ static uint8_t unicast_client_read_func(struct bt_conn *conn, uint8_t err,
codec.meta_count);
discover_cb(conn, 0, &codec, NULL, params);
rsp->num_pac--;
params->num_caps++;
}
if (!params->num_caps) {
if (i != rsp->num_pac) {
LOG_DBG("Failed to process all PAC records (%u/%u)", i, rsp->num_pac);
cb_err = BT_ATT_ERR_INVALID_PDU;
goto fail;
}
@ -3706,7 +3706,6 @@ int bt_bap_unicast_client_discover(struct bt_conn *conn,
conn_cb_registered = true;
}
params->num_caps = 0u;
params->num_eps = 0u;
return bt_gatt_discover(conn, &params->discover);

View file

@ -703,11 +703,10 @@ static uint8_t stream_dir(const struct bt_bap_stream *stream)
return 0;
}
static void print_remote_codec(const struct bt_conn *conn, struct bt_codec *codec, uint8_t index,
static void print_remote_codec(const struct bt_conn *conn, struct bt_codec *codec,
enum bt_audio_dir dir)
{
shell_print(ctx_shell, "conn %p: #%u: codec %p dir 0x%02x",
conn, index, codec, dir);
shell_print(ctx_shell, "conn %p: codec %p dir 0x%02x", conn, codec, dir);
print_codec(ctx_shell, codec);
}
@ -736,7 +735,7 @@ static void discover_cb(struct bt_conn *conn, int err, struct bt_codec *codec, s
struct bt_bap_unicast_client_discover_params *params)
{
if (codec != NULL) {
print_remote_codec(conn, codec, params->num_caps, params->dir);
print_remote_codec(conn, codec, params->dir);
return;
}
@ -765,7 +764,7 @@ static void discover_all(struct bt_conn *conn, int err, struct bt_codec *codec,
struct bt_bap_ep *ep, struct bt_bap_unicast_client_discover_params *params)
{
if (codec != NULL) {
print_remote_codec(conn, codec, params->num_caps, params->dir);
print_remote_codec(conn, codec, params->dir);
return;
}

View file

@ -212,9 +212,9 @@ static void add_remote_source(struct bt_bap_ep *ep, uint8_t index)
g_sources[index] = ep;
}
static void print_remote_codec(struct bt_codec *codec, int index, enum bt_audio_dir dir)
static void print_remote_codec(struct bt_codec *codec, enum bt_audio_dir dir)
{
printk("#%u: codec %p dir 0x%02x\n", index, codec, dir);
printk("codec %p dir 0x%02x\n", codec, dir);
print_codec(codec);
}
@ -232,7 +232,7 @@ static void discover_sinks_cb(struct bt_conn *conn, int err, struct bt_codec *co
}
if (codec != NULL) {
print_remote_codec(codec, params->num_caps, params->dir);
print_remote_codec(codec, params->dir);
codec_found = true;
return;
}
@ -272,7 +272,7 @@ static void discover_sources_cb(struct bt_conn *conn, int err, struct bt_codec *
}
if (codec != NULL) {
print_remote_codec(codec, params->num_caps, params->dir);
print_remote_codec(codec, params->dir);
codec_found = true;
return;
}

View file

@ -249,9 +249,9 @@ static void add_remote_sink(struct bt_bap_ep *ep, uint8_t index)
unicast_sink_eps[index] = ep;
}
static void print_remote_codec(struct bt_codec *codec, int index, enum bt_audio_dir dir)
static void print_remote_codec(struct bt_codec *codec, enum bt_audio_dir dir)
{
printk("#%u: codec %p dir 0x%02x\n", index, codec, dir);
printk("codec %p dir 0x%02x\n", codec, dir);
print_codec(codec);
}
@ -269,7 +269,7 @@ static void discover_sink_cb(struct bt_conn *conn, int err, struct bt_codec *cod
}
if (codec != NULL) {
print_remote_codec(codec, params->num_caps, params->dir);
print_remote_codec(codec, params->dir);
codec_found = true;
return;