Bluetooth: gatt: Add option to read multiple without variable length
Currently, with EATT enabled, when bt_gatt_read is called with multiple handles first it'll try to use gatt_read_mult_vl, and if it fails gatt_read_mult will be used to try again. Add option to skip the gatt_read_mult_vl and use gatt_read_mult right away. This is needed by tests that expect BT_ATT_OP_READ_MULT_REQ but support variable lenght, thus don't return BT_ATT_ERR_NOT_SUPPORTED. Removed fallback from read multiple vl to read multiple on BT_ATT_ERR_NOT_SUPPORTED error. This was affecting: GATT/CL/GAR/BV-05-C, GATT/CL/GAR/BI-18-C, GATT/CL/GAR/BI-19-C, GATT/CL/GAR/BI-20-C, GATT/CL/GAR/BI-21-C, GATT/CL/GAR/BI-22-C Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
This commit is contained in:
parent
e4dc8ed26b
commit
00bfac00ae
5 changed files with 38 additions and 17 deletions
|
@ -3951,7 +3951,7 @@ static int gatt_read_mult_encode(struct net_buf *buf, size_t len,
|
|||
uint8_t i;
|
||||
|
||||
for (i = 0U; i < params->handle_count; i++) {
|
||||
net_buf_add_le16(buf, params->handles[i]);
|
||||
net_buf_add_le16(buf, params->multiple.handles[i]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -3979,9 +3979,6 @@ static void gatt_read_mult_vl_rsp(struct bt_conn *conn, uint8_t err,
|
|||
BT_DBG("err 0x%02x", err);
|
||||
|
||||
if (err || !length) {
|
||||
if (err == BT_ATT_ERR_NOT_SUPPORTED) {
|
||||
gatt_read_mult(conn, params);
|
||||
}
|
||||
params->func(conn, err, params, NULL, 0);
|
||||
return;
|
||||
}
|
||||
|
@ -4018,7 +4015,7 @@ static int gatt_read_mult_vl_encode(struct net_buf *buf, size_t len,
|
|||
uint8_t i;
|
||||
|
||||
for (i = 0U; i < params->handle_count; i++) {
|
||||
net_buf_add_le16(buf, params->handles[i]);
|
||||
net_buf_add_le16(buf, params->multiple.handles[i]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -4042,13 +4039,15 @@ static int gatt_read_mult(struct bt_conn *conn,
|
|||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
#endif /* CONFIG_BT_GATT_READ_MULTIPLE */
|
||||
|
||||
#if !defined(CONFIG_BT_GATT_READ_MULTIPLE) || !defined(CONFIG_BT_EATT)
|
||||
static int gatt_read_mult_vl(struct bt_conn *conn,
|
||||
struct bt_gatt_read_params *params)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
#endif /* CONFIG_BT_GATT_READ_MULTIPLE */
|
||||
#endif
|
||||
|
||||
static int gatt_read_encode(struct net_buf *buf, size_t len, void *user_data)
|
||||
{
|
||||
|
@ -4075,11 +4074,11 @@ int bt_gatt_read(struct bt_conn *conn, struct bt_gatt_read_params *params)
|
|||
}
|
||||
|
||||
if (params->handle_count > 1) {
|
||||
#if defined(CONFIG_BT_EATT)
|
||||
return gatt_read_mult_vl(conn, params);
|
||||
#else
|
||||
return gatt_read_mult(conn, params);
|
||||
#endif /* CONFIG_BT_EATT */
|
||||
if (params->multiple.variable) {
|
||||
return gatt_read_mult_vl(conn, params);
|
||||
} else {
|
||||
return gatt_read_mult(conn, params);
|
||||
}
|
||||
}
|
||||
|
||||
if (params->single.offset) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue