Hamlib/tests/rigctld.8

599 wiersze
20 KiB
Groff

.\" Hey, EMACS: -*- nroff -*-
.\" 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"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
.\" .nh disable hyphenation
.\" .hy enable hyphenation
.\" .ad l left justify
.\" .ad b justify to both left and right margins
.\" .nf disable filling
.\" .fi enable filling
.\" .br insert line break
.\" .sp <n> insert n+1 empty lines
.\" for manpage-specific macros, see man(7)
.SH NAME
rigctld \- Hamlib TCP rig control daemon
.SH SYNOPSIS
.B rigctld
[\fIOPTION\fR]...
.SH DESCRIPTION
The \fBrigctld\fP program is a NEW \fBHamlib\fP rig control daemon ready for testing
that handles client requests via TCP sockets. This allows multiple user programs to
share one radio (this needs testing). Multiple radios can be controlled
on different TCP ports by use of multiple \fBrigctld\fP processes. The syntax of the
commands are the same as \fBrigctl\fP. It is hoped that \fBrigctld\fP will be
especially useful for client authors using languages such as Perl, Python, PHP,
and others.
.PP
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
.\" \fI<whatever>\fP escape sequences to invoke bold face and italics,
.\" respectively.
\fBrigctld\fP communicates to a client through a TCP socket using text
commands shared with \fBrigctl\fP. The protocol is simple; commands are sent
to \fBrigctld\fP on one line and \fBrigctld\fP responds to "get" commands with
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.
.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.
.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.
.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.
.SH OPTIONS
This program follows the usual GNU command line syntax, with long
options starting with two dashes ('-').
.PP
Here is a summary of the supported options:
.TP
.B \-m, --model=id
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.
.TP
.B \-p, --ptt-file=device
Use \fIdevice\fP as the file name of the Push-To-Talk device using a
device file as described above.
.TP
.B \-d, --dcd-file=device
Use \fIdevice\fP as the file name of the Data Carrier Detect device using a
device file as described above.
.TP
.B \-P, --ptt-type=type
Use \fItype\fP of Push-To-Talk device.
Supported types are RIG (CAT command), DTR, RTS, PARALLEL, NONE.
.TP
.B \-D, --dcd-type=type
Use \fItype\fP of Data Carrier Detect device.
Supported types are RIG (CAT command), DSR, CTS, CD, PARALLEL, NONE.
.TP
.B \-s, --serial-speed=baud
Set serial speed to \fIbaud\fP rate. Uses maximum serial speed from rig
backend capabilities (set by -m above) as the default.
.TP
.B \-c, --civaddr=id
Use \fIid\fP as the CI-V address to communicate with the rig. Only useful for
Icom rigs.
.br
\fBN.B.\fP: The \fIid\fP is in decimal notation, unless prefixed by
\fI0x\fP for a hexadecimal value.
.TP
.B \-T, --listen-addr=IPADDR
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
\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 \-C, --set-conf=parm=val[,parm=val]*
Set config parameter. e.g. --set-conf=stop_bits=2
.br
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
.B \-o, --vfo
Set vfo mode, requiring an extra VFO argument in front of each appropriate
command (except \fI\\set_vfo\fP!). Otherwise, 'currVFO' is assumed when this
option is not set and an extra VFO argument is not used. See \fI\\chk_vfo\fP
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
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 \fIDIAGNOSTICS\fP below).
.TP
.B \-h, --help
Show a summary of these options and exit.
.TP
.B \-V, --version
Show the version of \fBrigctld\fP and exit.
.PP
\fBN.B.\fP Some options may not be implemented by a given backend and will
return an error. This is most likely to occur with the \fI\-\-set-conf\fP
and \fI\-\-show-conf\fP options.
.PP
Please note that the backend for the radio to be controlled,
or the radio itself may not support some commands. In that case,
the operation will fail with a \fBHamlib\fP error code.
.SH COMMANDS
Commands can be sent over the TCP socket either as a single char, or as a
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
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.
.PP
Example (Perl): `print $socket "\\\\dump_caps\\n";' to see what the radio's
backend can do
.br
(\fBN.B.\fP: In Perl and many other languages a '\\' will need to be
escaped with a preceding '\\' so that even though two backslash characters
appear in the code, only one will be passed to \fBrigctld\fP. This is a
possible bug, beware!).
.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 (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 'Frequency'
Set 'Frequency', in Hz.
.TP
.B f, get_freq
Get 'Frequency', in Hz.
.TP
.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
Set 'Passband' in Hz, or '0' for the Hamlib backend default.
.TP
.B m, get_mode
Get 'Mode' 'Passband'.
.br
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
In VFO mode only a single VFO parameter is required.
.TP
.B v, get_vfo
Get current 'VFO'.
.br
Returns VFO as a string from \fIset_vfo\fP above.
.TP
.B J, set_rit 'RIT'
Set 'RIT', in Hz, can be + or -.
.br
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.
.TP
.B Z, set_xit 'XIT'
Set 'XIT', in Hz can be + or -.
.br
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.
.TP
.B T, set_ptt 'PTT'
Set 'PTT', 0 (RX) or 1 (TX).
.TP
.B t, get_ptt
Get 'PTT' status.
.TP
.B 0x8b, get_dcd
Get 'DCD' (squelch) status, 0 (Closed) or 1 (Open)
.TP
.B R, set_rptr_shift 'Rptr Shift'
Set 'Rptr Shift': "+", "-" or something else for none.
.TP
.B r, get_rptr_shift
Get 'Rptr Shift'. Returns "+", "-" or "None".
.TP
.B O, set_rptr_offs 'Rptr Offset'
Set 'Rptr Offset', in Hz.
.TP
.B o, get_rptr_offs
Get 'Rptr Offset', in Hz.
.TP
.B C, set_ctcss_tone 'CTCSS Tone'
Set 'CTCSS Tone', in tenths of Hz.
.TP
.B c, get_ctcss_tone
Get 'CTCSS Tone', in tenths of Hz.
.TP
.B D, set_dcs_code 'DCS Code'
Set 'DCS Code'.
.TP
.B d, get_dcs_code
Get 'DCS Code'.
.TP
.B 0x90, set_ctcss_sql 'CTCSS Sql'
Set 'CTCSS Sql' tone, in tenths of Hz.
.TP
.B 0x91, get_ctcss_sql
Get 'CTCSS Sql' tone, in tenths of Hz.
.TP
.B 0x92, set_dcs_sql 'DCS Sql'
Set 'DCS Sql' code.
.TP
.B 0x93, get_dcs_sql
Get 'DCS Sql' code.
.TP
.B I, set_split_freq 'Tx Frequency'
Set 'TX Frequency', in Hz.
.TP
.B i, get_split_freq
Get 'TX Frequency', in Hz.
.TP
.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
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
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'
Set 'Split' mode, '0' or '1', and 'TX VFO' from \fIset_vfo\fP above.
.TP
.B s, get_split_vfo
Get 'Split' mode, '0' or '1', and 'TX VFO'.
.TP
.B N, set_ts 'Tuning Step'
Set 'Tuning Step', in Hz.
.TP
.B n, get_ts
Get 'Tuning Step', in Hz.
.TP
.B U, set_func 'Func' 'Func Status'
Set 'Func' 'Func Status'.
.br
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
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
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
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
The Level Value can be a float or an integer.
.TP
.B l, get_level
Get 'Level' 'Level Value'.
.br
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
Parm is one of: ANN, APO, BACKLIGHT, BEEP, TIME, BAT, KEYLIGHT.
.TP
.B p, get_parm
Get 'Parm' 'Parm Value'.
.br
Returns Parm as a string from \fIset_parm\fP above and Parm Value as a float or
integer.
.TP
.B B, set_bank 'Bank'
Set 'Bank'. Sets the current memory bank number.
.TP
.B E, set_mem 'Memory#'
Set 'Memory#' channel number.
.TP
.B e, get_mem
Get 'Memory#' channel number.
.TP
.B G, vfo_op 'Mem/VFO Op'
Perform 'Mem/VFO Op'.
.br
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
Scan function/channel is one of: STOP, MEM, SLCT, PRIO, PROG, DELTA, VFO, PLT.
.TP
.B H, set_channel 'Channel'
Set memory 'Channel' data. Not implemented yet.
.TP
.B h, get_channel
Get memory 'Channel' data. Not implemented yet.
.TP
.B A, set_trn 'Transceive'
Set 'Transceive' mode (reporting event): OFF, RIG, POLL.
.TP
.B a, get_trn
Get 'Transceive' mode (reporting event) as in \fIset_trn\fP above.
.TP
.B Y, set_ant 'Antenna'
Set 'Antenna' number (0, 1, 2, ..).
.TP
.B y, get_ant
Get 'Antenna' number (0, 1, 2, ..).
.TP
.B *, reset 'Reset'
Perform rig 'Reset'.
.br
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 'Morse'
Send 'Morse' symbols.
.TP
.B 0x87, set_powerstat 'Power Status'
Set power On/Off/Standby 'Power Status'.
.br
0 = Power Off, 1 = Power On, 2 = Power Standby. Defined as a bitmask in rig.h.
.TP
.B 0x88, get_powerstat
Get power On/Off/Standby 'Power Status' as in \fIset_powerstat\fP above.
.TP
.B 0x89, send_dtmf 'Digits'
Set DTMF 'Digits'.
.TP
.B 0x8a, recv_dtmf
Get DTMF 'Digits'.
.TP
.B _, get_info
Get misc information about the rig (no 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
\fBN.B.\fP: This command will produce many lines of output so be very careful
if using a fixed length array! For example, running this command against these
Dummy backend results in over 5kB of text output.
.br
VFO parameter not used in 'VFO mode'.
.TP
.B 2, power2mW 'Power [0.0..1.0]' 'Frequency' 'Mode'
Returns 'Power mW'
.br
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
VFO parameter not used in 'VFO mode'.
.TP
.B 4, mW2power 'Power mW' 'Frequency' 'Mode'
Returns 'Power [0.0..1.0]'
.br
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
VFO parameter not used in 'VFO mode'.
.TP
.B w, send_cmd 'Cmd'
Send raw command string to rig.
.br
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
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
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
Example \fIset\fP (Perl code):
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.
.PP
Example \fIget\fP (Perl code):
print $socket "f\\n";
"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
\fBExtended Response Protocol\fP
.br
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.
.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.
.PP
2. The last line of each block is the string "RPTR \fIx\fP\\n" wheren \fIx\fP is
the numeric return value of the Hamlib backend function that was called by the
command.
.PP
3. Any lines 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"
.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
$ echo "+F USB 2400" | nc -w 1 localhost 4532
.br
set_mode: USB 2400
.br
RPRT 0
.PP
In this case the long command name and values are returned on the first line and
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
$ echo "+\\get_mode" | nc -w 1 localhost 4532
.br
get_mode:
.br
Mode: USB
.br
Passband: 2400
.br
RPRT 0
.PP
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
The following commands have been tested with the Extended Response protocol and the
included \fBtestctld.pl\fP script:
.br
\fI\\set_freq\fP \fI\\get_freq\fP \fI\\set_split_freq\fP \fI\\get_split_freq\fP
.br
\fI\\set_mode\fP \fI\\get_mode\fP \fI\\set_split_mode\fP \fI\\get_split_mode\fP
.br
\fI\\set_vfo\fP \fI\\get_vfo\fP \fI\\set_split_vfo\fP \fI\\get_split_vfo\fP
.br
\fI\\set_rit\fP \fI\\get_rit\fP
.br
\fI\\set_xit\fP \fI\\get_xit\fP
.br
\fI\\set_ptt\fP \fI\\get_ptt\fP
.br
\fI\\power2mW\fP \fI\\mW2power\fP
.br
\fI\\dump_caps\fP
.SH EXAMPLES
Start \fBrigctld\fP for a Yaesu FT-920 using an USB-to-serial adapter and
backgrounding:
.PP
$ rigctld -m 114 -r /dev/ttyUSB1 &
.PP
Start \fBrigctld\fP for a Yaesu FT-920 using a USB to serial adapter while
setting baud rate and stop bits, and backgrounding:
.PP
$ rigctld -m 114 -r /dev/ttyUSB1 -s 4800 -C stop_bits=2 &
.PP
Connect to the already running \fBrigctld\fP, and set current frequency to
14.266 MHz with a 1 second read timeout using the default protocol:
.PP
$ echo "\\set_freq 14266000" | nc -w 1 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,
-vvv for WARN, -vvvv for VERBOSE, or -vvvvv for TRACE.
.PP
A given verbose level is useful for providing needed debugging information to
the email address below. For example, TRACE output shows all of the values
sent to and received from the radio which is very useful for radio backend
library development and may be requested by the developers. See the
\fBREADME.betatester\fP and \fBREADME.developer\fP files for more information.
.SH SECURITY
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 \fBrigctld\fP does not need any greater permissions than \fBrigctl\fP, it
is advisable to not start \fBrigctld\fP as \fIroot\fP or another system user
account in order to limit any vulnerability.
.SH BUGS
The daemon is not detaching and backgrounding itself.
.br
Much testing needs to be done.
.SH REPORTING BUGS
Report bugs to <hamlib-developer@lists.sourceforge.net>.
.br
We are already aware of the bugs in the previous section :-)
.SH AUTHORS
Written by Stephane Fillod, Nate Bargmann, and the Hamlib Group
.br
<http://www.hamlib.org>.
.SH COPYRIGHT
Copyright \(co 2000-2010 Stephane Fillod, Nate Bargmann, and the Hamlib Group.
.PP
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 rigctl (1),
.BR hamlib (3)