diff options
author | Vinicius Costa Gomes <vinicius.gomes@openbossa.org> | 2010-07-22 20:21:25 -0300 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2010-08-09 18:06:45 -0400 |
commit | 25d27208696bfd5cb10e61b1e066ca226102ee74 (patch) | |
tree | 4a4fd94c9dca85c029c7f7565fdad9fabaa30597 /attrib/att.c | |
parent | 02641ec20b62487556739cf2d311e1bd75a8766d (diff) | |
download | bluez-25d27208696bfd5cb10e61b1e066ca226102ee74.tar.gz |
Add encoder for Read By Group Type Response PDU
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 031fb8738..5aed9d137 100644 --- a/attrib/att.c +++ b/attrib/att.c @@ -141,6 +141,27 @@ uint16_t dec_read_by_grp_req(const uint8_t *pdu, int len, uint16_t *start, return len; } +uint16_t enc_read_by_grp_resp(struct att_data_list *list, uint8_t *pdu, int len) +{ + int i; + uint16_t w; + uint8_t *ptr; + + if (list == NULL) + return 0; + + pdu[0] = ATT_OP_READ_BY_GROUP_RESP; + + ptr = &pdu[1]; + + for (i = 0, w = 0; i < list->num && w < len; i++, w += list->len) { + memcpy(ptr, list->data[i], list->len); + ptr += list->len; + } + + return w; +} + struct att_data_list *dec_read_by_grp_resp(const uint8_t *pdu, int len) { struct att_data_list *list; |