summaryrefslogtreecommitdiff
path: root/attrib/att.c
diff options
context:
space:
mode:
authorBruna Moreira <bruna.moreira@openbossa.org>2011-02-15 10:16:48 -0400
committerJohan Hedberg <johan.hedberg@nokia.com>2011-02-15 11:47:40 -0300
commitec141a423b38c74dfee428ade29c57da3a817c19 (patch)
tree14e3a78be259aad8fd2df63ff4c91a9d0c46e0b7 /attrib/att.c
parent32d7daf120ab0b78756eafd0fe72fa700ecdcbcd (diff)
downloadbluez-ec141a423b38c74dfee428ade29c57da3a817c19.tar.gz
Add encode/decode for write response
The encode/decode functions for Write Response operations were created to keep consistency with the rest of GATT API.
Diffstat (limited to 'attrib/att.c')
-rw-r--r--attrib/att.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/attrib/att.c b/attrib/att.c
index dff859723..3259fca62 100644
--- a/attrib/att.c
+++ b/attrib/att.c
@@ -526,6 +526,27 @@ uint16_t dec_write_req(const uint8_t *pdu, int len, uint16_t *handle,
return len;
}
+uint16_t enc_write_resp(uint8_t *pdu, int len)
+{
+ if (pdu == NULL)
+ return 0;
+
+ pdu[0] = ATT_OP_WRITE_RESP;
+
+ return sizeof(pdu[0]);
+}
+
+uint16_t dec_write_resp(const uint8_t *pdu, int len)
+{
+ if (pdu == NULL)
+ return 0;
+
+ if (pdu[0] != ATT_OP_WRITE_RESP)
+ return 0;
+
+ return len;
+}
+
uint16_t enc_read_req(uint16_t handle, uint8_t *pdu, int len)
{
const uint16_t min_len = sizeof(pdu[0]) + sizeof(handle);