summaryrefslogtreecommitdiff
path: root/attrib/att.c
diff options
context:
space:
mode:
authorEder Ruiz Maria <eder.ruiz@openbossa.org>2012-07-30 13:38:09 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2012-08-15 11:58:43 +0300
commitf5cf20bb066e0ec9ccbc4c51c167d2a79c04d4b4 (patch)
tree02ee7b39f40c80780af857e983f10231bac188c1 /attrib/att.c
parent3be0d8feef1983079f0d6dd83ec1aa1c5e2d946d (diff)
downloadbluez-f5cf20bb066e0ec9ccbc4c51c167d2a79c04d4b4.tar.gz
att: Add encode/decode execute write support
Add functions for encoding/decoding Execute Write Request and Response PDUs.
Diffstat (limited to 'attrib/att.c')
-rw-r--r--attrib/att.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/attrib/att.c b/attrib/att.c
index 790ec3a9e..20a8efab3 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;
+}