annotate rvinterf/asyncshell/at.c @ 762:ad503b495e3e

doc/Rvinterf-tools: document rvinterf -b PID addition
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 02 Dec 2020 20:17:23 +0000
parents 10f4062e049b
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 * Functions for the AT-over-RVTMUX interface
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 */
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 #include <sys/types.h>
75
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
6 #include <sys/errno.h>
0
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 <ctype.h>
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <string.h>
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include <strings.h>
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #include <stdlib.h>
75
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
12 #include <unistd.h>
0
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 #include "pktmux.h"
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 #include "limits.h"
64
d43d82cbfb85 fc-shell: use the newly adopted exit code convention
Mychaela Falconia <falcon@freecalypso.org>
parents: 0
diff changeset
15 #include "exitcodes.h"
0
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16
424
dd0247097097 fc-shell: implemented 30 ms delay for batch mode AT commands with -p
Mychaela Falconia <falcon@freecalypso.org>
parents: 75
diff changeset
17 extern char *rvinterf_ttyport;
75
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
18 extern u_char rvi_msg[];
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
19 extern int rvi_msg_len;
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
20 extern int oneshot_nowait;
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
21 extern int sock;
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
22
0
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 send_string_to_ati(str)
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 char *str;
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 {
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 unsigned len;
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 u_char sendpkt[MAX_PKT_TO_TARGET+1];
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 len = strlen(str);
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 if (len + 1 > MAX_PKT_TO_TARGET) {
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 printf("error: max pkt to target limit exceeded\n");
64
d43d82cbfb85 fc-shell: use the newly adopted exit code convention
Mychaela Falconia <falcon@freecalypso.org>
parents: 0
diff changeset
32 return(ERROR_USAGE);
0
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 }
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 /* fill out the packet */
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 sendpkt[0] = RVT_AT_HEADER;
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 strcpy(sendpkt + 1, str);
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 /* send it! */
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 send_pkt_to_target(sendpkt, len + 1);
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 return(0);
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 }
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41
447
e13f60d4f8dd fc-shell: added unterm command for sending unterminated strings to ATI
Mychaela Falconia <falcon@freecalypso.org>
parents: 424
diff changeset
42 send_unterm_string_to_ati(str)
e13f60d4f8dd fc-shell: added unterm command for sending unterminated strings to ATI
Mychaela Falconia <falcon@freecalypso.org>
parents: 424
diff changeset
43 char *str;
e13f60d4f8dd fc-shell: added unterm command for sending unterminated strings to ATI
Mychaela Falconia <falcon@freecalypso.org>
parents: 424
diff changeset
44 {
e13f60d4f8dd fc-shell: added unterm command for sending unterminated strings to ATI
Mychaela Falconia <falcon@freecalypso.org>
parents: 424
diff changeset
45 unsigned len;
e13f60d4f8dd fc-shell: added unterm command for sending unterminated strings to ATI
Mychaela Falconia <falcon@freecalypso.org>
parents: 424
diff changeset
46 u_char sendpkt[MAX_PKT_TO_TARGET+1];
e13f60d4f8dd fc-shell: added unterm command for sending unterminated strings to ATI
Mychaela Falconia <falcon@freecalypso.org>
parents: 424
diff changeset
47
e13f60d4f8dd fc-shell: added unterm command for sending unterminated strings to ATI
Mychaela Falconia <falcon@freecalypso.org>
parents: 424
diff changeset
48 len = strlen(str);
e13f60d4f8dd fc-shell: added unterm command for sending unterminated strings to ATI
Mychaela Falconia <falcon@freecalypso.org>
parents: 424
diff changeset
49 if (len + 2 > MAX_PKT_TO_TARGET) {
e13f60d4f8dd fc-shell: added unterm command for sending unterminated strings to ATI
Mychaela Falconia <falcon@freecalypso.org>
parents: 424
diff changeset
50 printf("error: max pkt to target limit exceeded\n");
e13f60d4f8dd fc-shell: added unterm command for sending unterminated strings to ATI
Mychaela Falconia <falcon@freecalypso.org>
parents: 424
diff changeset
51 return(ERROR_USAGE);
e13f60d4f8dd fc-shell: added unterm command for sending unterminated strings to ATI
Mychaela Falconia <falcon@freecalypso.org>
parents: 424
diff changeset
52 }
e13f60d4f8dd fc-shell: added unterm command for sending unterminated strings to ATI
Mychaela Falconia <falcon@freecalypso.org>
parents: 424
diff changeset
53 /* fill out the packet */
e13f60d4f8dd fc-shell: added unterm command for sending unterminated strings to ATI
Mychaela Falconia <falcon@freecalypso.org>
parents: 424
diff changeset
54 sendpkt[0] = RVT_AT_HEADER;
e13f60d4f8dd fc-shell: added unterm command for sending unterminated strings to ATI
Mychaela Falconia <falcon@freecalypso.org>
parents: 424
diff changeset
55 sendpkt[1] = 0x01;
e13f60d4f8dd fc-shell: added unterm command for sending unterminated strings to ATI
Mychaela Falconia <falcon@freecalypso.org>
parents: 424
diff changeset
56 strcpy(sendpkt + 2, str);
e13f60d4f8dd fc-shell: added unterm command for sending unterminated strings to ATI
Mychaela Falconia <falcon@freecalypso.org>
parents: 424
diff changeset
57 /* send it! */
e13f60d4f8dd fc-shell: added unterm command for sending unterminated strings to ATI
Mychaela Falconia <falcon@freecalypso.org>
parents: 424
diff changeset
58 send_pkt_to_target(sendpkt, len + 2);
e13f60d4f8dd fc-shell: added unterm command for sending unterminated strings to ATI
Mychaela Falconia <falcon@freecalypso.org>
parents: 424
diff changeset
59 return(0);
e13f60d4f8dd fc-shell: added unterm command for sending unterminated strings to ATI
Mychaela Falconia <falcon@freecalypso.org>
parents: 424
diff changeset
60 }
e13f60d4f8dd fc-shell: added unterm command for sending unterminated strings to ATI
Mychaela Falconia <falcon@freecalypso.org>
parents: 424
diff changeset
61
0
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 void
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 cmd_sendat(arg)
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 char *arg;
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 {
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 while (isspace(*arg))
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 arg++;
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 if (!*arg) {
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 printf("error: missing string argument\n");
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 return;
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 }
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 ati_rx_control(1);
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 send_string_to_ati(arg);
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 }
75
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
75
447
e13f60d4f8dd fc-shell: added unterm command for sending unterminated strings to ATI
Mychaela Falconia <falcon@freecalypso.org>
parents: 424
diff changeset
76 void
e13f60d4f8dd fc-shell: added unterm command for sending unterminated strings to ATI
Mychaela Falconia <falcon@freecalypso.org>
parents: 424
diff changeset
77 cmd_unterm(arg)
e13f60d4f8dd fc-shell: added unterm command for sending unterminated strings to ATI
Mychaela Falconia <falcon@freecalypso.org>
parents: 424
diff changeset
78 char *arg;
e13f60d4f8dd fc-shell: added unterm command for sending unterminated strings to ATI
Mychaela Falconia <falcon@freecalypso.org>
parents: 424
diff changeset
79 {
e13f60d4f8dd fc-shell: added unterm command for sending unterminated strings to ATI
Mychaela Falconia <falcon@freecalypso.org>
parents: 424
diff changeset
80 while (isspace(*arg))
e13f60d4f8dd fc-shell: added unterm command for sending unterminated strings to ATI
Mychaela Falconia <falcon@freecalypso.org>
parents: 424
diff changeset
81 arg++;
e13f60d4f8dd fc-shell: added unterm command for sending unterminated strings to ATI
Mychaela Falconia <falcon@freecalypso.org>
parents: 424
diff changeset
82 if (!*arg) {
e13f60d4f8dd fc-shell: added unterm command for sending unterminated strings to ATI
Mychaela Falconia <falcon@freecalypso.org>
parents: 424
diff changeset
83 printf("error: missing string argument\n");
e13f60d4f8dd fc-shell: added unterm command for sending unterminated strings to ATI
Mychaela Falconia <falcon@freecalypso.org>
parents: 424
diff changeset
84 return;
e13f60d4f8dd fc-shell: added unterm command for sending unterminated strings to ATI
Mychaela Falconia <falcon@freecalypso.org>
parents: 424
diff changeset
85 }
e13f60d4f8dd fc-shell: added unterm command for sending unterminated strings to ATI
Mychaela Falconia <falcon@freecalypso.org>
parents: 424
diff changeset
86 ati_rx_control(1);
e13f60d4f8dd fc-shell: added unterm command for sending unterminated strings to ATI
Mychaela Falconia <falcon@freecalypso.org>
parents: 424
diff changeset
87 send_unterm_string_to_ati(arg);
e13f60d4f8dd fc-shell: added unterm command for sending unterminated strings to ATI
Mychaela Falconia <falcon@freecalypso.org>
parents: 424
diff changeset
88 }
e13f60d4f8dd fc-shell: added unterm command for sending unterminated strings to ATI
Mychaela Falconia <falcon@freecalypso.org>
parents: 424
diff changeset
89
75
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
90 oneshot_at_command(cmd)
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
91 char *cmd;
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
92 {
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
93 fd_set fds;
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
94 int rc;
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
95
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
96 if (!oneshot_nowait) {
424
dd0247097097 fc-shell: implemented 30 ms delay for batch mode AT commands with -p
Mychaela Falconia <falcon@freecalypso.org>
parents: 75
diff changeset
97 if (rvinterf_ttyport)
dd0247097097 fc-shell: implemented 30 ms delay for batch mode AT commands with -p
Mychaela Falconia <falcon@freecalypso.org>
parents: 75
diff changeset
98 usleep(30000);
75
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
99 init(); /* to catch the response properly */
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
100 ati_rx_control(1);
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
101 }
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
102 rc = send_string_to_ati(cmd);
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
103 if (rc)
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
104 exit(rc);
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
105 if (oneshot_nowait)
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
106 exit(0);
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
107 /* wait for response */
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
108 for (;;) {
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
109 FD_ZERO(&fds);
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
110 FD_SET(sock, &fds);
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
111 rc = select(sock+1, &fds, 0, 0, 0);
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
112 if (rc < 0) {
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
113 if (errno == EINTR)
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
114 continue;
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
115 perror("select");
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
116 exit(ERROR_UNIX);
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
117 }
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
118 if (FD_ISSET(sock, &fds))
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
119 handle_rvinterf_input();
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
120 }
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
121 }
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
122
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
123 cmd_str_oneshot(argc, argv)
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
124 char **argv;
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
125 {
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
126 return oneshot_at_command(argv[1]);
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
127 }
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
128
451
10f4062e049b fc-shell: unterm command implemented in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 447
diff changeset
129 cmd_unterm_oneshot(argc, argv)
10f4062e049b fc-shell: unterm command implemented in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 447
diff changeset
130 char **argv;
10f4062e049b fc-shell: unterm command implemented in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 447
diff changeset
131 {
10f4062e049b fc-shell: unterm command implemented in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 447
diff changeset
132 return send_unterm_string_to_ati(argv[1]);
10f4062e049b fc-shell: unterm command implemented in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 447
diff changeset
133 }
10f4062e049b fc-shell: unterm command implemented in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 447
diff changeset
134
75
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
135 void
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
136 oneshot_at_check_response()
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
137 {
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
138 if (rvi_msg_len == 4 && !strncmp(rvi_msg + 2, "OK", 2))
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
139 exit(0);
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
140 if (rvi_msg_len == 4 && !strncmp(rvi_msg + 2, "> ", 2))
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
141 exit(0);
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
142 if (rvi_msg_len == 7 && !strncmp(rvi_msg + 2, "ERROR", 5))
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
143 exit(ERROR_TARGET);
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
144 if (rvi_msg_len == 6 && !strncmp(rvi_msg + 2, "BUSY", 4))
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
145 exit(ERROR_TARGET);
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
146 if (rvi_msg_len == 12 && !strncmp(rvi_msg + 2, "NO CARRIER", 10))
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
147 exit(ERROR_TARGET);
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
148 if (rvi_msg_len >= 12 && !strncmp(rvi_msg + 2, "+CME ERROR", 10))
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
149 exit(ERROR_TARGET);
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
150 if (rvi_msg_len >= 12 && !strncmp(rvi_msg + 2, "+CMS ERROR", 10))
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
151 exit(ERROR_TARGET);
bbc41034f14c fc-shell: added support for AT commands in one-shot mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 64
diff changeset
152 }