changeset 880:136fa1ccd591

rvtdump & rvinterf: print and log ATI responses in ASCII
author Space Falcon <falcon@ivan.Harhan.ORG>
date Mon, 01 Jun 2015 01:20:33 +0000
parents 4661b84260a0
children da9a36515da6
files rvinterf/lowlevel/format.c rvinterf/lowlevel/rvifmain.c rvinterf/lowlevel/rvtdump.c
diffstat 3 files changed, 37 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/rvinterf/lowlevel/format.c	Mon Jun 01 00:19:28 2015 +0000
+++ b/rvinterf/lowlevel/format.c	Mon Jun 01 01:20:33 2015 +0000
@@ -121,6 +121,35 @@
 }
 
 void
+print_ati_output()
+{
+	int i, c;
+	char *dp;
+
+	dp = fmtbuf;
+	strcpy(dp, "ATI: ");
+	dp += 5;
+	for (i = 1; i < rxpkt_len; i++) {
+		c = rxpkt[i];
+		if (c & 0x80) {
+			*dp++ = 'M';
+			*dp++ = '-';
+			c &= 0x7F;
+		}
+		if (c < 0x20) {
+			*dp++ = '^';
+			*dp++ = c + '@';
+		} else if (c == 0x7F) {
+			*dp++ = '^';
+			*dp++ = '?';
+		} else
+			*dp++ = c;
+	}
+	*dp = '\0';
+	output_line(fmtbuf);
+}
+
+void
 print_fc_lld_msg()
 {
 	int i, c;
--- a/rvinterf/lowlevel/rvifmain.c	Mon Jun 01 00:19:28 2015 +0000
+++ b/rvinterf/lowlevel/rvifmain.c	Mon Jun 01 01:20:33 2015 +0000
@@ -174,6 +174,11 @@
 			forward_nonrvt_pkt();
 		return;
 	case RVT_AT_HEADER:
+		if (!no_output || logF)
+			print_ati_output();
+		if (client_head)
+			forward_nonrvt_pkt();
+		return;
 	case RVT_EXTUI_HEADER:
 		if (!no_output || logF)
 			print_unknown_packet();	/* formatting TBD */
--- a/rvinterf/lowlevel/rvtdump.c	Mon Jun 01 00:19:28 2015 +0000
+++ b/rvinterf/lowlevel/rvtdump.c	Mon Jun 01 01:20:33 2015 +0000
@@ -117,6 +117,9 @@
 	case RVT_TM_HEADER:
 		print_etm_output_raw();
 		return;
+	case RVT_AT_HEADER:
+		print_ati_output();
+		return;
 	case '*':
 		print_fc_lld_msg();
 		return;