linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ] btmon: Add colors to data status in extended adv report
@ 2018-10-24 10:17 Łukasz Rymanowski
  2018-10-30  9:21 ` Szymon Janc
  0 siblings, 1 reply; 2+ messages in thread
From: Łukasz Rymanowski @ 2018-10-24 10:17 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Łukasz Rymanowski

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH BlueZ] btmon: Add colors to data status in extended adv report
  2018-10-24 10:17 [PATCH BlueZ] btmon: Add colors to data status in extended adv report Łukasz Rymanowski
@ 2018-10-30  9:21 ` Szymon Janc
  0 siblings, 0 replies; 2+ messages in thread
From: Szymon Janc @ 2018-10-30  9:21 UTC (permalink / raw)
  To: Łukasz Rymanowski; +Cc: linux-bluetooth

Hi Łukasz,

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

Patch applied, thanks.

-- 
pozdrawiam
Szymon Janc



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-10-30  9:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-24 10:17 [PATCH BlueZ] btmon: Add colors to data status in extended adv report Łukasz Rymanowski
2018-10-30  9:21 ` Szymon Janc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).