view cmu200/signalgen.c @ 4:504d3cbb95b5

fc-cmu200d: signal-gen-setup implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 21 May 2017 07:21:17 +0000
parents
children 493987a4527e
line wrap: on
line source

/*
 * This module implements the signal generator functionality.
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include "mode.h"
#include "secaddr.h"

extern char *client_cmd_fields[];
extern int client_cmd_nfields;

extern int current_mode;

cmd_signal_gen_setup()
{
	int rc;
	char cmdstr[32];

	if (client_cmd_nfields != 2) {
		send_socket_response("-Wrong number of arguments\n");
		return(0);
	}
	stop_signal_gen();
	current_mode = OP_MODE_UNDEF;
	rc = find_named_band(client_cmd_fields[1]);
	if (rc < 0) {
		send_socket_response("-Invalid band argument\n");
		return(0);
	}
	sprintf(cmdstr, "*SEC %d\n", SECADDR_RF_NSIG);
	send_scpi_cmd(cmdstr);
	current_mode = OP_MODE_SIGNAL_GEN;
	send_socket_response("+OK\n");
	return(0);
}