Bluetooth: att: Add Kconfig option to disable Multiple Read operation
This adds an Kconfig option to disable GATT Multiple Read support. This GATT sub-procedure is optional and does not have to be supported. Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This commit is contained in:
parent
becbfa2243
commit
698311d220
3 changed files with 23 additions and 0 deletions
|
@ -307,6 +307,13 @@ config BT_GATT_CLIENT
|
|||
help
|
||||
This option enables support for the GATT Client role.
|
||||
|
||||
config BT_GATT_READ_MULTIPLE
|
||||
bool "GATT Read Multiple Characteristic Values support"
|
||||
default y
|
||||
help
|
||||
This option enables support for the GATT Read Multiple Characteristic
|
||||
Values procedure.
|
||||
|
||||
config BT_MAX_PAIRED
|
||||
int "Maximum number of paired devices"
|
||||
default 1
|
||||
|
|
|
@ -975,6 +975,7 @@ static u8_t att_read_blob_req(struct bt_att *att, struct net_buf *buf)
|
|||
BT_ATT_OP_READ_BLOB_RSP, handle, offset);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_BT_GATT_READ_MULTIPLE)
|
||||
static u8_t att_read_mult_req(struct bt_att *att, struct net_buf *buf)
|
||||
{
|
||||
struct bt_conn *conn = att->chan.chan.conn;
|
||||
|
@ -1020,6 +1021,7 @@ static u8_t att_read_mult_req(struct bt_att *att, struct net_buf *buf)
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_BT_GATT_READ_MULTIPLE */
|
||||
|
||||
struct read_group_data {
|
||||
struct bt_att *att;
|
||||
|
@ -1636,12 +1638,14 @@ static u8_t att_handle_read_blob_rsp(struct bt_att *att, struct net_buf *buf)
|
|||
return att_handle_rsp(att, buf->data, buf->len, 0);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_BT_GATT_READ_MULTIPLE)
|
||||
static u8_t att_handle_read_mult_rsp(struct bt_att *att, struct net_buf *buf)
|
||||
{
|
||||
BT_DBG("");
|
||||
|
||||
return att_handle_rsp(att, buf->data, buf->len, 0);
|
||||
}
|
||||
#endif /* CONFIG_BT_GATT_READ_MULTIPLE */
|
||||
|
||||
static u8_t att_handle_write_rsp(struct bt_att *att, struct net_buf *buf)
|
||||
{
|
||||
|
@ -1765,14 +1769,18 @@ static const struct att_handler {
|
|||
sizeof(struct bt_att_read_blob_rsp),
|
||||
ATT_RESPONSE,
|
||||
att_handle_read_blob_rsp },
|
||||
#if defined(CONFIG_BT_GATT_READ_MULTIPLE)
|
||||
{ BT_ATT_OP_READ_MULT_REQ,
|
||||
BT_ATT_READ_MULT_MIN_LEN_REQ,
|
||||
ATT_REQUEST,
|
||||
att_read_mult_req },
|
||||
#endif /* CONFIG_BT_GATT_READ_MULTIPLE */
|
||||
#if defined(CONFIG_BT_GATT_READ_MULTIPLE)
|
||||
{ BT_ATT_OP_READ_MULT_RSP,
|
||||
sizeof(struct bt_att_read_mult_rsp),
|
||||
ATT_RESPONSE,
|
||||
att_handle_read_mult_rsp },
|
||||
#endif /* CONFIG_BT_GATT_READ_MULTIPLE */
|
||||
{ BT_ATT_OP_READ_GROUP_REQ,
|
||||
sizeof(struct bt_att_read_group_req),
|
||||
ATT_REQUEST,
|
||||
|
|
|
@ -1697,6 +1697,7 @@ static int gatt_read_blob(struct bt_conn *conn,
|
|||
return gatt_send(conn, buf, gatt_read_rsp, params, NULL);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_BT_GATT_READ_MULTIPLE)
|
||||
static void gatt_read_multiple_rsp(struct bt_conn *conn, u8_t err,
|
||||
const void *pdu, u16_t length,
|
||||
void *user_data)
|
||||
|
@ -1734,6 +1735,13 @@ static int gatt_read_multiple(struct bt_conn *conn,
|
|||
|
||||
return gatt_send(conn, buf, gatt_read_multiple_rsp, params, NULL);
|
||||
}
|
||||
#else
|
||||
static int gatt_read_multiple(struct bt_conn *conn,
|
||||
struct bt_gatt_read_params *params)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
#endif /* CONFIG_BT_GATT_READ_MULTIPLE */
|
||||
|
||||
int bt_gatt_read(struct bt_conn *conn, struct bt_gatt_read_params *params)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue