diff options
author | Bruna Moreira <bruna.moreira@openbossa.org> | 2011-02-15 10:16:48 -0400 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2011-02-15 11:47:40 -0300 |
commit | ec141a423b38c74dfee428ade29c57da3a817c19 (patch) | |
tree | 14e3a78be259aad8fd2df63ff4c91a9d0c46e0b7 /attrib/att.c | |
parent | 32d7daf120ab0b78756eafd0fe72fa700ecdcbcd (diff) | |
download | bluez-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.c | 21 |
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); |