comparison rvinterf/asyncshell/at.c @ 879:4661b84260a0

fc-shell: AT-over-RVTMUX command sending implemented
author Space Falcon <falcon@ivan.Harhan.ORG>
date Mon, 01 Jun 2015 00:19:28 +0000
parents
children
comparison
equal deleted inserted replaced
878:89c70b89dca5 879:4661b84260a0
1 /*
2 * Functions for the AT-over-RVTMUX interface
3 */
4
5 #include <sys/types.h>
6 #include <stdio.h>
7 #include <ctype.h>
8 #include <string.h>
9 #include <strings.h>
10 #include <stdlib.h>
11 #include "pktmux.h"
12 #include "limits.h"
13
14 send_string_to_ati(str)
15 char *str;
16 {
17 unsigned len;
18 u_char sendpkt[MAX_PKT_TO_TARGET+1];
19
20 len = strlen(str);
21 if (len + 1 > MAX_PKT_TO_TARGET) {
22 printf("error: max pkt to target limit exceeded\n");
23 return(1);
24 }
25 /* fill out the packet */
26 sendpkt[0] = RVT_AT_HEADER;
27 strcpy(sendpkt + 1, str);
28 /* send it! */
29 send_pkt_to_target(sendpkt, len + 1);
30 return(0);
31 }
32
33 void
34 cmd_sendat(arg)
35 char *arg;
36 {
37 while (isspace(*arg))
38 arg++;
39 if (!*arg) {
40 printf("error: missing string argument\n");
41 return;
42 }
43 ati_rx_control(1);
44 send_string_to_ati(arg);
45 }