From f42632c599e84e165da8979d13991c75c7f01eda Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=81ukasz=20Rymanowski?= Date: Wed, 24 Oct 2018 12:17:18 +0200 Subject: [PATCH] btmon: Add colors to data status in extended adv report This patch gives color indicators to data status in extended advertising reports. This gives better visibility on which advertising events were completed or truncated. Change-Id: I79a3cd8eec85eb08ad07a6083ee33a8e77b0ea5e Signed-off-by: himanshu --- monitor/packet.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/monitor/packet.c b/monitor/packet.c index 31b3169..28d309b 100755 --- a/monitor/packet.c +++ b/monitor/packet.c @@ -9523,6 +9523,7 @@ static void print_ext_adv_report_evt_type(const char *indent, uint16_t flags) uint16_t props = flags; uint8_t data_status; const char *str; + const char *color_on; int i; print_field("%sEvent type: 0x%4.4x", indent, flags); @@ -9543,19 +9544,23 @@ static void print_ext_adv_report_evt_type(const char *indent, uint16_t flags) switch (data_status) { case 0x00: str = "Complete"; + color_on = COLOR_GREEN; break; case 0x01: str = "Incomplete, more data to come"; + color_on = COLOR_YELLOW; break; case 0x02: str = "Incomplete, data truncated, no more to come"; + color_on = COLOR_RED; break; default: str = "Reserved"; + color_on = COLOR_RED; break; } - print_field("%s Data status: %s", indent, str); + print_field("%s Data status: %s%s%s", indent, color_on, str, COLOR_OFF); if (mask) print_text(COLOR_UNKNOWN_ADV_FLAG, -- 2.7.4