Bluetooth: Add ATT Execute Write Request skeleton

This adds the defines for Execute Write PDUs along with initial code to
parse them.

Change-Id: Ifa8229b9f3bf0a60d9abe553263b32397d1ba881
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
Luiz Augusto von Dentz 2015-05-08 14:39:51 +03:00 committed by Anas Nashif
commit ed7b333385
2 changed files with 35 additions and 0 deletions

View file

@ -444,6 +444,26 @@ static void att_prepare_write_req(struct bt_conn *conn, struct bt_buf *data)
BT_ATT_ERR_INVALID_HANDLE);
}
static void att_exec_write_req(struct bt_conn *conn, struct bt_buf *data)
{
struct bt_att_exec_write_req *req;
if (data->len != sizeof(*req)) {
send_err_rsp(conn, BT_ATT_OP_EXEC_WRITE_REQ, 0,
BT_ATT_ERR_INVALID_PDU);
return;
}
req = (void *)data->data;
BT_DBG("flags %u\n", req->flags);
/* TODO: Generate proper response once a database is defined */
send_err_rsp(conn, BT_ATT_OP_EXEC_WRITE_REQ, 0,
BT_ATT_ERR_NOT_SUPPORTED);
}
static void att_write_cmd(struct bt_conn *conn, struct bt_buf *data)
{
struct bt_att_write_req *req;
@ -525,6 +545,9 @@ void bt_att_recv(struct bt_conn *conn, struct bt_buf *buf)
case BT_ATT_OP_PREPARE_WRITE_REQ:
att_prepare_write_req(conn, buf);
break;
case BT_ATT_OP_EXEC_WRITE_REQ:
att_exec_write_req(conn, buf);
break;
case BT_ATT_OP_WRITE_CMD:
att_write_cmd(conn, buf);
break;

View file

@ -239,6 +239,18 @@ struct bt_att_prepare_write_rsp {
uint8_t value[0];
} PACK_STRUCT;
/* Execute Write Request */
#define BT_ATT_FLAG_CANCEL 0x00
#define BT_ATT_FLAG_EXEC 0x01
#define BT_ATT_OP_EXEC_WRITE_REQ 0x18
struct bt_att_exec_write_req {
uint8_t flags;
} PACK_STRUCT;
/* Execute Write Response */
#define BT_ATT_OP_EXEC_WRITE_RSP 0x19
/* Write Command */
#define BT_ATT_OP_WRITE_CMD 0x52
struct bt_att_write_cmd {