summaryrefslogtreecommitdiff
path: root/attrib/gatttool.c
diff options
context:
space:
mode:
authorAnderson Lizardo <anderson.lizardo@openbossa.org>2010-08-04 16:40:54 -0400
committerJohan Hedberg <johan.hedberg@nokia.com>2010-08-09 18:06:49 -0400
commit08e83df251524a9f6d6481a54a0f65de88277bdc (patch)
tree5cb97390d524de1605bcdeadbb2c85553637f32c /attrib/gatttool.c
parent4dc133a198a3032ed84941c20617aef221e56096 (diff)
downloadbluez-08e83df251524a9f6d6481a54a0f65de88277bdc.tar.gz
gatttool: simplify characteristic discovery output
Diffstat (limited to 'attrib/gatttool.c')
-rw-r--r--attrib/gatttool.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/attrib/gatttool.c b/attrib/gatttool.c
index e2475d338..cddb37d49 100644
--- a/attrib/gatttool.c
+++ b/attrib/gatttool.c
@@ -265,27 +265,30 @@ static void char_discovered_cb(guint8 status, const guint8 *pdu, guint16 plen,
return;
for (i = 0; i < list->num; i++) {
- uint16_t *u16, length;
- uint8_t *data;
- int j;
-
- u16 = (uint16_t *) list->data[i];
+ uint16_t *u16;
+ uint8_t *u8;
- /* Each element contains: handle and attribute value */
- length = list->len - sizeof(*u16);
+ u8 = list->data[i];
+ u16 = (uint16_t *) u8;
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 = ");
- for (j = 3; j < length; j++) {
- data = (uint8_t *)u16 + j;
- g_print("%02x ", *data);
+ if (list->len == 7) {
+ u16 = (void *) &u8[5];
+ 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);