diff rvinterf/lowlevel/format.c @ 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 d527ac304ad5
children 4423039aeb4b
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;