From a1253420527b89a3d9f38d7751634e9512df4560 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Tue, 8 Oct 2013 14:03:03 -0700 Subject: [PATCH] monitor: Add support for decoding 3D information data --- monitor/packet.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/monitor/packet.c b/monitor/packet.c index 7e6032853..3f83aea73 100644 --- a/monitor/packet.c +++ b/monitor/packet.c @@ -2216,6 +2216,17 @@ static const struct { { } }; +static const struct { + uint8_t bit; + const char *str; +} eir_3d_table[] = { + { 0, "Association Notification" }, + { 1, "Battery Level Reporting" }, + { 2, "Send Battery Level Report on Start-up Synchronization" }, + { 7, "Factory Test Mode" }, + { } +}; + static void print_eir(const uint8_t *eir, uint8_t eir_len, bool le) { uint8_t len = 0; @@ -2413,6 +2424,31 @@ static void print_eir(const uint8_t *eir, uint8_t eir_len, bool le) print_randomizer("P-256", data); break; + case BT_EIR_3D_INFO_DATA: + print_hex_field("3D Information Data", data, data_len); + if (data_len < 2) + break; + + flags = *data; + mask = flags; + + print_field(" Features: 0x%2.2x", flags); + + for (i = 0; eir_3d_table[i].str; i++) { + if (flags & (1 << eir_3d_table[i].bit)) { + print_field(" %s", + eir_3d_table[i].str); + mask &= ~(1 << eir_3d_table[i].bit); + } + } + + if (mask) + print_text(COLOR_UNKNOWN_FEATURE_BIT, + " Unknown features (0x%2.2x)", mask); + + print_field(" Path Loss Threshold: %d", data[1]); + break; + case BT_EIR_MANUFACTURER_DATA: if (data_len < 2) break; -- 2.47.3