changeset 41:3f4221ef916a

fc-cmu200d: power-meas implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 27 May 2017 02:43:43 +0000
parents 2fb9768fc1e2
children dcf7cd305e2b
files cmu200/dispatch.c cmu200/rfanalyzer.c
diffstat 2 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/cmu200/dispatch.c	Sat May 27 02:38:28 2017 +0000
+++ b/cmu200/dispatch.c	Sat May 27 02:43:43 2017 +0000
@@ -11,6 +11,7 @@
 extern int client_cmd_nfields;
 
 extern int cmd_freq_meas();
+extern int cmd_power_meas();
 extern int cmd_rfan_setup();
 extern int cmd_signal_gen_off();
 extern int cmd_signal_gen_sine();
@@ -28,6 +29,7 @@
 } cmdtab[] = {
 	{"freq-meas", cmd_freq_meas},
 	{"ping", cmd_ping},
+	{"power-meas", cmd_power_meas},
 	{"rfan-setup", cmd_rfan_setup},
 	{"signal-gen-off", cmd_signal_gen_off},
 	{"signal-gen-sine", cmd_signal_gen_sine},
--- a/cmu200/rfanalyzer.c	Sat May 27 02:38:28 2017 +0000
+++ b/cmu200/rfanalyzer.c	Sat May 27 02:43:43 2017 +0000
@@ -74,3 +74,24 @@
 	send_socket_response(client_resp);
 	return(0);
 }
+
+cmd_power_meas()
+{
+	char *resp_fields[5];
+	char client_resp[128];
+
+	if (current_mode != OP_MODE_GSM_RFAN) {
+		send_socket_response("-Wrong mode\n");
+		return(0);
+	}
+	send_scpi_cmd("READ:POW?\n");
+	collect_instr_response();
+	if (parse_commasep_response(resp_fields, 5) < 0) {
+		send_socket_response
+			("-CMU200 response has wrong number of fields\n");
+		return(0);
+	}
+	sprintf(client_resp, "+ %s\n", resp_fields[4]);
+	send_socket_response(client_resp);
+	return(0);
+}