annotate rvinterf/lowlevel/format_fc.c @ 966:ec7e23d5151f

fcup-smsend: add support for backslash escapes, new -e option
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 01 Sep 2023 15:44:52 +0000
parents 8fc3b72eb2c6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This module has been split off from format.c; it implements the decoding
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * of those Rx packet types which have been invented in FreeCalypso.
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 */
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <sys/types.h>
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <stdio.h>
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <string.h>
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <strings.h>
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include "../include/pktmux.h"
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #include "../include/limits.h"
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 extern u_char rxpkt[];
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 extern size_t rxpkt_len;
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15
941
8fc3b72eb2c6 rvinterf -vv TCH raw dump: write to log only if running with -l
Mychaela Falconia <falcon@freecalypso.org>
parents: 930
diff changeset
16 extern void output_cont_logpref();
928
65953c172f24 rvinterf/lowlevel: new hex dump format
Mychaela Falconia <falcon@freecalypso.org>
parents: 927
diff changeset
17
0
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 void
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 print_ati_output()
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 {
930
a38430e03e73 rvinterf/lowlevel/format_fc.c: get rid of static fmtbuf
Mychaela Falconia <falcon@freecalypso.org>
parents: 928
diff changeset
21 char fmtbuf[MAX_PKT_FROM_TARGET*4+2];
a38430e03e73 rvinterf/lowlevel/format_fc.c: get rid of static fmtbuf
Mychaela Falconia <falcon@freecalypso.org>
parents: 928
diff changeset
22
927
4e243402f453 rvinterf/lowlevel: use libprint for backslash-escape output
Mychaela Falconia <falcon@freecalypso.org>
parents: 0
diff changeset
23 strcpy(fmtbuf, "ATI: ");
928
65953c172f24 rvinterf/lowlevel: new hex dump format
Mychaela Falconia <falcon@freecalypso.org>
parents: 927
diff changeset
24 safe_print_trace(rxpkt + 1, (int)rxpkt_len - 1, fmtbuf + 5);
0
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 output_line(fmtbuf);
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 }
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 void
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 print_fc_lld_msg()
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 {
930
a38430e03e73 rvinterf/lowlevel/format_fc.c: get rid of static fmtbuf
Mychaela Falconia <falcon@freecalypso.org>
parents: 928
diff changeset
31 char fmtbuf[MAX_PKT_FROM_TARGET*4+2];
a38430e03e73 rvinterf/lowlevel/format_fc.c: get rid of static fmtbuf
Mychaela Falconia <falcon@freecalypso.org>
parents: 928
diff changeset
32
927
4e243402f453 rvinterf/lowlevel: use libprint for backslash-escape output
Mychaela Falconia <falcon@freecalypso.org>
parents: 0
diff changeset
33 strcpy(fmtbuf, "LLD: ");
928
65953c172f24 rvinterf/lowlevel: new hex dump format
Mychaela Falconia <falcon@freecalypso.org>
parents: 927
diff changeset
34 safe_print_trace(rxpkt + 1, (int)rxpkt_len - 1, fmtbuf + 5);
0
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 output_line(fmtbuf);
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 }
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 void
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 print_tch_output_raw()
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 {
928
65953c172f24 rvinterf/lowlevel: new hex dump format
Mychaela Falconia <falcon@freecalypso.org>
parents: 927
diff changeset
41 output_line("Rx TCH packet");
941
8fc3b72eb2c6 rvinterf -vv TCH raw dump: write to log only if running with -l
Mychaela Falconia <falcon@freecalypso.org>
parents: 930
diff changeset
42 packet_hex_dump(rxpkt, (unsigned) rxpkt_len, output_cont_logpref);
0
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 }
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 void
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 report_extui_packet()
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 {
930
a38430e03e73 rvinterf/lowlevel/format_fc.c: get rid of static fmtbuf
Mychaela Falconia <falcon@freecalypso.org>
parents: 928
diff changeset
48 char fmtbuf[80];
a38430e03e73 rvinterf/lowlevel/format_fc.c: get rid of static fmtbuf
Mychaela Falconia <falcon@freecalypso.org>
parents: 928
diff changeset
49
0
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 sprintf(fmtbuf, "LCD OUT: row %u col %u-%u", rxpkt[1], rxpkt[2],
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 rxpkt[2] + (rxpkt_len - 3) / 2 - 1);
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 output_line(fmtbuf);
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 }