FreeCalypso > hg > freecalypso-sw
comparison rvinterf/asyncshell/tchcmd.c @ 1014:0511507bf6e7
fc-shell: tch-dl control command implemented
author | Mychaela Falconia <falcon@ivan.Harhan.ORG> |
---|---|
date | Sun, 20 Mar 2016 22:52:25 +0000 |
parents | |
children | 9ced8e13cf91 |
comparison
equal
deleted
inserted
replaced
1013:6eee1e547778 | 1014:0511507bf6e7 |
---|---|
1 /* | |
2 * Commands for manipulating the experimental TCH rerouting feature | |
3 * of FreeCalypso GSM firmware | |
4 */ | |
5 | |
6 #include <sys/types.h> | |
7 #include <stdio.h> | |
8 #include <string.h> | |
9 #include <strings.h> | |
10 #include <stdlib.h> | |
11 #include "pktmux.h" | |
12 #include "tch_feature.h" | |
13 | |
14 send_tch_config_req(config) | |
15 { | |
16 u_char sendpkt[3]; | |
17 | |
18 sendpkt[0] = RVT_TCH_HEADER; | |
19 sendpkt[1] = TCH_CONFIG_REQ; | |
20 sendpkt[2] = config; | |
21 /* send it! */ | |
22 send_pkt_to_target(sendpkt, 3); | |
23 return(0); | |
24 } | |
25 | |
26 cmd_tchdl_common(argc, argv) | |
27 char **argv; | |
28 { | |
29 int config; | |
30 | |
31 if (!strcmp(argv[1], "enable") || !strcmp(argv[1], "on") || | |
32 !strcmp(argv[1], "1")) | |
33 config = 1; | |
34 else if (!strcmp(argv[1], "disable") || !strcmp(argv[1], "off") || | |
35 !strcmp(argv[1], "0")) | |
36 config = 0; | |
37 else { | |
38 printf("error: boolean argument required\n"); | |
39 return(1); | |
40 } | |
41 return send_tch_config_req(config); | |
42 } | |
43 | |
44 void | |
45 cmd_tchdl_interactive(argstr) | |
46 char *argstr; | |
47 { | |
48 char *argv[2]; | |
49 int argc, rc; | |
50 | |
51 rc = parse_interactive_command_into_argv(argstr, argv, 1, 1, &argc); | |
52 if (rc < 0) | |
53 return; | |
54 tch_rx_control(1); | |
55 cmd_tchdl_common(argc, argv); | |
56 } | |
57 | |
58 cmd_tchdl_oneshot(argc, argv) | |
59 char **argv; | |
60 { | |
61 return cmd_tchdl_common(argc - 1, argv + 1); | |
62 } |