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:
parent
11f5f3b080
commit
0b10498fb1
6 changed files with 21 additions and 28 deletions
|
@ -1249,9 +1249,6 @@ struct bt_bap_unicast_client_discover_params {
|
||||||
/** Capabilities type */
|
/** Capabilities type */
|
||||||
enum bt_audio_dir dir;
|
enum bt_audio_dir dir;
|
||||||
|
|
||||||
/** Number of capabilities found */
|
|
||||||
uint8_t num_caps;
|
|
||||||
|
|
||||||
/** Number of endpoints found */
|
/** Number of endpoints found */
|
||||||
uint8_t num_eps;
|
uint8_t num_eps;
|
||||||
|
|
||||||
|
|
|
@ -574,11 +574,9 @@ static void add_remote_sink(struct bt_bap_ep *ep, uint8_t index)
|
||||||
sinks[index].ep = ep;
|
sinks[index].ep = ep;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_remote_codec(struct bt_codec *codec_capabilities, int index,
|
static void print_remote_codec(struct bt_codec *codec_capabilities, enum bt_audio_dir dir)
|
||||||
enum bt_audio_dir dir)
|
|
||||||
{
|
{
|
||||||
printk("#%u: codec_capabilities %p dir 0x%02x\n",
|
printk("codec_capabilities %p dir 0x%02x\n", codec_capabilities, dir);
|
||||||
index, codec_capabilities, dir);
|
|
||||||
|
|
||||||
print_codec_capabilities(codec_capabilities);
|
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) {
|
if (codec != NULL) {
|
||||||
print_remote_codec(codec, params->num_caps, params->dir);
|
print_remote_codec(codec, params->dir);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -624,7 +622,7 @@ static void discover_sources_cb(struct bt_conn *conn, int err, struct bt_codec *
|
||||||
}
|
}
|
||||||
|
|
||||||
if (codec != NULL) {
|
if (codec != NULL) {
|
||||||
print_remote_codec(codec, params->num_caps, params->dir);
|
print_remote_codec(codec, params->dir);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 bt_pacs_read_rsp *rsp;
|
||||||
struct net_buf_simple *buf;
|
struct net_buf_simple *buf;
|
||||||
int cb_err = err;
|
int cb_err = err;
|
||||||
|
uint8_t i;
|
||||||
|
|
||||||
params = CONTAINER_OF(read, struct bt_bap_unicast_client_discover_params, read);
|
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;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (rsp->num_pac) {
|
for (i = 0U; i < rsp->num_pac; i++) {
|
||||||
struct bt_pac_codec *pac_codec;
|
struct bt_pac_codec *pac_codec;
|
||||||
struct bt_pac_ltv_data *meta, *cc;
|
struct bt_pac_ltv_data *meta, *cc;
|
||||||
void *cc_ltv, *meta_ltv;
|
void *cc_ltv, *meta_ltv;
|
||||||
struct bt_codec codec;
|
struct bt_codec codec;
|
||||||
|
|
||||||
LOG_DBG("pac #%u", params->num_caps);
|
LOG_DBG("pac #%u", i);
|
||||||
|
|
||||||
if (buf->len < sizeof(*pac_codec)) {
|
if (buf->len < sizeof(*pac_codec)) {
|
||||||
LOG_ERR("Malformed PAC: remaining len %u expected %zu",
|
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);
|
codec.meta_count);
|
||||||
|
|
||||||
discover_cb(conn, 0, &codec, NULL, params);
|
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;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3706,7 +3706,6 @@ int bt_bap_unicast_client_discover(struct bt_conn *conn,
|
||||||
conn_cb_registered = true;
|
conn_cb_registered = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
params->num_caps = 0u;
|
|
||||||
params->num_eps = 0u;
|
params->num_eps = 0u;
|
||||||
|
|
||||||
return bt_gatt_discover(conn, ¶ms->discover);
|
return bt_gatt_discover(conn, ¶ms->discover);
|
||||||
|
|
|
@ -703,11 +703,10 @@ static uint8_t stream_dir(const struct bt_bap_stream *stream)
|
||||||
return 0;
|
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)
|
enum bt_audio_dir dir)
|
||||||
{
|
{
|
||||||
shell_print(ctx_shell, "conn %p: #%u: codec %p dir 0x%02x",
|
shell_print(ctx_shell, "conn %p: codec %p dir 0x%02x", conn, codec, dir);
|
||||||
conn, index, codec, dir);
|
|
||||||
|
|
||||||
print_codec(ctx_shell, codec);
|
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)
|
struct bt_bap_unicast_client_discover_params *params)
|
||||||
{
|
{
|
||||||
if (codec != NULL) {
|
if (codec != NULL) {
|
||||||
print_remote_codec(conn, codec, params->num_caps, params->dir);
|
print_remote_codec(conn, codec, params->dir);
|
||||||
return;
|
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)
|
struct bt_bap_ep *ep, struct bt_bap_unicast_client_discover_params *params)
|
||||||
{
|
{
|
||||||
if (codec != NULL) {
|
if (codec != NULL) {
|
||||||
print_remote_codec(conn, codec, params->num_caps, params->dir);
|
print_remote_codec(conn, codec, params->dir);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -212,9 +212,9 @@ static void add_remote_source(struct bt_bap_ep *ep, uint8_t index)
|
||||||
g_sources[index] = ep;
|
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);
|
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) {
|
if (codec != NULL) {
|
||||||
print_remote_codec(codec, params->num_caps, params->dir);
|
print_remote_codec(codec, params->dir);
|
||||||
codec_found = true;
|
codec_found = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -272,7 +272,7 @@ static void discover_sources_cb(struct bt_conn *conn, int err, struct bt_codec *
|
||||||
}
|
}
|
||||||
|
|
||||||
if (codec != NULL) {
|
if (codec != NULL) {
|
||||||
print_remote_codec(codec, params->num_caps, params->dir);
|
print_remote_codec(codec, params->dir);
|
||||||
codec_found = true;
|
codec_found = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -249,9 +249,9 @@ static void add_remote_sink(struct bt_bap_ep *ep, uint8_t index)
|
||||||
unicast_sink_eps[index] = ep;
|
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);
|
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) {
|
if (codec != NULL) {
|
||||||
print_remote_codec(codec, params->num_caps, params->dir);
|
print_remote_codec(codec, params->dir);
|
||||||
codec_found = true;
|
codec_found = true;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue