kopia lustrzana https://github.com/Hamlib/Hamlib
Removed -b|--block option in favor of using '+' prepended to a command
from the client to request Extended Response protocol. git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2827 7ae35d74-ebe9-4afe-98af-79ac388436b8Hamlib-1.2.11
rodzic
18c31c61ad
commit
14841cf118
|
@ -2,26 +2,26 @@
|
||||||
* rigctl.c - (C) Stephane Fillod 2000-2009
|
* rigctl.c - (C) Stephane Fillod 2000-2009
|
||||||
*
|
*
|
||||||
* This program test/control a radio using Hamlib.
|
* This program test/control a radio using Hamlib.
|
||||||
* It takes commands in interactive mode as well as
|
* It takes commands in interactive mode as well as
|
||||||
* from command line options.
|
* from command line options.
|
||||||
*
|
*
|
||||||
* $Id: rigctl.c,v 1.70 2009-01-04 14:49:17 fillods Exp $
|
* $Id: rigctl.c,v 1.70 2009-01-04 14:49:17 fillods Exp $
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation; either version 2
|
* as published by the Free Software Foundation; either version 2
|
||||||
* of the License, or (at your option) any later version.
|
* of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
|
@ -53,7 +53,7 @@ void usage(void);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reminder: when adding long options,
|
* Reminder: when adding long options,
|
||||||
* keep up to date SHORT_OPTIONS, usage()'s output and man page. thanks.
|
* keep up to date SHORT_OPTIONS, usage()'s output and man page. thanks.
|
||||||
* NB: do NOT use -W since it's reserved by POSIX.
|
* NB: do NOT use -W since it's reserved by POSIX.
|
||||||
* TODO: add an option to read from a file
|
* TODO: add an option to read from a file
|
||||||
|
@ -86,7 +86,7 @@ static struct option long_options[] =
|
||||||
int interactive = 1; /* if no cmd on command line, switch to interactive */
|
int interactive = 1; /* if no cmd on command line, switch to interactive */
|
||||||
int prompt = 1; /* Print prompt in rigctl */
|
int prompt = 1; /* Print prompt in rigctl */
|
||||||
int opt_end= 0; /* only used by rigctld */
|
int opt_end= 0; /* only used by rigctld */
|
||||||
int opt_block = 0; /* only used by rigctld */
|
//int opt_block = 0; /* only used by rigctld */
|
||||||
int vfo_mode; /* vfo_mode=0 means target VFO is current VFO */
|
int vfo_mode; /* vfo_mode=0 means target VFO is current VFO */
|
||||||
|
|
||||||
char send_cmd_term = '\r'; /* send_cmd termination char */
|
char send_cmd_term = '\r'; /* send_cmd termination char */
|
||||||
|
@ -251,7 +251,7 @@ int main (int argc, char *argv[])
|
||||||
"<hamlib-developer@lists.sourceforge.net>\n\n");
|
"<hamlib-developer@lists.sourceforge.net>\n\n");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* at least one command on command line,
|
* at least one command on command line,
|
||||||
* disable interactive mode
|
* disable interactive mode
|
||||||
*/
|
*/
|
||||||
if (optind < argc)
|
if (optind < argc)
|
||||||
|
@ -260,7 +260,7 @@ int main (int argc, char *argv[])
|
||||||
my_rig = rig_init(my_model);
|
my_rig = rig_init(my_model);
|
||||||
|
|
||||||
if (!my_rig) {
|
if (!my_rig) {
|
||||||
fprintf(stderr, "Unknown rig num %d, or initialization error.\n",
|
fprintf(stderr, "Unknown rig num %d, or initialization error.\n",
|
||||||
my_model);
|
my_model);
|
||||||
fprintf(stderr, "Please check with --list option.\n");
|
fprintf(stderr, "Please check with --list option.\n");
|
||||||
exit(2);
|
exit(2);
|
||||||
|
@ -275,7 +275,7 @@ int main (int argc, char *argv[])
|
||||||
if (rig_file)
|
if (rig_file)
|
||||||
strncpy(my_rig->state.rigport.pathname, rig_file, FILPATHLEN);
|
strncpy(my_rig->state.rigport.pathname, rig_file, FILPATHLEN);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ex: RIG_PTT_PARALLEL and /dev/parport0
|
* ex: RIG_PTT_PARALLEL and /dev/parport0
|
||||||
*/
|
*/
|
||||||
if (ptt_type != RIG_PTT_NONE)
|
if (ptt_type != RIG_PTT_NONE)
|
||||||
|
@ -318,7 +318,7 @@ int main (int argc, char *argv[])
|
||||||
if (verbose > 0)
|
if (verbose > 0)
|
||||||
printf("Opened rig model %d, '%s'\n", my_rig->caps->rig_model,
|
printf("Opened rig model %d, '%s'\n", my_rig->caps->rig_model,
|
||||||
my_rig->caps->model_name);
|
my_rig->caps->model_name);
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "Backend version: %s, Status: %s\n",
|
rig_debug(RIG_DEBUG_VERBOSE, "Backend version: %s, Status: %s\n",
|
||||||
my_rig->caps->version, rig_strstatus(my_rig->caps->status));
|
my_rig->caps->version, rig_strstatus(my_rig->caps->status));
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
|
@ -152,7 +152,6 @@ declare_proto_rig(set_powerstat);
|
||||||
declare_proto_rig(get_powerstat);
|
declare_proto_rig(get_powerstat);
|
||||||
declare_proto_rig(send_dtmf);
|
declare_proto_rig(send_dtmf);
|
||||||
declare_proto_rig(recv_dtmf);
|
declare_proto_rig(recv_dtmf);
|
||||||
declare_proto_rig(chk_blk);
|
|
||||||
declare_proto_rig(chk_vfo);
|
declare_proto_rig(chk_vfo);
|
||||||
|
|
||||||
|
|
||||||
|
@ -229,8 +228,7 @@ static struct test_table test_list[] = {
|
||||||
{ '1', "dump_caps", dump_caps, ARG_NOVFO },
|
{ '1', "dump_caps", dump_caps, ARG_NOVFO },
|
||||||
{ '3', "dump_conf", dump_conf, ARG_NOVFO },
|
{ '3', "dump_conf", dump_conf, ARG_NOVFO },
|
||||||
{ 0x8f,"dump_state", dump_state, ARG_OUT|ARG_NOVFO },
|
{ 0x8f,"dump_state", dump_state, ARG_OUT|ARG_NOVFO },
|
||||||
{ 0xf0,"chk_blk", chk_blk, ARG_NOVFO }, /* rigctld only--check for block protocol */
|
{ 0xf0,"chk_vfo", chk_vfo, ARG_NOVFO }, /* rigctld only--check for VFO mode */
|
||||||
{ 0xf1,"chk_vfo", chk_vfo, ARG_NOVFO }, /* rigctld only--check for VFO mode */
|
|
||||||
{ 0x00, "", NULL },
|
{ 0x00, "", NULL },
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -283,9 +281,9 @@ static int scanfc(FILE *fin, const char *format, void *p)
|
||||||
extern int interactive;
|
extern int interactive;
|
||||||
extern int prompt;
|
extern int prompt;
|
||||||
extern int opt_end;
|
extern int opt_end;
|
||||||
extern int opt_block;
|
|
||||||
extern int vfo_mode;
|
extern int vfo_mode;
|
||||||
extern char send_cmd_term;
|
extern char send_cmd_term;
|
||||||
|
int ext_resp = 0;
|
||||||
|
|
||||||
int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc)
|
int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc)
|
||||||
{
|
{
|
||||||
|
@ -307,6 +305,16 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc)
|
||||||
if (scanfc(fin, "%c", &cmd) < 0)
|
if (scanfc(fin, "%c", &cmd) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
/* Extended response protocol requested with leading '+' on command
|
||||||
|
* string--rigctld only! */
|
||||||
|
if (cmd == '+' && !prompt) {
|
||||||
|
ext_resp = 1;
|
||||||
|
if (scanfc(fin, "%c", &cmd) < 0)
|
||||||
|
return -1;
|
||||||
|
} else if (cmd == '+' && prompt) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* command by name */
|
/* command by name */
|
||||||
if (cmd == '\\') {
|
if (cmd == '\\') {
|
||||||
unsigned char cmd_name[MAXNAMSIZ], *pcmd = cmd_name;
|
unsigned char cmd_name[MAXNAMSIZ], *pcmd = cmd_name;
|
||||||
|
@ -466,23 +474,25 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!prompt)
|
if (!prompt)
|
||||||
rig_debug(RIG_DEBUG_TRACE, "rigctl(d): %c '%s' '%s' '%s'\n",
|
rig_debug(RIG_DEBUG_TRACE, "rigctl(d): %c '0x%02x' '%s' '%s' '%s'\n",
|
||||||
cmd, p1, p2, p3);
|
cmd, vfo, p1, p2, p3);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Block protocol: output received command name and arguments response
|
* Extended Response protocol: output received command name and arguments
|
||||||
* Don't send response on '\chk_blk' command
|
* response. Don't send command header on '\chk_vfo' command.
|
||||||
*/
|
*/
|
||||||
if (interactive && opt_block && (cmd != 0xf0 && cmd != 0xf1)) {
|
if (interactive && ext_resp && cmd != 0xf0) {
|
||||||
char a1[MAXARGSZ+1];
|
char a1[MAXARGSZ + 1];
|
||||||
char a2[MAXARGSZ+1];
|
char a2[MAXARGSZ + 1];
|
||||||
char a3[MAXARGSZ+1];
|
char a3[MAXARGSZ + 1];
|
||||||
|
char vfo_str[MAXARGSZ + 1];
|
||||||
|
|
||||||
p1 == NULL ? a1[0] = '\0' : snprintf(a1, sizeof(a1), " %s", p1);
|
vfo_mode == 0 ? vfo_str[0] = '\0' : snprintf(vfo_str, sizeof(vfo_str), " %s", rig_strvfo(vfo));
|
||||||
|
p1 == NULL ? a1[0] = '\0' : snprintf(a1, sizeof(a1), " %s", p1);
|
||||||
p2 == NULL ? a2[0] = '\0' : snprintf(a2, sizeof(a2), " %s", p2);
|
p2 == NULL ? a2[0] = '\0' : snprintf(a2, sizeof(a2), " %s", p2);
|
||||||
p3 == NULL ? a3[0] = '\0' : snprintf(a3, sizeof(a3), " %s", p3);
|
p3 == NULL ? a3[0] = '\0' : snprintf(a3, sizeof(a3), " %s", p3);
|
||||||
|
|
||||||
fprintf(fout, "%s:%s%s%s\n", cmd_entry->name, a1, a2, a3);
|
fprintf(fout, "%s:%s%s%s%s\n", cmd_entry->name, vfo_str, a1, a2, a3);
|
||||||
}
|
}
|
||||||
|
|
||||||
retcode = (*cmd_entry->rig_routine)(my_rig, fout, interactive,
|
retcode = (*cmd_entry->rig_routine)(my_rig, fout, interactive,
|
||||||
|
@ -494,21 +504,28 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc)
|
||||||
|
|
||||||
|
|
||||||
if (retcode != RIG_OK) {
|
if (retcode != RIG_OK) {
|
||||||
if ((interactive && !prompt && opt_block) || (interactive && !prompt))
|
/* only for rigctld */
|
||||||
fprintf(fout, NETRIGCTL_RET "%d\n", retcode); /* only for rigctld */
|
if ((interactive && !prompt && ext_resp) || (interactive && !prompt)) {
|
||||||
|
fprintf(fout, NETRIGCTL_RET "%d\n", retcode);
|
||||||
|
ext_resp = 0;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
fprintf(fout, "%s: error = %s\n", cmd_entry->name, rigerror(retcode));
|
fprintf(fout, "%s: error = %s\n", cmd_entry->name, rigerror(retcode));
|
||||||
} else {
|
} else {
|
||||||
// rig_debug(RIG_DEBUG_TRACE, "rigctld: %d %s\n", cmd, cmd_entry->name);
|
/* only for rigctld */
|
||||||
|
if (interactive && !prompt) {
|
||||||
if (interactive && !prompt) { /* only for rigctld */
|
/* netrigctl RIG_OK */
|
||||||
if (!(cmd_entry->flags & ARG_OUT)
|
if (!(cmd_entry->flags & ARG_OUT)
|
||||||
&& !opt_end && !opt_block && (cmd != 0xf0 && cmd != 0xf1)) /* netrigctl RIG_OK */
|
&& !opt_end && !ext_resp && cmd != 0xf0)
|
||||||
fprintf(fout, NETRIGCTL_RET "0\n");
|
fprintf(fout, NETRIGCTL_RET "0\n");
|
||||||
else if ((cmd_entry->flags & ARG_OUT) && opt_end) /* Nate's protocol */
|
/* block marker protocol */
|
||||||
|
else if (ext_resp && cmd != 0xf0) {
|
||||||
|
fprintf(fout, NETRIGCTL_RET "0\n");
|
||||||
|
ext_resp = 0;
|
||||||
|
}
|
||||||
|
/* Nate's protocol (obsolete) */
|
||||||
|
else if ((cmd_entry->flags & ARG_OUT) && opt_end)
|
||||||
fprintf(fout, "END\n");
|
fprintf(fout, "END\n");
|
||||||
else if (opt_block && (cmd != 0xf0 && cmd != 0xf1)) /* block marker protocol */
|
|
||||||
fprintf(fout, NETRIGCTL_RET "0\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -658,7 +675,7 @@ declare_proto_rig(get_freq)
|
||||||
if (status != RIG_OK)
|
if (status != RIG_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
if ((interactive && prompt) || (interactive && !prompt && opt_block))
|
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||||
fprintf(fout, "%s: ", cmd->arg1); /* i.e. "Frequency" */
|
fprintf(fout, "%s: ", cmd->arg1); /* i.e. "Frequency" */
|
||||||
fprintf(fout, "%"PRIll"\n", (long long)freq);
|
fprintf(fout, "%"PRIll"\n", (long long)freq);
|
||||||
|
|
||||||
|
@ -683,7 +700,7 @@ declare_proto_rig(get_rit)
|
||||||
status = rig_get_rit(rig, vfo, &rit);
|
status = rig_get_rit(rig, vfo, &rit);
|
||||||
if (status != RIG_OK)
|
if (status != RIG_OK)
|
||||||
return status;
|
return status;
|
||||||
if ((interactive && prompt) || (interactive && !prompt && opt_block))
|
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||||
fprintf(fout, "%s: ", cmd->arg1);
|
fprintf(fout, "%s: ", cmd->arg1);
|
||||||
fprintf(fout, "%ld\n", rit);
|
fprintf(fout, "%ld\n", rit);
|
||||||
|
|
||||||
|
@ -708,7 +725,7 @@ declare_proto_rig(get_xit)
|
||||||
status = rig_get_xit(rig, vfo, &xit);
|
status = rig_get_xit(rig, vfo, &xit);
|
||||||
if (status != RIG_OK)
|
if (status != RIG_OK)
|
||||||
return status;
|
return status;
|
||||||
if ((interactive && prompt) || (interactive && !prompt && opt_block))
|
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||||
fprintf(fout, "%s: ", cmd->arg1);
|
fprintf(fout, "%s: ", cmd->arg1);
|
||||||
fprintf(fout, "%ld\n", xit);
|
fprintf(fout, "%ld\n", xit);
|
||||||
|
|
||||||
|
@ -744,10 +761,10 @@ declare_proto_rig(get_mode)
|
||||||
status = rig_get_mode(rig, vfo, &mode, &width);
|
status = rig_get_mode(rig, vfo, &mode, &width);
|
||||||
if (status != RIG_OK)
|
if (status != RIG_OK)
|
||||||
return status;
|
return status;
|
||||||
if ((interactive && prompt) || (interactive && !prompt && opt_block))
|
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||||
fprintf(fout, "%s: ", cmd->arg1);
|
fprintf(fout, "%s: ", cmd->arg1);
|
||||||
fprintf(fout, "%s\n", rig_strrmode(mode));
|
fprintf(fout, "%s\n", rig_strrmode(mode));
|
||||||
if ((interactive && prompt) || (interactive && !prompt && opt_block))
|
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||||
fprintf(fout, "%s: ", cmd->arg2);
|
fprintf(fout, "%s: ", cmd->arg2);
|
||||||
fprintf(fout, "%ld\n", width);
|
fprintf(fout, "%ld\n", width);
|
||||||
|
|
||||||
|
@ -768,7 +785,7 @@ declare_proto_rig(get_vfo)
|
||||||
status = rig_get_vfo(rig, &vfo);
|
status = rig_get_vfo(rig, &vfo);
|
||||||
if (status != RIG_OK)
|
if (status != RIG_OK)
|
||||||
return status;
|
return status;
|
||||||
if ((interactive && prompt) || (interactive && !prompt && opt_block))
|
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||||
fprintf(fout, "%s: ", cmd->arg1);
|
fprintf(fout, "%s: ", cmd->arg1);
|
||||||
fprintf(fout, "%s\n", rig_strvfo(vfo));
|
fprintf(fout, "%s\n", rig_strvfo(vfo));
|
||||||
|
|
||||||
|
@ -793,7 +810,7 @@ declare_proto_rig(get_ptt)
|
||||||
status = rig_get_ptt(rig, vfo, &ptt);
|
status = rig_get_ptt(rig, vfo, &ptt);
|
||||||
if (status != RIG_OK)
|
if (status != RIG_OK)
|
||||||
return status;
|
return status;
|
||||||
if ((interactive && prompt) || (interactive && !prompt && opt_block))
|
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||||
fprintf(fout, "%s: ", cmd->arg1);
|
fprintf(fout, "%s: ", cmd->arg1);
|
||||||
fprintf(fout, "%d\n", ptt);
|
fprintf(fout, "%d\n", ptt);
|
||||||
|
|
||||||
|
@ -809,7 +826,7 @@ declare_proto_rig(get_dcd)
|
||||||
status = rig_get_dcd(rig, vfo, &dcd);
|
status = rig_get_dcd(rig, vfo, &dcd);
|
||||||
if (status != RIG_OK)
|
if (status != RIG_OK)
|
||||||
return status;
|
return status;
|
||||||
if ((interactive && prompt) || (interactive && !prompt && opt_block))
|
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||||
fprintf(fout, "%s: ", cmd->arg1);
|
fprintf(fout, "%s: ", cmd->arg1);
|
||||||
fprintf(fout, "%d\n", dcd);
|
fprintf(fout, "%d\n", dcd);
|
||||||
|
|
||||||
|
@ -834,7 +851,7 @@ declare_proto_rig(get_rptr_shift)
|
||||||
status = rig_get_rptr_shift(rig, vfo, &rptr_shift);
|
status = rig_get_rptr_shift(rig, vfo, &rptr_shift);
|
||||||
if (status != RIG_OK)
|
if (status != RIG_OK)
|
||||||
return status;
|
return status;
|
||||||
if ((interactive && prompt) || (interactive && !prompt && opt_block))
|
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||||
fprintf(fout, "%s: ", cmd->arg1);
|
fprintf(fout, "%s: ", cmd->arg1);
|
||||||
fprintf(fout, "%s\n", rig_strptrshift(rptr_shift));
|
fprintf(fout, "%s\n", rig_strptrshift(rptr_shift));
|
||||||
|
|
||||||
|
@ -859,7 +876,7 @@ declare_proto_rig(get_rptr_offs)
|
||||||
status = rig_get_rptr_offs(rig, vfo, &rptr_offs);
|
status = rig_get_rptr_offs(rig, vfo, &rptr_offs);
|
||||||
if (status != RIG_OK)
|
if (status != RIG_OK)
|
||||||
return status;
|
return status;
|
||||||
if ((interactive && prompt) || (interactive && !prompt && opt_block))
|
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||||
fprintf(fout, "%s: ", cmd->arg1);
|
fprintf(fout, "%s: ", cmd->arg1);
|
||||||
fprintf(fout, "%ld\n", rptr_offs);
|
fprintf(fout, "%ld\n", rptr_offs);
|
||||||
|
|
||||||
|
@ -884,7 +901,7 @@ declare_proto_rig(get_ctcss_tone)
|
||||||
status = rig_get_ctcss_tone(rig, vfo, &tone);
|
status = rig_get_ctcss_tone(rig, vfo, &tone);
|
||||||
if (status != RIG_OK)
|
if (status != RIG_OK)
|
||||||
return status;
|
return status;
|
||||||
if ((interactive && prompt) || (interactive && !prompt && opt_block))
|
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||||
fprintf(fout, "%s: ", cmd->arg1);
|
fprintf(fout, "%s: ", cmd->arg1);
|
||||||
fprintf(fout, "%d\n", tone);
|
fprintf(fout, "%d\n", tone);
|
||||||
|
|
||||||
|
@ -909,7 +926,7 @@ declare_proto_rig(get_dcs_code)
|
||||||
status = rig_get_dcs_code(rig, vfo, &code);
|
status = rig_get_dcs_code(rig, vfo, &code);
|
||||||
if (status != RIG_OK)
|
if (status != RIG_OK)
|
||||||
return status;
|
return status;
|
||||||
if ((interactive && prompt) || (interactive && !prompt && opt_block))
|
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||||
fprintf(fout, "%s: ", cmd->arg1);
|
fprintf(fout, "%s: ", cmd->arg1);
|
||||||
fprintf(fout, "%d\n", code);
|
fprintf(fout, "%d\n", code);
|
||||||
|
|
||||||
|
@ -934,7 +951,7 @@ declare_proto_rig(get_ctcss_sql)
|
||||||
status = rig_get_ctcss_sql(rig, vfo, &tone);
|
status = rig_get_ctcss_sql(rig, vfo, &tone);
|
||||||
if (status != RIG_OK)
|
if (status != RIG_OK)
|
||||||
return status;
|
return status;
|
||||||
if ((interactive && prompt) || (interactive && !prompt && opt_block))
|
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||||
fprintf(fout, "%s: ", cmd->arg1);
|
fprintf(fout, "%s: ", cmd->arg1);
|
||||||
fprintf(fout, "%d\n", tone);
|
fprintf(fout, "%d\n", tone);
|
||||||
|
|
||||||
|
@ -959,7 +976,7 @@ declare_proto_rig(get_dcs_sql)
|
||||||
status = rig_get_dcs_sql(rig, vfo, &code);
|
status = rig_get_dcs_sql(rig, vfo, &code);
|
||||||
if (status != RIG_OK)
|
if (status != RIG_OK)
|
||||||
return status;
|
return status;
|
||||||
if ((interactive && prompt) || (interactive && !prompt && opt_block))
|
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||||
fprintf(fout, "%s: ", cmd->arg1);
|
fprintf(fout, "%s: ", cmd->arg1);
|
||||||
fprintf(fout, "%d\n", code);
|
fprintf(fout, "%d\n", code);
|
||||||
|
|
||||||
|
@ -986,7 +1003,7 @@ declare_proto_rig(get_split_freq)
|
||||||
status = rig_get_split_freq(rig, txvfo, &txfreq);
|
status = rig_get_split_freq(rig, txvfo, &txfreq);
|
||||||
if (status != RIG_OK)
|
if (status != RIG_OK)
|
||||||
return status;
|
return status;
|
||||||
if ((interactive && prompt) || (interactive && !prompt && opt_block))
|
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||||
fprintf(fout, "%s: ", cmd->arg1);
|
fprintf(fout, "%s: ", cmd->arg1);
|
||||||
fprintf(fout, "%"PRIll"\n", (long long)txfreq);
|
fprintf(fout, "%"PRIll"\n", (long long)txfreq);
|
||||||
|
|
||||||
|
@ -1024,10 +1041,10 @@ declare_proto_rig(get_split_mode)
|
||||||
status = rig_get_split_mode(rig, txvfo, &mode, &width);
|
status = rig_get_split_mode(rig, txvfo, &mode, &width);
|
||||||
if (status != RIG_OK)
|
if (status != RIG_OK)
|
||||||
return status;
|
return status;
|
||||||
if ((interactive && prompt) || (interactive && !prompt && opt_block))
|
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||||
fprintf(fout, "%s: ", cmd->arg1);
|
fprintf(fout, "%s: ", cmd->arg1);
|
||||||
fprintf(fout, "%s\n", rig_strrmode(mode));
|
fprintf(fout, "%s\n", rig_strrmode(mode));
|
||||||
if ((interactive && prompt) || (interactive && !prompt && opt_block))
|
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||||
fprintf(fout, "%s: ", cmd->arg2);
|
fprintf(fout, "%s: ", cmd->arg2);
|
||||||
fprintf(fout, "%ld\n", width);
|
fprintf(fout, "%ld\n", width);
|
||||||
|
|
||||||
|
@ -1053,10 +1070,10 @@ declare_proto_rig(get_split_vfo)
|
||||||
status = rig_get_split_vfo(rig, vfo, &split, &tx_vfo);
|
status = rig_get_split_vfo(rig, vfo, &split, &tx_vfo);
|
||||||
if (status != RIG_OK)
|
if (status != RIG_OK)
|
||||||
return status;
|
return status;
|
||||||
if ((interactive && prompt) || (interactive && !prompt && opt_block))
|
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||||
fprintf(fout, "%s: ", cmd->arg1);
|
fprintf(fout, "%s: ", cmd->arg1);
|
||||||
fprintf(fout, "%d\n", split);
|
fprintf(fout, "%d\n", split);
|
||||||
if ((interactive && prompt) || (interactive && !prompt && opt_block))
|
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||||
fprintf(fout, "%s: ", cmd->arg2);
|
fprintf(fout, "%s: ", cmd->arg2);
|
||||||
fprintf(fout, "%s\n", rig_strvfo(tx_vfo));
|
fprintf(fout, "%s\n", rig_strvfo(tx_vfo));
|
||||||
|
|
||||||
|
@ -1081,7 +1098,7 @@ declare_proto_rig(get_ts)
|
||||||
status = rig_get_ts(rig, vfo, &ts);
|
status = rig_get_ts(rig, vfo, &ts);
|
||||||
if (status != RIG_OK)
|
if (status != RIG_OK)
|
||||||
return status;
|
return status;
|
||||||
if ((interactive && prompt) || (interactive && !prompt && opt_block))
|
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||||
fprintf(fout, "%s: ", cmd->arg1);
|
fprintf(fout, "%s: ", cmd->arg1);
|
||||||
fprintf(fout, "%ld\n", ts);
|
fprintf(fout, "%ld\n", ts);
|
||||||
|
|
||||||
|
@ -1104,7 +1121,7 @@ declare_proto_rig(power2mW)
|
||||||
status = rig_power2mW(rig, &mwp, power, freq, mode);
|
status = rig_power2mW(rig, &mwp, power, freq, mode);
|
||||||
if (status != RIG_OK)
|
if (status != RIG_OK)
|
||||||
return status;
|
return status;
|
||||||
if ((interactive && prompt) || (interactive && !prompt && opt_block))
|
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||||
fprintf(fout, "%s: ", cmd->arg4);
|
fprintf(fout, "%s: ", cmd->arg4);
|
||||||
fprintf(fout, "%i\n", mwp);
|
fprintf(fout, "%i\n", mwp);
|
||||||
|
|
||||||
|
@ -1127,7 +1144,7 @@ declare_proto_rig(mW2power)
|
||||||
status = rig_mW2power(rig, &power, mwp, freq, mode);
|
status = rig_mW2power(rig, &power, mwp, freq, mode);
|
||||||
if (status != RIG_OK)
|
if (status != RIG_OK)
|
||||||
return status;
|
return status;
|
||||||
if ((interactive && prompt) || (interactive && !prompt && opt_block))
|
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||||
fprintf(fout, "%s: ", cmd->arg4);
|
fprintf(fout, "%s: ", cmd->arg4);
|
||||||
fprintf(fout, "%f\n", power);
|
fprintf(fout, "%f\n", power);
|
||||||
|
|
||||||
|
@ -1436,7 +1453,7 @@ declare_proto_rig(get_mem)
|
||||||
status = rig_get_mem(rig, vfo, &ch);
|
status = rig_get_mem(rig, vfo, &ch);
|
||||||
if (status != RIG_OK)
|
if (status != RIG_OK)
|
||||||
return status;
|
return status;
|
||||||
if ((interactive && prompt) || (interactive && !prompt && opt_block))
|
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||||
fprintf(fout, "%s: ", cmd->arg1);
|
fprintf(fout, "%s: ", cmd->arg1);
|
||||||
fprintf(fout, "%d\n", ch);
|
fprintf(fout, "%d\n", ch);
|
||||||
|
|
||||||
|
@ -1722,7 +1739,7 @@ declare_proto_rig(get_trn)
|
||||||
status = rig_get_trn(rig, &trn);
|
status = rig_get_trn(rig, &trn);
|
||||||
if (status != RIG_OK)
|
if (status != RIG_OK)
|
||||||
return status;
|
return status;
|
||||||
if ((interactive && prompt) || (interactive && !prompt && opt_block))
|
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||||
fprintf(fout, "%s: ", cmd->arg1);
|
fprintf(fout, "%s: ", cmd->arg1);
|
||||||
fprintf(fout, "%d\n", trn);
|
fprintf(fout, "%d\n", trn);
|
||||||
|
|
||||||
|
@ -1735,7 +1752,7 @@ declare_proto_rig(get_info)
|
||||||
const char *s;
|
const char *s;
|
||||||
|
|
||||||
s = rig_get_info(rig);
|
s = rig_get_info(rig);
|
||||||
if ((interactive && prompt) || (interactive && !prompt && opt_block))
|
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||||
fprintf(fout, "%s: ", cmd->arg1);
|
fprintf(fout, "%s: ", cmd->arg1);
|
||||||
fprintf(fout, "%s\n", s ? s : "None");
|
fprintf(fout, "%s\n", s ? s : "None");
|
||||||
|
|
||||||
|
@ -1923,7 +1940,7 @@ declare_proto_rig(get_ant)
|
||||||
status = rig_get_ant(rig, vfo, &ant);
|
status = rig_get_ant(rig, vfo, &ant);
|
||||||
if (status != RIG_OK)
|
if (status != RIG_OK)
|
||||||
return status;
|
return status;
|
||||||
if ((interactive && prompt) || (interactive && !prompt && opt_block))
|
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||||
fprintf(fout, "%s: ", cmd->arg1);
|
fprintf(fout, "%s: ", cmd->arg1);
|
||||||
fprintf(fout, "%d\n", rig_setting2idx(ant));
|
fprintf(fout, "%d\n", rig_setting2idx(ant));
|
||||||
|
|
||||||
|
@ -1985,7 +2002,7 @@ declare_proto_rig(get_powerstat)
|
||||||
status = rig_get_powerstat(rig, &stat);
|
status = rig_get_powerstat(rig, &stat);
|
||||||
if (status != RIG_OK)
|
if (status != RIG_OK)
|
||||||
return status;
|
return status;
|
||||||
if ((interactive && prompt) || (interactive && !prompt && opt_block))
|
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||||
fprintf(fout, "%s: ", cmd->arg1);
|
fprintf(fout, "%s: ", cmd->arg1);
|
||||||
fprintf(fout, "%d\n", stat);
|
fprintf(fout, "%d\n", stat);
|
||||||
|
|
||||||
|
@ -2077,14 +2094,6 @@ declare_proto_rig(send_cmd)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* '0xf0'--test if rigctld called with -b|--block option */
|
|
||||||
declare_proto_rig(chk_blk)
|
|
||||||
{
|
|
||||||
fprintf(fout, "CHKBLK %d\n", opt_block);
|
|
||||||
|
|
||||||
return RIG_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* '0xf1'--test if rigctld called with -o|--vfo option */
|
/* '0xf1'--test if rigctld called with -o|--vfo option */
|
||||||
declare_proto_rig(chk_vfo)
|
declare_proto_rig(chk_vfo)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
.\" First parameter, NAME, should be all caps
|
.\" First parameter, NAME, should be all caps
|
||||||
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
||||||
.\" other parameters are allowed: see man(7), man(1)
|
.\" other parameters are allowed: see man(7), man(1)
|
||||||
.TH RIGCTLD "8" "February 3, 2010" "Hamlib" "Rig Control Daemon"
|
.TH RIGCTLD "8" "February 8, 2010" "Hamlib" "Rig Control Daemon"
|
||||||
.\" Please adjust this date whenever revising the manpage.
|
.\" Please adjust this date whenever revising the manpage.
|
||||||
.\"
|
.\"
|
||||||
.\" Some roff macros, for reference:
|
.\" Some roff macros, for reference:
|
||||||
|
@ -16,23 +16,24 @@
|
||||||
.\" .sp <n> insert n+1 empty lines
|
.\" .sp <n> insert n+1 empty lines
|
||||||
.\" for manpage-specific macros, see man(7)
|
.\" for manpage-specific macros, see man(7)
|
||||||
.SH NAME
|
.SH NAME
|
||||||
rigctld \- Hamlib rig control daemon
|
rigctld \- Hamlib TCP rig control daemon
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B rigctld
|
.B rigctld
|
||||||
[\fIOPTION\fR]...
|
[\fIOPTION\fR]...
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
The \fBrigctld\fP program is an EXPERIMENTAL \fBHamlib\fP rig control daemon
|
The \fBrigctld\fP program is a NEW \fBHamlib\fP rig control daemon ready for testing
|
||||||
that handles TCP client requests. This allows multiple user programs to share
|
that handles client requests via TCP sockets. This allows multiple user programs to
|
||||||
one radio. Multiple radios can be controlled on different TCP ports by use of
|
share one radio (this needs testing). Multiple radios can be controlled
|
||||||
multiple \fBrigctld\fP processes. The syntax of the commands are the same as
|
on different TCP ports by use of multiple \fBrigctld\fP processes. The syntax of the
|
||||||
\fBrigctl\fP. It is hoped that \fBrigctld\fP will be especially useful for
|
commands are the same as \fBrigctl\fP. It is hoped that \fBrigctld\fP will be
|
||||||
languages such as Perl, Python, PHP, and others.
|
especially useful for client authors using languages such as Perl, Python, PHP,
|
||||||
|
and others.
|
||||||
.PP
|
.PP
|
||||||
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
|
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
|
||||||
.\" \fI<whatever>\fP escape sequences to invoke bold face and italics,
|
.\" \fI<whatever>\fP escape sequences to invoke bold face and italics,
|
||||||
.\" respectively.
|
.\" respectively.
|
||||||
\fBrigctld\fP communicates to a client through a TCP socket using text
|
\fBrigctld\fP communicates to a client through a TCP socket using text
|
||||||
commands shared with \fBrigctl\fP. The protocol is simple, commands are sent
|
commands shared with \fBrigctl\fP. The protocol is simple; commands are sent
|
||||||
to \fBrigctld\fP on one line and \fBrigctld\fP responds to "get" commands with
|
to \fBrigctld\fP on one line and \fBrigctld\fP responds to "get" commands with
|
||||||
the requested values, one per line, when successful, otherwise, it responds
|
the requested values, one per line, when successful, otherwise, it responds
|
||||||
with one line "RPTR x", where x is a negative number indicating the error code.
|
with one line "RPTR x", where x is a negative number indicating the error code.
|
||||||
|
@ -40,24 +41,22 @@ Commands that do not return values respond with the line "RPTR x", where x
|
||||||
is zero when successful, otherwise is a regative number indicating the error code.
|
is zero when successful, otherwise is a regative number indicating the error code.
|
||||||
Each line is terminated with a newline '\\n' character.
|
Each line is terminated with a newline '\\n' character.
|
||||||
.PP
|
.PP
|
||||||
A separate \fBblock\fP protocol (-b, or --block option) extends the above
|
A separate \fBExtended Response\fP protocol extends the above
|
||||||
behavior by echoing the received command string as a header, any returned values
|
behavior by echoing the received command string as a header, any returned values
|
||||||
as a key: value pair, and the "RPTR x" string as the end of block marker which
|
as a key: value pair, and the "RPTR x" string as the end of response marker which
|
||||||
includes the \fBHamlib\fP success or failure value. See the \fIPROTOCOL\fP
|
includes the \fBHamlib\fP success or failure value. See the \fIPROTOCOL\fP
|
||||||
section for details.
|
section for details.
|
||||||
.PP
|
.PP
|
||||||
Keep in mind that \fBHamlib\fP is BETA level software.
|
Keep in mind that \fBHamlib\fP is BETA level software.
|
||||||
While a lot of backend libraries lack complete rig support, the basic functions
|
While a lot of backend libraries lack complete rig support, the basic functions
|
||||||
are usually well supported. The API may change without publicized notice,
|
are usually well supported.
|
||||||
while an advancement of the minor version (e.g. 1.1.x to 1.2.x) indicates such
|
|
||||||
a change.
|
|
||||||
.PP
|
.PP
|
||||||
Please report bugs and provide feedback at the e-mail address given in the
|
Please report bugs and provide feedback at the e-mail address given in the
|
||||||
REPORTING BUGS section. Patches and code enhancements are also welcome.
|
\fIREPORTING BUGS\fP section. Patches and code enhancements are also welcome.
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
This program follows the usual GNU command line syntax, with long
|
This program follows the usual GNU command line syntax, with long
|
||||||
options starting with two dashes ('-').
|
options starting with two dashes ('-').
|
||||||
|
.PP
|
||||||
Here is a summary of the supported options:
|
Here is a summary of the supported options:
|
||||||
.TP
|
.TP
|
||||||
.B \-m, --model=id
|
.B \-m, --model=id
|
||||||
|
@ -92,7 +91,7 @@ backend capabilities (set by -m above) as the default.
|
||||||
Use \fIid\fP as the CI-V address to communicate with the rig. Only useful for
|
Use \fIid\fP as the CI-V address to communicate with the rig. Only useful for
|
||||||
Icom rigs.
|
Icom rigs.
|
||||||
.br
|
.br
|
||||||
N.B.: The \fIid\fP is in decimal notation, unless prefixed by
|
\fBN.B.\fP: The \fIid\fP is in decimal notation, unless prefixed by
|
||||||
\fI0x\fP for a hexadecimal value.
|
\fI0x\fP for a hexadecimal value.
|
||||||
.TP
|
.TP
|
||||||
.B \-T, --listen-addr=IPADDR
|
.B \-T, --listen-addr=IPADDR
|
||||||
|
@ -100,6 +99,9 @@ Use \fIIPADDR\fP as the listening IP address. The default is ANY.
|
||||||
.TP
|
.TP
|
||||||
.B \-t, --port=number
|
.B \-t, --port=number
|
||||||
Use \fInumber\fP as the TCP listening port. The default is 4532.
|
Use \fInumber\fP as the TCP listening port. The default is 4532.
|
||||||
|
.br
|
||||||
|
\fBN.B.\fP: As \fBrotctld\fP's default port is 4533, it is advisable to use even
|
||||||
|
numbered ports for \fBrigctld\fP, e.g. 4532, 4534, 4536, etc.
|
||||||
.TP
|
.TP
|
||||||
.B \-C, --set-conf=parm=val[,parm=val]*
|
.B \-C, --set-conf=parm=val[,parm=val]*
|
||||||
Set config parameter. e.g. --set-conf=stop_bits=2
|
Set config parameter. e.g. --set-conf=stop_bits=2
|
||||||
|
@ -121,14 +123,12 @@ command (except \fI\\set_vfo\fP!). Otherwise, 'currVFO' is assumed when this
|
||||||
option is not set and an extra VFO argument is not used. See \fI\\chk_vfo\fP
|
option is not set and an extra VFO argument is not used. See \fI\\chk_vfo\fP
|
||||||
below.
|
below.
|
||||||
.TP
|
.TP
|
||||||
.B \-b, --block
|
|
||||||
Use the block rigctld protocol. See \fI\\chk_blk\fP below. \fIEXPERIMENTAL\fP
|
|
||||||
.TP
|
|
||||||
.B \-e, --end-marker
|
.B \-e, --end-marker
|
||||||
Use END marker in rigctld protocol.
|
Use END marker in rigctld protocol.
|
||||||
.br
|
.br
|
||||||
N.B.: This option can be considered obsolete. Please consider using the block
|
\fBN.B.\fP: This option can be considered obsolete. Please consider using the Extended
|
||||||
protocol instead (see \fIPROTOCOL\fP below).
|
Response protocol instead (see \fIPROTOCOL\fP below). This option will be removed
|
||||||
|
in a future Hamlib release.
|
||||||
.TP
|
.TP
|
||||||
.B \-v, --verbose
|
.B \-v, --verbose
|
||||||
Set verbose mode, cumulative (see \fIDIAGNOSTICS\fP below).
|
Set verbose mode, cumulative (see \fIDIAGNOSTICS\fP below).
|
||||||
|
@ -157,10 +157,12 @@ corresponding lower case letter refers to the \fIget\fP method. Each operation
|
||||||
also has a long name, prepend a backslash to send a long command name.
|
also has a long name, prepend a backslash to send a long command name.
|
||||||
.PP
|
.PP
|
||||||
Example (Perl): `print $socket "\\\\dump_caps\\n";' to see what the radio's
|
Example (Perl): `print $socket "\\\\dump_caps\\n";' to see what the radio's
|
||||||
backend can do (NOTE: In Perl and many other languages a '\\' will need to be
|
backend can do
|
||||||
|
.br
|
||||||
|
(\fBN.B.\fP: In Perl and many other languages a '\\' will need to be
|
||||||
escaped with a preceding '\\' so that even though two backslash characters
|
escaped with a preceding '\\' so that even though two backslash characters
|
||||||
appear in the code, only one will be passed to \fBrigctld\fP. This is a
|
appear in the code, only one will be passed to \fBrigctld\fP. This is a
|
||||||
possible bug!).
|
possible bug, beware!).
|
||||||
.PP
|
.PP
|
||||||
Please note that the backend for the radio to be controlled, or the radio itself
|
Please note that the backend for the radio to be controlled, or the radio itself
|
||||||
may not support some commands. In that case, the operation will fail with a
|
may not support some commands. In that case, the operation will fail with a
|
||||||
|
@ -404,6 +406,10 @@ backend knows about this model, and what it can do. TODO: Ensure this is
|
||||||
in a consistent format so it can be read into a hash, dictionary, etc. Bug
|
in a consistent format so it can be read into a hash, dictionary, etc. Bug
|
||||||
reports requested.
|
reports requested.
|
||||||
.br
|
.br
|
||||||
|
\fBN.B.\fP: This command will produce many lines of output so be very careful
|
||||||
|
if using a fixed length array! For example, running this command against these
|
||||||
|
Dummy backend results in over 5kB of text output.
|
||||||
|
.br
|
||||||
VFO parameter not used in 'VFO mode'.
|
VFO parameter not used in 'VFO mode'.
|
||||||
.TP
|
.TP
|
||||||
.B 2, power2mW 'Power [0.0..1.0]' 'Frequency' 'Mode'
|
.B 2, power2mW 'Power [0.0..1.0]' 'Frequency' 'Mode'
|
||||||
|
@ -430,16 +436,11 @@ Send raw command string to rig.
|
||||||
For binary protocols enter values as \\0xAA\\0xBB. Expect a 'Reply' from the
|
For binary protocols enter values as \\0xAA\\0xBB. Expect a 'Reply' from the
|
||||||
rig which will likely be a binary block or an ASCII string.
|
rig which will likely be a binary block or an ASCII string.
|
||||||
.TP
|
.TP
|
||||||
.B chk_blk
|
|
||||||
Returns "CHKBLK 1\\n" (single line only) if \fBrigctld\fP was invoked with the
|
|
||||||
\fI-b\fP or \fI--block\fP option, "CHKBLK 0\\n" if not.
|
|
||||||
.br
|
|
||||||
.TP
|
|
||||||
.B chk_vfo
|
.B chk_vfo
|
||||||
Returns "CHKVFO 1\\n" (single line only) if \fBrigctld\fP was invoked with the
|
Returns "CHKVFO 1\\n" (single line only) if \fBrigctld\fP was invoked with the
|
||||||
\fI-o\fP or \fI--vfo\fP option, "CHKVFO 0\\n" if not.
|
\fI-o\fP or \fI--vfo\fP option, "CHKVFO 0\\n" if not.
|
||||||
.br
|
.br
|
||||||
When in VFO mode client will need to pass 'VFO' as the first parameter to
|
When in VFO mode the client will need to pass 'VFO' as the first parameter to
|
||||||
\fI\\set\fP or \fI\\get\fP commands. 'VFO' is one of the strings defined
|
\fI\\set\fP or \fI\\get\fP commands. 'VFO' is one of the strings defined
|
||||||
for \fI\\set_vfo\fP above.
|
for \fI\\set_vfo\fP above.
|
||||||
.br
|
.br
|
||||||
|
@ -471,15 +472,17 @@ the \fI\\dump_caps\fP function which returns many lines of key:value pairs.
|
||||||
Future work will focus on making this output compatible with assignment to a
|
Future work will focus on making this output compatible with assignment to a
|
||||||
hash, dictionary, or other key:value variable.
|
hash, dictionary, or other key:value variable.
|
||||||
.PP
|
.PP
|
||||||
\fBBlock Protocol\fP
|
\fBExtended Response Protocol\fP
|
||||||
.br
|
.br
|
||||||
An \fIEXPERIMENTAL\fP Block protocol has been introduced into \fBrigctld\fP
|
An \fIEXPERIMENTAL\fP Extended Response protocol has been introduced into
|
||||||
as of January 24, 2010. This protocol adds several rules to the strings
|
\fBrigctld\fP as of February 8, 2010. This protocol is invoked by prepending
|
||||||
returned by \fBrigctld\fP.
|
a '+' character immediately ahead of the command string with no intervening
|
||||||
|
space. Also, several rules are added to the strings returned by \fBrigctld\fP.
|
||||||
.PP
|
.PP
|
||||||
1. The command received by \fBrigctld\fP is echoed with its long command name
|
1. The command received by \fBrigctld\fP is echoed with its long command name
|
||||||
followed by the value(s) received from the client terminated by a newline
|
followed by the value(s) received from the client terminated by a newline
|
||||||
as the first line of the block.
|
as the first line of the block. The leading '+' and '\\' characters are not
|
||||||
|
included in the echoed command string.
|
||||||
.PP
|
.PP
|
||||||
2. The last line of each block is the string "RPTR \fIx\fP\\n" wheren \fIx\fP is
|
2. The last line of each block is the string "RPTR \fIx\fP\\n" wheren \fIx\fP is
|
||||||
the numeric return value of the Hamlib backend function that was called by the
|
the numeric return value of the Hamlib backend function that was called by the
|
||||||
|
@ -495,6 +498,8 @@ returned to the client.
|
||||||
.PP
|
.PP
|
||||||
An example response to a \fI\\set_mode\fP command:
|
An example response to a \fI\\set_mode\fP command:
|
||||||
.br
|
.br
|
||||||
|
$ echo "+F USB 2400" | nc -w 1 localhost 4532
|
||||||
|
.br
|
||||||
set_mode: USB 2400
|
set_mode: USB 2400
|
||||||
.br
|
.br
|
||||||
RPRT 0
|
RPRT 0
|
||||||
|
@ -505,9 +510,11 @@ return value indicating success.
|
||||||
.PP
|
.PP
|
||||||
An example response to a \fI\\get_mode\fP query:
|
An example response to a \fI\\get_mode\fP query:
|
||||||
.br
|
.br
|
||||||
|
$ echo "+\\get_mode" | nc -w 1 localhost 4532
|
||||||
|
.br
|
||||||
get_mode:
|
get_mode:
|
||||||
.br
|
.br
|
||||||
Mode: CW
|
Mode: USB
|
||||||
.br
|
.br
|
||||||
Passband: 2400
|
Passband: 2400
|
||||||
.br
|
.br
|
||||||
|
@ -517,8 +524,8 @@ In this case, as no value is passed to \fBrigctld\fP, the first line consists
|
||||||
only of the long command name. The final line shows that the command was
|
only of the long command name. The final line shows that the command was
|
||||||
processed successfully by the rig backend.
|
processed successfully by the rig backend.
|
||||||
.PP
|
.PP
|
||||||
The following commands have been tested with the Block protocol and the included
|
The following commands have been tested with the Extended Response protocol and the
|
||||||
\fBtestctld.pl\fP script:
|
included \fBtestctld.pl\fP script:
|
||||||
.br
|
.br
|
||||||
\fI\\set_freq\fP \fI\\get_freq\fP \fI\\set_split_freq\fP \fI\\get_split_freq\fP
|
\fI\\set_freq\fP \fI\\get_freq\fP \fI\\set_split_freq\fP \fI\\get_split_freq\fP
|
||||||
.br
|
.br
|
||||||
|
@ -542,12 +549,12 @@ backgrounding:
|
||||||
$ rigctld -m 114 -r /dev/ttyUSB1 &
|
$ rigctld -m 114 -r /dev/ttyUSB1 &
|
||||||
.PP
|
.PP
|
||||||
Start \fBrigctld\fP for a Yaesu FT-920 using a USB to serial adapter while
|
Start \fBrigctld\fP for a Yaesu FT-920 using a USB to serial adapter while
|
||||||
setting baud rate and stop bits, invoking block protocol, and backgrounding:
|
setting baud rate and stop bits, and backgrounding:
|
||||||
.PP
|
.PP
|
||||||
$ rigctld -m 114 -r /dev/ttyUSB1 -s 4800 -C stop_bits=2 --block &
|
$ rigctld -m 114 -r /dev/ttyUSB1 -s 4800 -C stop_bits=2 &
|
||||||
.PP
|
.PP
|
||||||
Connect to the already running \fBrigctld\fP, and set current frequency to
|
Connect to the already running \fBrigctld\fP, and set current frequency to
|
||||||
14.266 MHz with a 1 second read timeout:
|
14.266 MHz with a 1 second read timeout using the default protocol:
|
||||||
.PP
|
.PP
|
||||||
$ echo "\\set_freq 14266000" | nc -w 1 localhost 4532
|
$ echo "\\set_freq 14266000" | nc -w 1 localhost 4532
|
||||||
.SH DIAGNOSTICS
|
.SH DIAGNOSTICS
|
||||||
|
@ -564,6 +571,10 @@ library development and may be requested by the developers. See the
|
||||||
No authentication whatsoever; DO NOT leave this TCP port open wide to the
|
No authentication whatsoever; DO NOT leave this TCP port open wide to the
|
||||||
Internet. Please ask if stronger security is needed or consider using an
|
Internet. Please ask if stronger security is needed or consider using an
|
||||||
SSH tunnel.
|
SSH tunnel.
|
||||||
|
.PP
|
||||||
|
As \fBrigctld\fP does not need any greater permissions than \fBrigctl\fP, it
|
||||||
|
is advisable to not start \fBrigctld\fP as \fIroot\fP or another system user
|
||||||
|
account in order to limit any vulnerability.
|
||||||
.SH BUGS
|
.SH BUGS
|
||||||
The daemon is not detaching and backgrounding itself.
|
The daemon is not detaching and backgrounding itself.
|
||||||
.br
|
.br
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
* NB: do NOT use -W since it's reserved by POSIX.
|
* NB: do NOT use -W since it's reserved by POSIX.
|
||||||
* TODO: add an option to read from a file
|
* TODO: add an option to read from a file
|
||||||
*/
|
*/
|
||||||
#define SHORT_OPTIONS "m:r:p:d:P:D:s:c:T:t:C:lLuobevhV"
|
#define SHORT_OPTIONS "m:r:p:d:P:D:s:c:T:t:C:lLuoevhV"
|
||||||
static struct option long_options[] =
|
static struct option long_options[] =
|
||||||
{
|
{
|
||||||
{"model", 1, 0, 'm'},
|
{"model", 1, 0, 'm'},
|
||||||
|
@ -86,7 +86,6 @@ static struct option long_options[] =
|
||||||
{"show-conf",0, 0, 'L'},
|
{"show-conf",0, 0, 'L'},
|
||||||
{"dump-caps", 0, 0, 'u'},
|
{"dump-caps", 0, 0, 'u'},
|
||||||
{"vfo", 0, 0, 'o'},
|
{"vfo", 0, 0, 'o'},
|
||||||
{"block", 0, 0, 'b'},
|
|
||||||
{"end-marker", 0, 0, 'e'},
|
{"end-marker", 0, 0, 'e'},
|
||||||
{"verbose", 0, 0, 'v'},
|
{"verbose", 0, 0, 'v'},
|
||||||
{"help", 0, 0, 'h'},
|
{"help", 0, 0, 'h'},
|
||||||
|
@ -107,7 +106,6 @@ void usage(void);
|
||||||
int interactive = 1; /* no cmd because of daemon */
|
int interactive = 1; /* no cmd because of daemon */
|
||||||
int prompt = 0; /* Daemon mode for rigparse return string */
|
int prompt = 0; /* Daemon mode for rigparse return string */
|
||||||
int opt_end = 0; /* END marker for rigctld */
|
int opt_end = 0; /* END marker for rigctld */
|
||||||
int opt_block = 0; /* Block markers for rigctld */
|
|
||||||
int vfo_mode = 0; /* vfo_mode=0 means target VFO is current VFO */
|
int vfo_mode = 0; /* vfo_mode=0 means target VFO is current VFO */
|
||||||
|
|
||||||
char send_cmd_term = '\r'; /* send_cmd termination char */
|
char send_cmd_term = '\r'; /* send_cmd termination char */
|
||||||
|
@ -279,10 +277,7 @@ int main (int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
case 'e':
|
case 'e':
|
||||||
opt_end++;
|
opt_end++;
|
||||||
fprintf(stderr, "-e|--end-marker option is deprecated. Please consider -b|--block instead.\n");
|
fprintf(stderr, "-e|--end-marker option is deprecated!\nPlease consider using the Extended Response protocol instead.\n");
|
||||||
break;
|
|
||||||
case 'b':
|
|
||||||
opt_block++;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
usage(); /* unknown option? */
|
usage(); /* unknown option? */
|
||||||
|
@ -518,8 +513,7 @@ void usage(void)
|
||||||
" -l, --list list all model numbers and exit\n"
|
" -l, --list list all model numbers and exit\n"
|
||||||
" -u, --dump-caps dump capabilities and exit\n"
|
" -u, --dump-caps dump capabilities and exit\n"
|
||||||
" -o, --vfo do not default to VFO_CURR, require extra vfo arg\n"
|
" -o, --vfo do not default to VFO_CURR, require extra vfo arg\n"
|
||||||
" -b, --block use block rigctld protocol\n",
|
" -e, --end-marker use END marker in rigctld protocol (obsolete)\n"
|
||||||
" -e, --end-marker use END marker in rigctld protocol\n"
|
|
||||||
" -v, --verbose set verbose mode, cumulative\n"
|
" -v, --verbose set verbose mode, cumulative\n"
|
||||||
" -h, --help display this help and exit\n"
|
" -h, --help display this help and exit\n"
|
||||||
" -V, --version output version information and exit\n\n",
|
" -V, --version output version information and exit\n\n",
|
||||||
|
|
Ładowanie…
Reference in New Issue