[PATCH BlueZ v2 2/3] att: Add encode/decode execute write support |
|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Add functions for encoding/decoding Execute Write Request and
Response PDUs.
---
attrib/att.c | 35 +++++++++++++++++++++++++++++++++++
attrib/att.h | 2 ++
2 files changed, 37 insertions(+)
diff --git a/attrib/att.c b/attrib/att.c
index 790ec3a..20a8efa 100644
--- a/attrib/att.c
+++ b/attrib/att.c
@@ -1028,3 +1028,38 @@ uint16_t dec_prep_write_resp(const uint8_t *pdu, int len, uint16_t *handle,
return len;
}
+
+uint16_t enc_exec_write_req(uint8_t flags, uint8_t *pdu, int len)
+{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(flags);
+
+ if (pdu == NULL)
+ return 0;
+
+ if (len < min_len)
+ return 0;
+
+ if (flags > 1)
+ return 0;
+
+ pdu[0] = ATT_OP_EXEC_WRITE_REQ;
+ pdu[1] = flags;
+
+ return min_len;
+}
+
+uint16_t dec_exec_write_resp(const uint8_t *pdu, int len)
+{
+ const uint16_t min_len = sizeof(pdu[0]);
+
+ if (pdu == NULL)
+ return 0;
+
+ if (len < min_len)
+ return 0;
+
+ if (pdu[0] != ATT_OP_EXEC_WRITE_RESP)
+ return 0;
+
+ return len;
+}
diff --git a/attrib/att.h b/attrib/att.h
index ec03be9..64d22ca 100644
--- a/attrib/att.h
+++ b/attrib/att.h
@@ -261,3 +261,5 @@ uint16_t enc_prep_write_req(uint16_t handle, uint16_t offset,
const uint8_t *value, int vlen, uint8_t *pdu, int len);
uint16_t dec_prep_write_resp(const uint8_t *pdu, int len, uint16_t *handle,
uint16_t *offset, uint8_t *value, int *vlen);
+uint16_t enc_exec_write_req(uint8_t flags, uint8_t *pdu, int len);
+uint16_t dec_exec_write_resp(const uint8_t *pdu, int len);
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[Bluez Devel]
[Linux USB Devel]
[Linux Media Drivers]
[Linux Audio Users]
[Yosemite News]
[Yosemite Photos]
[Free Online Dating]
[Bluez Devel]
[Linux Kernel]
[Linux SCSI]
[XFree86]
[Big List of Linux Books]