kopia lustrzana https://github.com/Hamlib/Hamlib
Implement and document rigctld protocol and provide a compatible test.
git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2283 7ae35d74-ebe9-4afe-98af-79ac388436b8Hamlib-1.2.7
rodzic
adfe95dedf
commit
c649181f37
|
@ -61,11 +61,11 @@ device file as described above.
|
|||
Use \fIdevice\fP as the file name of the Data Carrier Detect device using a
|
||||
device file as described above.
|
||||
.TP
|
||||
.B \-p, --ptt-type=type
|
||||
.B \-P, --ptt-type=type
|
||||
Use \fItype\fP of Push-To-Talk device.
|
||||
Supported types are RIG, DTR, RTS, PARALLEL, NONE.
|
||||
.TP
|
||||
.B \-d, --dcd-type=type
|
||||
.B \-D, --dcd-type=type
|
||||
Use \fItype\fP of Data Carrier Detect device.
|
||||
Supported types are RIG, DSR, CTS, CD, PARALLEL, NONE.
|
||||
.TP
|
||||
|
@ -107,9 +107,13 @@ Show summary of these options and exit.
|
|||
.B \-V, --version
|
||||
Show version of \fBrigctl\fP and exit.
|
||||
.PP
|
||||
\fBNOTE!\fP Some options may not be implemented by a given backend and will
|
||||
\fBN.B.\fP Some options may not be implemented by a given backend and will
|
||||
return an error. This is most likely to occur with the \fI\-\-set-conf\fP
|
||||
and \fI\-\-show-conf\fP options.
|
||||
.pp
|
||||
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 \fBHamlib\fP error code.
|
||||
.SH COMMANDS
|
||||
Commands can be entered either as a single char, or as a long command name.
|
||||
Basically, the commands do not take a dash in front of them on the command
|
||||
|
@ -137,7 +141,7 @@ Get frequency, in Hz.
|
|||
.TP
|
||||
.B M, set_mode
|
||||
Set mode/passband: AM, FM, CW, CWR, USB, LSB, RTTY, RTTYR, WFM, AMS,
|
||||
PKTLSB, PKTUSB, PKTFM, ECSSUSB, ECSSLSB, FAX.
|
||||
PKTLSB, PKTUSB, PKTFM, ECSSUSB, ECSSLSB, FAX, SAM, SAL, SAH, DSB.
|
||||
|
||||
The passband is the exact passband in Hz, or 0 for the default.
|
||||
.TP
|
||||
|
@ -145,7 +149,7 @@ The passband is the exact passband in Hz, or 0 for the default.
|
|||
Get mode/passband.
|
||||
.TP
|
||||
.B V, set_vfo
|
||||
Set VFO: VFOA, VFOB, VFOC, VFO, MEM, Main, Sub, etc.
|
||||
Set VFO: VFOA, VFOB, VFOC, currVFO, VFO, MEM, Main, Sub, TX, RX.
|
||||
.TP
|
||||
.B v, get_vfo
|
||||
Get current VFO.
|
||||
|
@ -200,7 +204,7 @@ Get TX frequency.
|
|||
.TP
|
||||
.B X, set_split_mode
|
||||
Set transmit mode/passband: AM, FM, CW, CWR, USB, LSB, RTTY, RTTYR, WFM, AMS,
|
||||
PKTLSB, PKTUSB, PKTFM, ECSSUSB, ECSSLSB, FAX.
|
||||
PKTLSB, PKTUSB, PKTFM, ECSSUSB, ECSSLSB, FAX, SAM, SAL, SAH, DSB.
|
||||
|
||||
The passband is the exact passband in Hz, or 0 for the default.
|
||||
.TP
|
||||
|
@ -221,25 +225,25 @@ Get tuning step.
|
|||
.TP
|
||||
.B U, set_func
|
||||
Set func/status:
|
||||
FAGC, NB, COMP, VOX, TONE, TSQL, SBKIN, FBKIN, ANF, NR, AIP, MON, MN,
|
||||
RNF, ARO, LOCK, MUTE, VSC, REV, SQL, BC, MBC, AFC, SATMODE, SCOPE, RESUME, TUNER.
|
||||
FAGC, NB, COMP, VOX, TONE, TSQL, SBKIN, FBKIN, ANF, NR, AIP, APF, MON, MN,
|
||||
RF, ARO, LOCK, MUTE, VSC, REV, SQL, ABM, BC, MBC, AFC, SATMODE, SCOPE,
|
||||
RESUME, TBURST, TUNER.
|
||||
.TP
|
||||
.B u, get_func
|
||||
Get func status.
|
||||
.TP
|
||||
.B L, set_level
|
||||
Set level/value:
|
||||
PREAMP, ATT, VOX, AF, RF, SQL, IF, APF, NR, PBT_IN,
|
||||
PBT_OUT, CWPITCH, RFPOWER, MICGAIN, KEYSPD, NOTCHF, COMP,
|
||||
AGC, BKINDL, BAL, METER, VOXGAIN, ANTIVOX. SLOPE_LOW, SLOPE_HIGH, Plus "extra" levels.
|
||||
PREAMP, ATT, VOX, AF, RF, SQL, IF, APF, NR, PBT_IN, PBT_OUT, CWPITCH, RFPOWER,
|
||||
MICGAIN, KEYSPD, NOTCHF, COMP, AGC, BKINDL, BAL, METER, VOXGAIN, ANTIVOX.
|
||||
SLOPE_LOW, SLOPE_HIGH, RAWSTR, SQLSTAT, SWR, ALC, STRENGTH.
|
||||
.TP
|
||||
.B l, get_level
|
||||
Get level value: also
|
||||
SWR, ALC, STRENGTH, RAWSTR, SLOPE_LOW, SLOPE_HIGH.
|
||||
Get level value.
|
||||
.TP
|
||||
.B P, set_parm
|
||||
Set parm/value:
|
||||
ANN, APO, BACKLIGHT, BEEP, TIME, BAT. Plus "extra" parameters.
|
||||
ANN, APO, BACKLIGHT, BEEP, TIME, BAT, KEYLIGHT.
|
||||
.TP
|
||||
.B p, get_parm
|
||||
Get parm value.
|
||||
|
@ -255,10 +259,11 @@ Get memory channel number.
|
|||
.TP
|
||||
.B G, vfo_op
|
||||
Perform VFO operation:
|
||||
CPY, XCHG, FROM_VFO, TO_VFO, MCL, UP, DOWN, BAND_UP, BAND_DOWN, LEFT, RIGHT, TUNER, TOGGLE.
|
||||
CPY, XCHG, FROM_VFO, TO_VFO, MCL, UP, DOWN, BAND_UP, BAND_DOWN, LEFT, RIGHT,
|
||||
TUNE, TOGGLE.
|
||||
.TP
|
||||
.B g, scan_op
|
||||
Perform scan operation/channel: STOP, MEM, SLCT, PRIO, DELTA, VFO, PLT.
|
||||
Perform scan operation/channel: STOP, MEM, SLCT, PRIO, PROG, DELTA, VFO, PLT.
|
||||
.TP
|
||||
.B H, set_channel
|
||||
Set memory channel data. Not implemented yet.
|
||||
|
@ -272,30 +277,31 @@ Set transceive mode (reporting event): OFF, RIG, POLL.
|
|||
.B a, get_trn
|
||||
Get transceive mode (reporting event).
|
||||
.TP
|
||||
.B set_ant
|
||||
.B Y, set_ant
|
||||
Set antenna number (0, 1, 2, ..).
|
||||
.TP
|
||||
.B get_ant
|
||||
.B y, get_ant
|
||||
Get antenna number (0, 1, 2, ..).
|
||||
.TP
|
||||
.B reset
|
||||
.B *, reset
|
||||
Reset.
|
||||
.TP
|
||||
.B send_morse
|
||||
.B b, send_morse
|
||||
Send morse symbols.
|
||||
.TP
|
||||
.B set_powerstat
|
||||
.B 0x87, set_powerstat
|
||||
Set power status.
|
||||
.TP
|
||||
.B get_powerstat
|
||||
.B 0x88, get_powerstat
|
||||
Get power status.
|
||||
.TP
|
||||
.B _, get_info
|
||||
Get misc information about the rig.
|
||||
.TP
|
||||
.B 1, dump_caps
|
||||
Not a real rig remote command, it just dumps capabilities,
|
||||
i.e. what the backend knows about this model, and what it can do.
|
||||
Not a real rig remote command, it just dumps capabilities, i.e. what the
|
||||
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.
|
||||
.TP
|
||||
.B 2, power2mW
|
||||
Converts a power value in a range of \fI0.0 ... 1.0\fP to the real transmit
|
||||
|
@ -303,7 +309,10 @@ power in milli-Watts. The \fIfrequency\fP and \fImode\fP also need to be
|
|||
provided as output power may vary according to these values.
|
||||
.TP
|
||||
.B w, send_cmd
|
||||
Send raw command string to rig. Binary protocols enter values as \\0xAA\\0xBB
|
||||
Send raw command string to rig.
|
||||
.br
|
||||
For binary protocols enter values as \\0xAA\\0xBB
|
||||
|
||||
.SH EXAMPLES
|
||||
Start \fBrigctl\fP for a Yaesu FT-920 using a USB to serial adapter in
|
||||
interactive mode:
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* It takes commands in interactive mode as well as
|
||||
* from command line options.
|
||||
*
|
||||
* $Id: rigctl.c,v 1.64 2008-01-05 18:13:12 fillods Exp $
|
||||
* $Id: rigctl.c,v 1.65 2008-01-10 03:42:35 n0nb Exp $
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -84,6 +84,7 @@ static struct option long_options[] =
|
|||
|
||||
int interactive=1; /* if no cmd on command line, switch to interactive */
|
||||
int prompt=1;
|
||||
int dmode = 0; /* no Daemon mode for rigparse return string in rigctl */
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* It takes commands in interactive mode as well as
|
||||
* from command line options.
|
||||
*
|
||||
* $Id: rigctl_parse.c,v 1.2 2008-01-05 18:13:12 fillods Exp $
|
||||
* $Id: rigctl_parse.c,v 1.3 2008-01-10 03:42:35 n0nb Exp $
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -257,7 +257,7 @@ static int scanfc(FILE *fin, const char *format, void *p)
|
|||
|
||||
extern int interactive;
|
||||
extern int prompt;
|
||||
|
||||
extern int dmode;
|
||||
|
||||
|
||||
int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc)
|
||||
|
@ -575,6 +575,7 @@ int set_conf(RIG *my_rig, char *conf_parms)
|
|||
* vfo_t vfo, const void *arg1, const void *arg2, const void *arg3)
|
||||
*/
|
||||
|
||||
/* 'F' */
|
||||
declare_proto_rig(set_freq)
|
||||
{
|
||||
freq_t freq;
|
||||
|
@ -583,6 +584,7 @@ declare_proto_rig(set_freq)
|
|||
return rig_set_freq(rig, vfo, freq);
|
||||
}
|
||||
|
||||
/* 'f' */
|
||||
declare_proto_rig(get_freq)
|
||||
{
|
||||
int status;
|
||||
|
@ -594,10 +596,15 @@ declare_proto_rig(get_freq)
|
|||
|
||||
if (interactive && prompt)
|
||||
fprintf(fout, "%s: ", cmd->arg1); /* i.e. "Frequency" */
|
||||
fprintf(fout, "%"PRIll"\n", (long long)freq);
|
||||
fprintf(fout, "%"PRIll"\n", (long long)freq);
|
||||
|
||||
if (interactive && dmode) /* only for rigctld */
|
||||
fprintf(fout, "END\n");
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/* 'J' */
|
||||
declare_proto_rig(set_rit)
|
||||
{
|
||||
shortfreq_t rit;
|
||||
|
@ -606,6 +613,7 @@ declare_proto_rig(set_rit)
|
|||
return rig_set_rit(rig, vfo, rit);
|
||||
}
|
||||
|
||||
/* 'j' */
|
||||
declare_proto_rig(get_rit)
|
||||
{
|
||||
int status;
|
||||
|
@ -617,9 +625,14 @@ declare_proto_rig(get_rit)
|
|||
if (interactive && prompt)
|
||||
fprintf(fout, "%s: ", cmd->arg1);
|
||||
fprintf(fout, "%ld\n", rit);
|
||||
|
||||
if (interactive && dmode) /* only for rigctld */
|
||||
printf(fout, "END\n");
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/* 'Z' */
|
||||
declare_proto_rig(set_xit)
|
||||
{
|
||||
shortfreq_t xit;
|
||||
|
@ -628,6 +641,7 @@ declare_proto_rig(set_xit)
|
|||
return rig_set_xit(rig, vfo, xit);
|
||||
}
|
||||
|
||||
/* 'z' */
|
||||
declare_proto_rig(get_xit)
|
||||
{
|
||||
int status;
|
||||
|
@ -639,10 +653,14 @@ declare_proto_rig(get_xit)
|
|||
if (interactive && prompt)
|
||||
fprintf(fout, "%s: ", cmd->arg1);
|
||||
fprintf(fout, "%ld\n", xit);
|
||||
|
||||
if (interactive && dmode) /* only for rigctld */
|
||||
fprintf(fout, "END\n");
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/* 'M' */
|
||||
declare_proto_rig(set_mode)
|
||||
{
|
||||
rmode_t mode;
|
||||
|
@ -653,7 +671,7 @@ declare_proto_rig(set_mode)
|
|||
return rig_set_mode(rig, vfo, mode, width);
|
||||
}
|
||||
|
||||
|
||||
/* 'm' */
|
||||
declare_proto_rig(get_mode)
|
||||
{
|
||||
int status;
|
||||
|
@ -669,16 +687,20 @@ declare_proto_rig(get_mode)
|
|||
if (interactive && prompt)
|
||||
fprintf(fout, "%s: ", cmd->arg2);
|
||||
fprintf(fout, "%ld\n", width);
|
||||
|
||||
if (interactive && dmode) /* only for rigctld */
|
||||
fprintf(fout, "END\n");
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/* 'V' */
|
||||
declare_proto_rig(set_vfo)
|
||||
{
|
||||
return rig_set_vfo(rig, rig_parse_vfo(arg1));
|
||||
}
|
||||
|
||||
|
||||
/* 'v' */
|
||||
declare_proto_rig(get_vfo)
|
||||
{
|
||||
int status;
|
||||
|
@ -689,10 +711,14 @@ declare_proto_rig(get_vfo)
|
|||
if (interactive && prompt)
|
||||
fprintf(fout, "%s: ", cmd->arg1);
|
||||
fprintf(fout, "%s\n", rig_strvfo(vfo));
|
||||
|
||||
if (interactive && dmode) /* only for rigctld */
|
||||
fprintf(fout, "END\n");
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/* 'T' */
|
||||
declare_proto_rig(set_ptt)
|
||||
{
|
||||
int ptt;
|
||||
|
@ -701,7 +727,7 @@ declare_proto_rig(set_ptt)
|
|||
return rig_set_ptt(rig, vfo, (ptt_t) ptt);
|
||||
}
|
||||
|
||||
|
||||
/* 't' */
|
||||
declare_proto_rig(get_ptt)
|
||||
{
|
||||
int status;
|
||||
|
@ -713,10 +739,14 @@ declare_proto_rig(get_ptt)
|
|||
if (interactive && prompt)
|
||||
fprintf(fout, "%s: ", cmd->arg1);
|
||||
fprintf(fout, "%d\n", ptt);
|
||||
|
||||
if (interactive && dmode) /* only for rigctld */
|
||||
fprintf(fout, "END\n");
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/* 'R' */
|
||||
declare_proto_rig(set_rptr_shift)
|
||||
{
|
||||
rptr_shift_t rptr_shift;
|
||||
|
@ -725,7 +755,7 @@ declare_proto_rig(set_rptr_shift)
|
|||
return rig_set_rptr_shift(rig, vfo, rptr_shift);
|
||||
}
|
||||
|
||||
|
||||
/* 'r' */
|
||||
declare_proto_rig(get_rptr_shift)
|
||||
{
|
||||
int status;
|
||||
|
@ -737,10 +767,14 @@ declare_proto_rig(get_rptr_shift)
|
|||
if (interactive && prompt)
|
||||
fprintf(fout, "%s: ", cmd->arg1);
|
||||
fprintf(fout, "%s\n", rig_strptrshift(rptr_shift));
|
||||
|
||||
if (interactive && dmode) /* only for rigctld */
|
||||
fprintf(fout, "END\n");
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/* 'O' */
|
||||
declare_proto_rig(set_rptr_offs)
|
||||
{
|
||||
unsigned long rptr_offs;
|
||||
|
@ -749,7 +783,7 @@ declare_proto_rig(set_rptr_offs)
|
|||
return rig_set_rptr_offs(rig, vfo, rptr_offs);
|
||||
}
|
||||
|
||||
|
||||
/* 'o' */
|
||||
declare_proto_rig(get_rptr_offs)
|
||||
{
|
||||
int status;
|
||||
|
@ -761,10 +795,14 @@ declare_proto_rig(get_rptr_offs)
|
|||
if (interactive && prompt)
|
||||
fprintf(fout, "%s: ", cmd->arg1);
|
||||
fprintf(fout, "%ld\n", rptr_offs);
|
||||
|
||||
if (interactive && dmode) /* only for rigctld */
|
||||
fprintf(fout, "END\n");
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/* 'C' */
|
||||
declare_proto_rig(set_ctcss_tone)
|
||||
{
|
||||
tone_t tone;
|
||||
|
@ -773,7 +811,7 @@ declare_proto_rig(set_ctcss_tone)
|
|||
return rig_set_ctcss_tone(rig, vfo, tone);
|
||||
}
|
||||
|
||||
|
||||
/* 'c' */
|
||||
declare_proto_rig(get_ctcss_tone)
|
||||
{
|
||||
int status;
|
||||
|
@ -785,10 +823,14 @@ declare_proto_rig(get_ctcss_tone)
|
|||
if (interactive && prompt)
|
||||
fprintf(fout, "%s: ", cmd->arg1);
|
||||
fprintf(fout, "%d\n", tone);
|
||||
|
||||
if (interactive && dmode) /* only for rigctld */
|
||||
fprintf(fout, "END\n");
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/* 'D' */
|
||||
declare_proto_rig(set_dcs_code)
|
||||
{
|
||||
tone_t code;
|
||||
|
@ -797,7 +839,7 @@ declare_proto_rig(set_dcs_code)
|
|||
return rig_set_dcs_code(rig, vfo, code);
|
||||
}
|
||||
|
||||
|
||||
/* 'd' */
|
||||
declare_proto_rig(get_dcs_code)
|
||||
{
|
||||
int status;
|
||||
|
@ -809,10 +851,14 @@ declare_proto_rig(get_dcs_code)
|
|||
if (interactive && prompt)
|
||||
fprintf(fout, "%s: ", cmd->arg1);
|
||||
fprintf(fout, "%d\n", code);
|
||||
|
||||
if (interactive && dmode) /* only for rigctld */
|
||||
fprintf(fout, "END\n");
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/* 'I' */
|
||||
declare_proto_rig(set_split_freq)
|
||||
{
|
||||
freq_t txfreq;
|
||||
|
@ -821,7 +867,7 @@ declare_proto_rig(set_split_freq)
|
|||
return rig_set_split_freq(rig, vfo, txfreq);
|
||||
}
|
||||
|
||||
|
||||
/* 'i' */
|
||||
declare_proto_rig(get_split_freq)
|
||||
{
|
||||
int status;
|
||||
|
@ -833,9 +879,14 @@ declare_proto_rig(get_split_freq)
|
|||
if (interactive && prompt)
|
||||
fprintf(fout, "%s: ", cmd->arg1);
|
||||
fprintf(fout, "%"PRIll"\n", (long long)txfreq);
|
||||
|
||||
if (interactive && dmode) /* only for rigctld */
|
||||
fprintf(fout, "END\n");
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/* 'X' */
|
||||
declare_proto_rig(set_split_mode)
|
||||
{
|
||||
rmode_t mode;
|
||||
|
@ -846,7 +897,7 @@ declare_proto_rig(set_split_mode)
|
|||
return rig_set_split_mode(rig, vfo, mode, (pbwidth_t) width);
|
||||
}
|
||||
|
||||
|
||||
/* 'x' */
|
||||
declare_proto_rig(get_split_mode)
|
||||
{
|
||||
int status;
|
||||
|
@ -862,10 +913,14 @@ declare_proto_rig(get_split_mode)
|
|||
if (interactive && prompt)
|
||||
fprintf(fout, "%s: ", cmd->arg2);
|
||||
fprintf(fout, "%ld\n", width);
|
||||
|
||||
if (interactive && dmode) /* only for rigctld */
|
||||
fprintf(fout, "END\n");
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/* 'S' */
|
||||
declare_proto_rig(set_split_vfo)
|
||||
{
|
||||
int split;
|
||||
|
@ -874,7 +929,7 @@ declare_proto_rig(set_split_vfo)
|
|||
return rig_set_split_vfo(rig, vfo, (split_t) split, rig_parse_vfo(arg2));
|
||||
}
|
||||
|
||||
|
||||
/* 's' */
|
||||
declare_proto_rig(get_split_vfo)
|
||||
{
|
||||
int status;
|
||||
|
@ -890,10 +945,14 @@ declare_proto_rig(get_split_vfo)
|
|||
if (interactive && prompt)
|
||||
fprintf(fout, "%s: ", cmd->arg2);
|
||||
fprintf(fout, "%s\n", rig_strvfo(tx_vfo));
|
||||
|
||||
if (interactive && dmode) /* only for rigctld */
|
||||
fprintf(fout, "END\n");
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/* 'N' */
|
||||
declare_proto_rig(set_ts)
|
||||
{
|
||||
unsigned long ts;
|
||||
|
@ -902,7 +961,7 @@ declare_proto_rig(set_ts)
|
|||
return rig_set_ts(rig, vfo, ts);
|
||||
}
|
||||
|
||||
|
||||
/* 'n' */
|
||||
declare_proto_rig(get_ts)
|
||||
{
|
||||
int status;
|
||||
|
@ -914,9 +973,14 @@ declare_proto_rig(get_ts)
|
|||
if (interactive && prompt)
|
||||
fprintf(fout, "%s: ", cmd->arg1);
|
||||
fprintf(fout, "%ld\n", ts);
|
||||
|
||||
if (interactive && dmode) /* only for rigctld */
|
||||
fprintf(fout, "END\n");
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/* '2' */
|
||||
declare_proto_rig(power2mW)
|
||||
{
|
||||
int status;
|
||||
|
@ -942,6 +1006,8 @@ declare_proto_rig(power2mW)
|
|||
* COMBO: val.i, starting from 0
|
||||
* STRING: val.s
|
||||
* CHECKBUTTON: val.i 0/1
|
||||
*
|
||||
* 'L'
|
||||
*/
|
||||
declare_proto_rig(set_level)
|
||||
{
|
||||
|
@ -981,7 +1047,7 @@ declare_proto_rig(set_level)
|
|||
return rig_set_level(rig, vfo, level, val);
|
||||
}
|
||||
|
||||
|
||||
/* 'l' */
|
||||
declare_proto_rig(get_level)
|
||||
{
|
||||
int status;
|
||||
|
@ -1029,10 +1095,14 @@ declare_proto_rig(get_level)
|
|||
fprintf(fout, "%f\n", val.f);
|
||||
else
|
||||
fprintf(fout, "%d\n", val.i);
|
||||
|
||||
if (interactive && dmode) /* only for rigctld */
|
||||
fprintf(fout, "END\n");
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/* 'U' */
|
||||
declare_proto_rig(set_func)
|
||||
{
|
||||
setting_t func;
|
||||
|
@ -1043,7 +1113,7 @@ declare_proto_rig(set_func)
|
|||
return rig_set_func(rig, vfo, func, func_stat);
|
||||
}
|
||||
|
||||
|
||||
/* 'u' */
|
||||
declare_proto_rig(get_func)
|
||||
{
|
||||
int status;
|
||||
|
@ -1057,9 +1127,14 @@ declare_proto_rig(get_func)
|
|||
if (interactive && prompt)
|
||||
fprintf(fout, "%s: ", cmd->arg2);
|
||||
fprintf(fout, "%d\n", func_stat);
|
||||
|
||||
if (interactive && dmode) /* only for rigctld */
|
||||
fprintf(fout, "END\n");
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/* 'P' */
|
||||
declare_proto_rig(set_parm)
|
||||
{
|
||||
setting_t parm;
|
||||
|
@ -1099,7 +1174,7 @@ declare_proto_rig(set_parm)
|
|||
return rig_set_parm(rig, parm, val);
|
||||
}
|
||||
|
||||
|
||||
/* 'p' */
|
||||
declare_proto_rig(get_parm)
|
||||
{
|
||||
int status;
|
||||
|
@ -1148,10 +1223,13 @@ declare_proto_rig(get_parm)
|
|||
else
|
||||
fprintf(fout, "%d\n", val.i);
|
||||
|
||||
if (interactive && dmode) /* only for rigctld */
|
||||
fprintf(fout, "END\n");
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/* 'B' */
|
||||
declare_proto_rig(set_bank)
|
||||
{
|
||||
int bank;
|
||||
|
@ -1160,7 +1238,7 @@ declare_proto_rig(set_bank)
|
|||
return rig_set_bank(rig, vfo, bank);
|
||||
}
|
||||
|
||||
|
||||
/* 'E' */
|
||||
declare_proto_rig(set_mem)
|
||||
{
|
||||
int ch;
|
||||
|
@ -1169,7 +1247,7 @@ declare_proto_rig(set_mem)
|
|||
return rig_set_mem(rig, vfo, ch);
|
||||
}
|
||||
|
||||
|
||||
/* 'e' */
|
||||
declare_proto_rig(get_mem)
|
||||
{
|
||||
int status;
|
||||
|
@ -1184,6 +1262,7 @@ declare_proto_rig(get_mem)
|
|||
return status;
|
||||
}
|
||||
|
||||
/* 'G' */
|
||||
declare_proto_rig(vfo_op)
|
||||
{
|
||||
vfo_op_t op;
|
||||
|
@ -1192,6 +1271,7 @@ declare_proto_rig(vfo_op)
|
|||
return rig_vfo_op(rig, vfo, op);
|
||||
}
|
||||
|
||||
/* 'g' */
|
||||
declare_proto_rig(scan)
|
||||
{
|
||||
scan_t op;
|
||||
|
@ -1202,6 +1282,7 @@ declare_proto_rig(scan)
|
|||
return rig_scan(rig, vfo, op, ch);
|
||||
}
|
||||
|
||||
/* 'H' */
|
||||
declare_proto_rig(set_channel)
|
||||
{
|
||||
channel_cap_t *mem_caps = NULL;
|
||||
|
@ -1304,7 +1385,7 @@ declare_proto_rig(set_channel)
|
|||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
||||
/* 'h' */
|
||||
declare_proto_rig(get_channel)
|
||||
{
|
||||
int status;
|
||||
|
@ -1323,6 +1404,10 @@ declare_proto_rig(get_channel)
|
|||
if (status != RIG_OK)
|
||||
return status;
|
||||
dump_chan(fout, rig, &chan);
|
||||
|
||||
if (interactive && dmode) /* only for rigctld */
|
||||
fprintf(fout, "END\n");
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -1357,6 +1442,7 @@ static int mydcd_event(RIG *rig, vfo_t vfo, dcd_t dcd, rig_ptr_t arg)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* 'A' */
|
||||
declare_proto_rig(set_trn)
|
||||
{
|
||||
int trn;
|
||||
|
@ -1381,7 +1467,7 @@ declare_proto_rig(set_trn)
|
|||
return rig_set_trn(rig, trn);
|
||||
}
|
||||
|
||||
|
||||
/* 'a' */
|
||||
declare_proto_rig(get_trn)
|
||||
{
|
||||
int status;
|
||||
|
@ -1393,18 +1479,27 @@ declare_proto_rig(get_trn)
|
|||
if (interactive && prompt)
|
||||
fprintf(fout, "%s: ", cmd->arg1);
|
||||
fprintf(fout, "%d\n", trn);
|
||||
|
||||
if (interactive && dmode) /* only for rigctld */
|
||||
fprintf(fout, "END\n");
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/* '_' */
|
||||
declare_proto_rig(get_info)
|
||||
{
|
||||
const char *s;
|
||||
const char *s;
|
||||
|
||||
s = rig_get_info(rig);
|
||||
if (interactive && prompt)
|
||||
fprintf(fout, "%s: ", cmd->arg1);
|
||||
fprintf(fout, "%s\n", s ? s : "None");
|
||||
return RIG_OK;
|
||||
s = rig_get_info(rig);
|
||||
if (interactive && prompt)
|
||||
fprintf(fout, "%s: ", cmd->arg1);
|
||||
fprintf(fout, "%s\n", s ? s : "None");
|
||||
|
||||
if (interactive && dmode) /* only for rigctld */
|
||||
fprintf(fout, "END\n");
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1472,13 +1567,18 @@ void dump_chan(FILE *fout, RIG *rig, channel_t *chan)
|
|||
fprintf(fout, "\n");
|
||||
}
|
||||
|
||||
/* '1' */
|
||||
declare_proto_rig(dump_caps)
|
||||
{
|
||||
dumpcaps(rig, fout);
|
||||
|
||||
if (interactive && dmode) /* only for rigctld */
|
||||
fprintf(fout, "END\n");
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
/* 'Y' */
|
||||
declare_proto_rig(set_ant)
|
||||
{
|
||||
ant_t ant;
|
||||
|
@ -1487,6 +1587,7 @@ declare_proto_rig(set_ant)
|
|||
return rig_set_ant(rig, vfo, rig_idx2setting(ant));
|
||||
}
|
||||
|
||||
/* 'y' */
|
||||
declare_proto_rig(get_ant)
|
||||
{
|
||||
int status;
|
||||
|
@ -1498,9 +1599,14 @@ declare_proto_rig(get_ant)
|
|||
if (interactive && prompt)
|
||||
fprintf(fout, "%s: ", cmd->arg1);
|
||||
fprintf(fout, "%d\n", rig_setting2idx(ant));
|
||||
|
||||
if (interactive && dmode) /* only for rigctld */
|
||||
fprintf(fout, "END\n");
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/* '*' */
|
||||
declare_proto_rig(reset)
|
||||
{
|
||||
int reset;
|
||||
|
@ -1509,11 +1615,13 @@ declare_proto_rig(reset)
|
|||
return rig_reset(rig, (reset_t) reset);
|
||||
}
|
||||
|
||||
/* 'b' */
|
||||
declare_proto_rig(send_morse)
|
||||
{
|
||||
return rig_send_morse(rig, vfo, arg1);
|
||||
}
|
||||
|
||||
/* '0x87' */
|
||||
declare_proto_rig(set_powerstat)
|
||||
{
|
||||
int stat;
|
||||
|
@ -1522,6 +1630,7 @@ declare_proto_rig(set_powerstat)
|
|||
return rig_set_powerstat(rig, (powerstat_t) stat);
|
||||
}
|
||||
|
||||
/* '0x88' */
|
||||
declare_proto_rig(get_powerstat)
|
||||
{
|
||||
int status;
|
||||
|
@ -1533,12 +1642,18 @@ declare_proto_rig(get_powerstat)
|
|||
if (interactive && prompt)
|
||||
fprintf(fout, "%s: ", cmd->arg1);
|
||||
fprintf(fout, "%d\n", stat);
|
||||
|
||||
if (interactive && dmode) /* only for rigctld */
|
||||
fprintf(fout, "END\n");
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/*
|
||||
* special debugging purpose send command
|
||||
* display reply until there's a timeout
|
||||
*
|
||||
* 'w'
|
||||
*/
|
||||
declare_proto_rig(send_cmd)
|
||||
{
|
||||
|
@ -1605,6 +1720,9 @@ declare_proto_rig(send_cmd)
|
|||
if (retval > 0 || retval == -RIG_ETIMEOUT)
|
||||
retval = RIG_OK;
|
||||
|
||||
if (interactive && dmode) /* only for rigctld */
|
||||
fprintf(fout, "END\n");
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* This program test/control a radio using Hamlib.
|
||||
* It takes commands from network connection.
|
||||
*
|
||||
* $Id: rigctld.c,v 1.2 2008-01-05 18:13:12 fillods Exp $
|
||||
* $Id: rigctld.c,v 1.3 2008-01-10 03:42:35 n0nb Exp $
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -92,6 +92,7 @@ void usage(void);
|
|||
|
||||
int interactive=1; /* no cmd because of daemon */
|
||||
int prompt=0;
|
||||
int dmode = 1; /* Daemon mode for rigparse return string */
|
||||
|
||||
int portno = 4532;
|
||||
|
||||
|
@ -99,7 +100,7 @@ int portno = 4532;
|
|||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
RIG *my_rig; /* handle to rig (nstance) */
|
||||
RIG *my_rig; /* handle to rig (instance) */
|
||||
rig_model_t my_model = RIG_MODEL_DUMMY;
|
||||
|
||||
int retcode; /* generic return code from functions */
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# testctld.pl - (C) Nate Bargmann 2008
|
||||
# A Perl test script for the rigctld program.
|
||||
|
||||
# $Id: testctld.pl,v 1.2 2008-01-07 21:41:27 n0nb Exp $
|
||||
# $Id: testctld.pl,v 1.3 2008-01-10 03:42:35 n0nb Exp $
|
||||
|
||||
# It connects to the rigctld TCP port (default 4532) and queries
|
||||
# the daemon for some common rig information. It also aims to provide
|
||||
|
@ -32,10 +32,24 @@ use IO::Socket;
|
|||
|
||||
# Local variables
|
||||
my $socket;
|
||||
my $answer;
|
||||
my @answer;
|
||||
my $freq = "14250000";
|
||||
my $mode = "USB";
|
||||
my $bw = "2400";
|
||||
my $flags;
|
||||
|
||||
# Thanks to Uri Guttman on comp.lang.perl.misc for this function
|
||||
sub get_results {
|
||||
|
||||
my ($sock) = @_;
|
||||
my @lines;
|
||||
|
||||
while (my $line = <$sock>) {
|
||||
|
||||
return @lines if $line =~ /^END$/;
|
||||
push @lines, $line;
|
||||
}
|
||||
}
|
||||
|
||||
# Create the new socket.
|
||||
# 'localhost' may be replaced by any hostname or IP address where a
|
||||
|
@ -53,37 +67,36 @@ $socket = new IO::Socket::INET (PeerAddr => 'localhost',
|
|||
print $socket "f\n";
|
||||
|
||||
# Get the rig's frequency from rigctld and print it to STDOUT
|
||||
# N.B. Replies are newline terminated.
|
||||
$answer = <$socket>;
|
||||
print "The rig's frequency is: $answer";
|
||||
# N.B. Replies are newline terminated, so lines in @answer end with '\n'.
|
||||
@answer = get_results($socket);
|
||||
|
||||
print "The rig's frequency is: $answer[0]";
|
||||
|
||||
# Extra newline for screen formatting.
|
||||
print "\n";
|
||||
|
||||
# Do the same for the mode (reading the mode also returns the bandwidth)
|
||||
print $socket "m\n";
|
||||
$answer = <$socket>;
|
||||
print "The rig's mode is: $answer";
|
||||
$answer = <$socket>;
|
||||
print "The rig's bandwidth is: $answer";
|
||||
@answer = get_results($socket);
|
||||
print "The rig's mode is: $answer[0]";
|
||||
print "The rig's bandwidth is: $answer[1]";
|
||||
print "\n";
|
||||
|
||||
# Now set the rig's frequency
|
||||
print "Setting the rig's frquency to: $freq\n";
|
||||
print "Setting the rig's frequency to: $freq\n";
|
||||
print $socket "F $freq\n";
|
||||
print $socket "f\n";
|
||||
$answer = <$socket>;
|
||||
print "The rig's frequency is now: $answer";
|
||||
@answer = get_results($socket);
|
||||
print "The rig's frequency is now: $answer[0]";
|
||||
print "\n";
|
||||
|
||||
# Setting the mode takes two parameters, mode and bandwidth
|
||||
print "Setting the rig's mode to $mode and bandwidth to $bw\n";
|
||||
print $socket "M $mode $bw\n";
|
||||
print $socket "m\n";
|
||||
$answer = <$socket>;
|
||||
print "The rig's mode is now: $answer";
|
||||
$answer = <$socket>;
|
||||
print "The rig's bandwidth is now: $answer";
|
||||
print $socket "\\set_mode $mode $bw\n";
|
||||
print $socket "\\get_mode\n";
|
||||
@answer = get_results($socket);
|
||||
print "The rig's mode is now: $answer[0]";
|
||||
print "The rig's bandwidth is now: $answer[1]";
|
||||
print "\n";
|
||||
|
||||
# Close the connection before we exit.
|
||||
|
|
Ładowanie…
Reference in New Issue