FreeCalypso > hg > freecalypso-sw
annotate rvinterf/asyncshell/at.c @ 902:4423039aeb4b
rvtdump: report ext LCD output packets sanely
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Sun, 06 Sep 2015 07:27:57 +0000 |
parents | 4661b84260a0 |
children |
rev | line source |
---|---|
879
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 /* |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 * Functions for the AT-over-RVTMUX interface |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 */ |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 #include <sys/types.h> |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 #include <stdio.h> |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 #include <ctype.h> |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 #include <string.h> |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 #include <strings.h> |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 #include <stdlib.h> |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 #include "pktmux.h" |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 #include "limits.h" |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 send_string_to_ati(str) |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 char *str; |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 { |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 unsigned len; |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 u_char sendpkt[MAX_PKT_TO_TARGET+1]; |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 len = strlen(str); |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 if (len + 1 > MAX_PKT_TO_TARGET) { |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 printf("error: max pkt to target limit exceeded\n"); |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 return(1); |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
24 } |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 /* fill out the packet */ |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 sendpkt[0] = RVT_AT_HEADER; |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 strcpy(sendpkt + 1, str); |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 /* send it! */ |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
29 send_pkt_to_target(sendpkt, len + 1); |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
30 return(0); |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
31 } |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
32 |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 void |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
34 cmd_sendat(arg) |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
35 char *arg; |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
36 { |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
37 while (isspace(*arg)) |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
38 arg++; |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
39 if (!*arg) { |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
40 printf("error: missing string argument\n"); |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
41 return; |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
42 } |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
43 ati_rx_control(1); |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
44 send_string_to_ati(arg); |
4661b84260a0
fc-shell: AT-over-RVTMUX command sending implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
45 } |