FreeCalypso > hg > fc-rfcal-tools
annotate cmu200/dispatch.c @ 132:94e8a410d6bd
fc-rfcal-txcheck: pass PCL to tester (txpwr-cal-pcl)
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 20 Dec 2021 03:52:01 +0000 |
parents | 6cccdafcd64d |
children |
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(); |
129
6cccdafcd64d
fc-cmu200d RF analyzer: implement command to set template PCL
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
17 extern int cmd_rfan_tpcl(); |
6
d8cbc7a383eb
fc-cmu200d: signal-gen-off implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
5
diff
changeset
|
18 extern int cmd_signal_gen_off(); |
5
493987a4527e
fc-cmu200d: signal-gen-sine implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
19 extern int cmd_signal_gen_sine(); |
4
504d3cbb95b5
fc-cmu200d: signal-gen-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
20 extern int cmd_signal_gen_setup(); |
504d3cbb95b5
fc-cmu200d: signal-gen-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
21 |
0
bd62be88259d
initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 cmd_ping() |
bd62be88259d
initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 { |
bd62be88259d
initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 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
|
25 return(0); |
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 |
bd62be88259d
initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 static struct cmdtab { |
bd62be88259d
initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 char *cmd_kw; |
bd62be88259d
initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 int (*handler)(); |
bd62be88259d
initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 } cmdtab[] = { |
8
c873a36a16e6
fc-cmu200d: freq-meas implemented without response parsing
Mychaela Falconia <falcon@freecalypso.org>
parents:
7
diff
changeset
|
32 {"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
|
33 {"ping", cmd_ping}, |
41
3f4221ef916a
fc-cmu200d: power-meas implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
40
diff
changeset
|
34 {"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
|
35 {"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
|
36 {"rfan-channel", cmd_rfan_channel}, |
129
6cccdafcd64d
fc-cmu200d RF analyzer: implement command to set template PCL
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
37 {"rfan-tpcl", cmd_rfan_tpcl}, |
6
d8cbc7a383eb
fc-cmu200d: signal-gen-off implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
5
diff
changeset
|
38 {"signal-gen-off", cmd_signal_gen_off}, |
5
493987a4527e
fc-cmu200d: signal-gen-sine implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
4
diff
changeset
|
39 {"signal-gen-sine", cmd_signal_gen_sine}, |
4
504d3cbb95b5
fc-cmu200d: signal-gen-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
40 {"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
|
41 {"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
|
42 {"txpwr-cal-channel", cmd_rfan_channel}, |
129
6cccdafcd64d
fc-cmu200d RF analyzer: implement command to set template PCL
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
43 {"txpwr-cal-pcl", cmd_rfan_tpcl}, |
40
2fb9768fc1e2
fc-cmu200d: VCXO calibration mode generalized into RF analyzer mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
8
diff
changeset
|
44 {"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
|
45 {0, 0} |
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 |
bd62be88259d
initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 dispatch_client_command() |
bd62be88259d
initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 { |
bd62be88259d
initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 struct cmdtab *tp; |
bd62be88259d
initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 |
bd62be88259d
initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 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
|
53 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
|
54 break; |
bd62be88259d
initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 if (tp->handler) |
bd62be88259d
initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 return tp->handler(); |
bd62be88259d
initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 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
|
58 return(0); |
bd62be88259d
initial import of rfcal code and docs from freecalypso-tools repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 } |