* first attempt at having a combined command line and interactive utility,

that is able to perform single Hamlib API calls. For maintenance reasons,
  both interfaces are combined. Work is not complete yet, but it works!
  The "dummy" rig backend proved to be helpful in that regard :-)
  More API calls are to come, and also a man page for the command line,
  and explanations about the short/long options triggering calls.
  FIXME: API calls requesting more than one argument are not working yet
  (still have to figure out how getopt can accept more than one arg for one
  option...)


git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@400 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.1.1
Stéphane Fillod, F8CFE 2001-02-25 23:14:19 +00:00
rodzic aaec33e8a7
commit 16dd038887
1 zmienionych plików z 316 dodań i 194 usunięć

Wyświetl plik

@ -7,7 +7,7 @@
* TODO: be more generic and add command line option to run
* in non-interactive mode
*
* $Id: rigctl.c,v 1.7 2001-02-14 01:13:20 f4cfe Exp $
* $Id: rigctl.c,v 1.8 2001-02-25 23:14:19 f4cfe Exp $
*
*
* This program is free software; you can redistribute it and/or
@ -28,6 +28,10 @@
#include <stdio.h>
#include <string.h>
#include <unistd.h>
/* TODO: autoconf should check for getopt support, include libs otherwise */
#include <getopt.h>
#include <hamlib/rig.h>
@ -35,101 +39,128 @@
#define SERIAL_PORT "/dev/ttyS0"
#define MAXNAMSIZ 40
#define MAXNBOPT 100 /* max number of different options */
struct test_table {
char cmd;
char name[MAXNAMSIZ];
int (*test_func)(RIG *rig);
unsigned char cmd;
unsigned char name[MAXNAMSIZ];
int (*test_func)(RIG*, int, const struct test_table*, const char*, const char*, const char*);
const char *name1;
const char *name2;
const char *name3;
};
static int set_freq(RIG *rig);
static int get_freq(RIG *rig);
static int set_mode(RIG *rig);
static int get_mode(RIG *rig);
static int set_vfo(RIG *rig);
static int get_vfo(RIG *rig);
static int set_ptt(RIG *rig);
static int get_ptt(RIG *rig);
static int set_rptr_shift(RIG *rig);
static int get_rptr_shift(RIG *rig);
static int set_rptr_offs(RIG *rig);
static int get_rptr_offs(RIG *rig);
static int set_ctcss(RIG *rig);
static int get_ctcss(RIG *rig);
static int set_dcs(RIG *rig);
static int get_dcs(RIG *rig);
static int set_split_freq(RIG *rig);
static int get_split_freq(RIG *rig);
static int set_split(RIG *rig);
static int get_split(RIG *rig);
static int set_ts(RIG *rig);
static int get_ts(RIG *rig);
static int power2mW(RIG *rig);
static int set_level(RIG *rig);
static int get_level(RIG *rig);
static int set_func(RIG *rig);
static int get_func(RIG *rig);
static int set_bank(RIG *rig);
static int set_mem(RIG *rig);
static int get_mem(RIG *rig);
static int mv_ctl(RIG *rig);
static int set_channel(RIG *rig);
static int get_channel(RIG *rig);
static int set_trn(RIG *rig);
static int get_trn(RIG *rig);
#define declare_proto_rig(f) static int (f)(RIG *rig, int interactive, const struct test_table *cmd, const char *arg1, const char *arg2, const char *arg3)
declare_proto_rig(set_freq);
declare_proto_rig(get_freq);
declare_proto_rig(set_mode);
declare_proto_rig(get_mode);
declare_proto_rig(set_vfo);
declare_proto_rig(get_vfo);
declare_proto_rig(set_ptt);
declare_proto_rig(get_ptt);
declare_proto_rig(get_ptt);
declare_proto_rig(set_rptr_shift);
declare_proto_rig(get_rptr_shift);
declare_proto_rig(set_rptr_offs);
declare_proto_rig(get_rptr_offs);
declare_proto_rig(set_ctcss);
declare_proto_rig(get_ctcss);
declare_proto_rig(set_dcs);
declare_proto_rig(get_dcs);
declare_proto_rig(set_split_freq);
declare_proto_rig(get_split_freq);
declare_proto_rig(set_split);
declare_proto_rig(get_split);
declare_proto_rig(set_ts);
declare_proto_rig(get_ts);
declare_proto_rig(power2mW);
declare_proto_rig(set_level);
declare_proto_rig(get_level);
declare_proto_rig(set_func);
declare_proto_rig(get_func);
declare_proto_rig(set_bank);
declare_proto_rig(set_mem);
declare_proto_rig(get_mem);
declare_proto_rig(mv_ctl);
declare_proto_rig(set_channel);
declare_proto_rig(get_channel);
declare_proto_rig(set_trn);
declare_proto_rig(get_trn);
/*
* TODO: add missing rig_set_/rig_get_: rit, ann, ant, dcs, ctcss, etc.
* convention: upper case cmd is set, lowercase is get
*
* TODO: add missing rig_set_/rig_get_: rit, ann, ant, dcs, ctcss, dcd, etc.
* NB: do NOT use -W since it's reserved by POSIX.
* 'q' 'Q' '?' are also reserved for interface use
*/
struct test_table test_list[] = {
{ 'F', "rig_set_freq", set_freq },
{ 'f', "rig_get_freq", get_freq },
{ 'M', "rig_set_mode", set_mode },
{ 'm', "rig_get_mode", get_mode },
{ 'V', "rig_set_vfo", set_vfo },
{ 'v', "rig_get_vfo", get_vfo },
{ 'T', "rig_set_ptt", set_ptt },
{ 't', "rig_get_ptt", get_ptt },
{ 'R', "rig_set_rptr_shift", set_rptr_shift },
{ 'r', "rig_get_rptr_shift", get_rptr_shift },
{ 'O', "rig_set_rptr_offs", set_rptr_offs },
{ 'o', "rig_get_rptr_offs", get_rptr_offs },
{ 'C', "rig_set_ctcss", set_ctcss },
{ 'c', "rig_get_ctcss", get_ctcss },
{ 'D', "rig_set_dcs", set_dcs },
{ 'd', "rig_get_dcs", get_dcs },
{ 'I', "rig_set_split_freq", set_split_freq },
{ 'i', "rig_get_split_freq", get_split_freq },
{ 'S', "rig_set_split", set_split },
{ 's', "rig_get_split", get_split },
{ 'N', "rig_set_ts", set_ts },
{ 'n', "rig_get_ts", get_ts },
{ 'W', "rig_set_poweron", rig_set_poweron },
{ 'w', "rig_set_poweroff", rig_set_poweroff },
{ 'F', "set_freq", set_freq, "Frequency" },
{ 'f', "get_freq", get_freq, "Frequency" },
{ 'M', "set_mode", set_mode, "Mode", "Passband" },
{ 'm', "get_mode", get_mode, "Mode", "Passband" },
{ 'V', "set_vfo", set_vfo, "VFO" },
{ 'v', "get_vfo", get_vfo, "VFO" },
{ 'T', "set_ptt", set_ptt, "PTT" },
{ 't', "get_ptt", get_ptt, "PTT" },
{ 'R', "set_rptr_shift", set_rptr_shift, "Rptr shift" },
{ 'r', "get_rptr_shift", get_rptr_shift, "Rptr shift" },
{ 'O', "set_rptr_offs", set_rptr_offs, "Rptr offset" },
{ 'o', "get_rptr_offs", get_rptr_offs, "Rptr offset" },
{ 'C', "set_ctcss", set_ctcss, "CTCSS tone" },
{ 'c', "get_ctcss", get_ctcss, "CTCSS tone" },
{ 'D', "set_dcs", set_dcs, "DCS code" },
{ 'd', "get_dcs", get_dcs, "DCS code" },
{ 'I', "set_split_freq", set_split_freq, "Rx frequency", "Tx frequency" },
{ 'i', "get_split_freq", get_split_freq, "Rx frequency", "Tx frequency" },
{ 'S', "set_split", set_split, "Split mode" },
{ 's', "get_split", get_split, "Split mode" },
{ 'N', "set_ts", set_ts, "Tuning step" },
{ 'n', "get_ts", get_ts, "Tuning step" },
{ '2', "power2mW", power2mW },
{ 'L', "rig_set_level", set_level },
{ 'l', "rig_get_level", get_level },
{ 'U', "rig_set_func", set_func },
{ 'u', "rig_get_func", get_func },
{ 'B', "rig_set_bank", set_bank },
{ 'E', "rig_set_mem", set_mem },
{ 'e', "rig_get_mem", get_mem },
{ 'G', "rig_mv_ctl", mv_ctl },
{ 'H', "rig_set_channel", set_channel },
{ 'h', "rig_get_channel", get_channel },
{ 'A', "rig_set_trn", set_trn },
{ 'a', "rig_get_trn", get_trn },
{ 'L', "set_level", set_level, "Level", "Value" },
{ 'l', "get_level", get_level, "Level", "Value" },
{ 'U', "set_func", set_func, "Func", "Func status" },
{ 'u', "get_func", get_func, "Func", "Func status" },
{ 'B', "set_bank", set_bank, "Bank" },
{ 'E', "set_mem", set_mem, "Memory#" },
{ 'e', "get_mem", get_mem, "Memory#" },
{ 'G', "mv_ctl", mv_ctl, "Mem/VFO op" },
{ 'H', "set_channel", set_channel },
{ 'h', "get_channel", get_channel },
{ 'A', "set_trn", set_trn },
{ 'a', "get_trn", get_trn },
{ 0x00, "", NULL },
};
int main ()
struct test_table *find_cmd_entry(int cmd)
{
int i;
for (i=0; i<MAXNBOPT && test_list[i].cmd != 0x00; i++)
if (test_list[i].cmd == cmd)
break;
if (i >= MAXNBOPT || test_list[i].cmd == 0x00)
return NULL;
return &test_list[i];
}
int main (int argc, char *argv[])
{
RIG *my_rig; /* handle to rig (nstance) */
int interactive=1; /* if no cmd on command line, switch to interactive */
int retcode; /* generic return code from functions */
int i;
char cmd;
struct option long_options[MAXNBOPT];
char opt_string[MAXNBOPT*2], *opt_ptr;
struct test_table *cmd_entry;
/*
* allocate memory, setup & open port
@ -148,10 +179,34 @@ int main ()
exit(3);
}
opt_ptr = opt_string;
for (i=0; i<MAXNBOPT-1 && test_list[i].cmd; i++) {
/*
* build long_options
*/
long_options[i].name = test_list[i].name;
long_options[i].val = test_list[i].cmd;
long_options[i].has_arg = test_list[i].name1 ?
required_argument : no_argument;
long_options[i].flag = 0;
/*
* build short_options
*/
*opt_ptr++ = test_list[i].cmd;
if (long_options[i].has_arg)
*opt_ptr++ = ':';
}
memset(&long_options[i], 0, sizeof(struct option));
*opt_ptr = '\0';
printf("%s\n",opt_string);
/* TODO: add a long option(after they are consumed) or arg to set rig model */
#if 1
my_rig = rig_init(RIG_MODEL_IC706MKIIG);
my_rig = rig_init(RIG_MODEL_DUMMY);
#else
my_rig = rig_init(RIG_MODEL_FT747);
my_rig = rig_init(RIG_MODEL_IC706MKIIG);
#endif
if (!my_rig)
@ -168,9 +223,46 @@ int main ()
exit(2);
}
printf("Port %s opened ok\n", SERIAL_PORT);
while(1) {
int c;
int option_index = 0;
c = getopt_long (argc, argv, opt_string,
long_options, &option_index);
if (c == -1)
break;
printf ("## option '%c' %s\n", c, long_options[option_index].name);
cmd_entry = find_cmd_entry(c);
if (!cmd_entry)
break; /* TODO: */
/*
* at least one command on command line,
* disable interactive mode
*/
interactive = 0;
retcode = (*cmd_entry->test_func)(my_rig, interactive, cmd_entry, optarg,
optarg, optarg);
if (retcode != RIG_OK ) {
printf("%s: error = %s\n",cmd_entry->name,rigerror(retcode));
}
}
if (!interactive) {
rig_close(my_rig); /* close port */
rig_cleanup(my_rig); /* if you care about memory */
return 0;
}
while (1) {
char arg1[128], *p1;
char arg2[128], *p2;
char arg3[128], *p3;
printf("\nRig command: ");
scanf("%c", &cmd);
if (cmd == 0x0a)
@ -185,266 +277,297 @@ int main ()
continue;
}
for (i=0; test_list[i].cmd != 0x00; i++)
if (test_list[i].cmd == cmd)
break;
if (test_list[i].cmd == 0x00) {
printf("Command not found!\n");
continue;
cmd_entry = find_cmd_entry(cmd);
if (!cmd_entry) {
fprintf(stderr, "Command not found!\n");
continue;
}
retcode = (*test_list[i].test_func)(my_rig);
p1 = p2 = p3 = NULL;
if (cmd_entry->name1) {
printf("%s: ", cmd_entry->name1);
scanf("%s", arg1);
p1 = arg1;
}
if (cmd_entry->name2) {
printf("%s: ", cmd_entry->name2);
scanf("%s", arg2);
p2 = arg2;
}
if (cmd_entry->name3) {
printf("%s: ", cmd_entry->name3);
scanf("%s", arg3);
p1 = arg3;
}
retcode = (*cmd_entry->test_func)(my_rig, interactive, cmd_entry, p1,
p2, p3);
if (retcode != RIG_OK ) {
printf("%s: error = %s\n",test_list[i].name,rigerror(retcode));
printf("%s: error = %s\n",cmd_entry->name,rigerror(retcode));
}
}
rig_close(my_rig); /* close port */
rig_cleanup(my_rig); /* if you care about memory */
printf("port %s closed ok \n",SERIAL_PORT);
return 0;
}
static int set_freq(RIG *rig)
/*
* static int (f)(RIG *rig, int interactive, const void *arg1, const void *arg2, const void *arg3, const void *arg4)
*/
declare_proto_rig(set_freq)
{
freq_t freq;
printf("Frequency: ");
scanf("%Ld", &freq);
sscanf(arg1, "%lld", &freq);
return rig_set_freq(rig, RIG_VFO_CURR, freq);
}
static int get_freq(RIG *rig)
declare_proto_rig(get_freq)
{
int status;
freq_t freq;
status = rig_get_freq(rig, RIG_VFO_CURR, &freq);
printf("Frequency: %Ld\n", freq);
if (interactive)
printf("%s: ", cmd->name1); /* i.e. "Frequency" */
printf("%lld", freq);
return status;
}
static int set_mode(RIG *rig)
declare_proto_rig(set_mode)
{
rmode_t mode;
pbwidth_t width;
printf("Mode: ");
scanf("%d", &mode);
printf("Passband: ");
scanf("%d", (int*)&width);
sscanf(arg1, "%d", &mode);
sscanf(arg2, "%d", (int*)&width);
return rig_set_mode(rig, RIG_VFO_CURR, mode, width);
}
static int get_mode(RIG *rig)
declare_proto_rig(get_mode)
{
int status;
rmode_t mode;
pbwidth_t width;
status = rig_get_mode(rig, RIG_VFO_CURR, &mode, &width);
printf("Mode: %d\nPassband: %d\n", mode, width);
if (interactive)
printf("%s: ", cmd->name1);
printf("%d", mode);
if (interactive)
printf("%s: ", cmd->name2);
printf("%d", width);
return status;
}
static int set_vfo(RIG *rig)
declare_proto_rig(set_vfo)
{
vfo_t vfo;
printf("VFO: ");
scanf("%d", (int*)&vfo);
sscanf(arg1, "%d", (int*)&vfo);
return rig_set_vfo(rig, vfo);
}
static int get_vfo(RIG *rig)
declare_proto_rig(get_vfo)
{
int status;
vfo_t vfo;
status = rig_get_vfo(rig, &vfo);
printf("VFO: %d\n", vfo);
if (interactive)
printf("%s: ", cmd->name1);
printf("%d\n", vfo);
return status;
}
static int set_ptt(RIG *rig)
declare_proto_rig(set_ptt)
{
ptt_t ptt;
printf("PTT: ");
scanf("%d", (int*)&ptt);
sscanf(arg1, "%d", (int*)&ptt);
return rig_set_ptt(rig, RIG_VFO_CURR, ptt);
}
static int get_ptt(RIG *rig)
declare_proto_rig(get_ptt)
{
int status;
ptt_t ptt;
status = rig_get_ptt(rig, RIG_VFO_CURR, &ptt);
printf("PTT: %d\n", ptt);
if (interactive)
printf("%s: ", cmd->name1);
printf("%d\n", ptt);
return status;
}
static int set_rptr_shift(RIG *rig)
declare_proto_rig(set_rptr_shift)
{
rptr_shift_t rptr_shift;
printf("Repeater shift: ");
scanf("%d", (int*)&rptr_shift);
sscanf(arg1, "%d", (int*)&rptr_shift);
return rig_set_rptr_shift(rig, RIG_VFO_CURR, rptr_shift);
}
static int get_rptr_shift(RIG *rig)
declare_proto_rig(get_rptr_shift)
{
int status;
rptr_shift_t rptr_shift;
status = rig_get_rptr_shift(rig, RIG_VFO_CURR, &rptr_shift);
printf("Repeater shift: %d\n", rptr_shift);
if (interactive)
printf("%s: ", cmd->name1);
printf("%d\n", rptr_shift);
return status;
}
static int set_rptr_offs(RIG *rig)
declare_proto_rig(set_rptr_offs)
{
unsigned long rptr_offs;
printf("Repeater shift offset: ");
scanf("%ld", &rptr_offs);
sscanf(arg1, "%ld", &rptr_offs);
return rig_set_rptr_offs(rig, RIG_VFO_CURR, rptr_offs);
}
static int get_rptr_offs(RIG *rig)
declare_proto_rig(get_rptr_offs)
{
int status;
unsigned long rptr_offs;
status = rig_get_rptr_offs(rig, RIG_VFO_CURR, &rptr_offs);
printf("Repeater shift offset: %ld\n", rptr_offs);
if (interactive)
printf("%s: ", cmd->name1);
printf("%ld\n", rptr_offs);
return status;
}
static int set_ctcss(RIG *rig)
declare_proto_rig(set_ctcss)
{
unsigned int tone;
printf("CTCSS tone: ");
scanf("%d", &tone);
sscanf(arg1, "%d", &tone);
return rig_set_ctcss(rig, RIG_VFO_CURR, tone);
}
static int get_ctcss(RIG *rig)
declare_proto_rig(get_ctcss)
{
int status;
unsigned int tone;
status = rig_get_ctcss(rig, RIG_VFO_CURR, &tone);
printf("CTCSS tone: %d\n", tone);
if (interactive)
printf("%s: ", cmd->name1);
printf("%d\n", tone);
return status;
}
static int set_dcs(RIG *rig)
declare_proto_rig(set_dcs)
{
unsigned int code;
printf("DCS code: ");
scanf("%d", &code);
sscanf(arg1, "%d", &code);
return rig_set_dcs(rig, RIG_VFO_CURR, code);
}
static int get_dcs(RIG *rig)
declare_proto_rig(get_dcs)
{
int status;
unsigned int code;
status = rig_get_dcs(rig, RIG_VFO_CURR, &code);
printf("DCS code: %d\n", code);
if (interactive)
printf("%s: ", cmd->name1);
printf("%d\n", code);
return status;
}
static int set_split_freq(RIG *rig)
declare_proto_rig(set_split_freq)
{
freq_t rxfreq,txfreq;
printf("Receive frequency: ");
scanf("%Ld", &rxfreq);
printf("Transmit frequency: ");
scanf("%Ld", &txfreq);
sscanf(arg2, "%lld", &rxfreq);
sscanf(arg2, "%lld", &txfreq);
return rig_set_split_freq(rig, RIG_VFO_CURR, rxfreq, txfreq);
}
static int get_split_freq(RIG *rig)
declare_proto_rig(get_split_freq)
{
int status;
freq_t rxfreq,txfreq;
status = rig_get_split_freq(rig, RIG_VFO_CURR, &rxfreq, &txfreq);
printf("Receive frequency: %Ld\n", rxfreq);
printf("Transmit frequency: %Ld\n", txfreq);
if (interactive)
printf("%s: ", cmd->name1);
printf("%lld\n", rxfreq);
if (interactive)
printf("%s: ", cmd->name2);
printf("%lld\n", txfreq);
return status;
}
static int set_split(RIG *rig)
declare_proto_rig(set_split)
{
split_t split;
printf("Split mode: ");
scanf("%d", (int*)&split);
sscanf(arg1, "%d", (int*)&split);
return rig_set_split(rig, RIG_VFO_CURR, split);
}
static int get_split(RIG *rig)
declare_proto_rig(get_split)
{
int status;
split_t split;
status = rig_get_split(rig, RIG_VFO_CURR, &split);
printf("Split mode: %d\n", split);
if (interactive)
printf("%s: ", cmd->name1);
printf("%d\n", split);
return status;
}
static int set_ts(RIG *rig)
declare_proto_rig(set_ts)
{
unsigned long ts;
printf("Tuning step: ");
scanf("%ld", &ts);
sscanf(arg1, "%ld", &ts);
return rig_set_ts(rig, RIG_VFO_CURR, ts);
}
static int get_ts(RIG *rig)
declare_proto_rig(get_ts)
{
int status;
unsigned long ts;
status = rig_get_ts(rig, RIG_VFO_CURR, &ts);
printf("Tuning step: %ld\n", ts);
if (interactive)
printf("%s: ", cmd->name1);
printf("%ld\n", ts);
return status;
}
static int power2mW(RIG *rig)
declare_proto_rig(power2mW)
{
int status;
float power;
@ -464,49 +587,47 @@ static int power2mW(RIG *rig)
}
static int set_level(RIG *rig)
declare_proto_rig(set_level)
{
setting_t level;
value_t val;
unsigned char m;
printf("Level: ");
scanf("%ld", &level);
printf("(i)nt or (f)loat: ");
scanf("%c", &m);
printf("Level: ");
if (m == 'f')
scanf("%f", &val.f);
sscanf(arg1, "%ld", &level);
if (RIG_LEVEL_IS_FLOAT(level))
sscanf(arg2, "%f", &val.f);
else
scanf("%d", &val.i);
sscanf(arg2, "%d", &val.i);
return rig_set_level(rig, RIG_VFO_CURR, level, val);
}
static int get_level(RIG *rig)
declare_proto_rig(get_level)
{
int status;
setting_t level;
value_t val;
printf("Level: ");
scanf("%ld", &level);
sscanf(arg1, "%ld", &level);
status = rig_get_level(rig, RIG_VFO_CURR, level, &val);
printf("Level (int): %d\n", val.i);
printf("Level (float): %f\n", val.f);
if (interactive)
printf("%s: ", cmd->name1);
if (RIG_LEVEL_IS_FLOAT(level))
printf("%f\n", val.f);
else
printf("%d\n", val.i);
return status;
}
static int set_func(RIG *rig)
declare_proto_rig(set_func)
{
setting_t func;
int func_stat;
printf("Func: ");
scanf("%ld", &func);
printf("Func status: ");
scanf("%d", (int*)&func_stat);
sscanf(arg1, "%ld", &func);
sscanf(arg2, "%d", (int*)&func_stat);
return rig_set_func(rig, RIG_VFO_CURR, func, func_stat);
}
@ -515,90 +636,91 @@ static int set_func(RIG *rig)
* TODO: if rig_get_func fails, do not printf
* fix all other get_* calls in rigctl..
*/
static int get_func(RIG *rig)
declare_proto_rig(get_func)
{
int status;
setting_t func;
int func_stat;
printf("Func: ");
scanf("%ld", &func);
sscanf(arg1, "%ld", &func);
status = rig_get_func(rig, RIG_VFO_CURR, func, &func_stat);
printf("Function status: %d\n", func_stat);
if (interactive)
printf("%s: ", cmd->name1);
printf("%d\n", func_stat);
return status;
}
static int set_bank(RIG *rig)
declare_proto_rig(set_bank)
{
int bank;
printf("Bank: ");
scanf("%d", &bank);
sscanf(arg1, "%d", &bank);
return rig_set_bank(rig, RIG_VFO_CURR, bank);
}
static int set_mem(RIG *rig)
declare_proto_rig(set_mem)
{
int ch;
printf("Memory#: ");
scanf("%d", &ch);
sscanf(arg1, "%d", &ch);
return rig_set_mem(rig, RIG_VFO_CURR, ch);
}
static int get_mem(RIG *rig)
declare_proto_rig(get_mem)
{
int status;
int ch;
status = rig_get_mem(rig, RIG_VFO_CURR, &ch);
printf("Memory#: %d\n", ch);
if (interactive)
printf("%s: ", cmd->name1);
printf("%d\n", ch);
return status;
}
static int mv_ctl(RIG *rig)
declare_proto_rig(mv_ctl)
{
mv_op_t op;
printf("Mem/VFO op: ");
scanf("%d", (int*)&op);
sscanf(arg1, "%d", (int*)&op);
return rig_mv_ctl(rig, RIG_VFO_CURR, op);
}
static int set_channel(RIG *rig)
declare_proto_rig(set_channel)
{
return 0;
}
static int get_channel(RIG *rig)
declare_proto_rig(get_channel)
{
return 0;
}
static int set_trn(RIG *rig)
declare_proto_rig(set_trn)
{
int trn;
printf("Transceive: ");
scanf("%d", &trn);
sscanf(arg1, "%d", &trn);
return rig_set_trn(rig, RIG_VFO_CURR, trn);
}
static int get_trn(RIG *rig)
declare_proto_rig(get_trn)
{
int status;
int trn;
status = rig_get_trn(rig, RIG_VFO_CURR, &trn);
printf("Transceive: %d\n", trn);
if (interactive)
printf("%s: ", cmd->name1);
printf("%d\n", trn);
return status;
}