Bluetooth: ATT: Handle Indications

This adds the callback necessary to parse Indication PDU generating
proper Confirm response:

> ACL Data RX: Handle 3585 flags 0x02 dlen 8
      ATT: Handle Value Indication (0x1d) len 3
        Handle: 0x0014
          Data: 00
< ACL Data TX: Handle 3585 flags 0x00 dlen 5
      ATT: Handle Value Confirmation (0x1e) len 0

Change-Id: I277c1776f32cc05a55ffad7aa483ff1857c9fb9f
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
Luiz Augusto von Dentz 2015-09-15 10:38:40 +03:00 committed by Anas Nashif
commit d87d1878b4

View file

@ -1349,6 +1349,26 @@ static uint8_t att_notify(struct bt_conn *conn, struct bt_buf *buf)
return 0; return 0;
} }
static uint8_t att_indicate(struct bt_conn *conn, struct bt_buf *buf)
{
uint16_t handle;
handle = bt_buf_pull_le16(buf);
BT_DBG("handle 0x%04x\n", handle);
bt_gatt_notification(conn, handle, buf->data, buf->len);
buf = bt_att_create_pdu(conn, BT_ATT_OP_CONFIRM, 0);
if (!buf) {
return 0;
}
bt_l2cap_send(conn, BT_L2CAP_CID_ATT, buf);
return 0;
}
static const struct { static const struct {
uint8_t op; uint8_t op;
uint8_t (*func)(struct bt_conn *conn, struct bt_buf *buf); uint8_t (*func)(struct bt_conn *conn, struct bt_buf *buf);
@ -1398,6 +1418,8 @@ static const struct {
{ BT_ATT_OP_EXEC_WRITE_RSP, att_handle_exec_write_rsp, 0 }, { BT_ATT_OP_EXEC_WRITE_RSP, att_handle_exec_write_rsp, 0 },
{ BT_ATT_OP_NOTIFY, att_notify, { BT_ATT_OP_NOTIFY, att_notify,
sizeof(struct bt_att_notify) }, sizeof(struct bt_att_notify) },
{ BT_ATT_OP_INDICATE, att_indicate,
sizeof(struct bt_att_indicate) },
{ BT_ATT_OP_WRITE_CMD, att_write_cmd, { BT_ATT_OP_WRITE_CMD, att_write_cmd,
sizeof(struct bt_att_write_cmd) }, sizeof(struct bt_att_write_cmd) },
{ BT_ATT_OP_SIGNED_WRITE_CMD, att_signed_write_cmd, { BT_ATT_OP_SIGNED_WRITE_CMD, att_signed_write_cmd,