hcidump: Add ATT read by type req/resp dump

This commit is contained in:
Andre Dieb Martins 2011-02-09 14:28:55 -03:00 committed by Marcel Holtmann
parent 38954ff4c7
commit d19c035749

View File

@ -330,6 +330,54 @@ static void att_find_info_resp_dump(int level, struct frame *frm)
}
}
static void att_read_by_type_req_dump(int level, struct frame *frm)
{
uint16_t start = btohs(htons(get_u16(frm)));
uint16_t end = btohs(htons(get_u16(frm)));
int i;
p_indent(level, frm);
printf("start 0x%2.2x, end 0x%2.2x\n", start, end);
p_indent(level, frm);
if (frm->len == 2) {
printf("type-uuid 0x%2.2x\n", btohs(htons(get_u16(frm))));
} else if (frm->len == 16) {
printf("type-uuid ");
for (i = 0; i < 16; i++) {
printf("%02x", get_u8(frm));
if (i == 3 || i == 5 || i == 7 || i == 9)
printf("-");
}
printf("\n");
} else {
printf("malformed uuid (expected 2 or 16 octets)\n");
p_indent(level, frm);
raw_dump(level, frm);
}
}
static void att_read_by_type_resp_dump(int level, struct frame *frm)
{
uint8_t length = get_u8(frm);
p_indent(level, frm);
printf("length: %d\n", length);
while (frm->len > 0) {
uint16_t handle = btohs(htons(get_u16(frm)));
int val_len = length - 2;
int i;
p_indent(level + 1, frm);
printf("handle 0x%2.2x, value ", handle);
for (i = 0; i < val_len; i++) {
printf("0x%.2x ", get_u8(frm));
}
printf("\n");
}
}
static void att_read_req_dump(int level, struct frame *frm)
{
uint16_t handle = btohs(htons(get_u16(frm)));
@ -378,6 +426,12 @@ void att_dump(int level, struct frame *frm)
case ATT_OP_FIND_INFO_RESP:
att_find_info_resp_dump(level + 1, frm);
break;
case ATT_OP_READ_BY_TYPE_REQ:
att_read_by_type_req_dump(level + 1, frm);
break;
case ATT_OP_READ_BY_TYPE_RESP:
att_read_by_type_resp_dump(level + 1, frm);
break;
case ATT_OP_READ_REQ:
att_read_req_dump(level + 1, frm);
break;