kopia lustrzana https://github.com/Hamlib/Hamlib
Merge branch 'API_3'
Conflicts: .gitignore Makefile.am NEWS c++/Makefile.am configure.ac hamlib.spec.in rpcrig/rpcrig.x rpcrig/rpcrig_backend.c rpcrig/rpcrig_backend.h rpcrig/rpcrig_proc.c rpcrig/rpcrigd.c rpcrot/rpcrot.x rpcrot/rpcrot_backend.c rpcrot/rpcrot_backend.h rpcrot/rpcrot_proc.c rpcrot/rpcrotd.c src/Makefile.am tests/rigctl.1 tests/rotctl.1Hamlib-3.0
commit
8c145cfc6b
4
INSTALL
4
INSTALL
|
@ -264,10 +264,6 @@ disabled by passing `--without-tcl-binding', `--without-perl-binding',
|
|||
and/or '--without-python-binding'. Note that these bindings are disabled
|
||||
by default.
|
||||
|
||||
Some platfroms may have trouble compiling the RPC support (e.g. Mac OS X).
|
||||
in such a case, the rpcrig and rpcrot backends may be disabled
|
||||
with the `--without-rpc-backends' option.
|
||||
|
||||
Building static libraries can be disabled by use of the `--disable-static'
|
||||
option. This will reduce the installed size of Hamlib considerably.
|
||||
|
||||
|
|
|
@ -16,9 +16,8 @@ SUBDIRS = macros include lib $(subdirs) src @BACKEND_LIST@ @ROT_BACKEND_LIST@ \
|
|||
# perl and kylix subdirs are no longer distributed
|
||||
DIST_SUBDIRS = macros include lib $(subdirs) src c++ bindings tests doc \
|
||||
icom kenwood aor yaesu dummy pcr alinco uniden tentec kachina jrc \
|
||||
rpcrig winradio adat easycomm fodtrack rpcrot drake rotorez \
|
||||
winradio adat easycomm fodtrack drake rotorez \
|
||||
flexradio sartek lowe rft rs tapr kit skanti prm80 wj racal tuner \
|
||||
gs232a heathkit spid ars m2 amsat scripts ts7400 celestron
|
||||
|
||||
ACLOCAL_AMFLAGS = -I macros
|
||||
|
||||
|
|
3
NEWS
3
NEWS
|
@ -5,6 +5,9 @@ Copyright (C) 2000-2012 Stephane Fillod, and others
|
|||
|
||||
Please send Hamlib bug reports to hamlib-developer@lists.sourceforge.net
|
||||
|
||||
Version 3.0
|
||||
* Kill RPC backends and rpc.rigd/rpc.rotd
|
||||
|
||||
Version 1.2.15
|
||||
2012-02-02
|
||||
* New models: TT-599 Eagle, IC-RX7, IC-1275, HiQSDR, ADAT ADT-200A,
|
||||
|
|
|
@ -87,7 +87,6 @@ Optional, but highly recommended for a complete build:
|
|||
* libxml2 devel # xml2-config --version
|
||||
* libgd2 devel # gdlib-config --version
|
||||
* libusb devel # libusb-config --version (not 1.0.0!)
|
||||
* RPC devel (libc-dev) # rpcgen --version
|
||||
|
||||
N.B The libusb package is required for building most of the 'kit' backend.
|
||||
The older version is needed, not 1.0.0 or higher. Debian and derivatives
|
||||
|
@ -179,8 +178,6 @@ yaesu,etc: rig backends
|
|||
easycomm,rotorez,
|
||||
sartek, etc: rotator backends
|
||||
dummy: virtual dummy rig and rotator, for developer's use.
|
||||
rpcrig: special networked rig backend (through RPC)
|
||||
rpcrot: special networked rotator backend (through RPC)
|
||||
lib: library for functions missing on your system
|
||||
libltdl: wrapper for shared module loader
|
||||
bindings Perl, Python, Tcl, and Visual Basic bindings
|
||||
|
|
|
@ -43,7 +43,7 @@ Hamlib also enables developers to develop professional looking
|
|||
GUI's towards a standard control library API, and they would not have
|
||||
to worry about the underlying connection towards physical hardware.
|
||||
|
||||
Serial (RS232) connectivity is built in as are RPC, IP (also via a socket
|
||||
Serial (RS232) connectivity is built in as well as IP (also via a socket
|
||||
utility), and USB. Other connectivity will follow afterwards.
|
||||
|
||||
|
||||
|
@ -90,8 +90,6 @@ $ tree -d -I .git
|
|||
├── racal
|
||||
├── rft
|
||||
├── rotorez
|
||||
├── rpcrig
|
||||
├── rpcrot
|
||||
├── rs
|
||||
├── sartek
|
||||
├── skanti
|
||||
|
@ -251,7 +249,6 @@ Optional, but highly recommended:
|
|||
* libxml2 devel # xml2-config --version
|
||||
* libgd2 devel # gdlib-config --version
|
||||
* libusb devel # libusb-config --version (not 1.0.0!)
|
||||
* RPC devel (libc-dev) # rpcgen --version
|
||||
|
||||
N.B The libusb package is required for building most of the 'kit' backend.
|
||||
The older version is needed, not 1.0.0 or higher. Debian and derivatives
|
||||
|
@ -503,8 +500,8 @@ Contributed code to the Hamlib frontend must be released under the LGPL.
|
|||
Contributed code to Hamlib backends must follow backend current license.
|
||||
Needless to say, the LGPL is the license of choice.
|
||||
|
||||
End user applications like rigctl, rotctl and RPC daemons should be released
|
||||
under the GPL, so any contributed code must follow the license.
|
||||
End user applications like rigctl, rotctl and networked daemons should be
|
||||
released under the GPL, so any contributed code must follow the license.
|
||||
|
||||
|
||||
8.2 Coding guidelines and style
|
||||
|
|
|
@ -29,7 +29,7 @@ Cygwin is fully updated):
|
|||
# export CC="gcc -mno-cygwin"
|
||||
# export CXX="g++ -mno-cygwin"
|
||||
# ./autogen.sh --prefix=/usr/local --disable-static \
|
||||
--without-rpc-backends --without-tcl-binding --without-perl-binding \
|
||||
--without-tcl-binding --without-perl-binding \
|
||||
--without-python-binding --build=i686-pc-cygwin --host=i686-pc-mingw32 \
|
||||
--target=i686-pc-mingw32
|
||||
Note: on subsequent runs you can replace ./autogen.sh with ./configure
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
lib_LTLIBRARIES = libhamlib++.la
|
||||
libhamlib___la_SOURCES = rigclass.cc rotclass.cc
|
||||
libhamlib___la_LDFLAGS = -no-undefined -version-info @ABI_VERSION@:16:0
|
||||
libhamlib___la_LDFLAGS = -no-undefined -version-info @ABI_VERSION@:0:0
|
||||
libhamlib___la_LIBADD = $(top_builddir)/src/libhamlib.la
|
||||
|
||||
check_PROGRAMS = testcpp
|
||||
|
|
31
configure.ac
31
configure.ac
|
@ -11,7 +11,7 @@ dnl Please do not use '-' in the version number, as package managers will fail,
|
|||
dnl however, the use of '~' should be fine as apt (others?) will treat
|
||||
dnl it as an earlier version than the actual release. TNX KA6MAL
|
||||
dnl PACKAGE_NAME + " " + PACKAGE_VERSION must not exceed 20 chars!
|
||||
AC_INIT([Hamlib],[1.2.15~rc1],[hamlib-developer@lists.sourceforge.net],[hamlib],[http://www.hamlib.org])
|
||||
AC_INIT([Hamlib],[3.0~git],[hamlib-developer@lists.sourceforge.net],[hamlib],[http://www.hamlib.org])
|
||||
AC_CONFIG_SRCDIR([include/hamlib/rig.h])
|
||||
AC_CONFIG_MACRO_DIR([macros])
|
||||
|
||||
|
@ -26,7 +26,7 @@ AM_MAINTAINER_MODE
|
|||
## ------------------------------- ##
|
||||
## Hamlib specific configuration. ##
|
||||
## ------------------------------- ##
|
||||
ABI_VERSION=2
|
||||
ABI_VERSION=3
|
||||
|
||||
dnl Pick up the Hamlib macros.
|
||||
AM_ACLOCAL_INCLUDE([macros])
|
||||
|
@ -74,7 +74,7 @@ dnl Checks for header files.
|
|||
AC_HEADER_DIRENT
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS([alloca.h argz.h malloc.h memory.h string.h strings.h])
|
||||
AC_CHECK_HEADERS([stdlib.h values.h rpc/rpc.h rpc/rpcent.h net/errno.h])
|
||||
AC_CHECK_HEADERS([stdlib.h values.h net/errno.h])
|
||||
AC_CHECK_HEADERS([fcntl.h sys/ioctl.h sys/time.h sys/param.h unistd.h getopt.h errno.h])
|
||||
AC_CHECK_HEADERS([sys/ioccom.h sgtty.h term.h termio.h termios.h])
|
||||
AC_CHECK_HEADERS([linux/ppdev.h linux/parport.h linux/ioctl.h linux/hidraw.h])
|
||||
|
@ -415,38 +415,19 @@ else
|
|||
fi
|
||||
AC_MSG_RESULT($cf_with_libusb)
|
||||
|
||||
# prepare backend dependencies before adding rpcrig and rpcrot dirs
|
||||
# prepare backend dependencies
|
||||
# otherwise parallel 'make -jn' will fail
|
||||
for be in ${BACKEND_LIST} ; do
|
||||
BACKENDEPS="${BACKENDEPS} \$(top_builddir)/${be}/hamlib-${be}.la"
|
||||
done
|
||||
|
||||
# prepare backend dependencies before adding rpcrig and rpcrot dirs
|
||||
# prepare backend dependencies
|
||||
# otherwise parallel 'make -jn' will fail
|
||||
for be in ${ROT_BACKEND_LIST} ; do
|
||||
ROT_BACKENDEPS="${ROT_BACKENDEPS} \$(top_builddir)/${be}/hamlib-${be}.la"
|
||||
done
|
||||
|
||||
|
||||
AC_CHECK_PROG(cf_with_rpcgen, rpcgen, [yes], [no])
|
||||
AC_MSG_CHECKING(whether to build rpc backends)
|
||||
# RPCRig must be the last one added to BACKEND_LIST
|
||||
# because it links against other backends (build order)
|
||||
if test "${ac_cv_header_rpc_rpc_h}" = "yes" -a "${cf_with_rpcgen}" = "yes"; then
|
||||
cf_with_rpc=yes
|
||||
else
|
||||
cf_with_rpc=no
|
||||
fi
|
||||
AC_ARG_WITH(rpc-backends,
|
||||
[ --without-rpc-backends do not build rpcrig and rpcrot backends],
|
||||
[cf_with_rpc_backends=$withval],
|
||||
[cf_with_rpc_backends=$cf_with_rpc])
|
||||
AC_MSG_RESULT($cf_with_rpc_backends)
|
||||
if test "${cf_with_rpc_backends}" = "yes"; then
|
||||
BACKEND_LIST="$BACKEND_LIST rpcrig"
|
||||
ROT_BACKEND_LIST="$ROT_BACKEND_LIST rpcrot"
|
||||
fi
|
||||
|
||||
# dlopen force or preopen self for static version ?
|
||||
BACKENDLNK="-dlopen force"
|
||||
for be in ${BACKEND_LIST} ; do
|
||||
|
@ -525,8 +506,6 @@ gs232a/Makefile
|
|||
heathkit/Makefile
|
||||
spid/Makefile
|
||||
sartek/Makefile
|
||||
rpcrig/Makefile
|
||||
rpcrot/Makefile
|
||||
src/Makefile
|
||||
c++/Makefile
|
||||
bindings/Makefile
|
||||
|
|
|
@ -414,6 +414,7 @@
|
|||
* The RPC backend can be used to connect and send commands to a rig server,
|
||||
* \c rpc.rigd, running on a remote machine. Using this client/server scheme,
|
||||
* several clients can control and monitor the same rig hardware.
|
||||
* \deprecated
|
||||
*/
|
||||
#define RIG_RPC 19
|
||||
#define RIG_BACKEND_RPC "rpcrig"
|
||||
|
@ -555,7 +556,7 @@ typedef int rig_model_t;
|
|||
{ RIG_TENTEC, RIG_BACKEND_TENTEC }, \
|
||||
{ RIG_ALINCO, RIG_BACKEND_ALINCO }, \
|
||||
{ RIG_KACHINA, RIG_BACKEND_KACHINA }, \
|
||||
{ RIG_RPC, RIG_BACKEND_RPC }, \
|
||||
/* { RIG_RPC, RIG_BACKEND_RPC }, */ \
|
||||
{ RIG_TAPR, RIG_BACKEND_TAPR }, \
|
||||
{ RIG_FLEXRADIO, RIG_BACKEND_FLEXRADIO }, \
|
||||
{ RIG_RFT, RIG_BACKEND_RFT }, \
|
||||
|
|
|
@ -76,6 +76,7 @@
|
|||
* The RPC backend can be used to connect and send commands to a rotator server,
|
||||
* \c rpc.rotd, running on a remote machine. Using this client/server scheme,
|
||||
* several clients can control and monitor the same rotator hardware.
|
||||
* \deprecated
|
||||
*/
|
||||
#define ROT_RPC 1
|
||||
#define ROT_BACKEND_RPC "rpcrot"
|
||||
|
@ -290,7 +291,7 @@ typedef int rot_model_t;
|
|||
*/
|
||||
#define ROT_BACKEND_LIST { \
|
||||
{ ROT_DUMMY, ROT_BACKEND_DUMMY }, \
|
||||
{ ROT_RPC, ROT_BACKEND_RPC }, \
|
||||
/* { ROT_RPC, ROT_BACKEND_RPC }, */ \
|
||||
{ ROT_EASYCOMM, ROT_BACKEND_EASYCOMM }, \
|
||||
{ ROT_FODTRACK, ROT_BACKEND_FODTRACK }, \
|
||||
{ ROT_ROTOREZ, ROT_BACKEND_ROTOREZ }, \
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
# rpcrig_xdr.c rpcrig_svc.c rpcrig_clnt.c and rpcrig.h are generated by rpcgen
|
||||
# have to provide: rpcrig_proc.c rpcrigd.c rpcrig_backend.c
|
||||
#
|
||||
# Note: automake complains rpcrig_xdr.c is generated both with and
|
||||
# without libtool, hence the copy rpcrig_xdr_lt.c
|
||||
|
||||
LDADD = $(top_builddir)/src/libhamlib.la $(top_builddir)/lib/libmisc.la @NET_LIBS@
|
||||
DEPENDENCIES = $(top_builddir)/src/libhamlib.la
|
||||
|
||||
BUILT_SOURCES = rpcrig_xdr.c rpcrig_svc.c rpcrig_xdr_lt.c rpcrig_clnt.c rpcrig.h
|
||||
DISTCLEANFILES = $(BUILT_SOURCES)
|
||||
|
||||
# needed for backward compatibility on Solaris.
|
||||
AM_CFLAGS = $(CFLAGS) -DPORTMAP
|
||||
|
||||
# The RPC backend
|
||||
pkglib_LTLIBRARIES = hamlib-rpcrig.la
|
||||
hamlib_rpcrig_la_SOURCES = rpcrig_backend.c rpcrig_backend.h
|
||||
nodist_hamlib_rpcrig_la_SOURCES = rpcrig_clnt.c rpcrig_xdr_lt.c rpcrig.h
|
||||
hamlib_rpcrig_la_LDFLAGS = -no-undefined -module -avoid-version
|
||||
hamlib_rpcrig_la_LIBADD = $(top_builddir)/src/libhamlib.la @NET_LIBS@
|
||||
|
||||
# The RPC server
|
||||
sbin_PROGRAMS = rpc.rigd
|
||||
rpc_rigd_DEPENDENCIES = $(DEPENDENCIES) @BACKENDEPS@ hamlib-rpcrig.la
|
||||
rpc_rigd_SOURCES = rpcrigd.c rpcrig_proc.c
|
||||
nodist_rpc_rigd_SOURCES = rpcrig_svc.c rpcrig_xdr.c rpcrig.h
|
||||
rpc_rigd_LDFLAGS = @BACKENDLNK@
|
||||
man_MANS = rpc.rigd.8
|
||||
|
||||
EXTRA_DIST = rpcrig.x $(man_MANS)
|
||||
|
||||
RPCGEN = rpcgen
|
||||
|
||||
rpcrig.h: Makefile rpcrig.x
|
||||
rm -f $@
|
||||
$(RPCGEN) -h -C `test -f rpcrig.x || echo '$(srcdir)/'`rpcrig.x -o $@
|
||||
|
||||
|
||||
# Need to chdir in source dir, otherwise rpcgen hardcodes header path. sigh.
|
||||
rpcrig_clnt.c: Makefile rpcrig.x
|
||||
rm -f $@
|
||||
abs_builddir=`pwd` ; \
|
||||
cd $(srcdir) && $(RPCGEN) -l -C rpcrig.x -o $$abs_builddir/$@
|
||||
|
||||
rpcrig_svc.c: Makefile rpcrig.x
|
||||
rm -f $@
|
||||
abs_builddir=`pwd` ; \
|
||||
cd $(srcdir) && $(RPCGEN) -m -C rpcrig.x -o $$abs_builddir/$@
|
||||
|
||||
# note:
|
||||
# we need 2 rpcrig_xdr.c's: one for static rpcrig deamon, one for lt backend
|
||||
|
||||
rpcrig_xdr.c: Makefile rpcrig.x
|
||||
rm -f $@
|
||||
abs_builddir=`pwd` ; \
|
||||
cd $(srcdir) && $(RPCGEN) -c -C rpcrig.x -o $$abs_builddir/$@
|
||||
|
||||
rpcrig_xdr_lt.c: Makefile rpcrig.x
|
||||
rm -f $@
|
||||
abs_builddir=`pwd` ; \
|
||||
cd $(srcdir) && $(RPCGEN) -c -C rpcrig.x -o $$abs_builddir/$@
|
||||
|
|
@ -1,151 +0,0 @@
|
|||
.\" 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 RIGD "8" "February 24, 2007" "Hamlib" "RPC Rig 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
|
||||
rigd \- Hamlib rig service daemon
|
||||
.SH SYNOPSIS
|
||||
.B rpc.rigd
|
||||
[\fIOPTION\fR]...
|
||||
.SH DESCRIPTION
|
||||
The \fBrigd\fP program is a \fBHamlib\fP rig daemon that handles RPC client
|
||||
requests. This allows multiple user programs to share one radio. At this time
|
||||
multiple radio support is not available (help needed!).
|
||||
.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.
|
||||
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. 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
|
||||
REPORTING BUGS 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 (`-').
|
||||
|
||||
Here is a summary of the supported options:
|
||||
.TP
|
||||
.B \-m, --model=id
|
||||
Select radio model number. See rig model list (use 'rigctl -l').
|
||||
.br
|
||||
NB: \fBrigctl\fP (or third party software) will use rig model 1901
|
||||
when using \fBrigd\fP.
|
||||
.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, DTR, RTS, PARALLEL, NONE.
|
||||
.TP
|
||||
.B \-d, --dcd-type=type
|
||||
Use \fItype\fP of Data Carrier Detect device.
|
||||
Supported types are RIG, 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 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
|
||||
NB: the \fIid\fP is in decimal notation, unless prefixed by
|
||||
\fI0x\fP, in which case it is hexadecimal.
|
||||
.TP
|
||||
.B \-C, --set-conf=parm=val[,parm=val]*
|
||||
Set config parameter. e.g. stop_bits=2
|
||||
.br
|
||||
Use -L option of \fBrigctl\fP for a list.
|
||||
.TP
|
||||
.B \-t, --prog=number
|
||||
Use \fInumber\fP as the RPC program number. The default is 536871065.
|
||||
.TP
|
||||
.B \-v, --verbose
|
||||
Set verbose mode, cumulative (see DIAGNOSTICS below).
|
||||
.TP
|
||||
.B \-h, --help
|
||||
Show a summary of these options and exit.
|
||||
.TP
|
||||
.B \-V, --version
|
||||
Show the version of \fBrigd\fP and exit.
|
||||
.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 EXAMPLES
|
||||
Start \fBrigd\fP as root for a Yaesu FT-920 using a USB to serial adapter and
|
||||
backgrounding:
|
||||
.PP
|
||||
# rpc.rigd -m 114 -r /dev/ttyUSB1 &
|
||||
.PP
|
||||
Start \fBrigd\fP as root for a Yaesu FT-920 using COM1 while generating TRACE output:
|
||||
.PP
|
||||
# rpc.rigd -m 114 -r /dev/ttyS0 -vvvvv
|
||||
.PP
|
||||
Start \fBrigd\fP as root for a Yaesu FT-920 using a USB to serial adapter while
|
||||
setting baud rate and stop bits and backgrounding:
|
||||
.PP
|
||||
# rpc.rigd -m 114 -r /dev/ttyUSB1 -s 4800 -C stop_bits=2 &
|
||||
.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,
|
||||
-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.
|
||||
.SH SECURITY
|
||||
No authentication whatsoever; could be done through domain restriction,
|
||||
though. Please ask if stronger security is needed.
|
||||
.SH BUGS
|
||||
Does not support more than one rig that share the same serial port (e.g. Icom
|
||||
radios on a CI-V bus).
|
||||
.PP
|
||||
Does not support more than one communication device for multiple rig control.
|
||||
(e.g. for Single Operator 2 Radio) Help needed!
|
||||
.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 and the Hamlib Group
|
||||
.br
|
||||
<http://www.hamlib.org>.
|
||||
.SH COPYRIGHT
|
||||
Copyright \(co 2000-2007 Stephane Fillod 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)
|
378
rpcrig/rpcrig.x
378
rpcrig/rpcrig.x
|
@ -1,378 +0,0 @@
|
|||
%/*
|
||||
% * Hamlib Interface - RPC definitions
|
||||
% * Copyright (c) 2000-2002 by Stephane Fillod and Frank Singleton
|
||||
% *
|
||||
% *
|
||||
% * This library is free software; you can redistribute it and/or
|
||||
% * modify it under the terms of the GNU Lesser General Public
|
||||
% * License as published by the Free Software Foundation; either
|
||||
% * version 2.1 of the License, or (at your option) any later version.
|
||||
% *
|
||||
% * This library is distributed in the hope that it will be useful,
|
||||
% * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
% * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
% * Lesser General Public License for more details.
|
||||
% *
|
||||
% * You should have received a copy of the GNU Lesser General Public
|
||||
% * License along with this library; if not, write to the Free Software
|
||||
% * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
% *
|
||||
% */
|
||||
|
||||
% #if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__
|
||||
% /* rpcgen produces code containing unused variables. hush that... */
|
||||
% # pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
% #endif
|
||||
|
||||
/* This gets stuffed into the source files. */
|
||||
#if RPC_HDR
|
||||
%#ifdef HAVE_CONFIG_H
|
||||
%#include "config.h"
|
||||
%#endif
|
||||
%#include <rpc/xdr.h>
|
||||
%#include <hamlib/rig.h>
|
||||
#endif
|
||||
|
||||
typedef unsigned int model_x;
|
||||
typedef int vfo_x;
|
||||
typedef double freq_x;
|
||||
typedef unsigned int rmode_x;
|
||||
typedef int pbwidth_x;
|
||||
typedef unsigned long split_x;
|
||||
typedef int ptt_x;
|
||||
typedef int dcd_x;
|
||||
typedef long vfo_op_x;
|
||||
typedef long shortfreq_x;
|
||||
typedef unsigned long setting_x;
|
||||
typedef long ant_x;
|
||||
typedef long ann_x;
|
||||
typedef int rptr_shift_x;
|
||||
typedef int tone_x;
|
||||
typedef long scan_x;
|
||||
typedef long reset_x;
|
||||
typedef long powerstat_x;
|
||||
|
||||
%#if __APPLE__
|
||||
%static int _rpcsvcdirty;
|
||||
%#endif
|
||||
|
||||
struct mode_s {
|
||||
rmode_x mode;
|
||||
pbwidth_x width;
|
||||
};
|
||||
|
||||
/* a union would have been better, but struct is simpler */
|
||||
struct value_s {
|
||||
int i;
|
||||
float f;
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct freq_arg {
|
||||
vfo_x vfo;
|
||||
freq_x freq;
|
||||
};
|
||||
union freq_res switch (int rigstatus) {
|
||||
case 0:
|
||||
freq_x freq;
|
||||
default:
|
||||
void;
|
||||
};
|
||||
|
||||
struct mode_arg {
|
||||
vfo_x vfo;
|
||||
mode_s mw;
|
||||
};
|
||||
union mode_res switch (int rigstatus) {
|
||||
case 0:
|
||||
mode_s mw;
|
||||
default:
|
||||
void;
|
||||
};
|
||||
|
||||
union vfo_res switch (int rigstatus) {
|
||||
case 0:
|
||||
vfo_x vfo;
|
||||
default:
|
||||
void;
|
||||
};
|
||||
|
||||
union powerstat_res switch (int rigstatus) {
|
||||
case 0:
|
||||
powerstat_x powerstat;
|
||||
default:
|
||||
void;
|
||||
};
|
||||
|
||||
struct split_arg {
|
||||
vfo_x vfo;
|
||||
split_x split;
|
||||
vfo_x tx_vfo;
|
||||
};
|
||||
union split_res switch (int rigstatus) {
|
||||
case 0:
|
||||
split_arg split;
|
||||
default:
|
||||
void;
|
||||
};
|
||||
|
||||
struct ptt_arg {
|
||||
vfo_x vfo;
|
||||
ptt_x ptt;
|
||||
};
|
||||
union ptt_res switch (int rigstatus) {
|
||||
case 0:
|
||||
ptt_x ptt;
|
||||
default:
|
||||
void;
|
||||
};
|
||||
union dcd_res switch (int rigstatus) {
|
||||
case 0:
|
||||
dcd_x dcd;
|
||||
default:
|
||||
void;
|
||||
};
|
||||
|
||||
struct setting_arg {
|
||||
vfo_x vfo;
|
||||
setting_x setting;
|
||||
value_s val;
|
||||
};
|
||||
|
||||
union val_res switch (int rigstatus) {
|
||||
case 0:
|
||||
value_s val;
|
||||
default:
|
||||
void;
|
||||
};
|
||||
|
||||
struct vfo_op_arg {
|
||||
vfo_x vfo;
|
||||
vfo_op_x vfo_op;
|
||||
};
|
||||
|
||||
union rptrshift_res switch (int rigstatus) {
|
||||
case 0:
|
||||
rptr_shift_x rptrshift;
|
||||
default:
|
||||
void;
|
||||
};
|
||||
|
||||
struct rptrshift_arg {
|
||||
vfo_x vfo;
|
||||
rptr_shift_x rptrshift;
|
||||
};
|
||||
|
||||
union shortfreq_res switch (int rigstatus) {
|
||||
case 0:
|
||||
shortfreq_x shortfreq;
|
||||
default:
|
||||
void;
|
||||
};
|
||||
|
||||
struct shortfreq_arg {
|
||||
vfo_x vfo;
|
||||
shortfreq_x shortfreq;
|
||||
};
|
||||
|
||||
union tone_res switch (int rigstatus) {
|
||||
case 0:
|
||||
tone_x tone;
|
||||
default:
|
||||
void;
|
||||
};
|
||||
|
||||
struct tone_arg {
|
||||
vfo_x vfo;
|
||||
tone_x tone;
|
||||
};
|
||||
|
||||
union ant_res switch (int rigstatus) {
|
||||
case 0:
|
||||
ant_x ant;
|
||||
default:
|
||||
void;
|
||||
};
|
||||
|
||||
struct ant_arg {
|
||||
vfo_x vfo;
|
||||
ant_x ant;
|
||||
};
|
||||
|
||||
union ch_res switch (int rigstatus) {
|
||||
case 0:
|
||||
int ch;
|
||||
default:
|
||||
void;
|
||||
};
|
||||
|
||||
struct ch_arg {
|
||||
vfo_x vfo;
|
||||
int ch;
|
||||
};
|
||||
|
||||
struct scan_s {
|
||||
scan_x scan;
|
||||
int ch;
|
||||
};
|
||||
|
||||
union scan_res switch (int rigstatus) {
|
||||
case 0:
|
||||
scan_s scan;
|
||||
default:
|
||||
void;
|
||||
};
|
||||
|
||||
struct scan_arg {
|
||||
vfo_x vfo;
|
||||
scan_x scan;
|
||||
int ch;
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct freq_range_s {
|
||||
freq_x start;
|
||||
freq_x end;
|
||||
rmode_x modes;
|
||||
int low_power;
|
||||
int high_power;
|
||||
vfo_x vfo;
|
||||
ant_x ant;
|
||||
};
|
||||
struct tuning_step_s {
|
||||
rmode_x modes;
|
||||
shortfreq_x ts;
|
||||
};
|
||||
struct filter_s {
|
||||
rmode_x modes;
|
||||
pbwidth_x width;
|
||||
};
|
||||
struct channel_cap_x {
|
||||
unsigned int caps;
|
||||
setting_x funcs;
|
||||
setting_x levels;
|
||||
};
|
||||
struct chan_s {
|
||||
int start;
|
||||
int end;
|
||||
unsigned int type;
|
||||
channel_cap_x mem_caps;
|
||||
};
|
||||
|
||||
struct rigstate_s {
|
||||
int itu_region;
|
||||
|
||||
shortfreq_x max_rit;
|
||||
shortfreq_x max_xit;
|
||||
shortfreq_x max_ifshift;
|
||||
|
||||
ann_x announces;
|
||||
|
||||
setting_x has_get_func;
|
||||
setting_x has_set_func;
|
||||
setting_x has_get_level;
|
||||
setting_x has_set_level;
|
||||
setting_x has_get_parm;
|
||||
setting_x has_set_parm;
|
||||
|
||||
int preamp[MAXDBLSTSIZ];
|
||||
int attenuator[MAXDBLSTSIZ];
|
||||
|
||||
freq_range_s rx_range_list[FRQRANGESIZ];
|
||||
freq_range_s tx_range_list[FRQRANGESIZ];
|
||||
|
||||
tuning_step_s tuning_steps[TSLSTSIZ];
|
||||
|
||||
filter_s filters[FLTLSTSIZ];
|
||||
|
||||
chan_s chan_list[CHANLSTSIZ];
|
||||
};
|
||||
|
||||
union rigstate_res switch (int rigstatus) {
|
||||
case 0:
|
||||
rigstate_s state;
|
||||
default:
|
||||
void;
|
||||
};
|
||||
|
||||
|
||||
|
||||
program RIGPROG {
|
||||
version RIGVERS {
|
||||
model_x GETMODEL(void) = 1;
|
||||
/* string GETLIBVERSION(void) = 2 */
|
||||
rigstate_res GETRIGSTATE(void) = 3;
|
||||
int SETFREQ(freq_arg) = 10;
|
||||
freq_res GETFREQ(vfo_x) = 11;
|
||||
int SETMODE(mode_arg) = 12;
|
||||
mode_res GETMODE(vfo_x) = 13;
|
||||
int SETVFO(vfo_x) = 14;
|
||||
vfo_res GETVFO(vfo_x) = 15;
|
||||
int SETSPLITFREQ(freq_arg) = 16;
|
||||
freq_res GETSPLITFREQ(vfo_x) = 17;
|
||||
int SETSPLITMODE(mode_arg) = 18;
|
||||
mode_res GETSPLITMODE(vfo_x) = 19;
|
||||
int SETSPLITVFO(split_arg) = 20;
|
||||
split_res GETSPLITVFO(vfo_x) = 21;
|
||||
int SETPTT(ptt_arg) = 22;
|
||||
ptt_res GETPTT(vfo_x) = 23;
|
||||
dcd_res GETDCD(vfo_x) = 24;
|
||||
int SETFUNC(setting_arg) = 25;
|
||||
val_res GETFUNC(setting_arg) = 26;
|
||||
int SETLEVEL(setting_arg) = 27;
|
||||
val_res GETLEVEL(setting_arg) = 28;
|
||||
int SETPARM(setting_arg) = 29;
|
||||
val_res GETPARM(setting_arg) = 30;
|
||||
int VFOOP(vfo_op_arg) = 31;
|
||||
int SETRPTRSHIFT(rptrshift_arg) = 32;
|
||||
rptrshift_res GETRPTRSHIFT(vfo_x) = 33;
|
||||
int SETRPTROFFS(shortfreq_arg) = 34;
|
||||
shortfreq_res GETRPTROFFS(vfo_x) = 35;
|
||||
int SETCTCSSTONE(tone_arg) = 36;
|
||||
tone_res GETCTCSSTONE(vfo_x) = 37;
|
||||
int SETCTCSSSQL(tone_arg) = 38;
|
||||
tone_res GETCTCSSSQL(vfo_x) = 39;
|
||||
int SETDCSCODE(tone_arg) = 40;
|
||||
tone_res GETDCSCODE(vfo_x) = 41;
|
||||
int SETDCSSQL(tone_arg) = 42;
|
||||
tone_res GETDCSSQL(vfo_x) = 43;
|
||||
int SETRIT(shortfreq_arg) = 44;
|
||||
shortfreq_res GETRIT(vfo_x) = 45;
|
||||
int SETXIT(shortfreq_arg) = 46;
|
||||
shortfreq_res GETXIT(vfo_x) = 47;
|
||||
int SETTS(shortfreq_arg) = 48;
|
||||
shortfreq_res GETTS(vfo_x) = 49;
|
||||
int SCAN(scan_arg) = 50;
|
||||
int RESET(reset_x) = 51;
|
||||
int SETMEM(ch_arg) = 52;
|
||||
ch_res GETMEM(vfo_x) = 53;
|
||||
int SETANT(ant_arg) = 54;
|
||||
ant_res GETANT(vfo_x) = 55;
|
||||
int SETBANK(ch_arg) = 56;
|
||||
int SETPOWERSTAT(powerstat_x) = 58;
|
||||
powerstat_res GETPOWERSTAT(void) = 59;
|
||||
} = 1;
|
||||
} = 0x20000099;
|
||||
|
||||
|
||||
#ifdef RPC_HDR
|
||||
%
|
||||
%#define freq_t2x(t, x) do { *(x) = (t); } while(0)
|
||||
%#define freq_x2t(x) ((freq_t)*(x))
|
||||
%
|
||||
%#define setting_t2x(t, x) do { *(x) = (t); } while(0)
|
||||
%#define setting_x2t(x) ((setting_t)*(x))
|
||||
%
|
||||
%static inline void mode_t2s(rmode_t modet, pbwidth_t widtht, mode_s *modes)
|
||||
%{
|
||||
% modes->mode = modet;
|
||||
% modes->width = widtht;
|
||||
%}
|
||||
%static inline void mode_s2t(mode_s *modes, rmode_t *modet, pbwidth_t *widtht)
|
||||
%{
|
||||
% *modet = modes->mode;
|
||||
% *widtht = modes->width;
|
||||
%}
|
||||
#endif /* RPC_HDR */
|
Plik diff jest za duży
Load Diff
|
@ -1,28 +0,0 @@
|
|||
/*
|
||||
* Hamlib RPC backend - main header
|
||||
* Copyright (c) 2001-2003 by Stephane Fillod
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _RPCRIG_H
|
||||
#define _RPCRIG_H 1
|
||||
|
||||
|
||||
extern struct rig_caps rpcrig_caps;
|
||||
|
||||
#endif /* _RPCRIG_H */
|
|
@ -1,423 +0,0 @@
|
|||
/*
|
||||
* Hamlib RPC server - procedures
|
||||
* Copyright (c) 2001-2003 by Stephane Fillod
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h> /* Standard input/output definitions */
|
||||
#include <string.h> /* String function definitions */
|
||||
#include <unistd.h> /* UNIX standard function definitions */
|
||||
#include <fcntl.h> /* File control definitions */
|
||||
#include <errno.h> /* Error number definitions */
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include <rpc/rpc.h>
|
||||
#include "rpcrig.h"
|
||||
#include <hamlib/rig.h>
|
||||
|
||||
extern RIG *the_rpc_rig;
|
||||
|
||||
|
||||
/* without VFO arg */
|
||||
#define DECLARESET1(f, rig_f, rpc_type) \
|
||||
int * f##_1_svc(rpc_type *arg, struct svc_req *svc) \
|
||||
{ \
|
||||
static int res; \
|
||||
\
|
||||
res = rig_f(the_rpc_rig, *arg); \
|
||||
\
|
||||
return &res; \
|
||||
}
|
||||
|
||||
#define DECLAREGET1(f, rig_f, rpc_type, rig_type) \
|
||||
rpc_type##_res *f##_1_svc(void *rpc_arg, struct svc_req *svc) \
|
||||
{ \
|
||||
static rpc_type##_res res; \
|
||||
rig_type arg; \
|
||||
\
|
||||
res.rigstatus = rig_f(the_rpc_rig, &arg); \
|
||||
res.rpc_type##_res_u.rpc_type = arg; \
|
||||
\
|
||||
return &res; \
|
||||
}
|
||||
|
||||
/* with VFO arg */
|
||||
#define DECLARESETV1(f, rig_f, rpc_type) \
|
||||
int *f##_1_svc(rpc_type##_arg *arg, struct svc_req *svc) \
|
||||
{ \
|
||||
static int res; \
|
||||
\
|
||||
res = rig_f(the_rpc_rig, arg->vfo, arg->rpc_type); \
|
||||
\
|
||||
return &res; \
|
||||
}
|
||||
|
||||
#define DECLAREGETV1(f, rig_f, rpc_type, rig_type) \
|
||||
rpc_type##_res *f##_1_svc(vfo_x *vfo, struct svc_req *svc) \
|
||||
{ \
|
||||
static rpc_type##_res res; \
|
||||
rig_type arg; \
|
||||
\
|
||||
res.rigstatus = rig_f(the_rpc_rig, *vfo, &arg); \
|
||||
res.rpc_type##_res_u.rpc_type = arg; \
|
||||
\
|
||||
return &res; \
|
||||
}
|
||||
|
||||
model_x *getmodel_1_svc(void *arg, struct svc_req *svc)
|
||||
{
|
||||
static model_x res;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__);
|
||||
|
||||
/* free previous result */
|
||||
//xdr_free(xdr_model, &res);
|
||||
|
||||
res = the_rpc_rig->caps->rig_model;
|
||||
|
||||
return &res;
|
||||
}
|
||||
|
||||
rigstate_res *getrigstate_1_svc(void *arg, struct svc_req *svc)
|
||||
{
|
||||
static rigstate_res res;
|
||||
struct rig_state *rs;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__);
|
||||
|
||||
if (!the_rpc_rig->state.comm_state) {
|
||||
res.rigstatus = -RIG_ERJCTED;
|
||||
return &res;
|
||||
}
|
||||
|
||||
rs = &the_rpc_rig->state;
|
||||
|
||||
res.rigstate_res_u.state.itu_region = rs->itu_region;
|
||||
res.rigstate_res_u.state.has_set_func = rs->has_set_func;
|
||||
res.rigstate_res_u.state.has_get_func = rs->has_get_func;
|
||||
res.rigstate_res_u.state.has_set_level = rs->has_set_level;
|
||||
res.rigstate_res_u.state.has_get_level = rs->has_get_level;
|
||||
res.rigstate_res_u.state.has_set_parm = rs->has_set_parm;
|
||||
res.rigstate_res_u.state.has_get_parm = rs->has_get_parm;
|
||||
|
||||
res.rigstate_res_u.state.max_rit = rs->max_rit;
|
||||
res.rigstate_res_u.state.max_xit = rs->max_xit;
|
||||
res.rigstate_res_u.state.max_ifshift = rs->max_ifshift;
|
||||
res.rigstate_res_u.state.announces = rs->announces;
|
||||
|
||||
memcpy(res.rigstate_res_u.state.preamp, rs->preamp,
|
||||
sizeof(int)*MAXDBLSTSIZ);
|
||||
memcpy(res.rigstate_res_u.state.attenuator, rs->attenuator,
|
||||
sizeof(int)*MAXDBLSTSIZ);
|
||||
|
||||
memcpy(res.rigstate_res_u.state.tuning_steps, rs->tuning_steps,
|
||||
sizeof(tuning_step_s)*TSLSTSIZ);
|
||||
memcpy(res.rigstate_res_u.state.filters, rs->filters,
|
||||
sizeof(filter_s)*FLTLSTSIZ);
|
||||
memcpy(res.rigstate_res_u.state.chan_list, rs->chan_list,
|
||||
sizeof(chan_s)*CHANLSTSIZ);
|
||||
memcpy(res.rigstate_res_u.state.rx_range_list, rs->rx_range_list,
|
||||
sizeof(freq_range_s)*FRQRANGESIZ);
|
||||
memcpy(res.rigstate_res_u.state.tx_range_list, rs->tx_range_list,
|
||||
sizeof(freq_range_s)*FRQRANGESIZ);
|
||||
|
||||
res.rigstatus = RIG_OK;
|
||||
|
||||
return &res;
|
||||
}
|
||||
|
||||
int *setfreq_1_svc(freq_arg *farg, struct svc_req *svc)
|
||||
{
|
||||
static int res;
|
||||
|
||||
res = rig_set_freq(the_rpc_rig, farg->vfo, freq_x2t(&farg->freq));
|
||||
|
||||
return &res;
|
||||
}
|
||||
|
||||
freq_res *getfreq_1_svc(vfo_x *vfo, struct svc_req *svc)
|
||||
{
|
||||
static freq_res res;
|
||||
freq_t f;
|
||||
|
||||
res.rigstatus = rig_get_freq(the_rpc_rig, *vfo, &f);
|
||||
freq_t2x(f, &res.freq_res_u.freq);
|
||||
|
||||
return &res;
|
||||
}
|
||||
|
||||
int *setmode_1_svc(mode_arg *marg, struct svc_req *svc)
|
||||
{
|
||||
static int res;
|
||||
rmode_t mode;
|
||||
pbwidth_t width;
|
||||
|
||||
mode_s2t(&marg->mw, &mode, &width);
|
||||
res = rig_set_mode(the_rpc_rig, marg->vfo, mode, width);
|
||||
|
||||
return &res;
|
||||
}
|
||||
|
||||
mode_res *getmode_1_svc(vfo_x *vfo, struct svc_req *svc)
|
||||
{
|
||||
static mode_res res;
|
||||
rmode_t mode;
|
||||
pbwidth_t width;
|
||||
|
||||
res.rigstatus = rig_get_mode(the_rpc_rig, *vfo, &mode, &width);
|
||||
mode_t2s(mode, width, &res.mode_res_u.mw);
|
||||
|
||||
return &res;
|
||||
}
|
||||
|
||||
DECLARESET1(setvfo, rig_set_vfo, vfo_x)
|
||||
|
||||
vfo_res *getvfo_1_svc(vfo_x *vfo, struct svc_req *svc)
|
||||
{
|
||||
static vfo_res res;
|
||||
vfo_t v;
|
||||
|
||||
v = *vfo; /* NB: arg vfo is also input argument to get_vfo */
|
||||
res.rigstatus = rig_get_vfo(the_rpc_rig, &v);
|
||||
res.vfo_res_u.vfo = v;
|
||||
|
||||
return &res;
|
||||
}
|
||||
|
||||
int *setsplitfreq_1_svc(freq_arg *farg, struct svc_req *svc)
|
||||
{
|
||||
static int res;
|
||||
|
||||
res = rig_set_split_freq(the_rpc_rig, farg->vfo, freq_x2t(&farg->freq));
|
||||
|
||||
return &res;
|
||||
}
|
||||
|
||||
freq_res *getsplitfreq_1_svc(vfo_x *vfo, struct svc_req *svc)
|
||||
{
|
||||
static freq_res res;
|
||||
freq_t f;
|
||||
|
||||
res.rigstatus = rig_get_split_freq(the_rpc_rig, *vfo, &f);
|
||||
freq_t2x(f, &res.freq_res_u.freq);
|
||||
|
||||
return &res;
|
||||
}
|
||||
|
||||
int *setsplitmode_1_svc(mode_arg *marg, struct svc_req *svc)
|
||||
{
|
||||
static int res;
|
||||
rmode_t mode;
|
||||
pbwidth_t width;
|
||||
|
||||
mode_s2t(&marg->mw, &mode, &width);
|
||||
res = rig_set_split_mode(the_rpc_rig, marg->vfo, mode, width);
|
||||
|
||||
return &res;
|
||||
}
|
||||
|
||||
mode_res *getsplitmode_1_svc(vfo_x *vfo, struct svc_req *svc)
|
||||
{
|
||||
static mode_res res;
|
||||
rmode_t mode;
|
||||
pbwidth_t width;
|
||||
|
||||
res.rigstatus = rig_get_split_mode(the_rpc_rig, *vfo, &mode, &width);
|
||||
mode_t2s(mode, width, &res.mode_res_u.mw);
|
||||
|
||||
return &res;
|
||||
}
|
||||
|
||||
int *setsplitvfo_1_svc(split_arg *arg, struct svc_req *svc)
|
||||
{
|
||||
static int res;
|
||||
|
||||
res = rig_set_split_vfo(the_rpc_rig, arg->vfo, arg->split, arg->tx_vfo);
|
||||
|
||||
return &res;
|
||||
}
|
||||
|
||||
split_res *getsplitvfo_1_svc(vfo_x *vfo, struct svc_req *svc)
|
||||
{
|
||||
static split_res res;
|
||||
split_t arg;
|
||||
vfo_t tx_vfo;
|
||||
|
||||
res.rigstatus = rig_get_split_vfo(the_rpc_rig, *vfo, &arg, &tx_vfo);
|
||||
res.split_res_u.split.split = arg;
|
||||
res.split_res_u.split.tx_vfo = tx_vfo;
|
||||
|
||||
return &res;
|
||||
}
|
||||
|
||||
|
||||
DECLARESETV1(setptt, rig_set_ptt, ptt)
|
||||
DECLAREGETV1(getptt, rig_get_ptt, ptt, ptt_t)
|
||||
DECLAREGETV1(getdcd, rig_get_dcd, dcd, dcd_t)
|
||||
|
||||
int *setlevel_1_svc(setting_arg *arg, struct svc_req *svc)
|
||||
{
|
||||
static int res;
|
||||
setting_t setting;
|
||||
value_t val;
|
||||
|
||||
setting = setting_x2t(&arg->setting);
|
||||
if (RIG_LEVEL_IS_FLOAT(setting))
|
||||
val.f = arg->val.f;
|
||||
else
|
||||
val.i = arg->val.i;
|
||||
|
||||
res = rig_set_level(the_rpc_rig, arg->vfo, setting, val);
|
||||
|
||||
return &res;
|
||||
}
|
||||
|
||||
val_res *getlevel_1_svc(setting_arg *arg, struct svc_req *svc)
|
||||
{
|
||||
static val_res res;
|
||||
setting_t setting;
|
||||
value_t val;
|
||||
|
||||
setting = setting_x2t(&arg->setting);
|
||||
if (RIG_LEVEL_IS_FLOAT(setting))
|
||||
val.f = arg->val.f;
|
||||
else
|
||||
val.i = arg->val.i;
|
||||
|
||||
res.rigstatus = rig_get_level(the_rpc_rig, arg->vfo, setting, &val);
|
||||
if (RIG_LEVEL_IS_FLOAT(setting))
|
||||
res.val_res_u.val.f = val.f;
|
||||
else
|
||||
res.val_res_u.val.i = val.i;
|
||||
|
||||
return &res;
|
||||
}
|
||||
|
||||
int *setparm_1_svc(setting_arg *arg, struct svc_req *svc)
|
||||
{
|
||||
static int res;
|
||||
setting_t setting;
|
||||
value_t val;
|
||||
|
||||
setting = setting_x2t(&arg->setting);
|
||||
if (RIG_PARM_IS_FLOAT(setting))
|
||||
val.f = arg->val.f;
|
||||
else
|
||||
val.i = arg->val.i;
|
||||
|
||||
res = rig_set_parm(the_rpc_rig, setting, val);
|
||||
|
||||
return &res;
|
||||
}
|
||||
|
||||
val_res *getparm_1_svc(setting_arg *arg, struct svc_req *svc)
|
||||
{
|
||||
static val_res res;
|
||||
setting_t setting;
|
||||
value_t val;
|
||||
|
||||
setting = setting_x2t(&arg->setting);
|
||||
if (RIG_PARM_IS_FLOAT(setting))
|
||||
val.f = arg->val.f;
|
||||
else
|
||||
val.i = arg->val.i;
|
||||
|
||||
res.rigstatus = rig_get_parm(the_rpc_rig, setting, &val);
|
||||
if (RIG_PARM_IS_FLOAT(setting))
|
||||
res.val_res_u.val.f = val.f;
|
||||
else
|
||||
res.val_res_u.val.i = val.i;
|
||||
|
||||
return &res;
|
||||
}
|
||||
|
||||
int *setfunc_1_svc(setting_arg *arg, struct svc_req *svc)
|
||||
{
|
||||
static int res;
|
||||
setting_t setting;
|
||||
|
||||
setting = setting_x2t(&arg->setting);
|
||||
|
||||
res = rig_set_func(the_rpc_rig, arg->vfo, setting, arg->val.i);
|
||||
|
||||
return &res;
|
||||
}
|
||||
|
||||
val_res *getfunc_1_svc(setting_arg *arg, struct svc_req *svc)
|
||||
{
|
||||
static val_res res;
|
||||
setting_t setting;
|
||||
value_t val;
|
||||
|
||||
setting = setting_x2t(&arg->setting);
|
||||
val.i = arg->val.i;
|
||||
res.rigstatus = rig_get_func(the_rpc_rig, arg->vfo, setting,
|
||||
&res.val_res_u.val.i);
|
||||
|
||||
return &res;
|
||||
/* quell stupid gcc "set but not used" warning */
|
||||
rig_debug(RIG_DEBUG_TRACE, "val = %d\n", val);
|
||||
}
|
||||
|
||||
int *scan_1_svc(scan_arg *arg, struct svc_req *svc)
|
||||
{
|
||||
static int res;
|
||||
|
||||
res = rig_scan(the_rpc_rig, arg->vfo, arg->scan, arg->ch);
|
||||
|
||||
return &res;
|
||||
}
|
||||
|
||||
DECLARESETV1(vfoop, rig_vfo_op, vfo_op)
|
||||
|
||||
DECLARESETV1(setrptrshift, rig_set_rptr_shift, rptrshift)
|
||||
DECLAREGETV1(getrptrshift, rig_get_rptr_shift, rptrshift, rptr_shift_t)
|
||||
DECLARESETV1(setrptroffs, rig_set_rptr_offs, shortfreq)
|
||||
DECLAREGETV1(getrptroffs, rig_get_rptr_offs, shortfreq, shortfreq_t)
|
||||
|
||||
DECLARESETV1(setctcsstone, rig_set_ctcss_tone, tone)
|
||||
DECLAREGETV1(getctcsstone, rig_get_ctcss_tone, tone, tone_t)
|
||||
DECLARESETV1(setctcsssql, rig_set_ctcss_sql, tone)
|
||||
DECLAREGETV1(getctcsssql, rig_get_ctcss_sql, tone, tone_t)
|
||||
DECLARESETV1(setdcscode, rig_set_dcs_code, tone)
|
||||
DECLAREGETV1(getdcscode, rig_get_dcs_code, tone, tone_t)
|
||||
DECLARESETV1(setdcssql, rig_set_dcs_sql, tone)
|
||||
DECLAREGETV1(getdcssql, rig_get_dcs_sql, tone, tone_t)
|
||||
|
||||
DECLARESETV1(setrit, rig_set_rit, shortfreq)
|
||||
DECLAREGETV1(getrit, rig_get_rit, shortfreq, shortfreq_t)
|
||||
DECLARESETV1(setxit, rig_set_xit, shortfreq)
|
||||
DECLAREGETV1(getxit, rig_get_xit, shortfreq, shortfreq_t)
|
||||
DECLARESETV1(setts, rig_set_ts, shortfreq)
|
||||
DECLAREGETV1(getts, rig_get_ts, shortfreq, shortfreq_t)
|
||||
|
||||
DECLARESETV1(setant, rig_set_ant, ant)
|
||||
DECLAREGETV1(getant, rig_get_ant, ant, ant_t)
|
||||
DECLARESETV1(setmem, rig_set_mem, ch)
|
||||
DECLAREGETV1(getmem, rig_get_mem, ch, int)
|
||||
DECLARESETV1(setbank, rig_set_bank, ch)
|
||||
|
||||
DECLARESET1(reset, rig_reset, reset_x)
|
||||
DECLARESET1(setpowerstat, rig_set_powerstat, powerstat_x)
|
||||
DECLAREGET1(getpowerstat, rig_get_powerstat, powerstat, powerstat_t)
|
||||
|
396
rpcrig/rpcrigd.c
396
rpcrig/rpcrigd.c
|
@ -1,396 +0,0 @@
|
|||
/*
|
||||
* rpcrigd - (C) Stephane Fillod 2001-2003
|
||||
*
|
||||
* This program let programs control a radio through
|
||||
* the mean of RPC services using Hamlib.
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "rpcrig.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <rpc/pmap_clnt.h>
|
||||
#include <string.h>
|
||||
#include <memory.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <unistd.h>
|
||||
#include <netdb.h>
|
||||
#ifdef HAVE_RPC_RPCENT_H
|
||||
#include <rpc/rpcent.h>
|
||||
#endif
|
||||
|
||||
#include <getopt.h>
|
||||
|
||||
#include <hamlib/rig.h>
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
void usage();
|
||||
void version();
|
||||
void rigd_exit();
|
||||
|
||||
void rigprog_1(struct svc_req *rqstp, register SVCXPRT *transp);
|
||||
|
||||
|
||||
/*
|
||||
* Reminder: when adding long options,
|
||||
* keep up to date SHORT_OPTIONS, usage()'s output and man page. thanks.
|
||||
* NB: do NOT use -W since it's reserved by POSIX.
|
||||
*/
|
||||
#define SHORT_OPTIONS "m:r:p:P:d:D:c:s:C:t:vhV"
|
||||
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'},
|
||||
{"set-conf", 1, 0, 'C'},
|
||||
{"prog", 1, 0, 't'},
|
||||
{"verbose", 0, 0, 'v'},
|
||||
{"help", 0, 0, 'h'},
|
||||
{"version", 0, 0, 'V'},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
|
||||
int set_conf(RIG *my_rig, char *conf_parms)
|
||||
{
|
||||
char *p, *q, *n;
|
||||
int ret;
|
||||
|
||||
p = conf_parms;
|
||||
while (p && *p != '\0') {
|
||||
/* FIXME: left hand value of = cannot be null */
|
||||
q = strchr(p, '=');
|
||||
if ( !q )
|
||||
return RIG_EINVAL;
|
||||
*q++ = '\0';
|
||||
n = strchr(q, ',');
|
||||
if (n) *n++ = '\0';
|
||||
|
||||
ret = rig_set_conf(my_rig, rig_token_lookup(my_rig, p), q);
|
||||
if (ret != RIG_OK)
|
||||
return ret;
|
||||
p = n;
|
||||
}
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
||||
static unsigned long extract_prognum(const char val[])
|
||||
{
|
||||
if (val[0] == '+') {
|
||||
return RIGPROG + atol(val+1);
|
||||
} else
|
||||
if (val[0] < '0' || val[0] > '9') {
|
||||
struct rpcent *ent;
|
||||
ent = getrpcbyname (val);
|
||||
if (ent)
|
||||
return ent->r_number;
|
||||
else
|
||||
return 0;
|
||||
} else
|
||||
return atol(val);
|
||||
}
|
||||
|
||||
|
||||
RIG *the_rpc_rig;
|
||||
|
||||
|
||||
#define MAXCONFLEN 128
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
register SVCXPRT *transp;
|
||||
|
||||
rig_model_t my_model = RIG_MODEL_DUMMY;
|
||||
int retcode; /* generic return code from functions */
|
||||
|
||||
int verbose = 0;
|
||||
const char *rig_file=NULL, *ptt_file=NULL, *dcd_file=NULL;
|
||||
ptt_type_t ptt_type = RIG_PTT_NONE;
|
||||
dcd_type_t dcd_type = RIG_DCD_NONE;
|
||||
char *civaddr = NULL; /* NULL means no need to set conf */
|
||||
int serial_rate = 0;
|
||||
char conf_parms[MAXCONFLEN] = "";
|
||||
unsigned long prognum = RIGPROG;
|
||||
|
||||
/* Arguments parsing */
|
||||
|
||||
while(1) {
|
||||
int c;
|
||||
int option_index = 0;
|
||||
|
||||
c = getopt_long (argc, argv, SHORT_OPTIONS,
|
||||
long_options, &option_index);
|
||||
if (c == -1)
|
||||
break;
|
||||
|
||||
switch(c) {
|
||||
case 'h':
|
||||
usage();
|
||||
exit(0);
|
||||
case 'V':
|
||||
version();
|
||||
exit(0);
|
||||
case 'm':
|
||||
if (!optarg) {
|
||||
usage(); /* wrong arg count */
|
||||
exit(1);
|
||||
}
|
||||
my_model = atoi(optarg);
|
||||
break;
|
||||
case 'r':
|
||||
if (!optarg) {
|
||||
usage(); /* wrong arg count */
|
||||
exit(1);
|
||||
}
|
||||
rig_file = optarg;
|
||||
break;
|
||||
case 'p':
|
||||
if (!optarg) {
|
||||
usage(); /* wrong arg count */
|
||||
exit(1);
|
||||
}
|
||||
ptt_file = optarg;
|
||||
break;
|
||||
case 'd':
|
||||
if (!optarg) {
|
||||
usage(); /* wrong arg count */
|
||||
exit(1);
|
||||
}
|
||||
dcd_file = optarg;
|
||||
break;
|
||||
case 'P':
|
||||
if (!optarg) {
|
||||
usage(); /* wrong arg count */
|
||||
exit(1);
|
||||
}
|
||||
if (!strcmp(optarg, "RIG"))
|
||||
ptt_type = RIG_PTT_RIG;
|
||||
else if (!strcmp(optarg, "DTR"))
|
||||
ptt_type = RIG_PTT_SERIAL_DTR;
|
||||
else if (!strcmp(optarg, "RTS"))
|
||||
ptt_type = RIG_PTT_SERIAL_RTS;
|
||||
else if (!strcmp(optarg, "PARALLEL"))
|
||||
ptt_type = RIG_PTT_PARALLEL;
|
||||
else if (!strcmp(optarg, "NONE"))
|
||||
ptt_type = RIG_PTT_NONE;
|
||||
else
|
||||
ptt_type = atoi(optarg);
|
||||
break;
|
||||
case 'D':
|
||||
if (!optarg) {
|
||||
usage(); /* wrong arg count */
|
||||
exit(1);
|
||||
}
|
||||
if (!strcmp(optarg, "RIG"))
|
||||
dcd_type = RIG_DCD_RIG;
|
||||
else if (!strcmp(optarg, "DSR"))
|
||||
dcd_type = RIG_DCD_SERIAL_DSR;
|
||||
else if (!strcmp(optarg, "CTS"))
|
||||
dcd_type = RIG_DCD_SERIAL_CTS;
|
||||
else if (!strcmp(optarg, "CD"))
|
||||
dcd_type = RIG_DCD_SERIAL_CAR;
|
||||
else if (!strcmp(optarg, "PARALLEL"))
|
||||
dcd_type = RIG_DCD_PARALLEL;
|
||||
else if (!strcmp(optarg, "NONE"))
|
||||
dcd_type = RIG_DCD_NONE;
|
||||
else
|
||||
dcd_type = atoi(optarg);
|
||||
break;
|
||||
case 'c':
|
||||
if (!optarg) {
|
||||
usage(); /* wrong arg count */
|
||||
exit(1);
|
||||
}
|
||||
civaddr = optarg;
|
||||
break;
|
||||
case 's':
|
||||
if (!optarg) {
|
||||
usage(); /* wrong arg count */
|
||||
exit(1);
|
||||
}
|
||||
serial_rate = atoi(optarg);
|
||||
break;
|
||||
case 'C':
|
||||
if (!optarg) {
|
||||
usage(); /* wrong arg count */
|
||||
exit(1);
|
||||
}
|
||||
if (*conf_parms != '\0')
|
||||
strcat(conf_parms, ",");
|
||||
strncat(conf_parms, optarg, MAXCONFLEN-strlen(conf_parms));
|
||||
break;
|
||||
case 't':
|
||||
if (!optarg) {
|
||||
usage(); /* wrong arg count */
|
||||
exit(1);
|
||||
}
|
||||
prognum = extract_prognum(optarg);
|
||||
break;
|
||||
case 'v':
|
||||
verbose++;
|
||||
break;
|
||||
default:
|
||||
usage(); /* unknown option? */
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
if (verbose < 2)
|
||||
rig_set_debug(RIG_DEBUG_WARN);
|
||||
|
||||
|
||||
/* Opening the local rig */
|
||||
|
||||
the_rpc_rig = rig_init(my_model);
|
||||
|
||||
if (!the_rpc_rig) {
|
||||
fprintf(stderr, "Unknown rig num %d, or initialization error.\n",
|
||||
my_model);
|
||||
fprintf(stderr, "Please check with rigctl --list option.\n");
|
||||
exit(2);
|
||||
}
|
||||
|
||||
retcode = set_conf(the_rpc_rig, conf_parms);
|
||||
if (retcode != RIG_OK) {
|
||||
fprintf(stderr, "Config parameter error: %s\n", rigerror(retcode));
|
||||
exit(2);
|
||||
}
|
||||
|
||||
if (rig_file)
|
||||
strncpy(the_rpc_rig->state.rigport.pathname, rig_file, FILPATHLEN - 1);
|
||||
|
||||
/*
|
||||
* ex: RIG_PTT_PARALLEL and /dev/parport0
|
||||
*/
|
||||
if (ptt_type != RIG_PTT_NONE)
|
||||
the_rpc_rig->state.pttport.type.ptt = ptt_type;
|
||||
if (dcd_type != RIG_DCD_NONE)
|
||||
the_rpc_rig->state.dcdport.type.dcd = dcd_type;
|
||||
if (ptt_file)
|
||||
strncpy(the_rpc_rig->state.pttport.pathname, ptt_file, FILPATHLEN - 1);
|
||||
if (dcd_file)
|
||||
strncpy(the_rpc_rig->state.dcdport.pathname, dcd_file, FILPATHLEN - 1);
|
||||
/* FIXME: bound checking and port type == serial */
|
||||
if (serial_rate != 0)
|
||||
the_rpc_rig->state.rigport.parm.serial.rate = serial_rate;
|
||||
if (civaddr)
|
||||
rig_set_conf(the_rpc_rig, rig_token_lookup(the_rpc_rig, "civaddr"), civaddr);
|
||||
|
||||
|
||||
retcode = rig_open(the_rpc_rig);
|
||||
if (retcode != RIG_OK) {
|
||||
fprintf(stderr,"rig_open: error = %s \n", rigerror(retcode));
|
||||
exit(2);
|
||||
}
|
||||
|
||||
atexit(rigd_exit);
|
||||
|
||||
if (verbose > 0)
|
||||
printf("Opened rig model %d, '%s'\n", the_rpc_rig->caps->rig_model,
|
||||
the_rpc_rig->caps->model_name);
|
||||
|
||||
|
||||
/* Setup the RPC service and fire it up */
|
||||
|
||||
|
||||
pmap_unset (prognum, RIGVERS);
|
||||
|
||||
transp = svcudp_create(RPC_ANYSOCK);
|
||||
if (transp == NULL) {
|
||||
fprintf (stderr, "cannot create udp service.");
|
||||
exit(1);
|
||||
}
|
||||
if (!svc_register(transp, prognum, RIGVERS, rigprog_1, IPPROTO_UDP)) {
|
||||
fprintf (stderr, "unable to register (%lu, %u, udp).", prognum, RIGVERS);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
transp = svctcp_create(RPC_ANYSOCK, 0, 0);
|
||||
if (transp == NULL) {
|
||||
fprintf (stderr, "cannot create tcp service.");
|
||||
exit(1);
|
||||
}
|
||||
if (!svc_register(transp, prognum, RIGVERS, rigprog_1, IPPROTO_TCP)) {
|
||||
fprintf (stderr, "unable to register (%lu, %u, tcp).", prognum, RIGVERS);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
svc_run ();
|
||||
fprintf (stderr, "svc_run returned");
|
||||
|
||||
/* the rig gets automatically closed in rigd_exit() */
|
||||
|
||||
exit (1);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
|
||||
void rigd_exit()
|
||||
{
|
||||
rig_close(the_rpc_rig);
|
||||
rig_cleanup(the_rpc_rig);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void usage()
|
||||
{
|
||||
printf("Usage: rpc.rigd [OPTION]...\n"
|
||||
"Offer RPC services to remotely control a connected radio transceiver or receiver.\n\n");
|
||||
|
||||
printf(
|
||||
" -m, --model=ID select radio model number. See model list\n"
|
||||
" -r, --rig-file=DEVICE set device of the radio to operate on\n"
|
||||
" -p, --ptt-file=DEVICE set device of the PTT device to operate on\n"
|
||||
" -d, --dcd-file=DEVICE set device of the DCD device to operate on\n"
|
||||
" -P, --ptt-type=TYPE set type of the PTT device to operate on\n"
|
||||
" -D, --dcd-type=TYPE set type of the DCD device to operate on\n"
|
||||
" -s, --serial-speed=BAUD set serial speed of the serial port\n"
|
||||
" -c, --civaddr=ID set CI-V address (for Icom rigs only)\n"
|
||||
" -C, --set-conf=PARM=VAL set config parameters\n"
|
||||
" -t, --prog=NUMBER set RPC program number\n"
|
||||
" -v, --verbose set verbose mode, cumulative\n"
|
||||
" -h, --help display this help and exit\n"
|
||||
" -V, --version output version information and exit\n\n"
|
||||
);
|
||||
|
||||
printf("\nReport bugs to <hamlib-developer@lists.sourceforge.net>.\n");
|
||||
|
||||
}
|
||||
|
||||
void version()
|
||||
{
|
||||
printf("rpcrigd, %s\n\n", hamlib_version);
|
||||
printf("%s\n", hamlib_copyright);
|
||||
}
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
# rpcrot_xdr.c rpcrot_svc.c rpcrot_clnt.c and rpcrot.h are generated by rpcgen
|
||||
# have to provide: rpcrot_proc.c rpcrotd.c rpcrot_backend.c
|
||||
#
|
||||
# Note: automake complains rpcrot_xdr.c is generated both with and
|
||||
# without libtool, hence the copy rpcrot_xdr_lt.c
|
||||
|
||||
LDADD = $(top_builddir)/src/libhamlib.la $(top_builddir)/lib/libmisc.la @NET_LIBS@
|
||||
DEPENDENCIES = $(top_builddir)/src/libhamlib.la
|
||||
|
||||
BUILT_SOURCES = rpcrot_xdr.c rpcrot_svc.c rpcrot_xdr_lt.c rpcrot_clnt.c rpcrot.h
|
||||
DISTCLEANFILES = $(BUILT_SOURCES)
|
||||
|
||||
# needed for backward compatibility on Solaris.
|
||||
AM_CFLAGS = $(CFLAGS) -DPORTMAP
|
||||
|
||||
# The RPC backend
|
||||
pkglib_LTLIBRARIES = hamlib-rpcrot.la
|
||||
hamlib_rpcrot_la_SOURCES = rpcrot_backend.c rpcrot_backend.h
|
||||
nodist_hamlib_rpcrot_la_SOURCES = rpcrot_clnt.c rpcrot_xdr_lt.c rpcrot.h
|
||||
hamlib_rpcrot_la_LDFLAGS = -no-undefined -module -avoid-version
|
||||
hamlib_rpcrot_la_LIBADD = $(top_builddir)/src/libhamlib.la @NET_LIBS@
|
||||
|
||||
# The RPC server
|
||||
sbin_PROGRAMS = rpc.rotd
|
||||
rpc_rotd_DEPENDENCIES = $(DEPENDENCIES) @ROT_BACKENDEPS@ hamlib-rpcrot.la
|
||||
rpc_rotd_SOURCES = rpcrotd.c rpcrot_proc.c
|
||||
nodist_rpc_rotd_SOURCES = rpcrot_svc.c rpcrot_xdr.c rpcrot.h
|
||||
rpc_rotd_LDFLAGS = @ROT_BACKENDLNK@
|
||||
man_MANS = rpc.rotd.8
|
||||
|
||||
|
||||
EXTRA_DIST = rpcrot.x $(man_MANS)
|
||||
|
||||
RPCGEN = rpcgen
|
||||
|
||||
rpcrot.h: Makefile rpcrot.x
|
||||
rm -f $@
|
||||
$(RPCGEN) -h -C `test -f rpcrot.x || echo '$(srcdir)/'`rpcrot.x -o $@
|
||||
|
||||
|
||||
# Need to chdir in source dir, otherwise rpcgen hardcodes header path. sigh.
|
||||
rpcrot_clnt.c: Makefile rpcrot.x
|
||||
rm -f $@
|
||||
abs_builddir=`pwd` ; \
|
||||
cd $(srcdir) && $(RPCGEN) -l -C rpcrot.x -o $$abs_builddir/$@
|
||||
|
||||
rpcrot_svc.c: Makefile rpcrot.x
|
||||
rm -f $@
|
||||
abs_builddir=`pwd` ; \
|
||||
cd $(srcdir) && $(RPCGEN) -m -C rpcrot.x -o $$abs_builddir/$@
|
||||
|
||||
# note:
|
||||
# we need 2 rpcrot_xdr.c's: one for static rpcrot deamon, one for lt backend
|
||||
|
||||
rpcrot_xdr.c: Makefile rpcrot.x
|
||||
rm -f $@
|
||||
abs_builddir=`pwd` ; \
|
||||
cd $(srcdir) && $(RPCGEN) -c -C rpcrot.x -o $$abs_builddir/$@
|
||||
|
||||
rpcrot_xdr_lt.c: Makefile rpcrot.x
|
||||
rm -f $@
|
||||
abs_builddir=`pwd` ; \
|
||||
cd $(srcdir) && $(RPCGEN) -c -C rpcrot.x -o $$abs_builddir/$@
|
||||
|
|
@ -1,127 +0,0 @@
|
|||
.\" 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 ROTD "8" "February 24, 2007" "Hamlib" "RPC Rotator 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
|
||||
rotd \- Hamlib rotator service daemon
|
||||
.SH SYNOPSIS
|
||||
.B rpc.rotd
|
||||
[\fIOPTION\fR]...
|
||||
.SH DESCRIPTION
|
||||
The \fBrotd\fP program is a \fBHamlib\fP rotator daemon that handles RPC
|
||||
client requests. This allows multiple user programs to share one rotator. At
|
||||
this time multiple rotator support is not available (help needed!).
|
||||
.PP
|
||||
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
|
||||
.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
|
||||
.\" respectively.
|
||||
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. 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
|
||||
REPORTING BUGS 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 (`-').
|
||||
|
||||
Here is a summary of the supported options:
|
||||
.TP
|
||||
.B \-m, --model=id
|
||||
Select rotator model number. See model list (use 'rotctl -l').
|
||||
.br
|
||||
NB: \fBrotctl\fP (or third party software) will use rotor model 101
|
||||
when using \fBrotd\fP.
|
||||
.TP
|
||||
.B \-r, --rot-file=device
|
||||
Use \fIdevice\fP as the file name of the port the rotator is connected.
|
||||
Often a serial port, but could be a USB to serial adapter. Typically
|
||||
/dev/ttyS0, /dev/ttyS1, /dev/ttyUSB0, etc.
|
||||
.TP
|
||||
.B \-s, --serial-speed=baud
|
||||
Set serial speed to \fIbaud\fP rate. Uses maximum serial speed from rotor
|
||||
backend as the default.
|
||||
.TP
|
||||
.B \-C, --set-conf=parm=val[,parm=val]*
|
||||
Set config parameter. e.g. stop_bits=2
|
||||
.br
|
||||
Use -L option of \fBrotctl\fP for a list.
|
||||
.TP
|
||||
.B \-t, --prog=number
|
||||
Use \fInumber\fP as the RPC program number. The default is 536873369.
|
||||
.TP
|
||||
.B \-v, --verbose
|
||||
Set verbose mode, cumulative (see DIAGNOSTICS below).
|
||||
.TP
|
||||
.B \-h, --help
|
||||
Show summary of these options and exit.
|
||||
.TP
|
||||
.B \-V, \-\-version
|
||||
Show version of \fBrpc.rotd\fP and exit.
|
||||
.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 with a \fBHamlib\fP error code.
|
||||
.SH EXAMPLES
|
||||
Start \fBrotd\fP as root for a RotorEZ using a USB to serial adapter and
|
||||
backgrounding:
|
||||
.PP
|
||||
# rpc.rotd -m 401 -r /dev/ttyUSB1 &
|
||||
.PP
|
||||
Start \fBrotd\fP as root for a RotorEZ using COM1 while generating TRACE
|
||||
output:
|
||||
.PP
|
||||
# rpc.rotd -m 401 -r /dev/ttyS0 -vvvvv
|
||||
.PP
|
||||
Start \fBrotd\fP as root for a RotorEZ using a USB to serial adapter while
|
||||
setting baud rate and stop bits and backgrounding:
|
||||
.PP
|
||||
# rpc.rotd -m 401 -r /dev/ttyUSB1 -s 4800 -C stop_bits=2 &
|
||||
.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,
|
||||
-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 rotator which is very useful for rotator backend
|
||||
library development and may be requested by the developers.
|
||||
.SH SECURITY
|
||||
No authentication whatsoever; could be done through domain restriction,
|
||||
though. Please ask if stronger security is needed.
|
||||
.SH BUGS
|
||||
Does not support more than one communication device for multiple rotor control.
|
||||
(e.g. for Single Operator 2 Radio) Help needed!
|
||||
.SH REPORTING BUGS
|
||||
Report bugs to <hamlib-developer@lists.sourceforge.net>.
|
||||
.br
|
||||
We are already aware of the bug in the previous section :-)
|
||||
.SH AUTHORS
|
||||
Written by Stephane Fillod and the Hamlib Group
|
||||
.br
|
||||
<http://www.hamlib.org>.
|
||||
.SH COPYRIGHT
|
||||
Copyright \(co 2000-2007 Stephane Fillod and the Hamlib Group.
|
||||
Contributed by Francois Retief <fgretief@sun.ac.za>.
|
||||
.br
|
||||
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 rotctl (1),
|
||||
.BR hamlib (3)
|
106
rpcrot/rpcrot.x
106
rpcrot/rpcrot.x
|
@ -1,106 +0,0 @@
|
|||
%/*
|
||||
% * Hamlib Interface - RPC definitions
|
||||
% * Copyright (c) 2000-2002 by Stephane Fillod and Frank Singleton
|
||||
% * Contributed by Francois Retief <fgretief@sun.ac.za>
|
||||
% *
|
||||
% *
|
||||
% * This library is free software; you can redistribute it and/or
|
||||
% * modify it under the terms of the GNU Lesser General Public
|
||||
% * License as published by the Free Software Foundation; either
|
||||
% * version 2.1 of the License, or (at your option) any later version.
|
||||
% *
|
||||
% * This library is distributed in the hope that it will be useful,
|
||||
% * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
% * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
% * Lesser General Public License for more details.
|
||||
% *
|
||||
% * You should have received a copy of the GNU Lesser General Public
|
||||
% * License along with this library; if not, write to the Free Software
|
||||
% * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
% *
|
||||
% */
|
||||
|
||||
% #if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__
|
||||
% /* rpcgen produces code containing unused variables. hush that... */
|
||||
% # pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
% #endif
|
||||
|
||||
/* This gets stuffed into the source files. */
|
||||
#if RPC_HDR
|
||||
%#ifdef HAVE_CONFIG_H
|
||||
%#include "config.h"
|
||||
%#endif
|
||||
%#include <rpc/xdr.h>
|
||||
%#include <hamlib/rotator.h>
|
||||
#endif
|
||||
|
||||
%#if __APPLE__
|
||||
%static int _rpcsvcdirty;
|
||||
%#endif
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
||||
typedef unsigned int model_x;
|
||||
typedef float azimuth_x;
|
||||
typedef float elevation_x;
|
||||
typedef unsigned int rot_reset_x;
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
||||
struct position_arg {
|
||||
azimuth_x az;
|
||||
elevation_x el;
|
||||
};
|
||||
|
||||
struct move_s {
|
||||
int direction;
|
||||
int speed;
|
||||
};
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
||||
struct position_s {
|
||||
azimuth_x az;
|
||||
elevation_x el;
|
||||
};
|
||||
union position_res switch (int rotstatus) {
|
||||
case 0:
|
||||
position_s pos;
|
||||
default:
|
||||
void;
|
||||
};
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
||||
struct rotstate_s {
|
||||
azimuth_x az_min;
|
||||
azimuth_x az_max;
|
||||
elevation_x el_min;
|
||||
elevation_x el_max;
|
||||
};
|
||||
union rotstate_res switch (int rotstatus) {
|
||||
case 0:
|
||||
rotstate_s state;
|
||||
default:
|
||||
void;
|
||||
};
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
||||
program ROTPROG {
|
||||
version ROTVERS {
|
||||
model_x GETMODEL(void) = 1;
|
||||
rotstate_res GETROTSTATE(void) = 3;
|
||||
|
||||
int SETPOSITION(position_s) = 10;
|
||||
position_res GETPOSITION(void) = 11;
|
||||
int STOP(void) = 12;
|
||||
int RESET(rot_reset_x) = 13;
|
||||
int PARK(void) = 14;
|
||||
int MOVE(move_s) = 15;
|
||||
} = 1;
|
||||
} = 0x20000999;
|
||||
|
||||
/* ************************************************************************* */
|
||||
/* end of file */
|
||||
|
|
@ -1,415 +0,0 @@
|
|||
/*
|
||||
* Hamlib RPC backend - main file
|
||||
* Copyright (c) 2001-2008 by Stephane Fillod
|
||||
* Contributed by Francois Retief <fgretief@sun.ac.za>
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h> /* String function definitions */
|
||||
#include <unistd.h> /* UNIX standard function definitions */
|
||||
#include <math.h>
|
||||
#include <netdb.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "hamlib/rotator.h"
|
||||
#include "serial.h"
|
||||
#include "misc.h"
|
||||
#include "token.h"
|
||||
#include "register.h"
|
||||
|
||||
#include <rpc/rpc.h>
|
||||
#ifdef HAVE_RPC_RPCENT_H
|
||||
#include <rpc/rpcent.h>
|
||||
#endif
|
||||
|
||||
#include "rpcrot.h"
|
||||
#include "rpcrot_backend.h"
|
||||
|
||||
struct rpcrot_priv_data {
|
||||
CLIENT *cl;
|
||||
unsigned long prognum;
|
||||
};
|
||||
|
||||
#define ROTPROTO "udp"
|
||||
|
||||
/*
|
||||
* Borrowed from stringify.h
|
||||
* Indirect stringification. Doing two levels allows the parameter to be a
|
||||
* macro itself. For example, compile with -DFOO=bar, __stringify(FOO)
|
||||
* converts to "bar".
|
||||
*/
|
||||
|
||||
#define r_stringify_1(x) #x
|
||||
#define r_stringify(x) r_stringify_1(x)
|
||||
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
||||
static unsigned long extract_prognum(const char val[])
|
||||
{
|
||||
if (val[0] == '+') {
|
||||
return ROTPROG + atol(val+1);
|
||||
} else
|
||||
if (val[0] < '0' || val[0] > '9') {
|
||||
struct rpcent *ent;
|
||||
ent = getrpcbyname (val);
|
||||
if (ent)
|
||||
return ent->r_number;
|
||||
else
|
||||
return 0;
|
||||
} else
|
||||
return atol(val);
|
||||
}
|
||||
|
||||
|
||||
static int rpcrot_init(ROT *rot)
|
||||
{
|
||||
struct rpcrot_priv_data *priv;
|
||||
|
||||
if (!rot || !rot->caps)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
rot->state.priv = malloc(sizeof(struct rpcrot_priv_data));
|
||||
if (!rot->state.priv) {
|
||||
/* whoops! memory shortage! */
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
priv = (struct rpcrot_priv_data*)rot->state.priv;
|
||||
|
||||
rot->state.rotport.type.rig = RIG_PORT_RPC;
|
||||
strcpy(rot->state.rotport.pathname, "localhost");
|
||||
priv->prognum = ROTPROG;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
static int rpcrot_cleanup(ROT *rot)
|
||||
{
|
||||
if (!rot)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
if (rot->state.priv)
|
||||
free(rot->state.priv);
|
||||
|
||||
rot->state.priv = NULL;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
||||
/*
|
||||
* assumes rot!=NULL, rs->priv != NULL
|
||||
*/
|
||||
static int rpcrot_open(ROT *rot)
|
||||
{
|
||||
struct rpcrot_priv_data *priv;
|
||||
struct rot_state *rs;
|
||||
model_x *mdl_res;
|
||||
rotstate_res *rs_res;
|
||||
rot_model_t model;
|
||||
// const struct rot_caps *caps;
|
||||
char *server, *s;
|
||||
|
||||
rs = &rot->state;
|
||||
priv = (struct rpcrot_priv_data *)rs->priv;
|
||||
server = strdup(rs->rotport.pathname);
|
||||
s = strchr(server, ':');
|
||||
if (s) {
|
||||
unsigned long prognum;
|
||||
*s = '\0';
|
||||
prognum = extract_prognum(s+1);
|
||||
if (prognum == 0) {
|
||||
free(server);
|
||||
return -RIG_ECONF;
|
||||
}
|
||||
priv->prognum = prognum;
|
||||
}
|
||||
|
||||
priv->cl = clnt_create(server, priv->prognum, ROTVERS, ROTPROTO);
|
||||
if (priv->cl == NULL) {
|
||||
clnt_pcreateerror(server);
|
||||
free(server);
|
||||
return -RIG_ECONF;
|
||||
}
|
||||
mdl_res = getmodel_1(NULL, priv->cl);
|
||||
if (mdl_res == NULL) {
|
||||
clnt_perror(priv->cl, server);
|
||||
clnt_destroy(priv->cl);
|
||||
free(server);
|
||||
priv->cl = NULL;
|
||||
return -RIG_EPROTO;
|
||||
}
|
||||
model = *mdl_res;
|
||||
rig_debug(RIG_DEBUG_TRACE,"%s: model %d\n", __FUNCTION__, model);
|
||||
|
||||
/*
|
||||
* autoload if necessary
|
||||
*/
|
||||
rot_check_backend(model);
|
||||
// caps = rot_get_caps(model);
|
||||
|
||||
/*
|
||||
* Load state values from remote rotator.
|
||||
*/
|
||||
rs_res = getrotstate_1(NULL, priv->cl);
|
||||
if (rs_res == NULL) {
|
||||
clnt_perror(priv->cl, server);
|
||||
clnt_destroy(priv->cl);
|
||||
free(server);
|
||||
priv->cl = NULL;
|
||||
return -RIG_EPROTO;
|
||||
}
|
||||
|
||||
free(server);
|
||||
|
||||
if (rs_res->rotstatus != RIG_OK) {
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: error from remote - %s\n", __FUNCTION__, rigerror(rs_res->rotstatus));
|
||||
return rs_res->rotstatus;
|
||||
}
|
||||
|
||||
rs->min_az = rs_res->rotstate_res_u.state.az_min;
|
||||
rs->max_az = rs_res->rotstate_res_u.state.az_max;
|
||||
rs->min_el = rs_res->rotstate_res_u.state.el_min;
|
||||
rs->max_el = rs_res->rotstate_res_u.state.el_max;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
static int rpcrot_close(ROT *rot)
|
||||
{
|
||||
struct rpcrot_priv_data *priv;
|
||||
|
||||
priv = (struct rpcrot_priv_data*)rot->state.priv;
|
||||
|
||||
if (priv->cl)
|
||||
clnt_destroy(priv->cl);
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
||||
static int rpcrot_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
||||
{
|
||||
struct rpcrot_priv_data *priv;
|
||||
int *result;
|
||||
position_s parg;
|
||||
|
||||
priv = (struct rpcrot_priv_data *)rot->state.priv;
|
||||
|
||||
parg.az = az;
|
||||
parg.el = el;
|
||||
result = setposition_1(&parg, priv->cl);
|
||||
if (result == NULL) {
|
||||
clnt_perror(priv->cl, "setposition_1");
|
||||
return -RIG_EPROTO;
|
||||
}
|
||||
|
||||
return *result;
|
||||
}
|
||||
|
||||
static int rpcrot_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
|
||||
{
|
||||
struct rpcrot_priv_data *priv;
|
||||
position_res *pres;
|
||||
|
||||
priv = (struct rpcrot_priv_data *)rot->state.priv;
|
||||
pres = getposition_1(NULL, priv->cl);
|
||||
if (pres == NULL) {
|
||||
clnt_perror(priv->cl, "getposition_1");
|
||||
return -RIG_EPROTO;
|
||||
}
|
||||
|
||||
if (pres->rotstatus == RIG_OK) {
|
||||
*az = pres->position_res_u.pos.az;
|
||||
*el = pres->position_res_u.pos.el;
|
||||
}
|
||||
return pres->rotstatus;
|
||||
}
|
||||
|
||||
static int rpcrot_stop(ROT *rot)
|
||||
{
|
||||
struct rpcrot_priv_data *priv;
|
||||
int *result;
|
||||
|
||||
priv = (struct rpcrot_priv_data *)rot->state.priv;
|
||||
result = stop_1(NULL, priv->cl);
|
||||
if (result == NULL) {
|
||||
clnt_perror(priv->cl, "stop_1");
|
||||
return -RIG_EPROTO;
|
||||
}
|
||||
return *result;
|
||||
}
|
||||
|
||||
static int rpcrot_reset(ROT *rot, rot_reset_t reset)
|
||||
{
|
||||
struct rpcrot_priv_data *priv;
|
||||
int *result;
|
||||
rot_reset_x rstx;
|
||||
|
||||
rstx = reset; /* FIXME: is this correct? */
|
||||
priv = (struct rpcrot_priv_data *)rot->state.priv;
|
||||
result = reset_1(&rstx, priv->cl);
|
||||
if (result == NULL) {
|
||||
clnt_perror(priv->cl, "reset_1");
|
||||
return -RIG_EPROTO;
|
||||
}
|
||||
return *result;
|
||||
}
|
||||
|
||||
static int rpcrot_park(ROT *rot)
|
||||
{
|
||||
struct rpcrot_priv_data *priv;
|
||||
int *result;
|
||||
|
||||
priv = (struct rpcrot_priv_data *)rot->state.priv;
|
||||
result = park_1(NULL, priv->cl);
|
||||
if (result == NULL) {
|
||||
clnt_perror(priv->cl, "park_1");
|
||||
return -RIG_EPROTO;
|
||||
}
|
||||
return *result;
|
||||
}
|
||||
|
||||
static int rpcrot_move(ROT *rot, int direction, int speed)
|
||||
{
|
||||
struct rpcrot_priv_data *priv;
|
||||
move_s arg;
|
||||
int *result;
|
||||
arg.direction = direction;
|
||||
arg.speed = speed;
|
||||
priv = (struct rpcrot_priv_data *)rot->state.priv;
|
||||
result = move_1(&arg, priv->cl);
|
||||
if (result == NULL) {
|
||||
clnt_perror(priv->cl, "move_1");
|
||||
return -RIG_EPROTO;
|
||||
}
|
||||
return *result;
|
||||
}
|
||||
|
||||
#define TOK_PROGNUM TOKEN_BACKEND(1)
|
||||
|
||||
static const struct confparams rpcrot_cfg_params[] = {
|
||||
{ TOK_PROGNUM, "prognum", "Program number", "RPC program number",
|
||||
r_stringify(ROTPROG), RIG_CONF_NUMERIC, { .n = { 100000, ULONG_MAX, 1 } }
|
||||
},
|
||||
{ RIG_CONF_END, NULL, }
|
||||
};
|
||||
|
||||
/*
|
||||
* Assumes rot!=NULL, rot->state.priv!=NULL
|
||||
*/
|
||||
int rpcrot_set_conf(ROT *rot, token_t token, const char *val)
|
||||
{
|
||||
struct rpcrot_priv_data *priv;
|
||||
struct rot_state *rs;
|
||||
|
||||
rs = &rot->state;
|
||||
priv = (struct rpcrot_priv_data*)rs->priv;
|
||||
|
||||
switch(token) {
|
||||
case TOK_PROGNUM:
|
||||
{
|
||||
unsigned long prognum;
|
||||
prognum = extract_prognum(val);
|
||||
if (prognum == 0)
|
||||
return -RIG_EINVAL;
|
||||
priv->prognum = prognum;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* assumes rot!=NULL,
|
||||
* Assumes rot!=NULL, rot->state.priv!=NULL
|
||||
* and val points to a buffer big enough to hold the conf value.
|
||||
*/
|
||||
int rpcrot_get_conf(ROT *rot, token_t token, char *val)
|
||||
{
|
||||
struct rpcrot_priv_data *priv;
|
||||
struct rot_state *rs;
|
||||
|
||||
rs = &rot->state;
|
||||
priv = (struct rpcrot_priv_data*)rs->priv;
|
||||
|
||||
switch(token) {
|
||||
case TOK_PROGNUM:
|
||||
sprintf(val, "%ld", priv->prognum);
|
||||
break;
|
||||
default:
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
||||
struct rot_caps rpcrot_caps = {
|
||||
.rot_model = ROT_MODEL_RPC,
|
||||
.model_name = "RPC rotator",
|
||||
.mfg_name = "Hamlib",
|
||||
.version = "0.1",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_BETA,
|
||||
.rot_type = ROT_TYPE_OTHER,
|
||||
.port_type = RIG_PORT_NONE,
|
||||
.priv = NULL,
|
||||
|
||||
.rot_init = rpcrot_init,
|
||||
.rot_cleanup = rpcrot_cleanup,
|
||||
.rot_open = rpcrot_open,
|
||||
.rot_close = rpcrot_close,
|
||||
|
||||
.cfgparams = rpcrot_cfg_params,
|
||||
.set_conf = rpcrot_set_conf,
|
||||
.get_conf = rpcrot_get_conf,
|
||||
|
||||
.set_position = rpcrot_set_position,
|
||||
.get_position = rpcrot_get_position,
|
||||
.stop = rpcrot_stop,
|
||||
.reset = rpcrot_reset,
|
||||
.park = rpcrot_park,
|
||||
.move = rpcrot_move,
|
||||
|
||||
};
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
||||
DECLARE_INITROT_BACKEND(rpcrot)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__);
|
||||
|
||||
rot_register(&rpcrot_caps);
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
/* end of file */
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
/*
|
||||
* Hamlib RPC backend - main file
|
||||
* Copyright (c) 2001-2008 by Stephane Fillod
|
||||
* Contributed by Francois Retief <fgretief@sun.ac.za>
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __RPCROT_BACKEND_H__
|
||||
#define __RPCROT_BACKEND_H__
|
||||
|
||||
/* TODO: for future use */
|
||||
|
||||
#endif
|
||||
/* end of file */
|
||||
|
|
@ -1,148 +0,0 @@
|
|||
/*
|
||||
* Hamlib RPC server - procedures
|
||||
* Copyright (c) 2000-2002 by Stephane Fillod and Frank Singleton
|
||||
* Contributed by Francois Retief <fgretief@sun.ac.za>
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
|
||||
#include <rpc/rpc.h>
|
||||
#include "rpcrot.h"
|
||||
#include <hamlib/rotator.h>
|
||||
|
||||
extern ROT *the_rpc_rot;
|
||||
|
||||
model_x *
|
||||
getmodel_1_svc(void *argp, struct svc_req *rqstp)
|
||||
{
|
||||
static model_x result;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__);
|
||||
|
||||
result = the_rpc_rot->caps->rot_model;
|
||||
|
||||
return &result;
|
||||
}
|
||||
|
||||
rotstate_res *
|
||||
getrotstate_1_svc(void *argp, struct svc_req *rqstp)
|
||||
{
|
||||
static rotstate_res res;
|
||||
struct rot_state *rs;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__);
|
||||
|
||||
if (!the_rpc_rot->state.comm_state) {
|
||||
res.rotstatus = -RIG_ERJCTED;
|
||||
return &res;
|
||||
}
|
||||
rs = &the_rpc_rot->state;
|
||||
|
||||
/* Copy the current state of the rotator into the transfer variable */
|
||||
res.rotstate_res_u.state.az_min = rs->min_az;
|
||||
res.rotstate_res_u.state.az_max = rs->max_az;
|
||||
res.rotstate_res_u.state.el_min = rs->min_el;
|
||||
res.rotstate_res_u.state.el_max = rs->max_el;
|
||||
|
||||
res.rotstatus = RIG_OK;
|
||||
return &res;
|
||||
}
|
||||
|
||||
int *
|
||||
setposition_1_svc(position_s *argp, struct svc_req *rqstp)
|
||||
{
|
||||
static int result;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __FUNCTION__);
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "Setting position to %.1f deg Az, %.1f deg El\n", argp->az, argp->el);
|
||||
|
||||
result = rot_set_position(the_rpc_rot, argp->az, argp->el);
|
||||
|
||||
return &result;
|
||||
}
|
||||
|
||||
position_res *
|
||||
getposition_1_svc(void *argp, struct svc_req *rqstp)
|
||||
{
|
||||
static position_res res;
|
||||
azimuth_t az;
|
||||
elevation_t el;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __FUNCTION__);
|
||||
memset(&res, 0, sizeof(res));
|
||||
|
||||
res.rotstatus = rot_get_position(the_rpc_rot, &az, &el);
|
||||
if (res.rotstatus == RIG_OK) {
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "Getting position of %.1f deg Az, %.1f deg El\n", az, el);
|
||||
res.position_res_u.pos.az = az;
|
||||
res.position_res_u.pos.el = el;
|
||||
}
|
||||
return &res;
|
||||
}
|
||||
|
||||
int *
|
||||
stop_1_svc(void *argp, struct svc_req *rqstp)
|
||||
{
|
||||
static int result;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __FUNCTION__);
|
||||
|
||||
result = rot_stop(the_rpc_rot);
|
||||
|
||||
return &result;
|
||||
}
|
||||
|
||||
int *
|
||||
reset_1_svc(rot_reset_x *argp, struct svc_req *rqstp)
|
||||
{
|
||||
static int result;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __FUNCTION__);
|
||||
|
||||
result = rot_reset(the_rpc_rot, *argp);
|
||||
|
||||
return &result;
|
||||
}
|
||||
|
||||
int *
|
||||
park_1_svc(void *argp, struct svc_req *rqstp)
|
||||
{
|
||||
static int result;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __FUNCTION__);
|
||||
|
||||
result = rot_park(the_rpc_rot);
|
||||
|
||||
return &result;
|
||||
}
|
||||
|
||||
int *
|
||||
move_1_svc(move_s *argp, struct svc_req *rqstp)
|
||||
{
|
||||
static int result;
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __FUNCTION__);
|
||||
|
||||
result = rot_move(the_rpc_rot, argp->direction, argp->speed);
|
||||
return &result;
|
||||
}
|
||||
|
303
rpcrot/rpcrotd.c
303
rpcrot/rpcrotd.c
|
@ -1,303 +0,0 @@
|
|||
/*
|
||||
* rpcrotd - (C) Stephane Fillod 2001-2002
|
||||
*
|
||||
* This program let programs control a rotator through
|
||||
* the mean of RPC services using Hamlib.
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "rpcrot.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <rpc/pmap_clnt.h>
|
||||
#include <string.h>
|
||||
#include <memory.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <unistd.h>
|
||||
#include <netdb.h>
|
||||
#ifdef HAVE_RPC_RPCENT_H
|
||||
#include <rpc/rpcent.h>
|
||||
#endif
|
||||
|
||||
#include <getopt.h>
|
||||
|
||||
#include <hamlib/rotator.h>
|
||||
|
||||
|
||||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
void usage();
|
||||
void version();
|
||||
void rotd_exit();
|
||||
|
||||
void rotprog_1(struct svc_req *rqstp, register SVCXPRT *transp);
|
||||
|
||||
/*
|
||||
* Reminder: when adding long options,
|
||||
* keep up to date SHORT_OPTIONS, usage()'s output and man page. thanks.
|
||||
* NB: do NOT use -W since it's reserved by POSIX.
|
||||
* TODO: add an option to read from a file
|
||||
*/
|
||||
#define SHORT_OPTIONS "m:r:s:C:t:vhV"
|
||||
static struct option long_options[] =
|
||||
{
|
||||
{"model", 1, 0, 'm'},
|
||||
{"rot-file", 1, 0, 'r'},
|
||||
{"serial-speed", 1, 0, 's'},
|
||||
{"set-conf", 1, 0, 'C'},
|
||||
{"prog", 1, 0, 't'},
|
||||
{"verbose", 0, 0, 'v'},
|
||||
{"help", 0, 0, 'h'},
|
||||
{"version", 0, 0, 'V'},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
|
||||
int set_conf(ROT *my_rot, char *conf_parms)
|
||||
{
|
||||
char *p, *q, *n;
|
||||
int ret;
|
||||
|
||||
p = conf_parms;
|
||||
while (p && *p != '\0') {
|
||||
/* FIXME: left hand value of = cannot be null */
|
||||
q = strchr(p, '=');
|
||||
if (q) *q++ = '\0';
|
||||
n = strchr(q, ',');
|
||||
if (n) *n++ = '\0';
|
||||
|
||||
ret = rot_set_conf(my_rot, rot_token_lookup(my_rot, p), q);
|
||||
if (ret != RIG_OK)
|
||||
return ret;
|
||||
p = n;
|
||||
}
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
||||
static unsigned long extract_prognum(const char val[])
|
||||
{
|
||||
if (val[0] == '+') {
|
||||
return ROTPROG + atol(val+1);
|
||||
} else
|
||||
if (val[0] < '0' || val[0] > '9') {
|
||||
struct rpcent *ent;
|
||||
ent = getrpcbyname (val);
|
||||
if (ent)
|
||||
return ent->r_number;
|
||||
else
|
||||
return 0;
|
||||
} else
|
||||
return atol(val);
|
||||
}
|
||||
|
||||
ROT *the_rpc_rot;
|
||||
|
||||
|
||||
#define MAXCONFLEN 128
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
register SVCXPRT *transp;
|
||||
|
||||
rot_model_t my_model = ROT_MODEL_DUMMY;
|
||||
int retcode; /* generic return code from functions */
|
||||
|
||||
int verbose = 0;
|
||||
const char *rot_file=NULL;
|
||||
int serial_rate = 0;
|
||||
char conf_parms[MAXCONFLEN] = "";
|
||||
unsigned long prognum = ROTPROG;
|
||||
|
||||
/* Arguments parsing */
|
||||
|
||||
while(1) {
|
||||
int c;
|
||||
int option_index = 0;
|
||||
|
||||
c = getopt_long (argc, argv, SHORT_OPTIONS,
|
||||
long_options, &option_index);
|
||||
if (c == -1)
|
||||
break;
|
||||
|
||||
switch(c) {
|
||||
case 'h':
|
||||
usage();
|
||||
exit(0);
|
||||
case 'V':
|
||||
version();
|
||||
exit(0);
|
||||
case 'm':
|
||||
if (!optarg) {
|
||||
usage(); /* wrong arg count */
|
||||
exit(1);
|
||||
}
|
||||
my_model = atoi(optarg);
|
||||
break;
|
||||
case 'r':
|
||||
if (!optarg) {
|
||||
usage(); /* wrong arg count */
|
||||
exit(1);
|
||||
}
|
||||
rot_file = optarg;
|
||||
break;
|
||||
case 's':
|
||||
if (!optarg) {
|
||||
usage(); /* wrong arg count */
|
||||
exit(1);
|
||||
}
|
||||
serial_rate = atoi(optarg);
|
||||
break;
|
||||
case 'C':
|
||||
if (!optarg) {
|
||||
usage(); /* wrong arg count */
|
||||
exit(1);
|
||||
}
|
||||
if (*conf_parms != '\0')
|
||||
strcat(conf_parms, ",");
|
||||
strncat(conf_parms, optarg, MAXCONFLEN-strlen(conf_parms));
|
||||
break;
|
||||
case 't':
|
||||
if (!optarg) {
|
||||
usage(); /* wrong arg count */
|
||||
exit(1);
|
||||
}
|
||||
prognum = extract_prognum(optarg);
|
||||
break;
|
||||
case 'v':
|
||||
verbose++;
|
||||
break;
|
||||
default:
|
||||
usage(); /* unknown option? */
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
if (verbose < 2)
|
||||
rig_set_debug(RIG_DEBUG_WARN);
|
||||
|
||||
|
||||
/* Opening the local rotator */
|
||||
|
||||
the_rpc_rot = rot_init(my_model);
|
||||
|
||||
if (!the_rpc_rot) {
|
||||
fprintf(stderr, "Unknown rotator num %d, or initialization error.\n",
|
||||
my_model);
|
||||
fprintf(stderr, "Please check with rotctl --list option.\n");
|
||||
exit(2);
|
||||
}
|
||||
|
||||
retcode = set_conf(the_rpc_rot, conf_parms);
|
||||
if (retcode != RIG_OK) {
|
||||
fprintf(stderr, "Config parameter error: %s\n", rigerror(retcode));
|
||||
exit(2);
|
||||
}
|
||||
|
||||
if (rot_file)
|
||||
strncpy(the_rpc_rot->state.rotport.pathname, rot_file, FILPATHLEN - 1);
|
||||
/* FIXME: bound checking and port type == serial */
|
||||
if (serial_rate != 0)
|
||||
the_rpc_rot->state.rotport.parm.serial.rate = serial_rate;
|
||||
|
||||
retcode = rot_open(the_rpc_rot);
|
||||
if (retcode != RIG_OK) {
|
||||
fprintf(stderr,"rot_open: error = %s \n", rigerror(retcode));
|
||||
exit(2);
|
||||
}
|
||||
|
||||
atexit(rotd_exit);
|
||||
|
||||
if (verbose > 0)
|
||||
printf("Opened rotator model %d, '%s'\n", the_rpc_rot->caps->rot_model,
|
||||
the_rpc_rot->caps->model_name);
|
||||
|
||||
|
||||
/* Setup the RPC service and fire it up */
|
||||
|
||||
|
||||
pmap_unset (prognum, ROTVERS);
|
||||
|
||||
transp = svcudp_create(RPC_ANYSOCK); /* Looks like we can spesify a socket number here?? */
|
||||
if (transp == NULL) {
|
||||
fprintf (stderr, "cannot create udp service.");
|
||||
exit(1);
|
||||
}
|
||||
if (!svc_register(transp, prognum, ROTVERS, rotprog_1, IPPROTO_UDP)) {
|
||||
fprintf (stderr, "unable to register (%lu, %u, udp).", prognum, ROTVERS);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
transp = svctcp_create(RPC_ANYSOCK, 0, 0);
|
||||
if (transp == NULL) {
|
||||
fprintf (stderr, "%s", "cannot create tcp service.");
|
||||
exit(1);
|
||||
}
|
||||
if (!svc_register(transp, prognum, ROTVERS, rotprog_1, IPPROTO_TCP)) {
|
||||
fprintf (stderr, "unable to register (%lu, %u, tcp).", prognum, ROTVERS);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
svc_run ();
|
||||
fprintf (stderr, "svc_run returned");
|
||||
|
||||
/* the rotator gets automatically closed in rotd_exit() */
|
||||
|
||||
exit (1);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
void rotd_exit()
|
||||
{
|
||||
rot_close(the_rpc_rot);
|
||||
rot_cleanup(the_rpc_rot);
|
||||
}
|
||||
|
||||
void usage()
|
||||
{
|
||||
printf("Usage: rpc.rotd [OPTION]... [COMMAND]...\n"
|
||||
"Offer RPC services to remotely control a connected rotator.\n\n");
|
||||
|
||||
printf(
|
||||
" -m, --model=ID select rotator model number. See model list\n"
|
||||
" -r, --rot-file=DEVICE set device of the rotator to operate on\n"
|
||||
" -s, --serial-speed=BAUD set serial speed of the serial port\n"
|
||||
" -C, --set-conf=PARM=VAL set config parameters\n"
|
||||
" -t, --prog=NUMBER set RPC program number\n"
|
||||
" -v, --verbose set verbose mode, cumulative\n"
|
||||
" -h, --help display this help and exit\n"
|
||||
" -V, --version output version information and exit\n\n"
|
||||
);
|
||||
|
||||
printf("\nReport bugs to <hamlib-developer@lists.sourceforge.net>.\n");
|
||||
}
|
||||
|
||||
void version()
|
||||
{
|
||||
printf("rpcrotd, %s\n\n", hamlib_version);
|
||||
printf("%s\n", hamlib_copyright);
|
||||
}
|
||||
|
||||
/* end of file */
|
||||
|
|
@ -6,7 +6,7 @@ RIGSRC = rig.c serial.c misc.c register.c event.c cal.c conf.c tones.c \
|
|||
|
||||
lib_LTLIBRARIES = libhamlib.la
|
||||
libhamlib_la_SOURCES = $(RIGSRC)
|
||||
libhamlib_la_LDFLAGS = $(WINLDFLAGS) $(OSXLDFLAGS) -no-undefined -version-info @ABI_VERSION@:16:0
|
||||
libhamlib_la_LDFLAGS = $(WINLDFLAGS) $(OSXLDFLAGS) -no-undefined -version-info @ABI_VERSION@:0:0
|
||||
libhamlib_la_CFLAGS = -DIN_HAMLIB $(AM_CFLAGS) -DHAMLIB_MODULE_DIR=\"$(pkglibdir)\"
|
||||
libhamlib_la_LIBADD = @LIBLTDL@ $(top_builddir)/lib/libmisc.la \
|
||||
@NET_LIBS@ @MATH_LIBS@ $(LIBUSB_LIBS)
|
||||
|
|
|
@ -45,8 +45,8 @@ Here is a summary of the supported options:
|
|||
.B \-m, --model=id
|
||||
Select radio model number. See model list (use 'rigctl -l').
|
||||
.sp
|
||||
NB: \fBrigctl\fP (or third party software) will use rig model 1901
|
||||
when using \fBrpc.rigd\fP or rig model 2 for NET rigctl (rigctld).
|
||||
NB: \fBrigctl\fP (or third party software) will use 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.
|
||||
|
@ -448,14 +448,10 @@ specifying a command terminator for the 'w' command:
|
|||
.sp
|
||||
$ rigctl -m 229 -r /dev/ttyUSB0 -t';'
|
||||
.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:
|
||||
local host and specifying the TCP port, setting frequency and mode:
|
||||
.sp
|
||||
$ rigctl -m 2 -r localhost:4532
|
||||
$ rigctl -m 2 -r localhost:4532 F 7253500 M LSB 0
|
||||
.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,
|
||||
|
@ -486,7 +482,7 @@ Written by Stephane Fillod, Nate Bargmann, and the Hamlib Group
|
|||
.PP
|
||||
<http://www.hamlib.org>.
|
||||
.SH COPYRIGHT
|
||||
Copyright \(co 2000-2010 Stephane Fillod
|
||||
Copyright \(co 2000-2011 Stephane Fillod
|
||||
.br
|
||||
Copyright \(co 2010-2012 Nate Bargmann
|
||||
.br
|
||||
|
@ -497,5 +493,4 @@ 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)
|
||||
|
|
|
@ -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 RIGMEM "1" "September 13, 2009" "Hamlib" "Radio Memory Operations"
|
||||
.TH RIGMEM "1" "August 21, 2011" "Hamlib" "Radio Memory Operations"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.\" Some roff macros, for reference:
|
||||
|
@ -43,9 +43,6 @@ Here is a summary of the supported options:
|
|||
.TP
|
||||
.B \-m, --model=id
|
||||
Select radio model number. See model list (use 'rigctl -l').
|
||||
.br
|
||||
NB: \fBrigmem\fP (or third party software) will use rig model 1901
|
||||
when using \fBrpc.rigd\fP.
|
||||
.TP
|
||||
.B \-r, --rig-file=device
|
||||
Use \fIdevice\fP as the file name of the port the radio is connected.
|
||||
|
|
|
@ -51,9 +51,6 @@ Here is a summary of the supported options:
|
|||
.TP
|
||||
.B \-m, --model=id
|
||||
Select radio model number. See model list (use 'rigctl -l').
|
||||
.br
|
||||
NB: \fBrigswr\fP (or third party software) will use rig model 1901
|
||||
when using \fBrpc.rigd\fP.
|
||||
.TP
|
||||
.B \-r, --rig-file=device
|
||||
Use \fIdevice\fP as the file name of the port the radio is connected.
|
||||
|
|
|
@ -45,8 +45,8 @@ Here is s summary of the supported options:
|
|||
.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).
|
||||
NB: \fBrotctl\fP (or third party software) will use 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.
|
||||
|
@ -241,9 +241,9 @@ Start \fBrotctl\fP using \fBrpc.rotd\fP and querying the position:
|
|||
$ rotctl -m 101 -r localhost \\get_pos
|
||||
.sp
|
||||
Connect to a running \fBrotctld\fP with rotor model 2 ("NET rotctl") on the
|
||||
local host and specifying the TCP port:
|
||||
local host and specifying the TCP port, and querying the position:
|
||||
.sp
|
||||
$ rotctl -m 2 -r localhost:4533
|
||||
$ rotctl -m 2 -r localhost:4533 \\get_pos
|
||||
.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,
|
||||
|
@ -273,7 +273,7 @@ Written by Stephane Fillod, Nate Bargmann, and the Hamlib Group
|
|||
.PP
|
||||
<http://www.hamlib.org>.
|
||||
.SH COPYRIGHT
|
||||
Copyright \(co 2000-2010 Stephane Fillod
|
||||
Copyright \(co 2000-2011 Stephane Fillod
|
||||
.br
|
||||
Copyright \(co 2011-2012 Nate Bargmann
|
||||
.br
|
||||
|
@ -284,6 +284,5 @@ There is NO warranty; not even for MERCHANTABILITY
|
|||
or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
.SH SEE ALSO
|
||||
.BR hamlib (3),
|
||||
.BR rpc.rotd (8)
|
||||
.BR rotctld (8)
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue