gatttool: simplify characteristic discovery output

This commit is contained in:
Anderson Lizardo 2010-08-04 16:40:54 -04:00 committed by Johan Hedberg
parent 4dc133a198
commit 08e83df251

View File

@ -265,27 +265,30 @@ static void char_discovered_cb(guint8 status, const guint8 *pdu, guint16 plen,
return; return;
for (i = 0; i < list->num; i++) { for (i = 0; i < list->num; i++) {
uint16_t *u16, length; uint16_t *u16;
uint8_t *data; uint8_t *u8;
int j;
u16 = (uint16_t *) list->data[i]; u8 = list->data[i];
u16 = (uint16_t *) u8;
/* Each element contains: handle and attribute value */
length = list->len - sizeof(*u16);
last = btohs(*u16); last = btohs(*u16);
u16++; u16 = (void *) &u8[3];
g_print("handle = 0x%04x, char properties = 0x%02x, "
"char value handle = 0x%04x, ", last, u8[2],
btohs(*u16));
data = (uint8_t *)u16;
g_print("handle = 0x%04x, length = %d, ", last, length);
g_print("permission = %02x, char value handle = %02x %02x, ",
*data, *(data + 1), *(data + 2));
g_print("uuid = "); g_print("uuid = ");
for (j = 3; j < length; j++) { if (list->len == 7) {
data = (uint8_t *)u16 + j; u16 = (void *) &u8[5];
g_print("%02x ", *data); g_print("0x%04x\n", btohs(*u16));
} else {
int j;
/* FIXME: pretty print 128-bit UUIDs */
for (j = 5; j < list->len; j++)
g_print("%02x ", u8[j]);
g_print("\n");
} }
g_print("\n");
} }
att_data_list_free(list); att_data_list_free(list);