diff options
author | Brian Gix <bgix@codeaurora.org> | 2010-12-17 11:08:53 -0800 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2010-12-19 14:10:40 +0200 |
commit | 7749241702ba89147edb52a30ed7c4c902bc8564 (patch) | |
tree | 7511354eba15f8e1d00b02df5b400af1cd904b8f /attrib/att.c | |
parent | 70be82e8fa2586045b58d45be5f183b88df942a7 (diff) | |
download | bluez-7749241702ba89147edb52a30ed7c4c902bc8564.tar.gz |
Add enc_read_blob_req() as defined in BT Core Spec v4.0
Diffstat (limited to 'attrib/att.c')
-rw-r--r-- | attrib/att.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/attrib/att.c b/attrib/att.c index 445b192be..f8dbc02f1 100644 --- a/attrib/att.c +++ b/attrib/att.c @@ -542,6 +542,25 @@ uint16_t enc_read_req(uint16_t handle, uint8_t *pdu, int len) return min_len; } +uint16_t enc_read_blob_req(uint16_t handle, uint16_t offset, uint8_t *pdu, + int len) +{ + const uint16_t min_len = sizeof(pdu[0]) + sizeof(handle) + + sizeof(offset); + + if (pdu == NULL) + return 0; + + if (len < min_len) + return 0; + + pdu[0] = ATT_OP_READ_BLOB_REQ; + att_put_u16(handle, &pdu[1]); + att_put_u16(offset, &pdu[3]); + + return min_len; +} + uint16_t dec_read_req(const uint8_t *pdu, int len, uint16_t *handle) { const uint16_t min_len = sizeof(pdu[0]) + sizeof(*handle); |