comparison rvinterf/asyncshell/at.c @ 0:e7502631a0f9

initial import from freecalypso-sw rev 1033:5ab737ac3ad7
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 11 Jun 2016 00:13:35 +0000
parents
children d43d82cbfb85
comparison
equal deleted inserted replaced
-1:000000000000 0:e7502631a0f9
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 }