[PATCH BlueZ] btmon: Add colors to data status in extended adv report

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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(-)

diff --git a/monitor/packet.c b/monitor/packet.c
index cf4a64362..eabd21914 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -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,
-- 
2.17.1




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux