kopia lustrzana https://github.com/Hamlib/Hamlib
Complete addition of Extended Response Protocol to rigctld
Update and synchronize rig and rot ctl(d) man pages Update testctld.pl for ERp. git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2837 7ae35d74-ebe9-4afe-98af-79ac388436b8Hamlib-1.2.11
rodzic
61b0062547
commit
1f6604b188
351
tests/rigctl.1
351
tests/rigctl.1
|
@ -2,7 +2,7 @@
|
|||
.\" First parameter, NAME, should be all caps
|
||||
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
||||
.\" other parameters are allowed: see man(7), man(1)
|
||||
.TH RIGCTL "1" "January 4, 2009" "Hamlib" "Radio Control Program"
|
||||
.TH RIGCTL "1" "February 17, 2010" "Hamlib" "Radio Control Program"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.\" Some roff macros, for reference:
|
||||
|
@ -44,14 +44,16 @@ Here is a summary of the supported options:
|
|||
.TP
|
||||
.B \-m, --model=id
|
||||
Select radio model number. See model list (use 'rigctl -l').
|
||||
.br
|
||||
.sp
|
||||
NB: \fBrigctl\fP (or third party software) will use rig model 1901
|
||||
when using \fBrpc.rigd\fP.
|
||||
when using \fBrpc.rigd\fP or rig model 2 for NET rigctl (rigctld).
|
||||
.TP
|
||||
.B \-r, --rig-file=device
|
||||
Use \fIdevice\fP as the file name of the port the radio is connected.
|
||||
Often a serial port, but could be a USB to serial adapter. Typically
|
||||
/dev/ttyS0, /dev/ttyS1, /dev/ttyUSB0, etc.
|
||||
.sp
|
||||
Default is \fB/dev/rig\fP (may be a symbolic link to the actual device).
|
||||
.TP
|
||||
.B \-p, --ptt-file=device
|
||||
Use \fIdevice\fP as the file name of the Push-To-Talk device using a
|
||||
|
@ -65,7 +67,7 @@ device file as described above.
|
|||
Use \fItype\fP of Push-To-Talk device.
|
||||
Supported types are RIG, DTR, RTS, PARALLEL, NONE, overriding PTT type
|
||||
defined in the rig's backend.
|
||||
|
||||
.sp
|
||||
Some side effects of this command are that when type is set to DTR, read
|
||||
PTT state comes from Hamlib frontend, not read from the radio. When set
|
||||
to NONE, PTT state cannot be read or set even if rig backend supports
|
||||
|
@ -82,7 +84,7 @@ backend capabilities as the default.
|
|||
.B \-c, --civaddr=id
|
||||
Use \fIid\fP as the CI-V address to communicate with the rig. Only useful for
|
||||
Icom rigs.
|
||||
.br
|
||||
.sp
|
||||
NB: the \fIid\fP is in decimal notation, unless prefixed by
|
||||
\fI0x\fP, in which case it is hexadecimal.
|
||||
.TP
|
||||
|
@ -98,7 +100,7 @@ List all config parameters for the radio defined with -m above.
|
|||
.TP
|
||||
.B \-C, --set-conf=parm=val[,parm=val]*
|
||||
Set config parameter. e.g. stop_bits=2
|
||||
.br
|
||||
.sp
|
||||
Use -L option for a list.
|
||||
.TP
|
||||
.B \-l, --list
|
||||
|
@ -135,243 +137,307 @@ or provided as argument(s) in command line interface mode.
|
|||
.PP
|
||||
Since most of the \fBHamlib\fP operations have a \fIset\fP and a \fIget\fP method,
|
||||
an upper case letter will be used for \fIset\fP method whereas the
|
||||
corresponding lower case letter refers to the \fIget\fP method.
|
||||
In interactive mode, prepend a backslash to enter a long command name.
|
||||
.br
|
||||
corresponding lower case letter refers to the \fIget\fP method. Each operation
|
||||
also has a long name; in interactive mode, prepend a backslash to enter a long
|
||||
command name.
|
||||
.sp
|
||||
Example: Use "\\dump_caps" to see what this radio can do.
|
||||
.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 message.
|
||||
.PP
|
||||
Here is a summary of the supported commands:
|
||||
Here is a summary of the supported commands (In the case of "set" commands the
|
||||
quoted string is replaced by the value in the description. In the case of "get"
|
||||
commands the quoted string is the key name of the value returned.):
|
||||
.TP
|
||||
.B F, set_freq
|
||||
Set frequency, in Hz.
|
||||
.B F, set_freq 'Frequency'
|
||||
Set 'Frequency', in Hz.
|
||||
.TP
|
||||
.B f, get_freq
|
||||
Get frequency, in Hz.
|
||||
Get 'Frequency', in Hz.
|
||||
.TP
|
||||
.B M, set_mode
|
||||
Set mode/passband: AM, FM, CW, CWR, USB, LSB, RTTY, RTTYR, WFM, AMS,
|
||||
.B M, set_mode 'Mode' 'Passband'
|
||||
Set 'Mode': USB, LSB, CW, CWR, RTTY, RTTYR, AM, FM, WFM, AMS,
|
||||
PKTLSB, PKTUSB, PKTFM, ECSSUSB, ECSSLSB, FAX, SAM, SAL, SAH, DSB.
|
||||
|
||||
The passband is the exact passband in Hz, or 0 for the default.
|
||||
.sp
|
||||
Set 'Passband' in Hz, or '0' for the Hamlib backend default.
|
||||
.TP
|
||||
.B m, get_mode
|
||||
Get mode/passband.
|
||||
Get 'Mode' 'Passband'.
|
||||
.sp
|
||||
Returns Mode as a string from \fIset_mode\fP above
|
||||
and Passband in Hz.
|
||||
.TP
|
||||
.B V, set_vfo
|
||||
Set VFO: VFOA, VFOB, VFOC, currVFO, VFO, MEM, Main, Sub, TX, RX.
|
||||
.B V, set_vfo 'VFO'
|
||||
Set 'VFO': VFOA, VFOB, VFOC, currVFO, VFO, MEM, Main, Sub, TX, RX.
|
||||
.sp
|
||||
In VFO mode only a single VFO parameter is required.
|
||||
.TP
|
||||
.B v, get_vfo
|
||||
Get current VFO.
|
||||
Get current 'VFO'.
|
||||
.sp
|
||||
Returns VFO as a string from \fIset_vfo\fP above.
|
||||
.TP
|
||||
.B J, set_rit
|
||||
Set RIT, in Hz.
|
||||
.B J, set_rit 'RIT'
|
||||
Set 'RIT', in Hz, can be + or -.
|
||||
.sp
|
||||
A value of '0' resets RIT and *should* turn RIT off. If not, file a bug report
|
||||
against the Hamlib backend.
|
||||
.TP
|
||||
.B j, get_rit
|
||||
Get RIT, in Hz.
|
||||
Get 'RIT', in Hz.
|
||||
.TP
|
||||
.B Z, set_xit
|
||||
Set XIT, in Hz.
|
||||
.B Z, set_xit 'XIT'
|
||||
Set 'XIT', in Hz can be + or -.
|
||||
.sp
|
||||
A value of '0' resets RIT and *should* turn RIT off. If not, file a bug report
|
||||
against the Hamlib backend.
|
||||
.TP
|
||||
.B z, get_xit
|
||||
Get XIT, in Hz.
|
||||
Get 'XIT', in Hz.
|
||||
.TP
|
||||
.B T, set_ptt
|
||||
Set PTT, 0 or 1.
|
||||
.B T, set_ptt 'PTT'
|
||||
Set 'PTT', 0 (RX) or 1 (TX).
|
||||
.TP
|
||||
.B t, get_ptt
|
||||
Get PTT status.
|
||||
Get 'PTT' status.
|
||||
.TP
|
||||
.B get_dcd
|
||||
Get DCD status.
|
||||
.B 0x8b, get_dcd
|
||||
Get 'DCD' (squelch) status, 0 (Closed) or 1 (Open)
|
||||
.TP
|
||||
.B R, set_rptr_shift
|
||||
Set repeater shift: "+", "-" or something else for none.
|
||||
.B R, set_rptr_shift 'Rptr Shift'
|
||||
Set 'Rptr Shift': "+", "-" or something else for none.
|
||||
.TP
|
||||
.B r, get_rptr_shift
|
||||
Get repeater shift.
|
||||
Get 'Rptr Shift'. Returns "+", "-" or "None".
|
||||
.TP
|
||||
.B O, set_rptr_offs
|
||||
Set repeater offset, in Hz.
|
||||
.B O, set_rptr_offs 'Rptr Offset'
|
||||
Set 'Rptr Offset', in Hz.
|
||||
.TP
|
||||
.B o, get_rptr_offs
|
||||
Get repeater offset.
|
||||
Get 'Rptr Offset', in Hz.
|
||||
.TP
|
||||
.B C, set_ctcss_tone
|
||||
Set CTCSS tone, in tenth of Hz.
|
||||
.B C, set_ctcss_tone 'CTCSS Tone'
|
||||
Set 'CTCSS Tone', in tenths of Hz.
|
||||
.TP
|
||||
.B c, get_ctcss_tone
|
||||
Get CTCSS tone, in tenth of Hz.
|
||||
Get 'CTCSS Tone', in tenths of Hz.
|
||||
.TP
|
||||
.B D, set_dcs_code
|
||||
Set DCS code.
|
||||
.B D, set_dcs_code 'DCS Code'
|
||||
Set 'DCS Code'.
|
||||
.TP
|
||||
.B d, get_dcs_code
|
||||
Get DCS code.
|
||||
Get 'DCS Code'.
|
||||
.TP
|
||||
.B set_ctcss_sql
|
||||
Set CTCSS squelch tone, in tenth of Hz.
|
||||
.B 0x90, set_ctcss_sql 'CTCSS Sql'
|
||||
Set 'CTCSS Sql' tone, in tenths of Hz.
|
||||
.TP
|
||||
.B get_ctcss_sql
|
||||
Get CTCSS squelch tone, in tenth of Hz.
|
||||
.B 0x91, get_ctcss_sql
|
||||
Get 'CTCSS Sql' tone, in tenths of Hz.
|
||||
.TP
|
||||
.B set_dcs_sql
|
||||
Set DCS squelch code.
|
||||
.B 0x92, set_dcs_sql 'DCS Sql'
|
||||
Set 'DCS Sql' code.
|
||||
.TP
|
||||
.B get_dcs_sql
|
||||
Get DCS squelch code.
|
||||
.B 0x93, get_dcs_sql
|
||||
Get 'DCS Sql' code.
|
||||
.TP
|
||||
.B I, set_split_freq
|
||||
Set TX frequency, in Hz.
|
||||
.B I, set_split_freq 'Tx Frequency'
|
||||
Set 'TX Frequency', in Hz.
|
||||
.TP
|
||||
.B i, get_split_freq
|
||||
Get TX frequency.
|
||||
Get 'TX Frequency', in Hz.
|
||||
.TP
|
||||
.B X, set_split_mode
|
||||
Set transmit mode/passband: AM, FM, CW, CWR, USB, LSB, RTTY, RTTYR, WFM, AMS,
|
||||
.B X, set_split_mode 'TX Mode' 'TX Passband'
|
||||
Set 'TX Mode': AM, FM, CW, CWR, USB, LSB, RTTY, RTTYR, WFM, AMS,
|
||||
PKTLSB, PKTUSB, PKTFM, ECSSUSB, ECSSLSB, FAX, SAM, SAL, SAH, DSB.
|
||||
|
||||
The passband is the exact passband in Hz, or 0 for the default.
|
||||
.sp
|
||||
The 'TX Passband' is the exact passband in Hz, or '0' for the Hamlib
|
||||
backend default.
|
||||
.TP
|
||||
.B x, get_split_mode
|
||||
Get transmit mode/passband.
|
||||
Get 'TX Mode' and 'TX Passband'.
|
||||
.sp
|
||||
Returns TX mode as a string from \fIset_split_mode\fP above and TX passband in Hz.
|
||||
.TP
|
||||
.B S, set_split_vfo
|
||||
Set split mode, 0 or 1, and transmit VFO.
|
||||
.B S, set_split_vfo 'Split' 'TX VFO'
|
||||
Set 'Split' mode, '0' or '1', and 'TX VFO' from \fIset_vfo\fP above.
|
||||
.TP
|
||||
.B s, get_split_vfo
|
||||
Get split mode and transmit VFO.
|
||||
Get 'Split' mode, '0' or '1', and 'TX VFO'.
|
||||
.TP
|
||||
.B N, set_ts
|
||||
Set tuning step, in Hz.
|
||||
.B N, set_ts 'Tuning Step'
|
||||
Set 'Tuning Step', in Hz.
|
||||
.TP
|
||||
.B n, get_ts
|
||||
Get tuning step.
|
||||
Get 'Tuning Step', in Hz.
|
||||
.TP
|
||||
.B U, set_func
|
||||
Set func/status:
|
||||
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.
|
||||
.B U, set_func 'Func' 'Func Status'
|
||||
Set 'Func' 'Func Status'.
|
||||
.sp
|
||||
Func is one of: 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.
|
||||
.sp
|
||||
Func Status argument is a non null value for "activate", "de-activate"
|
||||
otherwise, much as TRUE/FALSE definitions in C language.
|
||||
.TP
|
||||
.B u, get_func
|
||||
Get func status.
|
||||
Get 'Func' 'Func Status'.
|
||||
.sp
|
||||
Returns Func as a string from \fIset_func\fP above and Func status as a non null value.
|
||||
.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.
|
||||
.B L, set_level 'Level' 'Level Value'
|
||||
Set 'Level' and 'Level Value'.
|
||||
.sp
|
||||
Level is one of: 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.
|
||||
.sp
|
||||
The Level Value can be a float or an integer.
|
||||
.TP
|
||||
.B l, get_level
|
||||
Get level value.
|
||||
Get 'Level' 'Level Value'.
|
||||
.sp
|
||||
Returns Level as a string from \fIset_level\fP above and Level value as a float or
|
||||
integer.
|
||||
.TP
|
||||
.B P, set_parm
|
||||
Set parm/value:
|
||||
ANN, APO, BACKLIGHT, BEEP, TIME, BAT, KEYLIGHT.
|
||||
.B P, set_parm 'Parm' 'Parm Value'
|
||||
Set 'Parm' 'Parm Value'
|
||||
.sp
|
||||
Parm is one of: ANN, APO, BACKLIGHT, BEEP, TIME, BAT, KEYLIGHT.
|
||||
.TP
|
||||
.B p, get_parm
|
||||
Get parm value.
|
||||
Get 'Parm' 'Parm Value'.
|
||||
.sp
|
||||
Returns Parm as a string from \fIset_parm\fP above and Parm Value as a float or
|
||||
integer.
|
||||
.TP
|
||||
.B B, set_bank
|
||||
Set bank.
|
||||
.B B, set_bank 'Bank'
|
||||
Set 'Bank'. Sets the current memory bank number.
|
||||
.TP
|
||||
.B E, set_mem
|
||||
Set memory channel number.
|
||||
.B E, set_mem 'Memory#'
|
||||
Set 'Memory#' channel number.
|
||||
.TP
|
||||
.B e, get_mem
|
||||
Get memory channel number.
|
||||
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,
|
||||
TUNE, TOGGLE.
|
||||
.B G, vfo_op 'Mem/VFO Op'
|
||||
Perform 'Mem/VFO Op'.
|
||||
.sp
|
||||
Mem VFO operation is one of: 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, PROG, DELTA, VFO, PLT.
|
||||
.B g, scan 'Scan Fct' 'Scan Channel'
|
||||
Perform 'Scan Fct' 'Scan Channel'.
|
||||
.sp
|
||||
Scan function/channel is one of: STOP, MEM, SLCT, PRIO, PROG, DELTA, VFO, PLT.
|
||||
.TP
|
||||
.B H, set_channel
|
||||
Set memory channel data. Partially implemented.
|
||||
.B H, set_channel 'Channel'
|
||||
Set memory 'Channel' data. Not implemented yet.
|
||||
.TP
|
||||
.B h, get_channel
|
||||
Get memory channel data.
|
||||
Get memory 'Channel' data. Not implemented yet.
|
||||
.TP
|
||||
.B A, set_trn
|
||||
Set transceive mode (reporting event): OFF, RIG, POLL.
|
||||
.B A, set_trn 'Transceive'
|
||||
Set 'Transceive' mode (reporting event): OFF, RIG, POLL.
|
||||
.TP
|
||||
.B a, get_trn
|
||||
Get transceive mode (reporting event).
|
||||
Get 'Transceive' mode (reporting event) as in \fIset_trn\fP above.
|
||||
.TP
|
||||
.B Y, set_ant
|
||||
Set antenna number (0, 1, 2, ..).
|
||||
.B Y, set_ant 'Antenna'
|
||||
Set 'Antenna' number (0, 1, 2, ..).
|
||||
.TP
|
||||
.B y, get_ant
|
||||
Get antenna number (0, 1, 2, ..).
|
||||
Get 'Antenna' number (0, 1, 2, ..).
|
||||
.TP
|
||||
.B *, reset
|
||||
Reset.
|
||||
.B *, reset 'Reset'
|
||||
Perform rig 'Reset'.
|
||||
.sp
|
||||
0 = None, 1 = Software reset, 2 = VFO reset, 4 = Memory Clear reset, 8 = Master reset.
|
||||
Since these values are defined as a bitmask in rig.h, it should be possible to AND
|
||||
these values together to do multiple resets at once, if the backend supports it or
|
||||
supports a reset action via rig control at all.
|
||||
.TP
|
||||
.B b, send_morse
|
||||
Send morse symbols.
|
||||
.B b, send_morse 'Morse'
|
||||
Send 'Morse' symbols.
|
||||
.TP
|
||||
.B 0x87, set_powerstat
|
||||
Set power status.
|
||||
.B 0x87, set_powerstat 'Power Status'
|
||||
Set power On/Off/Standby 'Power Status'.
|
||||
.sp
|
||||
0 = Power Off, 1 = Power On, 2 = Power Standby. Defined as a bitmask in rig.h.
|
||||
.TP
|
||||
.B 0x88, get_powerstat
|
||||
Get power status.
|
||||
Get power On/Off/Standby 'Power Status' as in \fIset_powerstat\fP above.
|
||||
.TP
|
||||
.B 0x89, send_dtmf
|
||||
Set DTMF digits.
|
||||
.B 0x89, send_dtmf 'Digits'
|
||||
Set DTMF 'Digits'.
|
||||
.TP
|
||||
.B 0x8a, recv_dtmf
|
||||
Get DTMF digits.
|
||||
Get DTMF 'Digits'.
|
||||
.TP
|
||||
.B _, get_info
|
||||
Get misc information about the rig.
|
||||
Get misc information about the rig (no VFO in 'VFO mode' or value is passed).
|
||||
.TP
|
||||
.B 1, dump_caps
|
||||
Not a real rig remote command, it just dumps capabilities, i.e. what the
|
||||
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.
|
||||
in a consistent format so it can be read into a hash, dictionary, etc. Bug
|
||||
reports requested.
|
||||
.sp
|
||||
\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 the
|
||||
Dummy backend results in over 5kB of text output.
|
||||
.sp
|
||||
VFO parameter not used in 'VFO mode'.
|
||||
.TP
|
||||
.B 3, dump_conf
|
||||
Not a real rig remote command, it just dumps a list of all config parameters
|
||||
defined for the radio.
|
||||
.B 2, power2mW 'Power [0.0..1.0]' 'Frequency' 'Mode'
|
||||
Returns 'Power mW'
|
||||
.sp
|
||||
Converts a Power value in a range of \fI0.0 ... 1.0\fP to the real transmit
|
||||
power in milli-Watts (integer). The \fIfrequency\fP and \fImode\fP also need to
|
||||
be provided as output power may vary according to these values.
|
||||
.sp
|
||||
VFO parameter not used in 'VFO mode'.
|
||||
.TP
|
||||
.B 2, power2mW
|
||||
Converts a power value in a range of \fI0.0 ... 1.0\fP to the real transmit
|
||||
power in milli-Watts. The \fIfrequency\fP and \fImode\fP also need to be
|
||||
provided as output power may vary according to these values.
|
||||
.B 4, mW2power 'Power mW' 'Frequency' 'Mode'
|
||||
Returns 'Power [0.0..1.0]'
|
||||
.sp
|
||||
Converts the real transmit power in milli-Watts (integer) to a Power value in
|
||||
a range of \fI0.0 ... 1.0\fP. The \fIfrequency\fP and \fImode\fP also need to
|
||||
be provided as output power may vary according to these values.
|
||||
.sp
|
||||
VFO parameter not used in 'VFO mode'.
|
||||
.TP
|
||||
.B w, send_cmd
|
||||
Send raw command string to the rig.
|
||||
.br
|
||||
<CR> (or send-cmd-term, see \fI-t\fP option) is appended automatically at the end
|
||||
of the command for text protocols.
|
||||
For binary protocols, enter values as \\0xAA\\0xBB
|
||||
|
||||
.B w, send_cmd 'Cmd'
|
||||
Send raw command string to rig.
|
||||
.sp
|
||||
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.
|
||||
.SH EXAMPLES
|
||||
Start \fBrigctl\fP for a Yaesu FT-920 using a USB to serial adapter in
|
||||
interactive mode:
|
||||
|
||||
.sp
|
||||
$ rigctl -m 114 -r /dev/ttyUSB1
|
||||
|
||||
.sp
|
||||
Start \fBrigctl\fP for a Yaesu FT-920 using COM1 while generating TRACE output
|
||||
to \fBstderr\fP:
|
||||
|
||||
.sp
|
||||
$ rigctl -m 114 -r /dev/ttyS0 -vvvvv
|
||||
|
||||
.sp
|
||||
Start \fBrigctl\fP for a Yaesu FT-920 using a USB to serial adapter while
|
||||
setting baud rate and stop bits:
|
||||
|
||||
.sp
|
||||
$ rigctl -m 114 -r /dev/ttyUSB1 -s 4800 -C stop_bits=2
|
||||
|
||||
.sp
|
||||
Start \fBrigctl\fP using \fBrpc.rigd\fP and setting the frequency and mode:
|
||||
|
||||
.sp
|
||||
$ rigctl -m 1901 -r localhost F 7253500 M LSB 0
|
||||
.sp
|
||||
Connect to a running \fBrigctld\fP with rig model 2 ("NET rigctl") on the
|
||||
local host and specifying the TCP port:
|
||||
.sp
|
||||
$ rotctl -m 2 -r localhost:4532
|
||||
.SH DIAGNOSTICS
|
||||
The \fB-v\fP, \fB--verbose\fP option allows different levels of diagnostics
|
||||
to be output to \fBstderr\fP and correspond to -v for BUG, -vv for ERR,
|
||||
|
@ -395,20 +461,23 @@ set_chan has no entry method as of yet, hence left unimplemented.
|
|||
This almost empty section...
|
||||
.SH REPORTING BUGS
|
||||
Report bugs to <hamlib-developer@lists.sourceforge.net>.
|
||||
.br
|
||||
.PP
|
||||
We are already aware of the bugs in the previous section :-)
|
||||
.SH AUTHORS
|
||||
Written by Stephane Fillod and the Hamlib Group
|
||||
.br
|
||||
Written by Stephane Fillod, Nate Bargmann, and the Hamlib Group
|
||||
.PP
|
||||
<http://www.hamlib.org>.
|
||||
.SH COPYRIGHT
|
||||
Copyright \(co 2000-2009 Stephane Fillod, Frank Singleton, and the Hamlib
|
||||
Group.
|
||||
Copyright \(co 2000-2009 Stephane Fillod
|
||||
.br
|
||||
Copyright \(co 2010 Nate Bargmann
|
||||
.br
|
||||
Copyright \(co 2000-2009 the Hamlib Group.
|
||||
.sp
|
||||
This is free software; see the source for copying conditions.
|
||||
There is NO warranty; not even for MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
.SH SEE ALSO
|
||||
.BR hamlib (3),
|
||||
.BR rpc.rigd (8)
|
||||
|
||||
.BR rigctld(8)
|
||||
|
|
|
@ -61,23 +61,23 @@ void usage(void);
|
|||
#define SHORT_OPTIONS "m:r:p:d:P:D:s:c:t:lC:LuovhV"
|
||||
static struct option long_options[] =
|
||||
{
|
||||
{"model", 1, 0, 'm'},
|
||||
{"rig-file", 1, 0, 'r'},
|
||||
{"ptt-file", 1, 0, 'p'},
|
||||
{"dcd-file", 1, 0, 'd'},
|
||||
{"ptt-type", 1, 0, 'P'},
|
||||
{"dcd-type", 1, 0, 'D'},
|
||||
{"serial-speed", 1, 0, 's'},
|
||||
{"civaddr", 1, 0, 'c'},
|
||||
{"send-cmd-term", 1, 0, 't'},
|
||||
{"list", 0, 0, 'l'},
|
||||
{"set-conf", 1, 0, 'C'},
|
||||
{"show-conf",0, 0, 'L'},
|
||||
{"dump-caps", 0, 0, 'u'},
|
||||
{"vfo", 0, 0, 'o'},
|
||||
{"verbose", 0, 0, 'v'},
|
||||
{"help", 0, 0, 'h'},
|
||||
{"version", 0, 0, 'V'},
|
||||
{"model", 1, 0, 'm'},
|
||||
{"rig-file", 1, 0, 'r'},
|
||||
{"ptt-file", 1, 0, 'p'},
|
||||
{"dcd-file", 1, 0, 'd'},
|
||||
{"ptt-type", 1, 0, 'P'},
|
||||
{"dcd-type", 1, 0, 'D'},
|
||||
{"serial-speed", 1, 0, 's'},
|
||||
{"civaddr", 1, 0, 'c'},
|
||||
{"send-cmd-term", 1, 0, 't'},
|
||||
{"list", 0, 0, 'l'},
|
||||
{"set-conf", 1, 0, 'C'},
|
||||
{"show-conf", 0, 0, 'L'},
|
||||
{"dump-caps", 0, 0, 'u'},
|
||||
{"vfo", 0, 0, 'o'},
|
||||
{"verbose", 0, 0, 'v'},
|
||||
{"help", 0, 0, 'h'},
|
||||
{"version", 0, 0, 'V'},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
|
@ -85,11 +85,10 @@ static struct option long_options[] =
|
|||
|
||||
int interactive = 1; /* if no cmd on command line, switch to interactive */
|
||||
int prompt = 1; /* Print prompt in rigctl */
|
||||
int opt_end= 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 opt_end = 0; /* only used by rigctld */
|
||||
int vfo_mode = 0; /* vfo_mode = 0 means target VFO is 'currVFO' */
|
||||
|
||||
char send_cmd_term = '\r'; /* send_cmd termination char */
|
||||
char send_cmd_term = '\r'; /* send_cmd termination char */
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
|
@ -244,7 +243,7 @@ int main (int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
rig_set_debug(verbose<2 ? RIG_DEBUG_WARN: verbose);
|
||||
rig_set_debug(verbose);
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "rigctl, %s\n", hamlib_version);
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "Report bugs to "
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* rigctl_parse.c - (C) Stephane Fillod 2000-2009
|
||||
* (C) Terry Embry 2008-2009
|
||||
* (C) Terry Embry 2008-2009
|
||||
* (C) The Hamlib Group 2010
|
||||
*
|
||||
* This program tests/controls a radio using Hamlib.
|
||||
|
@ -165,72 +165,71 @@ declare_proto_rig(chk_vfo);
|
|||
* Available alphabetic letters: -.--------K-----*-----W-Y-
|
||||
*/
|
||||
static struct test_table test_list[] = {
|
||||
{ 'F', "set_freq", set_freq, ARG_IN, "Frequency" },
|
||||
{ 'f', "get_freq", get_freq, ARG_OUT, "Frequency" },
|
||||
{ 'M', "set_mode", set_mode, ARG_IN, "Mode", "Passband" },
|
||||
{ 'm', "get_mode", get_mode, ARG_OUT, "Mode", "Passband" },
|
||||
{ 'I', "set_split_freq", set_split_freq, ARG_IN, "TX Frequency" },
|
||||
{ 'i', "get_split_freq", get_split_freq, ARG_OUT, "TX Frequency" },
|
||||
{ 'X', "set_split_mode", set_split_mode, ARG_IN, "TX Mode", "TX Passband" },
|
||||
{ 'x', "get_split_mode", get_split_mode, ARG_OUT, "TX Mode", "TX Passband" },
|
||||
{ 'S', "set_split_vfo", set_split_vfo, ARG_IN, "Split", "TX VFO" },
|
||||
{ 's', "get_split_vfo", get_split_vfo, ARG_OUT, "Split", "TX VFO" },
|
||||
{ 'N', "set_ts", set_ts, ARG_IN, "Tuning Step" },
|
||||
{ 'n', "get_ts", get_ts, ARG_OUT, "Tuning Step" },
|
||||
{ 'L', "set_level", set_level, ARG_IN, "Level", "Level Value" },
|
||||
{ 'l', "get_level", get_level, ARG_IN1|ARG_OUT2, "Level", "Level Value" },
|
||||
{ 'U', "set_func", set_func, ARG_IN, "Func", "Func Status" },
|
||||
{ 'u', "get_func", get_func, ARG_IN1|ARG_OUT2, "Func", "Func Status" },
|
||||
{ 'P', "set_parm", set_parm, ARG_IN|ARG_NOVFO, "Parm", "Parm Value" },
|
||||
{ 'p', "get_parm", get_parm, ARG_IN1|ARG_OUT2|ARG_NOVFO, "Parm", "Parm Value" },
|
||||
{ 'G', "vfo_op", vfo_op, ARG_IN, "Mem/VFO Op" },
|
||||
{ 'g', "scan", scan, ARG_IN, "Scan Fct", "Scan Channel" },
|
||||
{ 'A', "set_trn", set_trn, ARG_IN|ARG_NOVFO, "Transceive" },
|
||||
{ 'a', "get_trn", get_trn, ARG_OUT|ARG_NOVFO, "Transceive" },
|
||||
{ 'R', "set_rptr_shift", set_rptr_shift, ARG_IN, "Rptr Shift" },
|
||||
{ 'r', "get_rptr_shift", get_rptr_shift, ARG_OUT, "Rptr Shift" },
|
||||
{ 'O', "set_rptr_offs", set_rptr_offs, ARG_IN, "Rptr Offset" },
|
||||
{ 'o', "get_rptr_offs", get_rptr_offs, ARG_OUT, "Rptr Offset" },
|
||||
{ 'C', "set_ctcss_tone", set_ctcss_tone, ARG_IN, "CTCSS Tone" },
|
||||
{ 'c', "get_ctcss_tone", get_ctcss_tone, ARG_OUT, "CTCSS Tone" },
|
||||
{ 'D', "set_dcs_code", set_dcs_code, ARG_IN, "DCS Code" },
|
||||
{ 'd', "get_dcs_code", get_dcs_code, ARG_OUT, "DCS Code" },
|
||||
{ 0x90, "set_ctcss_sql", set_ctcss_sql, ARG_IN, "CTCSS Sql" },
|
||||
{ 0x91, "get_ctcss_sql", get_ctcss_sql, ARG_OUT, "CTCSS Sql" },
|
||||
{ 0x92, "set_dcs_sql", set_dcs_sql, ARG_IN, "DCS Sql" },
|
||||
{ 0x93, "get_dcs_sql", get_dcs_sql, ARG_OUT, "DCS Sql" },
|
||||
{ 'V', "set_vfo", set_vfo, ARG_IN|ARG_NOVFO, "VFO" },
|
||||
{ 'v', "get_vfo", get_vfo, ARG_OUT, "VFO" },
|
||||
{ 'T', "set_ptt", set_ptt, ARG_IN, "PTT" },
|
||||
{ 't', "get_ptt", get_ptt, ARG_OUT, "PTT" },
|
||||
{ 'E', "set_mem", set_mem, ARG_IN, "Memory#" },
|
||||
{ 'e', "get_mem", get_mem, ARG_OUT, "Memory#" },
|
||||
{ 'H', "set_channel", set_channel, ARG_IN|ARG_NOVFO, "Channel" },
|
||||
{ 'h', "get_channel", get_channel, ARG_IN|ARG_NOVFO, "Channel" },
|
||||
{ 'B', "set_bank", set_bank, ARG_IN, "Bank" },
|
||||
{ '_', "get_info", get_info, ARG_OUT|ARG_NOVFO, "Info" },
|
||||
{ 'J', "set_rit", set_rit, ARG_IN, "RIT" },
|
||||
{ 'j', "get_rit", get_rit, ARG_OUT, "RIT" },
|
||||
{ 'Z', "set_xit", set_xit, ARG_IN, "XIT" },
|
||||
{ 'z', "get_xit", get_xit, ARG_OUT, "XIT" },
|
||||
{ 'Y', "set_ant", set_ant, ARG_IN, "Antenna" },
|
||||
{ 'y', "get_ant", get_ant, ARG_OUT, "Antenna" },
|
||||
{ 0x87, "set_powerstat", set_powerstat, ARG_IN|ARG_NOVFO, "Power Status" },
|
||||
{ 0x88, "get_powerstat", get_powerstat, ARG_OUT|ARG_NOVFO, "Power Status" },
|
||||
{ 0x89, "send_dtmf", send_dtmf, ARG_IN, "Digits" },
|
||||
{ 0x8a, "recv_dtmf", recv_dtmf, ARG_OUT, "Digits" },
|
||||
{ '*', "reset", reset, ARG_IN, "Reset" },
|
||||
{ 'w', "send_cmd", send_cmd, ARG_IN1|ARG_IN_LINE|ARG_OUT2|ARG_NOVFO, "Cmd", "Reply" },
|
||||
{ 'b', "send_morse", send_morse, ARG_IN|ARG_IN_LINE, "Morse" },
|
||||
{ 0x8b, "get_dcd", get_dcd, ARG_OUT, "DCD" },
|
||||
{ '2', "power2mW", power2mW, ARG_IN1|ARG_IN2|ARG_IN3|ARG_OUT1|ARG_NOVFO, "Power [0.0..1.0]", "Frequency", "Mode", "Power mW" },
|
||||
{ '4', "mW2power", mW2power, ARG_IN1|ARG_IN2|ARG_IN3|ARG_OUT1|ARG_NOVFO, "Power mW", "Frequency", "Mode", "Power [0.0..1.0]" },
|
||||
{ '1', "dump_caps", dump_caps, ARG_NOVFO },
|
||||
{ '3', "dump_conf", dump_conf, ARG_NOVFO },
|
||||
{ 0x8f,"dump_state", dump_state, ARG_OUT|ARG_NOVFO },
|
||||
{ 0xf0,"chk_vfo", chk_vfo, ARG_NOVFO }, /* rigctld only--check for VFO mode */
|
||||
{ 'F', "set_freq", set_freq, ARG_IN, "Frequency" },
|
||||
{ 'f', "get_freq", get_freq, ARG_OUT, "Frequency" },
|
||||
{ 'M', "set_mode", set_mode, ARG_IN, "Mode", "Passband" },
|
||||
{ 'm', "get_mode", get_mode, ARG_OUT, "Mode", "Passband" },
|
||||
{ 'I', "set_split_freq", set_split_freq, ARG_IN, "TX Frequency" },
|
||||
{ 'i', "get_split_freq", get_split_freq, ARG_OUT, "TX Frequency" },
|
||||
{ 'X', "set_split_mode", set_split_mode, ARG_IN, "TX Mode", "TX Passband" },
|
||||
{ 'x', "get_split_mode", get_split_mode, ARG_OUT, "TX Mode", "TX Passband" },
|
||||
{ 'S', "set_split_vfo", set_split_vfo, ARG_IN, "Split", "TX VFO" },
|
||||
{ 's', "get_split_vfo", get_split_vfo, ARG_OUT, "Split", "TX VFO" },
|
||||
{ 'N', "set_ts", set_ts, ARG_IN, "Tuning Step" },
|
||||
{ 'n', "get_ts", get_ts, ARG_OUT, "Tuning Step" },
|
||||
{ 'L', "set_level", set_level, ARG_IN, "Level", "Level Value" },
|
||||
{ 'l', "get_level", get_level, ARG_IN1|ARG_OUT2, "Level", "Level Value" },
|
||||
{ 'U', "set_func", set_func, ARG_IN, "Func", "Func Status" },
|
||||
{ 'u', "get_func", get_func, ARG_IN1|ARG_OUT2, "Func", "Func Status" },
|
||||
{ 'P', "set_parm", set_parm, ARG_IN|ARG_NOVFO, "Parm", "Parm Value" },
|
||||
{ 'p', "get_parm", get_parm, ARG_IN1|ARG_OUT2|ARG_NOVFO, "Parm", "Parm Value" },
|
||||
{ 'G', "vfo_op", vfo_op, ARG_IN, "Mem/VFO Op" },
|
||||
{ 'g', "scan", scan, ARG_IN, "Scan Fct", "Scan Channel" },
|
||||
{ 'A', "set_trn", set_trn, ARG_IN|ARG_NOVFO, "Transceive" },
|
||||
{ 'a', "get_trn", get_trn, ARG_OUT|ARG_NOVFO, "Transceive" },
|
||||
{ 'R', "set_rptr_shift", set_rptr_shift, ARG_IN, "Rptr Shift" },
|
||||
{ 'r', "get_rptr_shift", get_rptr_shift, ARG_OUT, "Rptr Shift" },
|
||||
{ 'O', "set_rptr_offs", set_rptr_offs, ARG_IN, "Rptr Offset" },
|
||||
{ 'o', "get_rptr_offs", get_rptr_offs, ARG_OUT, "Rptr Offset" },
|
||||
{ 'C', "set_ctcss_tone", set_ctcss_tone, ARG_IN, "CTCSS Tone" },
|
||||
{ 'c', "get_ctcss_tone", get_ctcss_tone, ARG_OUT, "CTCSS Tone" },
|
||||
{ 'D', "set_dcs_code", set_dcs_code, ARG_IN, "DCS Code" },
|
||||
{ 'd', "get_dcs_code", get_dcs_code, ARG_OUT, "DCS Code" },
|
||||
{ 0x90, "set_ctcss_sql", set_ctcss_sql, ARG_IN, "CTCSS Sql" },
|
||||
{ 0x91, "get_ctcss_sql", get_ctcss_sql, ARG_OUT, "CTCSS Sql" },
|
||||
{ 0x92, "set_dcs_sql", set_dcs_sql, ARG_IN, "DCS Sql" },
|
||||
{ 0x93, "get_dcs_sql", get_dcs_sql, ARG_OUT, "DCS Sql" },
|
||||
{ 'V', "set_vfo", set_vfo, ARG_IN|ARG_NOVFO, "VFO" },
|
||||
{ 'v', "get_vfo", get_vfo, ARG_OUT, "VFO" },
|
||||
{ 'T', "set_ptt", set_ptt, ARG_IN, "PTT" },
|
||||
{ 't', "get_ptt", get_ptt, ARG_OUT, "PTT" },
|
||||
{ 'E', "set_mem", set_mem, ARG_IN, "Memory#" },
|
||||
{ 'e', "get_mem", get_mem, ARG_OUT, "Memory#" },
|
||||
{ 'H', "set_channel", set_channel, ARG_IN|ARG_NOVFO, "Channel" },
|
||||
{ 'h', "get_channel", get_channel, ARG_IN|ARG_NOVFO, "Channel" },
|
||||
{ 'B', "set_bank", set_bank, ARG_IN, "Bank" },
|
||||
{ '_', "get_info", get_info, ARG_OUT|ARG_NOVFO, "Info" },
|
||||
{ 'J', "set_rit", set_rit, ARG_IN, "RIT" },
|
||||
{ 'j', "get_rit", get_rit, ARG_OUT, "RIT" },
|
||||
{ 'Z', "set_xit", set_xit, ARG_IN, "XIT" },
|
||||
{ 'z', "get_xit", get_xit, ARG_OUT, "XIT" },
|
||||
{ 'Y', "set_ant", set_ant, ARG_IN, "Antenna" },
|
||||
{ 'y', "get_ant", get_ant, ARG_OUT, "Antenna" },
|
||||
{ 0x87, "set_powerstat", set_powerstat, ARG_IN|ARG_NOVFO, "Power Status" },
|
||||
{ 0x88, "get_powerstat", get_powerstat, ARG_OUT|ARG_NOVFO, "Power Status" },
|
||||
{ 0x89, "send_dtmf", send_dtmf, ARG_IN, "Digits" },
|
||||
{ 0x8a, "recv_dtmf", recv_dtmf, ARG_OUT, "Digits" },
|
||||
{ '*', "reset", reset, ARG_IN, "Reset" },
|
||||
{ 'w', "send_cmd", send_cmd, ARG_IN1|ARG_IN_LINE|ARG_OUT2|ARG_NOVFO, "Cmd", "Reply" },
|
||||
{ 'b', "send_morse", send_morse, ARG_IN|ARG_IN_LINE, "Morse" },
|
||||
{ 0x8b, "get_dcd", get_dcd, ARG_OUT, "DCD" },
|
||||
{ '2', "power2mW", power2mW, ARG_IN1|ARG_IN2|ARG_IN3|ARG_OUT1|ARG_NOVFO, "Power [0.0..1.0]", "Frequency", "Mode", "Power mW" },
|
||||
{ '4', "mW2power", mW2power, ARG_IN1|ARG_IN2|ARG_IN3|ARG_OUT1|ARG_NOVFO, "Power mW", "Frequency", "Mode", "Power [0.0..1.0]" },
|
||||
{ '1', "dump_caps", dump_caps, ARG_NOVFO },
|
||||
{ '3', "dump_conf", dump_conf, ARG_NOVFO },
|
||||
{ 0x8f,"dump_state", dump_state, ARG_OUT|ARG_NOVFO },
|
||||
{ 0xf0,"chk_vfo", chk_vfo, ARG_NOVFO }, /* rigctld only--check for VFO mode */
|
||||
{ 0x00, "", NULL },
|
||||
|
||||
};
|
||||
|
||||
static struct test_table *find_cmd_entry(int cmd)
|
||||
|
@ -284,6 +283,7 @@ extern int opt_end;
|
|||
extern int vfo_mode;
|
||||
extern char send_cmd_term;
|
||||
int ext_resp = 0;
|
||||
unsigned char resp_sep = '\n'; /* Default response separator */
|
||||
|
||||
int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc)
|
||||
{
|
||||
|
@ -306,7 +306,8 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc)
|
|||
return -1;
|
||||
|
||||
/* Extended response protocol requested with leading '+' on command
|
||||
* string--rigctld only! */
|
||||
* string--rigctld only!
|
||||
*/
|
||||
if (cmd == '+' && !prompt) {
|
||||
ext_resp = 1;
|
||||
if (scanfc(fin, "%c", &cmd) < 0)
|
||||
|
@ -315,6 +316,15 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (cmd != '\\' && cmd != '_' && ispunct(cmd) && !prompt) {
|
||||
ext_resp = 1;
|
||||
resp_sep = cmd;
|
||||
if (scanfc(fin, "%c", &cmd) < 0)
|
||||
return -1;
|
||||
} else if (cmd != '\\' && cmd != '?' && cmd != '_' && ispunct(cmd) && prompt) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* command by name */
|
||||
if (cmd == '\\') {
|
||||
unsigned char cmd_name[MAXNAMSIZ], *pcmd = cmd_name;
|
||||
|
@ -477,23 +487,23 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc)
|
|||
rig_debug(RIG_DEBUG_TRACE, "rigctl(d): %c '0x%02x' '%s' '%s' '%s'\n",
|
||||
cmd, vfo, p1, p2, p3);
|
||||
|
||||
/*
|
||||
* Extended Response protocol: output received command name and arguments
|
||||
* response. Don't send command header on '\chk_vfo' command.
|
||||
*/
|
||||
if (interactive && ext_resp && cmd != 0xf0) {
|
||||
char a1[MAXARGSZ + 1];
|
||||
char a2[MAXARGSZ + 1];
|
||||
char a3[MAXARGSZ + 1];
|
||||
char vfo_str[MAXARGSZ + 1];
|
||||
/*
|
||||
* Extended Response protocol: output received command name and arguments
|
||||
* response. Don't send command header on '\chk_vfo' command.
|
||||
*/
|
||||
if (interactive && ext_resp && !prompt && cmd != 0xf0) {
|
||||
char a1[MAXARGSZ + 1];
|
||||
char a2[MAXARGSZ + 1];
|
||||
char a3[MAXARGSZ + 1];
|
||||
char vfo_str[MAXARGSZ + 1];
|
||||
|
||||
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);
|
||||
p3 == NULL ? a3[0] = '\0' : snprintf(a3, sizeof(a3), " %s", p3);
|
||||
p2 == NULL ? a2[0] = '\0' : snprintf(a2, sizeof(a2), " %s", p2);
|
||||
p3 == NULL ? a3[0] = '\0' : snprintf(a3, sizeof(a3), " %s", p3);
|
||||
|
||||
fprintf(fout, "%s:%s%s%s%s\n", cmd_entry->name, vfo_str, a1, a2, a3);
|
||||
}
|
||||
fprintf(fout, "%s:%s%s%s%s%c", cmd_entry->name, vfo_str, a1, a2, a3, resp_sep);
|
||||
}
|
||||
|
||||
retcode = (*cmd_entry->rig_routine)(my_rig, fout, interactive,
|
||||
cmd_entry, vfo, p1, p2, p3);
|
||||
|
@ -505,12 +515,13 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc)
|
|||
|
||||
if (retcode != RIG_OK) {
|
||||
/* only for rigctld */
|
||||
if ((interactive && !prompt && ext_resp) || (interactive && !prompt)) {
|
||||
fprintf(fout, NETRIGCTL_RET "%d\n", retcode);
|
||||
ext_resp = 0;
|
||||
}
|
||||
if (interactive && !prompt) {
|
||||
fprintf(fout, NETRIGCTL_RET "%d\n", retcode);
|
||||
ext_resp = 0;
|
||||
resp_sep = '\n';
|
||||
}
|
||||
else
|
||||
fprintf(fout, "%s: error = %s\n", cmd_entry->name, rigerror(retcode));
|
||||
fprintf(fout, "%s: error = %s\n", cmd_entry->name, rigerror(retcode));
|
||||
} else {
|
||||
/* only for rigctld */
|
||||
if (interactive && !prompt) {
|
||||
|
@ -518,15 +529,18 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc)
|
|||
if (!(cmd_entry->flags & ARG_OUT)
|
||||
&& !opt_end && !ext_resp && cmd != 0xf0)
|
||||
fprintf(fout, NETRIGCTL_RET "0\n");
|
||||
/* block marker protocol */
|
||||
else if (ext_resp && cmd != 0xf0) {
|
||||
|
||||
/* Extended Response protocol */
|
||||
else if (ext_resp && cmd != 0xf0) {
|
||||
fprintf(fout, NETRIGCTL_RET "0\n");
|
||||
ext_resp = 0;
|
||||
resp_sep = '\n';
|
||||
}
|
||||
|
||||
/* Nate's protocol (obsolete) */
|
||||
else if ((cmd_entry->flags & ARG_OUT) && opt_end)
|
||||
fprintf(fout, "END\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fflush(fout);
|
||||
|
@ -546,7 +560,7 @@ void usage_rig(FILE *fout)
|
|||
int i, nbspaces;
|
||||
|
||||
fprintf(fout, "Commands (some may not be available for this rig):\n");
|
||||
for (i=0; test_list[i].cmd != 0; i++) {
|
||||
for (i = 0; test_list[i].cmd != 0; i++) {
|
||||
fprintf(fout, "%c: %-16s(", isprint(test_list[i].cmd) ?
|
||||
test_list[i].cmd:'?', test_list[i].name);
|
||||
|
||||
|
@ -558,7 +572,7 @@ void usage_rig(FILE *fout)
|
|||
if (test_list[i].arg3 && (test_list[i].flags&ARG_IN3))
|
||||
nbspaces -= fprintf(fout, ",%s", test_list[i].arg3);
|
||||
|
||||
if (i%2)
|
||||
if (i % 2)
|
||||
fprintf(fout, ")\n");
|
||||
else
|
||||
fprintf(fout, ")%*s", nbspaces, " ");
|
||||
|
@ -609,7 +623,7 @@ int print_conf_list(const struct confparams *cfp, rig_ptr_t data)
|
|||
|
||||
static int print_model_list(const struct rig_caps *caps, void *data)
|
||||
{
|
||||
printf("%d\t%-16s%-24s%-8s%s\n", caps->rig_model, caps->mfg_name,
|
||||
printf("%d\t%-23s%-24s%-12s%s\n", caps->rig_model, caps->mfg_name,
|
||||
caps->model_name, caps->version, rig_strstatus(caps->status));
|
||||
return 1; /* !=0, we want them all ! */
|
||||
}
|
||||
|
@ -620,7 +634,7 @@ void list_models()
|
|||
|
||||
rig_load_all_backends();
|
||||
|
||||
printf("Rig#\tMfg Model Vers. Status\n");
|
||||
printf("Rig#\tMfgr Model Vers. Status\n");
|
||||
status = rig_list_foreach(print_model_list, NULL);
|
||||
if (status != RIG_OK ) {
|
||||
printf("rig_list_foreach: error = %s \n", rigerror(status));
|
||||
|
@ -677,7 +691,7 @@ declare_proto_rig(get_freq)
|
|||
|
||||
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||
fprintf(fout, "%s: ", cmd->arg1); /* i.e. "Frequency" */
|
||||
fprintf(fout, "%"PRIll"\n", (long long)freq);
|
||||
fprintf(fout, "%"PRIll"%c", (long long)freq, resp_sep);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -702,7 +716,7 @@ declare_proto_rig(get_rit)
|
|||
return status;
|
||||
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||
fprintf(fout, "%s: ", cmd->arg1);
|
||||
fprintf(fout, "%ld\n", rit);
|
||||
fprintf(fout, "%ld%c", rit, resp_sep);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -727,7 +741,7 @@ declare_proto_rig(get_xit)
|
|||
return status;
|
||||
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||
fprintf(fout, "%s: ", cmd->arg1);
|
||||
fprintf(fout, "%ld\n", xit);
|
||||
fprintf(fout, "%ld%c", xit, resp_sep);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -763,10 +777,10 @@ declare_proto_rig(get_mode)
|
|||
return status;
|
||||
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||
fprintf(fout, "%s: ", cmd->arg1);
|
||||
fprintf(fout, "%s\n", rig_strrmode(mode));
|
||||
fprintf(fout, "%s%c", rig_strrmode(mode), resp_sep);
|
||||
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||
fprintf(fout, "%s: ", cmd->arg2);
|
||||
fprintf(fout, "%ld\n", width);
|
||||
fprintf(fout, "%ld%c", width, resp_sep);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -787,7 +801,7 @@ declare_proto_rig(get_vfo)
|
|||
return status;
|
||||
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||
fprintf(fout, "%s: ", cmd->arg1);
|
||||
fprintf(fout, "%s\n", rig_strvfo(vfo));
|
||||
fprintf(fout, "%s%c", rig_strvfo(vfo), resp_sep);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -795,7 +809,7 @@ declare_proto_rig(get_vfo)
|
|||
/* 'T' */
|
||||
declare_proto_rig(set_ptt)
|
||||
{
|
||||
int ptt;
|
||||
int ptt;
|
||||
|
||||
sscanf(arg1, "%d", &ptt);
|
||||
return rig_set_ptt(rig, vfo, (ptt_t) ptt);
|
||||
|
@ -812,7 +826,7 @@ declare_proto_rig(get_ptt)
|
|||
return status;
|
||||
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||
fprintf(fout, "%s: ", cmd->arg1);
|
||||
fprintf(fout, "%d\n", ptt);
|
||||
fprintf(fout, "%d%c", ptt, resp_sep);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -828,7 +842,7 @@ declare_proto_rig(get_dcd)
|
|||
return status;
|
||||
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||
fprintf(fout, "%s: ", cmd->arg1);
|
||||
fprintf(fout, "%d\n", dcd);
|
||||
fprintf(fout, "%d%c", dcd, resp_sep);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -853,7 +867,7 @@ declare_proto_rig(get_rptr_shift)
|
|||
return status;
|
||||
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||
fprintf(fout, "%s: ", cmd->arg1);
|
||||
fprintf(fout, "%s\n", rig_strptrshift(rptr_shift));
|
||||
fprintf(fout, "%s%c", rig_strptrshift(rptr_shift), resp_sep);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -878,7 +892,7 @@ declare_proto_rig(get_rptr_offs)
|
|||
return status;
|
||||
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||
fprintf(fout, "%s: ", cmd->arg1);
|
||||
fprintf(fout, "%ld\n", rptr_offs);
|
||||
fprintf(fout, "%ld%c", rptr_offs, resp_sep);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -903,7 +917,7 @@ declare_proto_rig(get_ctcss_tone)
|
|||
return status;
|
||||
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||
fprintf(fout, "%s: ", cmd->arg1);
|
||||
fprintf(fout, "%d\n", tone);
|
||||
fprintf(fout, "%d%c", tone, resp_sep);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -928,7 +942,7 @@ declare_proto_rig(get_dcs_code)
|
|||
return status;
|
||||
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||
fprintf(fout, "%s: ", cmd->arg1);
|
||||
fprintf(fout, "%d\n", code);
|
||||
fprintf(fout, "%d%c", code, resp_sep);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -953,7 +967,7 @@ declare_proto_rig(get_ctcss_sql)
|
|||
return status;
|
||||
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||
fprintf(fout, "%s: ", cmd->arg1);
|
||||
fprintf(fout, "%d\n", tone);
|
||||
fprintf(fout, "%d%c", tone, resp_sep);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -978,7 +992,7 @@ declare_proto_rig(get_dcs_sql)
|
|||
return status;
|
||||
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||
fprintf(fout, "%s: ", cmd->arg1);
|
||||
fprintf(fout, "%d\n", code);
|
||||
fprintf(fout, "%d%c", code, resp_sep);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -1005,7 +1019,7 @@ declare_proto_rig(get_split_freq)
|
|||
return status;
|
||||
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||
fprintf(fout, "%s: ", cmd->arg1);
|
||||
fprintf(fout, "%"PRIll"\n", (long long)txfreq);
|
||||
fprintf(fout, "%"PRIll"%c", (long long)txfreq, resp_sep);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -1014,7 +1028,7 @@ declare_proto_rig(get_split_freq)
|
|||
declare_proto_rig(set_split_mode)
|
||||
{
|
||||
rmode_t mode;
|
||||
int width;
|
||||
int width;
|
||||
vfo_t txvfo = RIG_VFO_TX;
|
||||
|
||||
#if 0
|
||||
|
@ -1043,10 +1057,10 @@ declare_proto_rig(get_split_mode)
|
|||
return status;
|
||||
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||
fprintf(fout, "%s: ", cmd->arg1);
|
||||
fprintf(fout, "%s\n", rig_strrmode(mode));
|
||||
fprintf(fout, "%s%c", rig_strrmode(mode), resp_sep);
|
||||
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||
fprintf(fout, "%s: ", cmd->arg2);
|
||||
fprintf(fout, "%ld\n", width);
|
||||
fprintf(fout, "%ld%c", width, resp_sep);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -1072,10 +1086,10 @@ declare_proto_rig(get_split_vfo)
|
|||
return status;
|
||||
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||
fprintf(fout, "%s: ", cmd->arg1);
|
||||
fprintf(fout, "%d\n", split);
|
||||
fprintf(fout, "%d%c", split, resp_sep);
|
||||
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||
fprintf(fout, "%s: ", cmd->arg2);
|
||||
fprintf(fout, "%s\n", rig_strvfo(tx_vfo));
|
||||
fprintf(fout, "%s%c", rig_strvfo(tx_vfo), resp_sep);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -1100,7 +1114,7 @@ declare_proto_rig(get_ts)
|
|||
return status;
|
||||
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||
fprintf(fout, "%s: ", cmd->arg1);
|
||||
fprintf(fout, "%ld\n", ts);
|
||||
fprintf(fout, "%ld%c", ts, resp_sep);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -1123,7 +1137,7 @@ declare_proto_rig(power2mW)
|
|||
return status;
|
||||
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||
fprintf(fout, "%s: ", cmd->arg4);
|
||||
fprintf(fout, "%i\n", mwp);
|
||||
fprintf(fout, "%i%c", mwp, resp_sep);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -1146,7 +1160,7 @@ declare_proto_rig(mW2power)
|
|||
return status;
|
||||
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||
fprintf(fout, "%s: ", cmd->arg4);
|
||||
fprintf(fout, "%f\n", power);
|
||||
fprintf(fout, "%f%c", power, resp_sep);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -1455,7 +1469,7 @@ declare_proto_rig(get_mem)
|
|||
return status;
|
||||
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||
fprintf(fout, "%s: ", cmd->arg1);
|
||||
fprintf(fout, "%d\n", ch);
|
||||
fprintf(fout, "%d%c", ch, resp_sep);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -1497,156 +1511,156 @@ declare_proto_rig(scan)
|
|||
/* 'H' */
|
||||
declare_proto_rig(set_channel)
|
||||
{
|
||||
const channel_cap_t *mem_caps = NULL;
|
||||
const chan_t *chan_list;
|
||||
channel_t chan;
|
||||
int status;
|
||||
char s[16];
|
||||
const channel_cap_t *mem_caps = NULL;
|
||||
const chan_t *chan_list;
|
||||
channel_t chan;
|
||||
int status;
|
||||
char s[16];
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "set_channel: arg1[0] = %d\n", arg1[0]);
|
||||
rig_debug(RIG_DEBUG_TRACE, "set_channel: arg1[0] = %d\n", arg1[0]);
|
||||
|
||||
memset(&chan, 0, sizeof(channel_t));
|
||||
memset(&chan, 0, sizeof(channel_t));
|
||||
|
||||
if (isdigit(arg1[0])) {
|
||||
chan.vfo = RIG_VFO_MEM;
|
||||
if (sscanf(arg1, "%d", &chan.channel_num) != 1)
|
||||
return -RIG_EINVAL;
|
||||
/*
|
||||
* find mem_caps in caps, we'll need it later
|
||||
*/
|
||||
chan_list = rig_lookup_mem_caps(rig, chan.channel_num);
|
||||
if (chan_list)
|
||||
mem_caps = &chan_list->mem_caps;
|
||||
if (isdigit(arg1[0])) {
|
||||
chan.vfo = RIG_VFO_MEM;
|
||||
if (sscanf(arg1, "%d", &chan.channel_num) != 1)
|
||||
return -RIG_EINVAL;
|
||||
/*
|
||||
* find mem_caps in caps, we'll need it later
|
||||
*/
|
||||
chan_list = rig_lookup_mem_caps(rig, chan.channel_num);
|
||||
if (chan_list)
|
||||
mem_caps = &chan_list->mem_caps;
|
||||
|
||||
} else {
|
||||
chan.vfo = rig_parse_vfo(arg1);
|
||||
chan.channel_num = 0;
|
||||
} else {
|
||||
chan.vfo = rig_parse_vfo(arg1);
|
||||
chan.channel_num = 0;
|
||||
|
||||
/* TODO: mem_caps for VFO! */
|
||||
}
|
||||
/* TODO: mem_caps for VFO! */
|
||||
}
|
||||
|
||||
if (!mem_caps)
|
||||
return -RIG_ECONF;
|
||||
if (!mem_caps)
|
||||
return -RIG_ECONF;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "set_channel: mem_caps->bank_num = %d, mem_caps->freq = %d\n", mem_caps->bank_num, mem_caps->freq);
|
||||
rig_debug(RIG_DEBUG_TRACE, "set_channel: mem_caps->bank_num = %d, mem_caps->freq = %d\n", mem_caps->bank_num, mem_caps->freq);
|
||||
|
||||
if (mem_caps->bank_num) {
|
||||
printf("Bank Num: ");
|
||||
status = scanf("%d", &chan.bank_num);
|
||||
}
|
||||
if (mem_caps->vfo) {
|
||||
printf("vfo (VFOA,MEM,etc...): ");
|
||||
status = scanf("%s", s);
|
||||
chan.vfo = rig_parse_vfo(s);
|
||||
}
|
||||
if (mem_caps->ant) {
|
||||
printf("ant: ");
|
||||
status = scanf("%d", &chan.ant);
|
||||
}
|
||||
if (mem_caps->freq) {
|
||||
printf("Frequency: ");
|
||||
status = scanf("%"SCNfreq, &chan.freq);
|
||||
}
|
||||
if (mem_caps->mode) {
|
||||
printf("mode (FM,LSB,etc...): ");
|
||||
status = scanf("%s", s);
|
||||
chan.mode = rig_parse_mode(s);
|
||||
}
|
||||
if (mem_caps->width) {
|
||||
printf("width: ");
|
||||
status = scanf("%ld", &chan.width);
|
||||
}
|
||||
if (mem_caps->tx_freq) {
|
||||
printf("tx freq (VFOA,MEM,etc...): ");
|
||||
status = scanf("%"SCNfreq, &chan.tx_freq);
|
||||
}
|
||||
if (mem_caps->tx_mode) {
|
||||
printf("tx mode (FM,LSB,etc...): ");
|
||||
status = scanf("%s", s);
|
||||
chan.tx_mode = rig_parse_mode(s);
|
||||
}
|
||||
if (mem_caps->tx_width) {
|
||||
printf("tx width: ");
|
||||
status = scanf("%ld", &chan.tx_width);
|
||||
}
|
||||
if (mem_caps->split) {
|
||||
printf("split (0,1): ");
|
||||
status = scanf("%d", &status);
|
||||
chan.split = status;
|
||||
}
|
||||
if (mem_caps->tx_vfo) {
|
||||
printf("tx vfo (VFOA,MEM,etc...): ");
|
||||
status = scanf("%s", s);
|
||||
chan.tx_vfo = rig_parse_vfo(s);
|
||||
}
|
||||
if (mem_caps->rptr_shift) {
|
||||
printf("rptr shift (+-0): ");
|
||||
status = scanf("%s", s);
|
||||
chan.rptr_shift = rig_parse_rptr_shift(s);
|
||||
}
|
||||
if (mem_caps->rptr_offs) {
|
||||
printf("rptr offset: ");
|
||||
status = scanf("%ld", &chan.rptr_offs);
|
||||
}
|
||||
if (mem_caps->tuning_step) {
|
||||
printf("tuning step: ");
|
||||
status = scanf("%ld", &chan.tuning_step);
|
||||
}
|
||||
if (mem_caps->rit) {
|
||||
printf("rit (Hz,0=off): ");
|
||||
status = scanf("%ld", &chan.rit);
|
||||
}
|
||||
if (mem_caps->xit) {
|
||||
printf("xit (Hz,0=off): ");
|
||||
status = scanf("%ld", &chan.xit);
|
||||
}
|
||||
if (mem_caps->funcs) {
|
||||
printf("funcs: ");
|
||||
status = scanf("%lx", &chan.funcs);
|
||||
}
|
||||
if (mem_caps->bank_num) {
|
||||
printf("Bank Num: ");
|
||||
status = scanf("%d", &chan.bank_num);
|
||||
}
|
||||
if (mem_caps->vfo) {
|
||||
printf("vfo (VFOA,MEM,etc...): ");
|
||||
status = scanf("%s", s);
|
||||
chan.vfo = rig_parse_vfo(s);
|
||||
}
|
||||
if (mem_caps->ant) {
|
||||
printf("ant: ");
|
||||
status = scanf("%d", &chan.ant);
|
||||
}
|
||||
if (mem_caps->freq) {
|
||||
printf("Frequency: ");
|
||||
status = scanf("%"SCNfreq, &chan.freq);
|
||||
}
|
||||
if (mem_caps->mode) {
|
||||
printf("mode (FM,LSB,etc...): ");
|
||||
status = scanf("%s", s);
|
||||
chan.mode = rig_parse_mode(s);
|
||||
}
|
||||
if (mem_caps->width) {
|
||||
printf("width: ");
|
||||
status = scanf("%ld", &chan.width);
|
||||
}
|
||||
if (mem_caps->tx_freq) {
|
||||
printf("tx freq (VFOA,MEM,etc...): ");
|
||||
status = scanf("%"SCNfreq, &chan.tx_freq);
|
||||
}
|
||||
if (mem_caps->tx_mode) {
|
||||
printf("tx mode (FM,LSB,etc...): ");
|
||||
status = scanf("%s", s);
|
||||
chan.tx_mode = rig_parse_mode(s);
|
||||
}
|
||||
if (mem_caps->tx_width) {
|
||||
printf("tx width: ");
|
||||
status = scanf("%ld", &chan.tx_width);
|
||||
}
|
||||
if (mem_caps->split) {
|
||||
printf("split (0,1): ");
|
||||
status = scanf("%d", &status);
|
||||
chan.split = status;
|
||||
}
|
||||
if (mem_caps->tx_vfo) {
|
||||
printf("tx vfo (VFOA,MEM,etc...): ");
|
||||
status = scanf("%s", s);
|
||||
chan.tx_vfo = rig_parse_vfo(s);
|
||||
}
|
||||
if (mem_caps->rptr_shift) {
|
||||
printf("rptr shift (+-0): ");
|
||||
status = scanf("%s", s);
|
||||
chan.rptr_shift = rig_parse_rptr_shift(s);
|
||||
}
|
||||
if (mem_caps->rptr_offs) {
|
||||
printf("rptr offset: ");
|
||||
status = scanf("%ld", &chan.rptr_offs);
|
||||
}
|
||||
if (mem_caps->tuning_step) {
|
||||
printf("tuning step: ");
|
||||
status = scanf("%ld", &chan.tuning_step);
|
||||
}
|
||||
if (mem_caps->rit) {
|
||||
printf("rit (Hz,0=off): ");
|
||||
status = scanf("%ld", &chan.rit);
|
||||
}
|
||||
if (mem_caps->xit) {
|
||||
printf("xit (Hz,0=off): ");
|
||||
status = scanf("%ld", &chan.xit);
|
||||
}
|
||||
if (mem_caps->funcs) {
|
||||
printf("funcs: ");
|
||||
status = scanf("%lx", &chan.funcs);
|
||||
}
|
||||
#if 0
|
||||
/* for all levels, ask */
|
||||
if (mem_caps->levels)
|
||||
sscanf(arg1, "%d", &chan.levels);
|
||||
/* for all levels, ask */
|
||||
if (mem_caps->levels)
|
||||
sscanf(arg1, "%d", &chan.levels);
|
||||
#endif
|
||||
if (mem_caps->ctcss_tone) {
|
||||
printf("ctcss tone freq in tenth of Hz (0=off): ");
|
||||
status = scanf("%d", &chan.ctcss_tone);
|
||||
}
|
||||
if (mem_caps->ctcss_sql) {
|
||||
printf("ctcss sql freq in tenth of Hz (0=off): ");
|
||||
status = scanf("%d", &chan.ctcss_sql);
|
||||
}
|
||||
if (mem_caps->dcs_code) {
|
||||
printf("dcs code: ");
|
||||
status = scanf("%d", &chan.dcs_code);
|
||||
}
|
||||
if (mem_caps->dcs_sql) {
|
||||
printf("dcs sql: ");
|
||||
status = scanf("%d", &chan.dcs_sql);
|
||||
}
|
||||
if (mem_caps->scan_group) {
|
||||
printf("scan group: ");
|
||||
status = scanf("%d", &chan.scan_group);
|
||||
}
|
||||
if (mem_caps->flags) {
|
||||
printf("flags: ");
|
||||
status = scanf("%d", &chan.flags);
|
||||
}
|
||||
if (mem_caps->channel_desc) {
|
||||
printf("channel desc: ");
|
||||
status = scanf("%s", s);
|
||||
strcpy(chan.channel_desc, s);
|
||||
}
|
||||
if (mem_caps->ctcss_tone) {
|
||||
printf("ctcss tone freq in tenth of Hz (0=off): ");
|
||||
status = scanf("%d", &chan.ctcss_tone);
|
||||
}
|
||||
if (mem_caps->ctcss_sql) {
|
||||
printf("ctcss sql freq in tenth of Hz (0=off): ");
|
||||
status = scanf("%d", &chan.ctcss_sql);
|
||||
}
|
||||
if (mem_caps->dcs_code) {
|
||||
printf("dcs code: ");
|
||||
status = scanf("%d", &chan.dcs_code);
|
||||
}
|
||||
if (mem_caps->dcs_sql) {
|
||||
printf("dcs sql: ");
|
||||
status = scanf("%d", &chan.dcs_sql);
|
||||
}
|
||||
if (mem_caps->scan_group) {
|
||||
printf("scan group: ");
|
||||
status = scanf("%d", &chan.scan_group);
|
||||
}
|
||||
if (mem_caps->flags) {
|
||||
printf("flags: ");
|
||||
status = scanf("%d", &chan.flags);
|
||||
}
|
||||
if (mem_caps->channel_desc) {
|
||||
printf("channel desc: ");
|
||||
status = scanf("%s", s);
|
||||
strcpy(chan.channel_desc, s);
|
||||
}
|
||||
#if 0
|
||||
/* TODO: same as levels */
|
||||
if (mem_caps->ext_levels)
|
||||
sscanf(arg1, "%d", &chan.ext_levels);
|
||||
/* TODO: same as levels */
|
||||
if (mem_caps->ext_levels)
|
||||
sscanf(arg1, "%d", &chan.ext_levels);
|
||||
#endif
|
||||
|
||||
status = rig_set_channel(rig, &chan);
|
||||
status = rig_set_channel(rig, &chan);
|
||||
|
||||
return status;
|
||||
return status;
|
||||
}
|
||||
|
||||
/* 'h' */
|
||||
|
@ -1655,7 +1669,7 @@ declare_proto_rig(get_channel)
|
|||
int status;
|
||||
channel_t chan;
|
||||
|
||||
memset(&chan, 0, sizeof(channel_t));
|
||||
memset(&chan, 0, sizeof(channel_t));
|
||||
|
||||
if (isdigit(arg1[0])) {
|
||||
chan.vfo = RIG_VFO_MEM;
|
||||
|
@ -1741,7 +1755,7 @@ declare_proto_rig(get_trn)
|
|||
return status;
|
||||
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||
fprintf(fout, "%s: ", cmd->arg1);
|
||||
fprintf(fout, "%d\n", trn);
|
||||
fprintf(fout, "%d%c", trn, resp_sep);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -1754,7 +1768,7 @@ declare_proto_rig(get_info)
|
|||
s = rig_get_info(rig);
|
||||
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||
fprintf(fout, "%s: ", cmd->arg1);
|
||||
fprintf(fout, "%s\n", s ? s : "None");
|
||||
fprintf(fout, "%s%c", s ? s : "None", resp_sep);
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -1908,7 +1922,7 @@ declare_proto_rig(dump_state)
|
|||
|
||||
#if 0
|
||||
gran_t level_gran[RIG_SETTING_MAX]; /*!< level granularity */
|
||||
gran_t parm_gran[RIG_SETTING_MAX]; /*!< parm granularity */
|
||||
gran_t parm_gran[RIG_SETTING_MAX]; /*!< parm granularity */
|
||||
#endif
|
||||
|
||||
return RIG_OK;
|
||||
|
@ -1942,7 +1956,7 @@ declare_proto_rig(get_ant)
|
|||
return status;
|
||||
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||
fprintf(fout, "%s: ", cmd->arg1);
|
||||
fprintf(fout, "%d\n", rig_setting2idx(ant));
|
||||
fprintf(fout, "%d%c", rig_setting2idx(ant), resp_sep);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
|
211
tests/rigctld.8
211
tests/rigctld.8
|
@ -2,7 +2,7 @@
|
|||
.\" First parameter, NAME, should be all caps
|
||||
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
||||
.\" other parameters are allowed: see man(7), man(1)
|
||||
.TH RIGCTLD "8" "February 8, 2010" "Hamlib" "Rig Control Daemon"
|
||||
.TH RIGCTLD "8" "February 17, 2010" "Hamlib" "Rig Control Daemon"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.\" Some roff macros, for reference:
|
||||
|
@ -39,17 +39,21 @@ 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.
|
||||
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.
|
||||
Each line is terminated with a newline '\\n' character.
|
||||
Each line is terminated with a newline '\\n' character. This protocol is primarily
|
||||
for use by the \fINET rigctl\fP (rig model 2)backend.
|
||||
.PP
|
||||
A separate \fBExtended Response\fP protocol extends the above
|
||||
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 response marker which
|
||||
includes the \fBHamlib\fP success or failure value. See the \fIPROTOCOL\fP
|
||||
section for details.
|
||||
section for details. Consider using this protocol for clients that will interact
|
||||
with \fBrigctld\fP directly through a TCP socket.
|
||||
.PP
|
||||
Keep in mind that \fBHamlib\fP is BETA level software.
|
||||
While a lot of backend libraries lack complete rig support, the basic functions
|
||||
are usually well supported.
|
||||
are usually well supported. The API may change without publicized notice,
|
||||
while an advancement of the minor version (e.g. 1.1.x to 1.2.x) indicates such
|
||||
a change.
|
||||
.PP
|
||||
Please report bugs and provide feedback at the e-mail address given in the
|
||||
\fIREPORTING BUGS\fP section. Patches and code enhancements are also welcome.
|
||||
|
@ -64,8 +68,8 @@ Select radio model number. See the -l, --list option below.
|
|||
.TP
|
||||
.B \-r, --rig-file=device
|
||||
Use \fIdevice\fP as the file name of the port the radio is connected.
|
||||
Often a serial port, but could be a USB to serial adapter. Typically
|
||||
/dev/ttyS0, /dev/ttyS1, /dev/ttyUSB0, etc.
|
||||
Often a serial port, but could be a USB to serial adapter or USB port device.
|
||||
Typically /dev/ttyS0, /dev/ttyS1, /dev/ttyUSB0, etc.
|
||||
.TP
|
||||
.B \-p, --ptt-file=device
|
||||
Use \fIdevice\fP as the file name of the Push-To-Talk device using a
|
||||
|
@ -90,7 +94,7 @@ backend capabilities (set by -m above) as the default.
|
|||
.B \-c, --civaddr=id
|
||||
Use \fIid\fP as the CI-V address to communicate with the rig. Only useful for
|
||||
Icom rigs.
|
||||
.br
|
||||
.sp
|
||||
\fBN.B.\fP: The \fIid\fP is in decimal notation, unless prefixed by
|
||||
\fI0x\fP for a hexadecimal value.
|
||||
.TP
|
||||
|
@ -99,21 +103,21 @@ Use \fIIPADDR\fP as the listening IP address. The default is ANY.
|
|||
.TP
|
||||
.B \-t, --port=number
|
||||
Use \fInumber\fP as the TCP listening port. The default is 4532.
|
||||
.br
|
||||
.sp
|
||||
\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
|
||||
.B \-L, --show-conf
|
||||
List all config parameters for the radio defined with -m above.
|
||||
.TP
|
||||
.B \-C, --set-conf=parm=val[,parm=val]*
|
||||
Set config parameter. e.g. --set-conf=stop_bits=2
|
||||
.br
|
||||
.sp
|
||||
Use -L option for a list.
|
||||
.TP
|
||||
.B \-l, --list
|
||||
List all model numbers defined in \fBHamlib\fP and exit.
|
||||
.TP
|
||||
.B \-L, --show-conf
|
||||
List all config parameters for the radio defined with -m above.
|
||||
.TP
|
||||
.B \-u, --dump-caps
|
||||
Dump capabilities for the radio defined with -m above and exit.
|
||||
.TP
|
||||
|
@ -125,8 +129,8 @@ below.
|
|||
.TP
|
||||
.B \-e, --end-marker
|
||||
Use END marker in rigctld protocol.
|
||||
.br
|
||||
\fBN.B.\fP: This option can be considered obsolete. Please consider using the Extended
|
||||
.sp
|
||||
\fBN.B.\fP: This option should be considered obsolete. Please consider using the Extended
|
||||
Response protocol instead (see \fIPROTOCOL\fP below). This option will be removed
|
||||
in a future Hamlib release.
|
||||
.TP
|
||||
|
@ -152,9 +156,9 @@ long command name plus the value(s) space separated on one '\\n' terminated
|
|||
line. See \fIPROTOCOL\fP.
|
||||
.PP
|
||||
Since most of the \fBHamlib\fP operations have a \fIset\fP and a \fIget\fP method,
|
||||
an upper case letter will be used for \fIset\fP method whereas the
|
||||
an upper case letter will be used for \fIset\fP methods whereas the
|
||||
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
|
||||
Example (Perl): `print $socket "\\\\dump_caps\\n";' to see what the radio's
|
||||
backend can do
|
||||
|
@ -181,28 +185,28 @@ Get 'Frequency', in Hz.
|
|||
.B M, set_mode 'Mode' 'Passband'
|
||||
Set 'Mode': USB, LSB, CW, CWR, RTTY, RTTYR, AM, FM, WFM, AMS,
|
||||
PKTLSB, PKTUSB, PKTFM, ECSSUSB, ECSSLSB, FAX, SAM, SAL, SAH, DSB.
|
||||
.br
|
||||
.sp
|
||||
Set 'Passband' in Hz, or '0' for the Hamlib backend default.
|
||||
.TP
|
||||
.B m, get_mode
|
||||
Get 'Mode' 'Passband'.
|
||||
.br
|
||||
.sp
|
||||
Returns Mode as a string from \fIset_mode\fP above
|
||||
and Passband in Hz.
|
||||
.TP
|
||||
.B V, set_vfo 'VFO'
|
||||
Set 'VFO': VFOA, VFOB, VFOC, currVFO, VFO, MEM, Main, Sub, TX, RX.
|
||||
.br
|
||||
.sp
|
||||
In VFO mode only a single VFO parameter is required.
|
||||
.TP
|
||||
.B v, get_vfo
|
||||
Get current 'VFO'.
|
||||
.br
|
||||
.sp
|
||||
Returns VFO as a string from \fIset_vfo\fP above.
|
||||
.TP
|
||||
.B J, set_rit 'RIT'
|
||||
Set 'RIT', in Hz, can be + or -.
|
||||
.br
|
||||
.sp
|
||||
A value of '0' resets RIT and *should* turn RIT off. If not, file a bug report
|
||||
against the Hamlib backend.
|
||||
.TP
|
||||
|
@ -211,7 +215,7 @@ Get 'RIT', in Hz.
|
|||
.TP
|
||||
.B Z, set_xit 'XIT'
|
||||
Set 'XIT', in Hz can be + or -.
|
||||
.br
|
||||
.sp
|
||||
A value of '0' resets RIT and *should* turn RIT off. If not, file a bug report
|
||||
against the Hamlib backend.
|
||||
.TP
|
||||
|
@ -272,13 +276,13 @@ Get 'TX Frequency', in Hz.
|
|||
.B X, set_split_mode 'TX Mode' 'TX Passband'
|
||||
Set 'TX Mode': AM, FM, CW, CWR, USB, LSB, RTTY, RTTYR, WFM, AMS,
|
||||
PKTLSB, PKTUSB, PKTFM, ECSSUSB, ECSSLSB, FAX, SAM, SAL, SAH, DSB.
|
||||
.br
|
||||
.sp
|
||||
The 'TX Passband' is the exact passband in Hz, or '0' for the Hamlib
|
||||
backend default.
|
||||
.TP
|
||||
.B x, get_split_mode
|
||||
Get 'TX Mode' and 'TX Passband'.
|
||||
.br
|
||||
.sp
|
||||
Returns TX mode as a string from \fIset_split_mode\fP above and TX passband in Hz.
|
||||
.TP
|
||||
.B S, set_split_vfo 'Split' 'TX VFO'
|
||||
|
@ -295,42 +299,42 @@ Get 'Tuning Step', in Hz.
|
|||
.TP
|
||||
.B U, set_func 'Func' 'Func Status'
|
||||
Set 'Func' 'Func Status'.
|
||||
.br
|
||||
.sp
|
||||
Func is one of: 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.
|
||||
.br
|
||||
.sp
|
||||
Func Status argument is a non null value for "activate", "de-activate"
|
||||
otherwise, much as TRUE/FALSE definitions in C language.
|
||||
.TP
|
||||
.B u, get_func
|
||||
Get 'Func' 'Func Status'.
|
||||
.br
|
||||
.sp
|
||||
Returns Func as a string from \fIset_func\fP above and Func status as a non null value.
|
||||
.TP
|
||||
.B L, set_level 'Level' 'Level Value'
|
||||
Set 'Level' and 'Level Value'.
|
||||
.br
|
||||
.sp
|
||||
Level is one of: 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.
|
||||
.br
|
||||
.sp
|
||||
The Level Value can be a float or an integer.
|
||||
.TP
|
||||
.B l, get_level
|
||||
Get 'Level' 'Level Value'.
|
||||
.br
|
||||
.sp
|
||||
Returns Level as a string from \fIset_level\fP above and Level value as a float or
|
||||
integer.
|
||||
.TP
|
||||
.B P, set_parm 'Parm' 'Parm Value'
|
||||
Set 'Parm' 'Parm Value'
|
||||
.br
|
||||
.sp
|
||||
Parm is one of: ANN, APO, BACKLIGHT, BEEP, TIME, BAT, KEYLIGHT.
|
||||
.TP
|
||||
.B p, get_parm
|
||||
Get 'Parm' 'Parm Value'.
|
||||
.br
|
||||
.sp
|
||||
Returns Parm as a string from \fIset_parm\fP above and Parm Value as a float or
|
||||
integer.
|
||||
.TP
|
||||
|
@ -345,13 +349,13 @@ Get 'Memory#' channel number.
|
|||
.TP
|
||||
.B G, vfo_op 'Mem/VFO Op'
|
||||
Perform 'Mem/VFO Op'.
|
||||
.br
|
||||
.sp
|
||||
Mem VFO operation is one of: CPY, XCHG, FROM_VFO, TO_VFO, MCL, UP, DOWN, BAND_UP,
|
||||
BAND_DOWN, LEFT, RIGHT, TUNE, TOGGLE.
|
||||
.TP
|
||||
.B g, scan 'Scan Fct' 'Scan Channel'
|
||||
Perform 'Scan Fct' 'Scan Channel'.
|
||||
.br
|
||||
.sp
|
||||
Scan function/channel is one of: STOP, MEM, SLCT, PRIO, PROG, DELTA, VFO, PLT.
|
||||
.TP
|
||||
.B H, set_channel 'Channel'
|
||||
|
@ -374,7 +378,7 @@ Get 'Antenna' number (0, 1, 2, ..).
|
|||
.TP
|
||||
.B *, reset 'Reset'
|
||||
Perform rig 'Reset'.
|
||||
.br
|
||||
.sp
|
||||
0 = None, 1 = Software reset, 2 = VFO reset, 4 = Memory Clear reset, 8 = Master reset.
|
||||
Since these values are defined as a bitmask in rig.h, it should be possible to AND
|
||||
these values together to do multiple resets at once, if the backend supports it or
|
||||
|
@ -385,7 +389,7 @@ Send 'Morse' symbols.
|
|||
.TP
|
||||
.B 0x87, set_powerstat 'Power Status'
|
||||
Set power On/Off/Standby 'Power Status'.
|
||||
.br
|
||||
.sp
|
||||
0 = Power Off, 1 = Power On, 2 = Power Standby. Defined as a bitmask in rig.h.
|
||||
.TP
|
||||
.B 0x88, get_powerstat
|
||||
|
@ -398,106 +402,114 @@ Set DTMF 'Digits'.
|
|||
Get DTMF 'Digits'.
|
||||
.TP
|
||||
.B _, get_info
|
||||
Get misc information about the rig (no value is passed).
|
||||
Get misc information about the rig (no VFO in 'VFO mode' or value is passed).
|
||||
.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. TODO: Ensure this is
|
||||
in a consistent format so it can be read into a hash, dictionary, etc. Bug
|
||||
reports requested.
|
||||
.br
|
||||
.sp
|
||||
\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
|
||||
if using a fixed length array! For example, running this command against the
|
||||
Dummy backend results in over 5kB of text output.
|
||||
.br
|
||||
.sp
|
||||
VFO parameter not used in 'VFO mode'.
|
||||
.TP
|
||||
.B 2, power2mW 'Power [0.0..1.0]' 'Frequency' 'Mode'
|
||||
Returns 'Power mW'
|
||||
.br
|
||||
.sp
|
||||
Converts a Power value in a range of \fI0.0 ... 1.0\fP to the real transmit
|
||||
power in milli-Watts (integer). The \fIfrequency\fP and \fImode\fP also need to
|
||||
be provided as output power may vary according to these values.
|
||||
.br
|
||||
.sp
|
||||
VFO parameter not used in 'VFO mode'.
|
||||
.TP
|
||||
.B 4, mW2power 'Power mW' 'Frequency' 'Mode'
|
||||
Returns 'Power [0.0..1.0]'
|
||||
.br
|
||||
.sp
|
||||
Converts the real transmit power in milli-Watts (integer) to a Power value in
|
||||
a range of \fI0.0 ... 1.0\fP. The \fIfrequency\fP and \fImode\fP also need to
|
||||
be provided as output power may vary according to these values.
|
||||
.br
|
||||
.sp
|
||||
VFO parameter not used in 'VFO mode'.
|
||||
.TP
|
||||
.B w, send_cmd 'Cmd'
|
||||
Send raw command string to rig.
|
||||
.br
|
||||
.sp
|
||||
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.
|
||||
.TP
|
||||
.B chk_vfo
|
||||
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.
|
||||
.br
|
||||
.sp
|
||||
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
|
||||
for \fI\\set_vfo\fP above.
|
||||
.br
|
||||
.SH PROTOCOL
|
||||
\fBDefault Protocol\fP
|
||||
.br
|
||||
.PP
|
||||
The \fBrigctld\fP protocol is intentionally simple. Commands are entered on
|
||||
a single line with any needed values. In Perl, reliable results are obtained
|
||||
by terminating each command string with a newline character, '\\n'.
|
||||
.PP
|
||||
.sp
|
||||
Example \fIset\fP (Perl code):
|
||||
|
||||
.sp
|
||||
print $socket "F 14250000\\n";
|
||||
.br
|
||||
print $socket "\\\\set_mode LSB 2400\\n"; # escape leading '\\'
|
||||
.PP
|
||||
Responses from \fBrigctld\fP are text values and match the same tokens used
|
||||
in the \fIset\fP commands. Each value is returned on its own line. To
|
||||
signal the end of a response "0\\n" is returned.
|
||||
A one line response will be sent as a reply to \fIset\fP commands,
|
||||
"RPTR \fIx\fP\\n" where \fIx\fP is the Hamlib error code with '0'
|
||||
indicating success of the command.
|
||||
.PP
|
||||
Responses from \fBrigctld\fP \fIget\fP commands are text values and match the
|
||||
same tokens used in the \fIset\fP commands. Each value is returned on its own
|
||||
line. On error the string "RPTR \fIx\fP\\n" is returned where \fIx\fP is the
|
||||
Hamlib error code.
|
||||
.sp
|
||||
Example \fIget\fP (Perl code):
|
||||
|
||||
.sp
|
||||
print $socket "f\\n";
|
||||
|
||||
.br
|
||||
"14250000\\n"
|
||||
.PP
|
||||
Most \fIget\fP functions return one to three values. A notable exception is
|
||||
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
|
||||
hash, dictionary, or other key:value variable.
|
||||
.PP
|
||||
This protocol is primarily used by the \fINET rigctl\fP (rigctl model 2) backend
|
||||
which allows applications already written for Hamlib's C API to take advantage of
|
||||
\fBrigctld\fP without the need of rewriting application code. An application's
|
||||
user can select rig model 2 ("NET rigctl") and then set rig_pathname to
|
||||
"localhost:4532" or other network host:port.
|
||||
.PP
|
||||
\fBExtended Response Protocol\fP
|
||||
.br
|
||||
.PP
|
||||
An \fIEXPERIMENTAL\fP Extended Response protocol has been introduced into
|
||||
\fBrigctld\fP as of February 8, 2010. This protocol is invoked by prepending
|
||||
a '+' character immediately ahead of the command string with no intervening
|
||||
space. Also, several rules are added to the strings returned by \fBrigctld\fP.
|
||||
\fBrigctld\fP as of February 16, 2010. This protocol adds several rules
|
||||
to the strings returned by \fBrigctld\fP and adds a rule for the command
|
||||
syntax.
|
||||
.PP
|
||||
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
|
||||
as the first line of the block. The leading '+' and '\\' characters are not
|
||||
included in the echoed command string.
|
||||
followed by the value(s) (if any) received from the client terminated by the
|
||||
specified response separator as the record line of the response.
|
||||
.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" where \fIx\fP is
|
||||
the numeric return value of the Hamlib backend function that was called by the
|
||||
command.
|
||||
.PP
|
||||
3. Any lines consisting of data values returned by the rig backend are prepended
|
||||
3. Any records consisting of data values returned by the rig backend are prepended
|
||||
by a string immediately followed by a colon then a space and then the value
|
||||
terminated by a newline. e.g. "Frequency: 14250000\\n"
|
||||
terminated by the response separator. e.g. "Frequency: 14250000\\n" when the
|
||||
command was prepended by '+'.
|
||||
.PP
|
||||
4. All commands received will be acknowledged by \fBrigctld\fP with lines from
|
||||
rules 1 and 2. Lines from rule 3 are only returned when data values must be
|
||||
returned to the client.
|
||||
.PP
|
||||
An example response to a \fI\\set_mode\fP command:
|
||||
.br
|
||||
An example response to a \fI+\\set_mode\fP command (note the prepended '+'):
|
||||
.sp
|
||||
$ echo "+F USB 2400" | nc -w 1 localhost 4532
|
||||
.br
|
||||
set_mode: USB 2400
|
||||
|
@ -509,7 +521,7 @@ the second line contains the end of block marker and the numeric rig backend
|
|||
return value indicating success.
|
||||
.PP
|
||||
An example response to a \fI\\get_mode\fP query:
|
||||
.br
|
||||
.sp
|
||||
$ echo "+\\get_mode" | nc -w 1 localhost 4532
|
||||
.br
|
||||
get_mode:
|
||||
|
@ -524,6 +536,51 @@ 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
|
||||
processed successfully by the rig backend.
|
||||
.PP
|
||||
Invoking the Extended Response protocol requires prepending a command with a
|
||||
punctuation character. As shown in the examples above, prepending a '+'
|
||||
character to the command results in the responses being separated by a newline
|
||||
character ('\\n'). Any other punctuation character recognized by the C
|
||||
\fIispunct()\fP function except '\\', '?', or '_' will cause that character to
|
||||
become the response separator and the entire response will be on one line.
|
||||
.PP
|
||||
Separator character summary:
|
||||
.TP
|
||||
.B '+'
|
||||
.br
|
||||
Each record of the response is appended with a newline ('\\n').
|
||||
.TP
|
||||
.B ';', '|', or ','
|
||||
.br
|
||||
Each record of the response is appended by the given character resulting in
|
||||
entire response on one line.
|
||||
.sp
|
||||
Common record separators for text representations of spreadsheet data, etc.
|
||||
.TP
|
||||
.B '?'
|
||||
.br
|
||||
Reserved for 'help' in rigctl short command
|
||||
.TP
|
||||
.B '_'
|
||||
.br
|
||||
Reserved for \\get_info short command
|
||||
.sp
|
||||
Other punctuation characters have not been tested! Use at your own risk.
|
||||
.PP
|
||||
For example, invoking a \fI;\\get_mode\fP query with a leading ';' returns:
|
||||
.sp
|
||||
get_mode:;Mode: USB;Passband: 2400;RPRT 0
|
||||
.sp
|
||||
Or, using the pipe character '|' returns:
|
||||
.sp
|
||||
get_mode:|Mode: USB|Passband: 2400|RPRT 0
|
||||
.sp
|
||||
And a \\set_pos command prepended with a '|' returns:
|
||||
.sp
|
||||
set_mode: USB 2400|RPRT 0
|
||||
.PP
|
||||
Such a format will allow reading a response as a single event using a prefered
|
||||
response separator. Other punctuation characters have not been tested!
|
||||
.PP
|
||||
The following commands have been tested with the Extended Response protocol and the
|
||||
included \fBtestctld.pl\fP script:
|
||||
.br
|
||||
|
@ -543,7 +600,7 @@ included \fBtestctld.pl\fP script:
|
|||
.br
|
||||
\fI\\dump_caps\fP
|
||||
.SH EXAMPLES
|
||||
Start \fBrigctld\fP for a Yaesu FT-920 using an USB-to-serial adapter and
|
||||
Start \fBrigctld\fP for a Yaesu FT-920 using a USB-to-serial adapter and
|
||||
backgrounding:
|
||||
.PP
|
||||
$ rigctld -m 114 -r /dev/ttyUSB1 &
|
||||
|
@ -577,18 +634,22 @@ is advisable to not start \fBrigctld\fP as \fIroot\fP or another system user
|
|||
account in order to limit any vulnerability.
|
||||
.SH BUGS
|
||||
The daemon is not detaching and backgrounding itself.
|
||||
.br
|
||||
.PP
|
||||
Much testing needs to be done.
|
||||
.SH REPORTING BUGS
|
||||
Report bugs to <hamlib-developer@lists.sourceforge.net>.
|
||||
.br
|
||||
.PP
|
||||
We are already aware of the bugs in the previous section :-)
|
||||
.SH AUTHORS
|
||||
Written by Stephane Fillod, Nate Bargmann, and the Hamlib Group
|
||||
.br
|
||||
.PP
|
||||
<http://www.hamlib.org>.
|
||||
.SH COPYRIGHT
|
||||
Copyright \(co 2000-2010 Stephane Fillod, Nate Bargmann, and the Hamlib Group.
|
||||
Copyright \(co 2000-2009 Stephane Fillod
|
||||
.br
|
||||
Copyright \(co 2010 Nate Bargmann
|
||||
.br
|
||||
Copyright \(co 2000-2009 the Hamlib Group.
|
||||
.PP
|
||||
This is free software; see the source for copying conditions.
|
||||
There is NO warranty; not even for MERCHANTABILITY
|
||||
|
|
|
@ -71,25 +71,25 @@
|
|||
#define SHORT_OPTIONS "m:r:p:d:P:D:s:c:T:t:C:lLuoevhV"
|
||||
static struct option long_options[] =
|
||||
{
|
||||
{"model", 1, 0, 'm'},
|
||||
{"rig-file", 1, 0, 'r'},
|
||||
{"ptt-file", 1, 0, 'p'},
|
||||
{"dcd-file", 1, 0, 'd'},
|
||||
{"ptt-type", 1, 0, 'P'},
|
||||
{"dcd-type", 1, 0, 'D'},
|
||||
{"serial-speed", 1, 0, 's'},
|
||||
{"civaddr", 1, 0, 'c'},
|
||||
{"listen-addr", 1, 0, 'T'},
|
||||
{"port", 1, 0, 't'},
|
||||
{"set-conf", 1, 0, 'C'},
|
||||
{"list", 0, 0, 'l'},
|
||||
{"show-conf",0, 0, 'L'},
|
||||
{"dump-caps", 0, 0, 'u'},
|
||||
{"vfo", 0, 0, 'o'},
|
||||
{"end-marker", 0, 0, 'e'},
|
||||
{"verbose", 0, 0, 'v'},
|
||||
{"help", 0, 0, 'h'},
|
||||
{"version", 0, 0, 'V'},
|
||||
{"model", 1, 0, 'm'},
|
||||
{"rig-file", 1, 0, 'r'},
|
||||
{"ptt-file", 1, 0, 'p'},
|
||||
{"dcd-file", 1, 0, 'd'},
|
||||
{"ptt-type", 1, 0, 'P'},
|
||||
{"dcd-type", 1, 0, 'D'},
|
||||
{"serial-speed",1, 0, 's'},
|
||||
{"civaddr", 1, 0, 'c'},
|
||||
{"listen-addr", 1, 0, 'T'},
|
||||
{"port", 1, 0, 't'},
|
||||
{"set-conf", 1, 0, 'C'},
|
||||
{"list", 0, 0, 'l'},
|
||||
{"show-conf", 0, 0, 'L'},
|
||||
{"dump-caps", 0, 0, 'u'},
|
||||
{"vfo", 0, 0, 'o'},
|
||||
{"end-marker", 0, 0, 'e'},
|
||||
{"verbose", 0, 0, 'v'},
|
||||
{"help", 0, 0, 'h'},
|
||||
{"version", 0, 0, 'V'},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
|
@ -108,7 +108,7 @@ int prompt = 0; /* Daemon mode for rigparse return string */
|
|||
int opt_end = 0; /* END marker for rigctld */
|
||||
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 */
|
||||
|
||||
int portno = 4532;
|
||||
uint32_t src_addr = INADDR_ANY;
|
||||
|
@ -285,7 +285,6 @@ int main (int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
// rig_set_debug(verbose < 2 ? RIG_DEBUG_WARN: verbose);
|
||||
rig_set_debug(verbose);
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "rigctld, %s\n", hamlib_version);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
.\" First parameter, NAME, should be all caps
|
||||
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
||||
.\" other parameters are allowed: see man(7), man(1)
|
||||
.TH ROTCTL "1" "February 14, 2010" "Hamlib" "Rotator Control Program"
|
||||
.TH ROTCTL "1" "February 17, 2010" "Hamlib" "Rotator Control Program"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.\" Some roff macros, for reference:
|
||||
|
@ -44,6 +44,9 @@ Here is s summary of the supported options:
|
|||
.TP
|
||||
.B \-m, --model=id
|
||||
Select rotator model number. See model list (use 'rotctl -l').
|
||||
.sp
|
||||
NB: \fBrotctl\fP (or third party software) will use rig model 1901
|
||||
when using \fBrpc.rotd\fP or rig model 2 for NET rotctl (rotctld).
|
||||
.TP
|
||||
.B \-r, --rot-file=device
|
||||
Use \fIdevice\fP as the file name of the port the rotator is connected.
|
||||
|
@ -68,7 +71,7 @@ List all config parameters for the rotor defined with -m above.
|
|||
.TP
|
||||
.B \-C, --set-conf=parm=val[,parm=val]*
|
||||
Set config parameter. e.g. --set_conf=stop_bits=2
|
||||
.br
|
||||
.sp
|
||||
Use -L option for a list.
|
||||
.TP
|
||||
.B \-l, --list
|
||||
|
@ -108,7 +111,9 @@ Please note that the backend for the rotator to be controlled,
|
|||
or the rotator itself may not support some commands. In that case,
|
||||
the operation will fail with a \fBHamlib\fP error message.
|
||||
.PP
|
||||
A summary of commands is included below.
|
||||
A summary of commands is included below (In the case of "set" commands the
|
||||
quoted string is replaced by the value in the description. In the case of "get"
|
||||
commands the quoted string is the key name of the value returned.):
|
||||
.TP
|
||||
.B P, set_pos 'Azimuth' 'Elevation'
|
||||
Set position: Azimuth and Elevation as double precision floating point values.
|
||||
|
@ -224,13 +229,14 @@ Start \fBrotctl\fP for RotorEZ using COM1:
|
|||
.sp
|
||||
$ rotctl -m 401 -r /dev/ttyS0
|
||||
.sp
|
||||
Start \fBrotctl\fP using \fBrpc.rotd\fP:
|
||||
Start \fBrotctl\fP using \fBrpc.rotd\fP and querying the position:
|
||||
.sp
|
||||
$ rotctl -m 101 -r localhost \\get_pos
|
||||
.sp
|
||||
$ rotctl -m 101
|
||||
Connect to a running \fBrotctld\fP with rotor model 2 ("NET rotctl") on the
|
||||
local host:
|
||||
local host and specifying the TCP port:
|
||||
.sp
|
||||
$ rotctl -m2
|
||||
$ rotctl -m 2 -r localhost:4533
|
||||
.SH DIAGNOSTICS
|
||||
The \fB-v\fP, \fB--version\fP option allows different levels of diagnostics
|
||||
to be output to \fBstderr\fP and correspond to -v for BUG, -vv for ERR,
|
||||
|
@ -253,11 +259,11 @@ library development and may be requested by the developers.
|
|||
This suspiciously empty section...
|
||||
.SH REPORTING BUGS
|
||||
Report bugs to <hamlib-developer@lists.sourceforge.net>.
|
||||
.br
|
||||
.PP
|
||||
We are already aware of the bug in the previous section :-)
|
||||
.SH AUTHOR
|
||||
Written by Stephane Fillod, Nate Bargmann, and the Hamlib Group
|
||||
.br
|
||||
.PP
|
||||
<http://www.hamlib.org>.
|
||||
.SH COPYRIGHT
|
||||
Copyright \(co 2000-2009 Stephane Fillod
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
.\" First parameter, NAME, should be all caps
|
||||
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
||||
.\" other parameters are allowed: see man(7), man(1)
|
||||
.TH ROTCTLD "8" "February 14, 2010" "Hamlib" "Rotator Control Daemon"
|
||||
.TH ROTCTLD "8" "February 17, 2010" "Hamlib" "Rotator Control Daemon"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.\" Some roff macros, for reference:
|
||||
|
@ -82,13 +82,16 @@ Use \fIIPADDR\fP as the listening IP address. The default is ANY.
|
|||
.TP
|
||||
.B \-t, --port=number
|
||||
Use \fInumber\fP as the TCP listening port. The default is 4533.
|
||||
.sp
|
||||
\fBN.B.\fP: As \fBrigctld\fP's default port is 4532, it is advisable to use odd
|
||||
numbered ports for \fBrotctld\fP, e.g. 4533, 4535, 4537, etc.
|
||||
.TP
|
||||
.B \-L, --show-conf
|
||||
List all config parameters for the rotator defined with -m above.
|
||||
.TP
|
||||
.B \-C, --set-conf=parm=val[,parm=val]*
|
||||
Set config parameter. e.g. --set-conf=stop_bits=2
|
||||
.br
|
||||
.sp
|
||||
Use -L option for a list.
|
||||
.TP
|
||||
.B \-l, --list
|
||||
|
@ -99,9 +102,10 @@ Dump capabilities for the radio defined with -m above and exit.
|
|||
.TP
|
||||
.B \-e, --end-marker
|
||||
Use END marker in rotctld protocol.
|
||||
.br
|
||||
N.B.: This option can be considered obsolete. Please consider using the block
|
||||
protocol instead (see \fIPROTOCOL\fP below).
|
||||
.sp
|
||||
N.B.: This option should be considered obsolete. Please consider using the Extended
|
||||
Response protocol instead (see \fIPROTOCOL\fP below). This option will be removed
|
||||
in a future Hamlib release.
|
||||
.TP
|
||||
.B \-v, --verbose
|
||||
Set verbose mode, cumulative (see DIAGNOSTICS below).
|
||||
|
@ -133,7 +137,7 @@ Example (Perl): `print $socket "\\\\dump_caps\\n";' to see what the rotor's
|
|||
backend can do (NOTE: In Perl and many other languages a '\\' will need to be
|
||||
escaped with a preceding '\\' so that even though two backslash characters
|
||||
appear in the code, only one will be passed to \fBrotctld\fP. This is a
|
||||
possible bug!).
|
||||
possible bug, beware!).
|
||||
.PP
|
||||
Please note that the backend for the rotator to be controlled, or the rotator
|
||||
itself may not support some commands. In that case, the operation will fail
|
||||
|
@ -264,30 +268,29 @@ print $socket "P 135 10\\n";
|
|||
.sp
|
||||
print $socket "\\\\set_pos 135 10\\n"; # escape leading '\\'
|
||||
.PP
|
||||
A one line response will be sent to \fIset\fP commands, "RPTR \fIx\fP\\n"
|
||||
where \fIx\fP is the Hamlib error code with '0' indicating success of the
|
||||
command.
|
||||
A one line response will be sent as a reply to \fIset\fP commands,
|
||||
"RPTR \fIx\fP\\n" where \fIx\fP is the Hamlib error code with '0'
|
||||
indicating success of the command.
|
||||
.PP
|
||||
Responses from \fBrotctld\fP \fIget\fP commands are text values and match the
|
||||
same tokens used in the \fIset\fP commands. Each value is returned on its own
|
||||
line. On error the string "RPTR \fIx\fP\\n" where \fIx\fP is the Hamlib error
|
||||
code.
|
||||
line. On error the string "RPTR \fIx\fP\\n" is returned where \fIx\fP is the
|
||||
Hamlib error code.
|
||||
.sp
|
||||
Example \fIget\fP (Perl code):
|
||||
.sp
|
||||
print $socket "p\\n";
|
||||
.sp
|
||||
.br
|
||||
"135"
|
||||
.br
|
||||
"10"
|
||||
.br
|
||||
.PP
|
||||
Most \fIget\fP functions return one to three values. A notable exception is
|
||||
the \fI\\dump_caps\fP function which returns many lines of key:value pairs.
|
||||
.PP
|
||||
This protocol is primarily used by the \fINET rotctl\fP (rotctl model 2) backend
|
||||
which allows applications already written for Hamlib to take advantage of
|
||||
\fBrotctld\fP without the need of rewriting application code. An application
|
||||
which allows applications already written for Hamlib's C API to take advantage of
|
||||
\fBrotctld\fP without the need of rewriting application code. An application's
|
||||
user can select rotor model 2 ("NET rotctl") and then set rot_pathname to
|
||||
"localhost:4533" or other network host:port.
|
||||
.PP
|
||||
|
@ -295,11 +298,11 @@ user can select rotor model 2 ("NET rotctl") and then set rot_pathname to
|
|||
.PP
|
||||
An \fIEXPERIMENTAL\fP Extended Response protocol has been introduced into
|
||||
\fBrotctld\fP as of February 10, 2010. This protocol adds several rules to the
|
||||
strings returned by \fBrotctld\fP.
|
||||
strings returned by \fBrotctld\fP and adds a rule for the command syntax.
|
||||
.PP
|
||||
1. The command received by \fBrotctld\fP is echoed with its long command name
|
||||
followed by the value(s) (if any) received from the client terminated by the
|
||||
specified response separator as the first record of the block.
|
||||
specified response separator as the first record of the response.
|
||||
.PP
|
||||
2. The last record of each block is the string "RPTR \fIx\fP\\n" where \fIx\fP is
|
||||
the numeric return value of the Hamlib backend function that was called by the
|
||||
|
@ -315,6 +318,8 @@ rules 1 and 2. Records from rule 3 are only returned when data values must be
|
|||
returned to the client.
|
||||
.PP
|
||||
An example response to a \fI+P\fP command (note the prepended '+'):
|
||||
.sp
|
||||
$ echo "+P 90 45" | nc -w 1 localhost 4533
|
||||
.br
|
||||
set_pos: 90 45
|
||||
.br
|
||||
|
@ -325,6 +330,8 @@ the second line contains the end of block marker and the numeric rig backend
|
|||
return value indicating success.
|
||||
.PP
|
||||
An example response to a \fI+\\get_pos\fP query:
|
||||
.sp
|
||||
$ echo "+\\get_pos" | nc -w 1 localhost 4533
|
||||
.br
|
||||
get_pos:
|
||||
.br
|
||||
|
@ -345,6 +352,29 @@ character ('\\n'). Any other punctuation character recognized by the C
|
|||
\fIispunct()\fP function except '\\', '?', or '_' will cause that character to
|
||||
become the response separator and the entire response will be on one line.
|
||||
.PP
|
||||
Separator character summary:
|
||||
.TP
|
||||
.B '+'
|
||||
.br
|
||||
Each record of the response is appended with a newline ('\\n').
|
||||
.TP
|
||||
.B ';', '|', or ','
|
||||
.br
|
||||
Each record of the response is appended by the given character resulting in
|
||||
entire response on one line.
|
||||
.sp
|
||||
Common record separators for text representations of spreadsheet data, etc.
|
||||
.TP
|
||||
.B '?'
|
||||
.br
|
||||
Reserved for 'help' in rotctl short command
|
||||
.TP
|
||||
.B '_'
|
||||
.br
|
||||
Reserved for \\get_info short command
|
||||
.sp
|
||||
Other punctuation characters have not been tested! Use at your own risk.
|
||||
.PP
|
||||
For example, invoking a \fI;\\get_pos\fP query with a leading ';' returns:
|
||||
.sp
|
||||
get_pos:;Azimuth: 90.000000;Elevation: 45.000000;RPRT 0
|
||||
|
@ -391,6 +421,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
|
||||
Internet. Please ask if stronger security is needed or consider using an
|
||||
SSH tunnel.
|
||||
.PP
|
||||
As \fBrotctld\fP does not need any greater permissions than \fBrotctl\fP, it
|
||||
is advisable to not start \fBrotctld\fP as \fIroot\fP or another system user
|
||||
account in order to limit any vulnerability.
|
||||
.SH BUGS
|
||||
The daemon is not detaching and backgrounding itself.
|
||||
.PP
|
||||
|
@ -401,7 +435,7 @@ Report bugs to <hamlib-developer@lists.sourceforge.net>.
|
|||
We are already aware of the bugs in the previous section :-)
|
||||
.SH AUTHORS
|
||||
Written by Stephane Fillod, Nate Bargmann, and the Hamlib Group
|
||||
.br
|
||||
.PP
|
||||
<http://www.hamlib.org>.
|
||||
.SH COPYRIGHT
|
||||
Copyright \(co 2000-2009 Stephane Fillod
|
||||
|
|
|
@ -2,15 +2,15 @@
|
|||
|
||||
# testctld.pl - (C) 2008,2010 Nate Bargmann, n0nb@arrl.net
|
||||
# A Perl test script for the rigctld program.
|
||||
|
||||
#
|
||||
# $Id$
|
||||
|
||||
#
|
||||
# It connects to the rigctld TCP port (default 4532) and queries the daemon
|
||||
# for some common rig information and sets some values. It also aims to
|
||||
# provide a bit of example code for Perl scripting.
|
||||
#
|
||||
# This script requires that `rigctld' be invoked with the '-b'|'--block' option.
|
||||
# Details of the Block protocol can be found in the rigctld(8) manual page.
|
||||
# This program utilizes the Extended Response protocol of rigctld in line
|
||||
# response mode. See the rigctld(8) man page for details.
|
||||
|
||||
#############################################################################
|
||||
# This program is free software; you can redistribute it and/or
|
||||
|
@ -44,10 +44,6 @@ use Pod::Usage;
|
|||
my $socket;
|
||||
my $host = 'localhost';
|
||||
my $port = 4532;
|
||||
# my @answer;
|
||||
my $freq = "14250000";
|
||||
my $mode = "USB";
|
||||
my $bw = "2400";
|
||||
my $vfo = '';
|
||||
my %rig_state = (); # State of the rig--freq, mode, passband, ptt, etc.
|
||||
my %rig_caps = (); # Rig capabilities from \dump_caps
|
||||
|
@ -108,14 +104,7 @@ $socket = new IO::Socket::INET (PeerAddr => $host,
|
|||
or die $@;
|
||||
|
||||
|
||||
# Check rigctld's response to the \chk_blk command to be sure it was
|
||||
# invoked with the -b|--block option
|
||||
#unless (chk_opt($socket, 'CHKBLK')) {
|
||||
# die "`rigctld' must be invoked with '-b' or '--block' option for $0\n";
|
||||
#}
|
||||
|
||||
|
||||
print "Welcome to tesctld.pl a program to test `rigctld'\n";
|
||||
print "Welcome to testctld.pl a program to test `rigctld'\n";
|
||||
print "Type '?' or 'help' for commands help.\n\n";
|
||||
|
||||
|
||||
|
@ -124,8 +113,8 @@ $ret_val = dump_caps();
|
|||
|
||||
# Tell user what radio rigctld is working with
|
||||
if ($ret_val eq $errstr{'RIG_OK'}) {
|
||||
print "Hamlib Model: $rig_caps{'Caps dump for model'}\t";
|
||||
print "Common Name: $rig_caps{'Mfg name'} $rig_caps{'Model name'}\n\n\n";
|
||||
print "Hamlib Model: " . $rig_caps{'Caps dump for model'} . "\t";
|
||||
print "Common Name: " . $rig_caps{'Mfg name'} . ' ' . $rig_caps{'Model name'} . "\n\n\n";
|
||||
} else {
|
||||
errmsg ($ret_val);
|
||||
}
|
||||
|
@ -135,7 +124,7 @@ if ($ret_val eq $errstr{'RIG_OK'}) {
|
|||
# invoked with the -o|--vfo option. If true, all commands must include VFO as
|
||||
# first parameter after the command
|
||||
if (chk_opt($socket, 'CHKVFO')) {
|
||||
$vfo = 'currVFO'; # KISS One could use the VFO key from %rig_state after calling the \get_vfo command...
|
||||
$vfo = 'currVFO'; # KISS--One could use the VFO key from %rig_state after calling the \get_vfo command...
|
||||
}
|
||||
|
||||
|
||||
|
@ -525,21 +514,25 @@ sub rig_cmd {
|
|||
} else { $vfo = ''; }
|
||||
|
||||
if (defined $p1) {
|
||||
# "Stringify" parameter value then add a space to the beginning of the string
|
||||
$p1 .= '';
|
||||
$p1 = sprintf("%*s", 1 + length $p1, $p1);
|
||||
} else { $p1 = ''; }
|
||||
|
||||
if (defined $p2) {
|
||||
$p2 .= '';
|
||||
$p2 = sprintf("%*s", 1 + length $p2, $p2);
|
||||
} else { $p2 = ''; }
|
||||
|
||||
if (defined $p3) {
|
||||
$p3 .= '';
|
||||
$p3 = sprintf("%*s", 1 + length $p3, $p3);
|
||||
} else { $p3 = ''; }
|
||||
|
||||
print '+\\' . $cmd . $vfo . $p1 . $p2 . $p3 . "\n\n" if $debug;
|
||||
|
||||
# N.B. Terminate query commands with a newline, e.g. "\n" character.
|
||||
# N.B. Preceding '+' char to request block or extended response protocol
|
||||
# N.B. Preceding '+' char to request line separated extended response protocol
|
||||
print $socket '+\\' . $cmd . $vfo . $p1 . $p2 . $p3 . "\n";
|
||||
|
||||
# rigctld echoes the command plus value(s) on "get" along with
|
||||
|
@ -648,14 +641,11 @@ sub get_errno {
|
|||
}
|
||||
|
||||
|
||||
# check for block response or VFO mode from rigctld
|
||||
# check for VFO mode from rigctld
|
||||
sub chk_opt {
|
||||
my $sock = shift @_;
|
||||
my @lines;
|
||||
|
||||
#if ($_[0] =~ /^CHKBLK/) {
|
||||
#print $sock "\\chk_blk\n";
|
||||
#}
|
||||
if ($_[0] =~ /^CHKVFO/) {
|
||||
print $sock "\\chk_vfo\n";
|
||||
}
|
||||
|
@ -733,7 +723,7 @@ testctld.pl [options]
|
|||
=head1 DESCRIPTION
|
||||
|
||||
B<testcld.pl> provides a set of functions to interactively test the Hamlib
|
||||
`rigctld' TCP/IP network daemon. It also aims to be an example of programming
|
||||
I<rigctld> TCP/IP network daemon. It also aims to be an example of programming
|
||||
code to control a radio via TCP/IP in Hamlib.
|
||||
|
||||
=head1 OPTIONS
|
||||
|
@ -742,13 +732,13 @@ code to control a radio via TCP/IP in Hamlib.
|
|||
|
||||
=item B<--host>
|
||||
|
||||
Hostname or IP address of the target `rigctld' process. Default is 'localhost'
|
||||
Hostname or IP address of the target I<rigctld> process. Default is I<localhost>
|
||||
which should resolve to 127.0.0.1 if I</etc/hosts> is configured correctly.
|
||||
|
||||
=item B<--port>
|
||||
|
||||
TCP port of the target `rigctld' process. Default is 4532. Mutliple instances
|
||||
of `rigctld' will require unique port numbers.
|
||||
TCP port of the target I<rigctld> process. Default is 4532. Mutliple instances
|
||||
of I<rigctld> will require unique port numbers.
|
||||
|
||||
=item B<--help>
|
||||
|
||||
|
@ -764,4 +754,31 @@ Enables debugging output to the console.
|
|||
|
||||
=back
|
||||
|
||||
=head1 COMMANDS
|
||||
|
||||
Commands are the same as described in the rigctld(8) man page. This is only
|
||||
a brief summary.
|
||||
|
||||
F, \set_freq Set frequency in Hz
|
||||
f, \get_freq Get frequency in Hz
|
||||
M, \set_mode Set mode including passband in Hz
|
||||
m, \get_mode Get mode including passband in Hz
|
||||
V, \set_vfo Set VFO (VFOA, VFOB, etc.)
|
||||
v, \get_vfo Get VFO (VFOA, VFOB, etc.)
|
||||
J, \set_rit Set RIT in +/-Hz, '0' to clear
|
||||
j, \get_rit Get RIT in +/-Hz, '0' indicates Off
|
||||
Z, \set_xit Set XIT in +/-Hz, '0' to clear
|
||||
z, \get_rit Get XIT in +/-Hz, '0' indicates Off
|
||||
T, \set_ptt Set PTT, '1' On, '0' Off
|
||||
t, \get_ptt Get PTT, '1' indicates On, '0' indicates Off
|
||||
S, \set_split_vfo Set rig into "split" VFO mode, '1' On, '0' Off
|
||||
s, \get_split_vfo Get status of :split" VFO mode, '1' On, '0' Off
|
||||
I, \set_split_freq Set TX VFO frequency in Hz
|
||||
i, \get_split_freq Get TX VFO frequency in Hz
|
||||
X, \set_split_mode Set TX VFO mode including passband in Hz
|
||||
x, \get_split_mode Get TX VFO mode including passband in Hz
|
||||
2, \power2mW Translate a power value [0.0..1.0] to milliWatts
|
||||
4, \mW2power Translate milliWatts to a power value [0.0..1.0]
|
||||
1, \dump_caps Get the rig capabilities and display select values.
|
||||
|
||||
=cut
|
||||
|
|
Ładowanie…
Reference in New Issue