Skip to contentSkip to conversation

btmon: Add colors to data status in extended adv report

PATCH In review Łukasz Rymanowski 2 participants 2 messages Oct 24, 2018 – Oct 30, 2018 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 monitor/packet.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
monitor/packet.c +6 -1
index cf4a64362..eabd21914 100644
@@ -9323,6 +9323,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);
@@ -9343,19 +9344,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,
Signature · 1 line
2.17.1
#1 lore raw

Hi Łukasz,

Quoted 34 lines · On Wednesday, 24 October 2018 12:17:18 CET Łukasz Rymanowski wrote:

This patch gives color indicators to data status in extended advertising reports. This gives better visibility on which advertising events were completed or truncated.

---
 monitor/packet.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
monitor/packet.c +4 -0
index cf4a64362..eabd21914 100644
@@ -9323,6 +9323,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);
@@ -9343,19 +9344,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:

monitor/packet.c static void print_ext_adv_report_evt_type(const char · line 9366

Quoted 10 lines
monitor/packet.c +2 -1
 		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,

Patch applied, thanks.

Signature · 2 lines
pozdrawiam
Szymon Janc