annotate cmu200/dispatch.c @ 112:fbfbd813c9b4

fc-cmu200d: implemented channel switching in Tx power calibration
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 13 Feb 2018 04:29:38 +0000
parents 3f4221ef916a
children 6cccdafcd64d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This module contains the code that dispatches client commands.
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 */
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 #include <stdio.h>
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <stdlib.h>
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <string.h>
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <strings.h>
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 extern char *client_cmd_fields[];
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 extern int client_cmd_nfields;
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12
8
c873a36a16e6 fc-cmu200d: freq-meas implemented without response parsing
Mychaela Falconia <falcon@freecalypso.org>
parents: 7
diff changeset
13 extern int cmd_freq_meas();
41
3f4221ef916a fc-cmu200d: power-meas implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 40
diff changeset
14 extern int cmd_power_meas();
40
2fb9768fc1e2 fc-cmu200d: VCXO calibration mode generalized into RF analyzer mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 8
diff changeset
15 extern int cmd_rfan_setup();
112
fbfbd813c9b4 fc-cmu200d: implemented channel switching in Tx power calibration
Mychaela Falconia <falcon@freecalypso.org>
parents: 41
diff changeset
16 extern int cmd_rfan_channel();
6
d8cbc7a383eb fc-cmu200d: signal-gen-off implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 5
diff changeset
17 extern int cmd_signal_gen_off();
5
493987a4527e fc-cmu200d: signal-gen-sine implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
18 extern int cmd_signal_gen_sine();
4
504d3cbb95b5 fc-cmu200d: signal-gen-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 0
diff changeset
19 extern int cmd_signal_gen_setup();
504d3cbb95b5 fc-cmu200d: signal-gen-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 0
diff changeset
20
0
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 cmd_ping()
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 {
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 send_socket_response("+Pong\n");
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 return(0);
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 }
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 static struct cmdtab {
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 char *cmd_kw;
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 int (*handler)();
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 } cmdtab[] = {
8
c873a36a16e6 fc-cmu200d: freq-meas implemented without response parsing
Mychaela Falconia <falcon@freecalypso.org>
parents: 7
diff changeset
31 {"freq-meas", cmd_freq_meas},
0
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 {"ping", cmd_ping},
41
3f4221ef916a fc-cmu200d: power-meas implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 40
diff changeset
33 {"power-meas", cmd_power_meas},
40
2fb9768fc1e2 fc-cmu200d: VCXO calibration mode generalized into RF analyzer mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 8
diff changeset
34 {"rfan-setup", cmd_rfan_setup},
112
fbfbd813c9b4 fc-cmu200d: implemented channel switching in Tx power calibration
Mychaela Falconia <falcon@freecalypso.org>
parents: 41
diff changeset
35 {"rfan-channel", cmd_rfan_channel},
6
d8cbc7a383eb fc-cmu200d: signal-gen-off implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 5
diff changeset
36 {"signal-gen-off", cmd_signal_gen_off},
5
493987a4527e fc-cmu200d: signal-gen-sine implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
37 {"signal-gen-sine", cmd_signal_gen_sine},
4
504d3cbb95b5 fc-cmu200d: signal-gen-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 0
diff changeset
38 {"signal-gen-setup", cmd_signal_gen_setup},
40
2fb9768fc1e2 fc-cmu200d: VCXO calibration mode generalized into RF analyzer mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 8
diff changeset
39 {"txpwr-cal-setup", cmd_rfan_setup},
112
fbfbd813c9b4 fc-cmu200d: implemented channel switching in Tx power calibration
Mychaela Falconia <falcon@freecalypso.org>
parents: 41
diff changeset
40 {"txpwr-cal-channel", cmd_rfan_channel},
40
2fb9768fc1e2 fc-cmu200d: VCXO calibration mode generalized into RF analyzer mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 8
diff changeset
41 {"vcxo-cal-setup", cmd_rfan_setup},
0
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 {0, 0}
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 };
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 dispatch_client_command()
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 {
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 struct cmdtab *tp;
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 for (tp = cmdtab; tp->cmd_kw; tp++)
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 if (!strcmp(client_cmd_fields[0], tp->cmd_kw))
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 break;
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 if (tp->handler)
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 return tp->handler();
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 send_socket_response("-Unknown or unimplemented command\n");
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 return(0);
bd62be88259d initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 }