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:
Krzysztof Kopyściński 2021-06-16 08:11:34 +02:00 committed by Christopher Friedt
commit 00bfac00ae
5 changed files with 38 additions and 17 deletions

View file

@ -1366,8 +1366,7 @@ struct bt_gatt_read_params {
/** Read attribute callback. */
bt_gatt_read_func_t func;
/** If equals to 1 single.handle and single.offset are used.
* If >1 Read Multiple Characteristic Values is performed and handles
* are used.
* If greater than 1 multiple.handles are used.
* If equals to 0 by_uuid is used for Read Using Characteristic UUID.
*/
size_t handle_count;
@ -1378,8 +1377,23 @@ struct bt_gatt_read_params {
/** Attribute data offset. */
uint16_t offset;
} single;
/** Handles to read in Read Multiple Characteristic Values. */
uint16_t *handles;
struct {
/** Attribute handles to read with Read Multiple
* Characteristic Values.
*/
uint16_t *handles;
/** If true use Read Multiple Variable Length
* Characteristic Values procedure.
* The values of the set of attributes may be of
* variable or unknown length.
* If false use Read Multiple Characteristic Values
* procedure.
* The values of the set of attributes must be of a
* known fixed length, with the exception of the last
* value that can have a variable length.
*/
bool variable;
} multiple;
struct {
/** First requested handle number. */
uint16_t start_handle;