summaryrefslogtreecommitdiff
path: root/attrib/att.c
diff options
context:
space:
mode:
authorAlvaro Silva <alvaro.silva@openbossa.org>2013-07-19 13:34:15 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2013-07-24 08:43:05 -0700
commit1ed64821ac7ec9ed1c6cfe197257e47c58f2494c (patch)
treeb6cef7be40c78c17b7d7cbe15fd045f9f3ef8141 /attrib/att.c
parent38487a99155988699aa0dc4f3505a2da5980ceee (diff)
downloadbluez-1ed64821ac7ec9ed1c6cfe197257e47c58f2494c.tar.gz
attrib: Add encode/decode execute write support
Add functions for encoding/decoding Execute Write Request PDUs.
Diffstat (limited to 'attrib/att.c')
-rw-r--r--attrib/att.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/attrib/att.c b/attrib/att.c
index 8fd5ab553..d5f4f68e1 100644
--- a/attrib/att.c
+++ b/attrib/att.c
@@ -1126,6 +1126,37 @@ uint16_t enc_exec_write_req(uint8_t flags, uint8_t *pdu, size_t len)
return min_len;
}
+uint16_t dec_exec_write_req(const uint8_t *pdu, size_t len, uint8_t *flags)
+{
+ const uint16_t min_len = sizeof(pdu[0]) + sizeof(*flags);
+
+ if (pdu == NULL)
+ return 0;
+
+ if (flags == NULL)
+ return 0;
+
+ if (len < min_len)
+ return 0;
+
+ if (pdu[0] != ATT_OP_EXEC_WRITE_REQ)
+ return 0;
+
+ *flags = pdu[1];
+
+ return min_len;
+}
+
+uint16_t enc_exec_write_resp(uint8_t *pdu)
+{
+ if (pdu == NULL)
+ return 0;
+
+ pdu[0] = ATT_OP_EXEC_WRITE_RESP;
+
+ return sizeof(pdu[0]);
+}
+
uint16_t dec_exec_write_resp(const uint8_t *pdu, size_t len)
{
const uint16_t min_len = sizeof(pdu[0]);