diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2014-02-12 20:55:58 -0800 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-02-12 20:55:58 -0800 |
commit | 864f763358ae791f43c5dc94f31c2ddf0d2dc108 (patch) | |
tree | c04b360095892a40ae100f3b2501fb714330acfe /monitor/packet.c | |
parent | 31a8077f84a55e6c9f98b988055f2135ff430d23 (diff) | |
download | bluez-864f763358ae791f43c5dc94f31c2ddf0d2dc108.tar.gz |
monitor: Add support for decoding LE channel classification map
Diffstat (limited to 'monitor/packet.c')
-rw-r--r-- | monitor/packet.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/monitor/packet.c b/monitor/packet.c index 6dfeb23e8..e92be7a8a 100644 --- a/monitor/packet.c +++ b/monitor/packet.c @@ -2382,13 +2382,34 @@ static void print_le_states(const uint8_t *states_array) static void print_le_channel_map(const uint8_t *map) { + unsigned int count = 0, start = 0; char str[11]; - int i; + int i, n; for (i = 0; i < 5; i++) sprintf(str + (i * 2), "%2.2x", map[i]); print_field("Channel map: 0x%s", str); + + for (i = 0; i < 5; i++) { + for (n = 0; n < 8; n++) { + if (map[i] & (1 << n)) { + if (count == 0) + start = (i * 8) + n; + count++; + continue; + } + + if (count > 1) { + print_field(" Channel %u-%u", + start, start + count - 1 ); + count = 0; + } else if (count > 0) { + print_field(" Channel %u", start); + count = 0; + } + } + } } void packet_print_channel_map_ll(const uint8_t *map) |