Bluetooth: Add ATT Read Mutiple Request skeleton
This adds the defines for Read Multiple PDUs along with initial code to parse them. Change-Id: I34f597881e3bdb9325ffbf2bda42b7ae6710c3ae Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
parent
eedc01d6d5
commit
f00308f0eb
2 changed files with 41 additions and 0 deletions
|
@ -314,6 +314,30 @@ static void att_read_blob_req(struct bt_conn *conn, struct bt_buf *data)
|
|||
BT_ATT_ERR_INVALID_HANDLE);
|
||||
}
|
||||
|
||||
static void att_read_mult_req(struct bt_conn *conn, struct bt_buf *data)
|
||||
{
|
||||
struct bt_att_read_mult_req *req;
|
||||
uint16_t handle1, handle2;
|
||||
|
||||
if (data->len < sizeof(*req)) {
|
||||
send_err_rsp(conn, BT_ATT_OP_READ_MULT_REQ, 0,
|
||||
BT_ATT_ERR_INVALID_PDU);
|
||||
return;
|
||||
}
|
||||
|
||||
req = (void *)data->data;
|
||||
|
||||
handle1 = sys_le16_to_cpu(req->handle1);
|
||||
handle2 = sys_le16_to_cpu(req->handle2);
|
||||
|
||||
BT_DBG("handle1 %u handle2 %u ...\n", handle1, handle2);
|
||||
|
||||
/* TODO: Generate proper response once a database is defined */
|
||||
|
||||
send_err_rsp(conn, BT_ATT_OP_READ_MULT_REQ, handle1,
|
||||
BT_ATT_ERR_INVALID_HANDLE);
|
||||
}
|
||||
|
||||
void bt_att_recv(struct bt_conn *conn, struct bt_buf *buf)
|
||||
{
|
||||
struct bt_att_hdr *hdr = (void *)buf->data;
|
||||
|
@ -346,6 +370,9 @@ void bt_att_recv(struct bt_conn *conn, struct bt_buf *buf)
|
|||
case BT_ATT_OP_READ_BLOB_REQ:
|
||||
att_read_blob_req(conn, buf);
|
||||
break;
|
||||
case BT_ATT_OP_READ_MULT_REQ:
|
||||
att_read_mult_req(conn, buf);
|
||||
break;
|
||||
default:
|
||||
BT_DBG("Unhandled ATT code %u\n", hdr->code);
|
||||
send_err_rsp(conn, hdr->code, 0, BT_ATT_ERR_NOT_SUPPORTED);
|
||||
|
|
|
@ -178,5 +178,19 @@ struct bt_att_read_blob_rsp {
|
|||
uint8_t value[0];
|
||||
} PACK_STRUCT;
|
||||
|
||||
/* Read Multiple Request */
|
||||
#define BT_ATT_OP_READ_MULT_REQ 0x0e
|
||||
struct bt_att_read_mult_req {
|
||||
uint16_t handle1;
|
||||
uint16_t handle2;
|
||||
uint16_t handles[0];
|
||||
} PACK_STRUCT;
|
||||
|
||||
/* Read Multiple Respose */
|
||||
#define BT_ATT_OP_READ_MULT_RSP 0x0f
|
||||
struct bt_att_read_mult_rsp {
|
||||
uint8_t value[0];
|
||||
} PACK_STRUCT;
|
||||
|
||||
void bt_att_recv(struct bt_conn *conn, struct bt_buf *buf);
|
||||
struct bt_buf *bt_att_create_pdu(struct bt_conn *conn, uint8_t op, size_t len);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue