kopia lustrzana https://github.com/Hamlib/Hamlib
New RPC backend for rotators
git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@866 7ae35d74-ebe9-4afe-98af-79ac388436b8Hamlib-1.1.3
rodzic
e2766bc309
commit
60b68946bb
|
@ -0,0 +1,47 @@
|
||||||
|
# $Id: Makefile.am,v 1.1 2002-01-16 16:45:11 fgretief Exp $
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
|
||||||
|
RPCROT_SVC = rpcrot.h rpcrot_xdr.c rpcrot_svc.c rpcrot_proc.c rpcrotd.c
|
||||||
|
RPCROT_CLNT = rpcrot.h rpcrot_xdr.c rpcrot_clnt.c rpcrot_backend.c
|
||||||
|
|
||||||
|
LDADD = ../src/libhamlib.la
|
||||||
|
DEPENDENCIES = ../src/libhamlib.la
|
||||||
|
|
||||||
|
# The RPC server
|
||||||
|
sbin_PROGRAMS = rpc.rotd
|
||||||
|
rpc_rotd_DEPENDENCIES = $(DEPENDENCIES) @BACKENDEPS@
|
||||||
|
rpc_rotd_SOURCES = $(RPCROT_SVC)
|
||||||
|
rpc_rotd_LDFLAGS = @BACKENDLNK@
|
||||||
|
man_MANS = rpc.rotd.8
|
||||||
|
|
||||||
|
# The RPC backend
|
||||||
|
lib_LTLIBRARIES = libhamlib-rpcrot.la
|
||||||
|
libhamlib_rpcrot_la_SOURCES = $(RPCROT_CLNT)
|
||||||
|
libhamlib_rpcrot_la_LDFLAGS = -no-undefined -module -version-info 0:0:0
|
||||||
|
libhamlib_rpcrot_la_LIBADD = ../src/libhamlib.la # -lnsl
|
||||||
|
|
||||||
|
|
||||||
|
noinst_HEADERS = rpcrot.h rpcrot_backend.h
|
||||||
|
|
||||||
|
EXTRA_DIST = rpcrot.x $(man_MANS)
|
||||||
|
|
||||||
|
RPCGEN = rpcgen
|
||||||
|
|
||||||
|
rpcrot.h: rpcrot.x
|
||||||
|
rm -f $@
|
||||||
|
$(RPCGEN) -h $< -o $@
|
||||||
|
|
||||||
|
rpcrot_clnt.c: rpcrot.x
|
||||||
|
rm -f $@
|
||||||
|
$(RPCGEN) -l $< -o $@
|
||||||
|
|
||||||
|
rpcrot_svc.c: rpcrot.x
|
||||||
|
rm -f $@
|
||||||
|
$(RPCGEN) -m $< -o $@
|
||||||
|
|
||||||
|
rpcrot_xdr.c: rpcrot.x
|
||||||
|
rm -f $@
|
||||||
|
$(RPCGEN) -c $< -o $@
|
||||||
|
|
|
@ -0,0 +1,473 @@
|
||||||
|
# Makefile.in generated automatically by automake 1.5 from Makefile.am.
|
||||||
|
|
||||||
|
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||||
|
# Free Software Foundation, Inc.
|
||||||
|
# This Makefile.in is free software; the Free Software Foundation
|
||||||
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
# with or without modifications, as long as this notice is preserved.
|
||||||
|
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||||
|
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
# PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
@SET_MAKE@
|
||||||
|
|
||||||
|
# $Id: Makefile.in,v 1.1 2002-01-16 16:45:11 fgretief Exp $
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
|
||||||
|
SHELL = @SHELL@
|
||||||
|
|
||||||
|
srcdir = @srcdir@
|
||||||
|
top_srcdir = @top_srcdir@
|
||||||
|
VPATH = @srcdir@
|
||||||
|
prefix = @prefix@
|
||||||
|
exec_prefix = @exec_prefix@
|
||||||
|
|
||||||
|
bindir = @bindir@
|
||||||
|
sbindir = @sbindir@
|
||||||
|
libexecdir = @libexecdir@
|
||||||
|
datadir = @datadir@
|
||||||
|
sysconfdir = @sysconfdir@
|
||||||
|
sharedstatedir = @sharedstatedir@
|
||||||
|
localstatedir = @localstatedir@
|
||||||
|
libdir = @libdir@
|
||||||
|
infodir = @infodir@
|
||||||
|
mandir = @mandir@
|
||||||
|
includedir = @includedir@
|
||||||
|
oldincludedir = /usr/include
|
||||||
|
pkgdatadir = $(datadir)/@PACKAGE@
|
||||||
|
pkglibdir = $(libdir)/@PACKAGE@
|
||||||
|
pkgincludedir = $(includedir)/@PACKAGE@
|
||||||
|
top_builddir = ..
|
||||||
|
|
||||||
|
ACLOCAL = @ACLOCAL@
|
||||||
|
AUTOCONF = @AUTOCONF@
|
||||||
|
AUTOMAKE = @AUTOMAKE@
|
||||||
|
AUTOHEADER = @AUTOHEADER@
|
||||||
|
|
||||||
|
INSTALL = @INSTALL@
|
||||||
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||||
|
INSTALL_DATA = @INSTALL_DATA@
|
||||||
|
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||||
|
INSTALL_HEADER = $(INSTALL_DATA)
|
||||||
|
transform = @program_transform_name@
|
||||||
|
NORMAL_INSTALL = :
|
||||||
|
PRE_INSTALL = :
|
||||||
|
POST_INSTALL = :
|
||||||
|
NORMAL_UNINSTALL = :
|
||||||
|
PRE_UNINSTALL = :
|
||||||
|
POST_UNINSTALL = :
|
||||||
|
host_alias = @host_alias@
|
||||||
|
host_triplet = @host@
|
||||||
|
AMTAR = @AMTAR@
|
||||||
|
AS = @AS@
|
||||||
|
AWK = @AWK@
|
||||||
|
BACKENDEPS = @BACKENDEPS@
|
||||||
|
BACKENDLNK = @BACKENDLNK@
|
||||||
|
BACKEND_LIST = @BACKEND_LIST@
|
||||||
|
CC = @CC@
|
||||||
|
CPP = @CPP@
|
||||||
|
CXX = @CXX@
|
||||||
|
DEPDIR = @DEPDIR@
|
||||||
|
DLLTOOL = @DLLTOOL@
|
||||||
|
ECHO = @ECHO@
|
||||||
|
EXEEXT = @EXEEXT@
|
||||||
|
INCLTDL = @INCLTDL@
|
||||||
|
INCLUDES = @INCLUDES@
|
||||||
|
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||||
|
LIBHAMLIBTCL = @LIBHAMLIBTCL@
|
||||||
|
LIBLTDL = @LIBLTDL@
|
||||||
|
LIBOBJS = @LIBOBJS@
|
||||||
|
LIBTOOL = @LIBTOOL@
|
||||||
|
LN_S = @LN_S@
|
||||||
|
LTHAMLIBTCL = @LTHAMLIBTCL@
|
||||||
|
LTLIBOBJS = @LTLIBOBJS@
|
||||||
|
MAINT = @MAINT@
|
||||||
|
NET = @NET@
|
||||||
|
OBJDUMP = @OBJDUMP@
|
||||||
|
OBJEXT = @OBJEXT@
|
||||||
|
PACKAGE = @PACKAGE@
|
||||||
|
RANLIB = @RANLIB@
|
||||||
|
RIGMATRIX = @RIGMATRIX@
|
||||||
|
STRIP = @STRIP@
|
||||||
|
VERSION = @VERSION@
|
||||||
|
am__include = @am__include@
|
||||||
|
am__quote = @am__quote@
|
||||||
|
hamlibdocdir = @hamlibdocdir@
|
||||||
|
install_sh = @install_sh@
|
||||||
|
|
||||||
|
RPCROT_SVC = rpcrot.h rpcrot_xdr.c rpcrot_svc.c rpcrot_proc.c rpcrotd.c
|
||||||
|
RPCROT_CLNT = rpcrot.h rpcrot_xdr.c rpcrot_clnt.c rpcrot_backend.c
|
||||||
|
|
||||||
|
LDADD = ../src/libhamlib.la
|
||||||
|
DEPENDENCIES = ../src/libhamlib.la
|
||||||
|
|
||||||
|
# The RPC server
|
||||||
|
sbin_PROGRAMS = rpc.rotd
|
||||||
|
rpc_rotd_DEPENDENCIES = $(DEPENDENCIES) @BACKENDEPS@
|
||||||
|
rpc_rotd_SOURCES = $(RPCROT_SVC)
|
||||||
|
rpc_rotd_LDFLAGS = @BACKENDLNK@
|
||||||
|
man_MANS = rpc.rotd.8
|
||||||
|
|
||||||
|
# The RPC backend
|
||||||
|
lib_LTLIBRARIES = libhamlib-rpcrot.la
|
||||||
|
libhamlib_rpcrot_la_SOURCES = $(RPCROT_CLNT)
|
||||||
|
libhamlib_rpcrot_la_LDFLAGS = -no-undefined -module -version-info 0:0:0
|
||||||
|
libhamlib_rpcrot_la_LIBADD = ../src/libhamlib.la # -lnsl
|
||||||
|
|
||||||
|
noinst_HEADERS = rpcrot.h rpcrot_backend.h
|
||||||
|
|
||||||
|
EXTRA_DIST = rpcrot.x $(man_MANS)
|
||||||
|
|
||||||
|
RPCGEN = rpcgen
|
||||||
|
subdir = rpcrot
|
||||||
|
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||||
|
CONFIG_HEADER = $(top_builddir)/include/config.h
|
||||||
|
CONFIG_CLEAN_FILES =
|
||||||
|
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||||
|
|
||||||
|
libhamlib_rpcrot_la_DEPENDENCIES = ../src/libhamlib.la
|
||||||
|
am_libhamlib_rpcrot_la_OBJECTS = rpcrot_xdr.lo rpcrot_clnt.lo \
|
||||||
|
rpcrot_backend.lo
|
||||||
|
libhamlib_rpcrot_la_OBJECTS = $(am_libhamlib_rpcrot_la_OBJECTS)
|
||||||
|
sbin_PROGRAMS = rpc.rotd$(EXEEXT)
|
||||||
|
PROGRAMS = $(sbin_PROGRAMS)
|
||||||
|
|
||||||
|
am_rpc_rotd_OBJECTS = rpcrot_xdr.$(OBJEXT) rpcrot_svc.$(OBJEXT) \
|
||||||
|
rpcrot_proc.$(OBJEXT) rpcrotd.$(OBJEXT)
|
||||||
|
rpc_rotd_OBJECTS = $(am_rpc_rotd_OBJECTS)
|
||||||
|
rpc_rotd_LDADD = $(LDADD)
|
||||||
|
|
||||||
|
DEFS = @DEFS@
|
||||||
|
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
|
||||||
|
CPPFLAGS = @CPPFLAGS@
|
||||||
|
LDFLAGS = @LDFLAGS@
|
||||||
|
LIBS = @LIBS@
|
||||||
|
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||||
|
@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/rpcrot_backend.Plo \
|
||||||
|
@AMDEP_TRUE@ $(DEPDIR)/rpcrot_clnt.Plo $(DEPDIR)/rpcrot_proc.Po \
|
||||||
|
@AMDEP_TRUE@ $(DEPDIR)/rpcrot_svc.Po $(DEPDIR)/rpcrot_xdr.Plo \
|
||||||
|
@AMDEP_TRUE@ $(DEPDIR)/rpcrot_xdr.Po $(DEPDIR)/rpcrotd.Po
|
||||||
|
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||||
|
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||||
|
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
|
||||||
|
$(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||||
|
CCLD = $(CC)
|
||||||
|
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||||
|
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||||
|
CFLAGS = @CFLAGS@
|
||||||
|
DIST_SOURCES = $(libhamlib_rpcrot_la_SOURCES) $(rpc_rotd_SOURCES)
|
||||||
|
|
||||||
|
NROFF = nroff
|
||||||
|
MANS = $(man_MANS)
|
||||||
|
HEADERS = $(noinst_HEADERS)
|
||||||
|
|
||||||
|
DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in
|
||||||
|
SOURCES = $(libhamlib_rpcrot_la_SOURCES) $(rpc_rotd_SOURCES)
|
||||||
|
|
||||||
|
all: all-am
|
||||||
|
|
||||||
|
.SUFFIXES:
|
||||||
|
.SUFFIXES: .c .lo .o .obj
|
||||||
|
|
||||||
|
mostlyclean-libtool:
|
||||||
|
-rm -f *.lo
|
||||||
|
|
||||||
|
clean-libtool:
|
||||||
|
-rm -rf .libs _libs
|
||||||
|
|
||||||
|
distclean-libtool:
|
||||||
|
-rm -f libtool
|
||||||
|
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
|
||||||
|
cd $(top_srcdir) && \
|
||||||
|
$(AUTOMAKE) --gnu rpcrot/Makefile
|
||||||
|
Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||||
|
cd $(top_builddir) && \
|
||||||
|
CONFIG_HEADERS= CONFIG_LINKS= \
|
||||||
|
CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
|
||||||
|
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
|
||||||
|
@$(NORMAL_INSTALL)
|
||||||
|
$(mkinstalldirs) $(DESTDIR)$(libdir)
|
||||||
|
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||||
|
if test -f $$p; then \
|
||||||
|
echo " $(LIBTOOL) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$p"; \
|
||||||
|
$(LIBTOOL) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$p; \
|
||||||
|
else :; fi; \
|
||||||
|
done
|
||||||
|
|
||||||
|
uninstall-libLTLIBRARIES:
|
||||||
|
@$(NORMAL_UNINSTALL)
|
||||||
|
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||||
|
echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p"; \
|
||||||
|
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
|
||||||
|
done
|
||||||
|
|
||||||
|
clean-libLTLIBRARIES:
|
||||||
|
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
|
||||||
|
libhamlib-rpcrot.la: $(libhamlib_rpcrot_la_OBJECTS) $(libhamlib_rpcrot_la_DEPENDENCIES)
|
||||||
|
$(LINK) -rpath $(libdir) $(libhamlib_rpcrot_la_LDFLAGS) $(libhamlib_rpcrot_la_OBJECTS) $(libhamlib_rpcrot_la_LIBADD) $(LIBS)
|
||||||
|
install-sbinPROGRAMS: $(sbin_PROGRAMS)
|
||||||
|
@$(NORMAL_INSTALL)
|
||||||
|
$(mkinstalldirs) $(DESTDIR)$(sbindir)
|
||||||
|
@list='$(sbin_PROGRAMS)'; for p in $$list; do \
|
||||||
|
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
|
||||||
|
if test -f $$p \
|
||||||
|
|| test -f $$p1 \
|
||||||
|
; then \
|
||||||
|
f=`echo $$p1|sed '$(transform);s/$$/$(EXEEXT)/'`; \
|
||||||
|
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/$$f"; \
|
||||||
|
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/$$f; \
|
||||||
|
else :; fi; \
|
||||||
|
done
|
||||||
|
|
||||||
|
uninstall-sbinPROGRAMS:
|
||||||
|
@$(NORMAL_UNINSTALL)
|
||||||
|
@list='$(sbin_PROGRAMS)'; for p in $$list; do \
|
||||||
|
f=`echo $$p|sed 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
|
||||||
|
echo " rm -f $(DESTDIR)$(sbindir)/$$f"; \
|
||||||
|
rm -f $(DESTDIR)$(sbindir)/$$f; \
|
||||||
|
done
|
||||||
|
|
||||||
|
clean-sbinPROGRAMS:
|
||||||
|
-test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS)
|
||||||
|
rpc.rotd$(EXEEXT): $(rpc_rotd_OBJECTS) $(rpc_rotd_DEPENDENCIES)
|
||||||
|
@rm -f rpc.rotd$(EXEEXT)
|
||||||
|
$(LINK) $(rpc_rotd_LDFLAGS) $(rpc_rotd_OBJECTS) $(rpc_rotd_LDADD) $(LIBS)
|
||||||
|
|
||||||
|
mostlyclean-compile:
|
||||||
|
-rm -f *.$(OBJEXT) core *.core
|
||||||
|
|
||||||
|
distclean-compile:
|
||||||
|
-rm -f *.tab.c
|
||||||
|
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/rpcrot_backend.Plo@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/rpcrot_clnt.Plo@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/rpcrot_proc.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/rpcrot_svc.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/rpcrot_xdr.Plo@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/rpcrot_xdr.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/rpcrotd.Po@am__quote@
|
||||||
|
|
||||||
|
distclean-depend:
|
||||||
|
-rm -rf $(DEPDIR)
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
$(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$<
|
||||||
|
|
||||||
|
.c.obj:
|
||||||
|
@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
$(COMPILE) -c `cygpath -w $<`
|
||||||
|
|
||||||
|
.c.lo:
|
||||||
|
@AMDEP_TRUE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
$(LTCOMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$<
|
||||||
|
CCDEPMODE = @CCDEPMODE@
|
||||||
|
uninstall-info-am:
|
||||||
|
|
||||||
|
man8dir = $(mandir)/man8
|
||||||
|
install-man8: $(man8_MANS) $(man_MANS)
|
||||||
|
@$(NORMAL_INSTALL)
|
||||||
|
$(mkinstalldirs) $(DESTDIR)$(man8dir)
|
||||||
|
@list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \
|
||||||
|
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
|
||||||
|
for i in $$l2; do \
|
||||||
|
case "$$i" in \
|
||||||
|
*.8*) list="$$list $$i" ;; \
|
||||||
|
esac; \
|
||||||
|
done; \
|
||||||
|
for i in $$list; do \
|
||||||
|
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
|
||||||
|
else file=$$i; fi; \
|
||||||
|
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
|
||||||
|
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
|
||||||
|
inst=`echo $$inst | sed -e 's/^.*\///'`; \
|
||||||
|
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
|
||||||
|
echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst"; \
|
||||||
|
$(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst; \
|
||||||
|
done
|
||||||
|
uninstall-man8:
|
||||||
|
@$(NORMAL_UNINSTALL)
|
||||||
|
@list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \
|
||||||
|
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
|
||||||
|
for i in $$l2; do \
|
||||||
|
case "$$i" in \
|
||||||
|
*.8*) list="$$list $$i" ;; \
|
||||||
|
esac; \
|
||||||
|
done; \
|
||||||
|
for i in $$list; do \
|
||||||
|
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
|
||||||
|
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
|
||||||
|
inst=`echo $$inst | sed -e 's/^.*\///'`; \
|
||||||
|
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
|
||||||
|
echo " rm -f $(DESTDIR)$(man8dir)/$$inst"; \
|
||||||
|
rm -f $(DESTDIR)$(man8dir)/$$inst; \
|
||||||
|
done
|
||||||
|
|
||||||
|
tags: TAGS
|
||||||
|
|
||||||
|
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||||
|
list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
|
||||||
|
unique=`for i in $$list; do \
|
||||||
|
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||||
|
done | \
|
||||||
|
$(AWK) ' { files[$$0] = 1; } \
|
||||||
|
END { for (i in files) print i; }'`; \
|
||||||
|
mkid -fID $$unique $(LISP)
|
||||||
|
|
||||||
|
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||||
|
$(TAGS_FILES) $(LISP)
|
||||||
|
tags=; \
|
||||||
|
here=`pwd`; \
|
||||||
|
list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
|
||||||
|
unique=`for i in $$list; do \
|
||||||
|
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||||
|
done | \
|
||||||
|
$(AWK) ' { files[$$0] = 1; } \
|
||||||
|
END { for (i in files) print i; }'`; \
|
||||||
|
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|
||||||
|
|| etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
|
||||||
|
|
||||||
|
GTAGS:
|
||||||
|
here=`CDPATH=: && cd $(top_builddir) && pwd` \
|
||||||
|
&& cd $(top_srcdir) \
|
||||||
|
&& gtags -i $(GTAGS_ARGS) $$here
|
||||||
|
|
||||||
|
distclean-tags:
|
||||||
|
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
|
||||||
|
|
||||||
|
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
|
|
||||||
|
top_distdir = ..
|
||||||
|
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
|
||||||
|
|
||||||
|
distdir: $(DISTFILES)
|
||||||
|
@for file in $(DISTFILES); do \
|
||||||
|
if test -f $$file; then d=.; else d=$(srcdir); fi; \
|
||||||
|
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||||
|
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||||
|
$(mkinstalldirs) "$(distdir)/$$dir"; \
|
||||||
|
fi; \
|
||||||
|
if test -d $$d/$$file; then \
|
||||||
|
cp -pR $$d/$$file $(distdir) \
|
||||||
|
|| exit 1; \
|
||||||
|
else \
|
||||||
|
test -f $(distdir)/$$file \
|
||||||
|
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||||
|
|| exit 1; \
|
||||||
|
fi; \
|
||||||
|
done
|
||||||
|
check-am: all-am
|
||||||
|
check: check-am
|
||||||
|
all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(MANS) $(HEADERS)
|
||||||
|
|
||||||
|
installdirs:
|
||||||
|
$(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(sbindir) $(DESTDIR)$(man8dir)
|
||||||
|
|
||||||
|
install: install-am
|
||||||
|
install-exec: install-exec-am
|
||||||
|
install-data: install-data-am
|
||||||
|
uninstall: uninstall-am
|
||||||
|
|
||||||
|
install-am: all-am
|
||||||
|
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||||
|
|
||||||
|
installcheck: installcheck-am
|
||||||
|
install-strip:
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||||
|
`test -z '$(STRIP)' || \
|
||||||
|
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||||
|
mostlyclean-generic:
|
||||||
|
|
||||||
|
clean-generic:
|
||||||
|
|
||||||
|
distclean-generic:
|
||||||
|
-rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
|
||||||
|
|
||||||
|
maintainer-clean-generic:
|
||||||
|
@echo "This command is intended for maintainers to use"
|
||||||
|
@echo "it deletes files that may require special tools to rebuild."
|
||||||
|
clean: clean-am
|
||||||
|
|
||||||
|
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
|
||||||
|
clean-sbinPROGRAMS mostlyclean-am
|
||||||
|
|
||||||
|
distclean: distclean-am
|
||||||
|
|
||||||
|
distclean-am: clean-am distclean-compile distclean-depend \
|
||||||
|
distclean-generic distclean-libtool distclean-tags
|
||||||
|
|
||||||
|
dvi: dvi-am
|
||||||
|
|
||||||
|
dvi-am:
|
||||||
|
|
||||||
|
info: info-am
|
||||||
|
|
||||||
|
info-am:
|
||||||
|
|
||||||
|
install-data-am: install-man
|
||||||
|
|
||||||
|
install-exec-am: install-libLTLIBRARIES install-sbinPROGRAMS
|
||||||
|
|
||||||
|
install-info: install-info-am
|
||||||
|
|
||||||
|
install-man: install-man8
|
||||||
|
|
||||||
|
installcheck-am:
|
||||||
|
|
||||||
|
maintainer-clean: maintainer-clean-am
|
||||||
|
|
||||||
|
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||||
|
|
||||||
|
mostlyclean: mostlyclean-am
|
||||||
|
|
||||||
|
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||||
|
mostlyclean-libtool
|
||||||
|
|
||||||
|
uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES uninstall-man \
|
||||||
|
uninstall-sbinPROGRAMS
|
||||||
|
|
||||||
|
uninstall-man: uninstall-man8
|
||||||
|
|
||||||
|
.PHONY: GTAGS all all-am check check-am clean clean-generic \
|
||||||
|
clean-libLTLIBRARIES clean-libtool clean-sbinPROGRAMS distclean \
|
||||||
|
distclean-compile distclean-depend distclean-generic \
|
||||||
|
distclean-libtool distclean-tags distdir dvi dvi-am info \
|
||||||
|
info-am install install-am install-data install-data-am \
|
||||||
|
install-exec install-exec-am install-info install-info-am \
|
||||||
|
install-libLTLIBRARIES install-man install-man8 \
|
||||||
|
install-sbinPROGRAMS install-strip installcheck installcheck-am \
|
||||||
|
installdirs maintainer-clean maintainer-clean-generic \
|
||||||
|
mostlyclean mostlyclean-compile mostlyclean-generic \
|
||||||
|
mostlyclean-libtool tags uninstall uninstall-am \
|
||||||
|
uninstall-info-am uninstall-libLTLIBRARIES uninstall-man \
|
||||||
|
uninstall-man8 uninstall-sbinPROGRAMS
|
||||||
|
|
||||||
|
|
||||||
|
rpcrot.h: rpcrot.x
|
||||||
|
rm -f $@
|
||||||
|
$(RPCGEN) -h $< -o $@
|
||||||
|
|
||||||
|
rpcrot_clnt.c: rpcrot.x
|
||||||
|
rm -f $@
|
||||||
|
$(RPCGEN) -l $< -o $@
|
||||||
|
|
||||||
|
rpcrot_svc.c: rpcrot.x
|
||||||
|
rm -f $@
|
||||||
|
$(RPCGEN) -m $< -o $@
|
||||||
|
|
||||||
|
rpcrot_xdr.c: rpcrot.x
|
||||||
|
rm -f $@
|
||||||
|
$(RPCGEN) -c $< -o $@
|
||||||
|
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||||
|
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||||
|
.NOEXPORT:
|
|
@ -0,0 +1,84 @@
|
||||||
|
.\" 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" "3 January 2002" "Hamlib"
|
||||||
|
.\" 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 Hamlib rig daemon that handles RPC client requests.
|
||||||
|
.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 still ALPHA level software.
|
||||||
|
A lof of stuff hasn't been tested thoroughly, and the API may change
|
||||||
|
without publicised notice. Please report bugs and feedback at
|
||||||
|
the e-mail address given in the REPORTING BUGS section.
|
||||||
|
.SH OPTIONS
|
||||||
|
This program follow the usual GNU command line syntax, with long
|
||||||
|
options starting with two dashes (`-').
|
||||||
|
A summary of options is included below.
|
||||||
|
.TP
|
||||||
|
.B \-m, \-\-model=id
|
||||||
|
Select rotator model number. See model list.
|
||||||
|
.TP
|
||||||
|
.B \-r, --rig-file=device
|
||||||
|
Use \fBdevice\fP as the file name of the rotator to operate on.
|
||||||
|
.TP
|
||||||
|
.B \-s, --serial-speed=baud
|
||||||
|
Set serial speed to \fBbaud\fP rate. Uses maximal rig speed as default.
|
||||||
|
.TP
|
||||||
|
.B \-C, \-\-set\-conf=parm=val[,parm=val]*
|
||||||
|
Set config parameter.
|
||||||
|
.TP
|
||||||
|
.B \-v, \-\-verbose
|
||||||
|
Set verbose mode, cumulative.
|
||||||
|
.TP
|
||||||
|
.B \-h, \-\-help
|
||||||
|
Show summary of options and exit.
|
||||||
|
.TP
|
||||||
|
.B \-V, \-\-version
|
||||||
|
Show version of program 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 standard error code.
|
||||||
|
|
||||||
|
.SH AUTHOR
|
||||||
|
Written by Stephane Fillod.
|
||||||
|
.SH BUGS
|
||||||
|
No authentication whatsoever. Could be done through domain restriction though.
|
||||||
|
Please ask if stronger security needed.
|
||||||
|
.PP
|
||||||
|
This almost empty section...
|
||||||
|
.SH REPORTING BUGS
|
||||||
|
Report bugs to <hamlib-developer@users.sourceforge.net>.
|
||||||
|
.br
|
||||||
|
I'm already aware of the bug in the previous section :-)
|
||||||
|
.SH COPYRIGHT
|
||||||
|
Copyright \(co 2000,2001 Stephane Fillod.
|
||||||
|
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)
|
||||||
|
|
|
@ -0,0 +1,181 @@
|
||||||
|
/*
|
||||||
|
* Please do not edit this file.
|
||||||
|
* It was generated using rpcgen.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _RPCROT_H_RPCGEN
|
||||||
|
#define _RPCROT_H_RPCGEN
|
||||||
|
|
||||||
|
#include <rpc/rpc.h>
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Hamlib Interface - RPC definitions
|
||||||
|
* Copyright (c) 2000,2001 by Stephane Fillod and Frank Singleton
|
||||||
|
* Contributed by Francois Retief <fgretief@sun.ac.za>
|
||||||
|
*
|
||||||
|
* $Id: rpcrot.h,v 1.1 2002-01-16 16:45:11 fgretief Exp $
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Library 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 Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#include <rpc/xdr.h>
|
||||||
|
#include <hamlib/rotator.h>
|
||||||
|
|
||||||
|
typedef u_int model_x;
|
||||||
|
|
||||||
|
typedef float azimuth_x;
|
||||||
|
|
||||||
|
typedef float elevation_x;
|
||||||
|
|
||||||
|
typedef u_int rot_reset_x;
|
||||||
|
|
||||||
|
struct position_arg {
|
||||||
|
azimuth_x az;
|
||||||
|
elevation_x el;
|
||||||
|
};
|
||||||
|
typedef struct position_arg position_arg;
|
||||||
|
|
||||||
|
struct move_s {
|
||||||
|
int direction;
|
||||||
|
int speed;
|
||||||
|
};
|
||||||
|
typedef struct move_s move_s;
|
||||||
|
|
||||||
|
struct position_s {
|
||||||
|
azimuth_x az;
|
||||||
|
elevation_x el;
|
||||||
|
};
|
||||||
|
typedef struct position_s position_s;
|
||||||
|
|
||||||
|
struct position_res {
|
||||||
|
int rotstatus;
|
||||||
|
union {
|
||||||
|
position_s pos;
|
||||||
|
} position_res_u;
|
||||||
|
};
|
||||||
|
typedef struct position_res position_res;
|
||||||
|
|
||||||
|
struct rotstate_s {
|
||||||
|
azimuth_x az_min;
|
||||||
|
azimuth_x az_max;
|
||||||
|
elevation_x el_min;
|
||||||
|
elevation_x el_max;
|
||||||
|
};
|
||||||
|
typedef struct rotstate_s rotstate_s;
|
||||||
|
|
||||||
|
struct rotstate_res {
|
||||||
|
int rotstatus;
|
||||||
|
union {
|
||||||
|
rotstate_s state;
|
||||||
|
} rotstate_res_u;
|
||||||
|
};
|
||||||
|
typedef struct rotstate_res rotstate_res;
|
||||||
|
|
||||||
|
#define ROTPROG 0x20000999
|
||||||
|
#define ROTVERS 1
|
||||||
|
|
||||||
|
#if defined(__STDC__) || defined(__cplusplus)
|
||||||
|
#define GETMODEL 1
|
||||||
|
extern model_x * getmodel_1(void *, CLIENT *);
|
||||||
|
extern model_x * getmodel_1_svc(void *, struct svc_req *);
|
||||||
|
#define GETROTSTATE 3
|
||||||
|
extern rotstate_res * getrotstate_1(void *, CLIENT *);
|
||||||
|
extern rotstate_res * getrotstate_1_svc(void *, struct svc_req *);
|
||||||
|
#define SETPOSITION 10
|
||||||
|
extern int * setposition_1(position_s *, CLIENT *);
|
||||||
|
extern int * setposition_1_svc(position_s *, struct svc_req *);
|
||||||
|
#define GETPOSITION 11
|
||||||
|
extern position_res * getposition_1(void *, CLIENT *);
|
||||||
|
extern position_res * getposition_1_svc(void *, struct svc_req *);
|
||||||
|
#define STOP 12
|
||||||
|
extern int * stop_1(void *, CLIENT *);
|
||||||
|
extern int * stop_1_svc(void *, struct svc_req *);
|
||||||
|
#define RESET 13
|
||||||
|
extern int * reset_1(rot_reset_x *, CLIENT *);
|
||||||
|
extern int * reset_1_svc(rot_reset_x *, struct svc_req *);
|
||||||
|
#define PARK 14
|
||||||
|
extern int * park_1(void *, CLIENT *);
|
||||||
|
extern int * park_1_svc(void *, struct svc_req *);
|
||||||
|
#define MOVE 15
|
||||||
|
extern int * move_1(move_s *, CLIENT *);
|
||||||
|
extern int * move_1_svc(move_s *, struct svc_req *);
|
||||||
|
extern int rotprog_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
|
||||||
|
|
||||||
|
#else /* K&R C */
|
||||||
|
#define GETMODEL 1
|
||||||
|
extern model_x * getmodel_1();
|
||||||
|
extern model_x * getmodel_1_svc();
|
||||||
|
#define GETROTSTATE 3
|
||||||
|
extern rotstate_res * getrotstate_1();
|
||||||
|
extern rotstate_res * getrotstate_1_svc();
|
||||||
|
#define SETPOSITION 10
|
||||||
|
extern int * setposition_1();
|
||||||
|
extern int * setposition_1_svc();
|
||||||
|
#define GETPOSITION 11
|
||||||
|
extern position_res * getposition_1();
|
||||||
|
extern position_res * getposition_1_svc();
|
||||||
|
#define STOP 12
|
||||||
|
extern int * stop_1();
|
||||||
|
extern int * stop_1_svc();
|
||||||
|
#define RESET 13
|
||||||
|
extern int * reset_1();
|
||||||
|
extern int * reset_1_svc();
|
||||||
|
#define PARK 14
|
||||||
|
extern int * park_1();
|
||||||
|
extern int * park_1_svc();
|
||||||
|
#define MOVE 15
|
||||||
|
extern int * move_1();
|
||||||
|
extern int * move_1_svc();
|
||||||
|
extern int rotprog_1_freeresult ();
|
||||||
|
#endif /* K&R C */
|
||||||
|
|
||||||
|
/* the xdr functions */
|
||||||
|
|
||||||
|
#if defined(__STDC__) || defined(__cplusplus)
|
||||||
|
extern bool_t xdr_model_x (XDR *, model_x*);
|
||||||
|
extern bool_t xdr_azimuth_x (XDR *, azimuth_x*);
|
||||||
|
extern bool_t xdr_elevation_x (XDR *, elevation_x*);
|
||||||
|
extern bool_t xdr_rot_reset_x (XDR *, rot_reset_x*);
|
||||||
|
extern bool_t xdr_position_arg (XDR *, position_arg*);
|
||||||
|
extern bool_t xdr_move_s (XDR *, move_s*);
|
||||||
|
extern bool_t xdr_position_s (XDR *, position_s*);
|
||||||
|
extern bool_t xdr_position_res (XDR *, position_res*);
|
||||||
|
extern bool_t xdr_rotstate_s (XDR *, rotstate_s*);
|
||||||
|
extern bool_t xdr_rotstate_res (XDR *, rotstate_res*);
|
||||||
|
|
||||||
|
#else /* K&R C */
|
||||||
|
extern bool_t xdr_model_x ();
|
||||||
|
extern bool_t xdr_azimuth_x ();
|
||||||
|
extern bool_t xdr_elevation_x ();
|
||||||
|
extern bool_t xdr_rot_reset_x ();
|
||||||
|
extern bool_t xdr_position_arg ();
|
||||||
|
extern bool_t xdr_move_s ();
|
||||||
|
extern bool_t xdr_position_s ();
|
||||||
|
extern bool_t xdr_position_res ();
|
||||||
|
extern bool_t xdr_rotstate_s ();
|
||||||
|
extern bool_t xdr_rotstate_res ();
|
||||||
|
|
||||||
|
#endif /* K&R C */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* !_RPCROT_H_RPCGEN */
|
|
@ -0,0 +1,95 @@
|
||||||
|
%/*
|
||||||
|
% * Hamlib Interface - RPC definitions
|
||||||
|
% * Copyright (c) 2000,2001 by Stephane Fillod and Frank Singleton
|
||||||
|
% * Contributed by Francois Retief <fgretief@sun.ac.za>
|
||||||
|
% *
|
||||||
|
% * $Id: rpcrot.x,v 1.1 2002-01-16 16:45:11 fgretief Exp $
|
||||||
|
% *
|
||||||
|
% * This library is free software; you can redistribute it and/or modify
|
||||||
|
% * it under the terms of the GNU Library 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 Library General Public License for more details.
|
||||||
|
% *
|
||||||
|
% * You should have received a copy of the GNU Library General Public
|
||||||
|
% * License along with this library; if not, write to the Free Software
|
||||||
|
% * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
% *
|
||||||
|
% */
|
||||||
|
|
||||||
|
/* This gets stuffed into the source files. */
|
||||||
|
#if RPC_HDR
|
||||||
|
%#include <rpc/xdr.h>
|
||||||
|
%#include <hamlib/rotator.h>
|
||||||
|
#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 */
|
||||||
|
|
|
@ -0,0 +1,296 @@
|
||||||
|
/*
|
||||||
|
* Hamlib RPC backend - main file
|
||||||
|
* Copyright (c) 2001,2002 by Stephane Fillod
|
||||||
|
* Contributed by Francois Retief <fgretief@sun.ac.za>
|
||||||
|
*
|
||||||
|
* $Id: rpcrot_backend.c,v 1.1 2002-01-16 16:45:11 fgretief Exp $
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Library 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 Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, 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 <termios.h> /* POSIX terminal control definitions */
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#include <hamlib/rotator.h>
|
||||||
|
#include <serial.h>
|
||||||
|
#include <misc.h>
|
||||||
|
|
||||||
|
#include <rpc/rpc.h>
|
||||||
|
#include "rpcrot.h"
|
||||||
|
#include "rpcrot_backend.h"
|
||||||
|
|
||||||
|
struct rpcrot_priv_data {
|
||||||
|
CLIENT *cl;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* ************************************************************************* */
|
||||||
|
|
||||||
|
static int rpcrot_init(ROT *rot)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
rot->state.rotport.type.rig = RIG_PORT_RPC;
|
||||||
|
strcpy(rot->state.rotport.pathname, "localhost");
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
rs = &rot->state;
|
||||||
|
priv = (struct rpcrot_priv_data *)rs->priv;
|
||||||
|
server = rs->rotport.pathname;
|
||||||
|
|
||||||
|
priv->cl = clnt_create(server, ROTPROG, ROTVERS, "udp");
|
||||||
|
if (priv->cl == NULL) {
|
||||||
|
clnt_pcreateerror(server);
|
||||||
|
return -RIG_ECONF;
|
||||||
|
}
|
||||||
|
mdl_res = getmodel_1(NULL, priv->cl);
|
||||||
|
if (mdl_res == NULL) {
|
||||||
|
clnt_perror(priv->cl, server);
|
||||||
|
clnt_destroy(priv->cl);
|
||||||
|
priv->cl = NULL;
|
||||||
|
return -RIG_EPROTO;
|
||||||
|
}
|
||||||
|
model = *mdl_res;
|
||||||
|
rig_debug(RIG_DEBUG_VERBOSE,__FUNCTION__ ": model %d\n", 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);
|
||||||
|
priv->cl = NULL;
|
||||||
|
return -RIG_EPROTO;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rs_res->rotstatus != RIG_OK) {
|
||||||
|
rig_debug(RIG_DEBUG_VERBOSE, __FUNCTION__": error from remote - %s\n", 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ************************************************************************* */
|
||||||
|
|
||||||
|
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_NEW,
|
||||||
|
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,
|
||||||
|
|
||||||
|
set_position: rpcrot_set_position,
|
||||||
|
get_position: rpcrot_get_position,
|
||||||
|
stop: rpcrot_stop,
|
||||||
|
reset: rpcrot_reset,
|
||||||
|
park: rpcrot_park,
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/* ************************************************************************* */
|
||||||
|
|
||||||
|
int initrots_rpcrot(void *be_handle)
|
||||||
|
{
|
||||||
|
rig_debug(RIG_DEBUG_VERBOSE, __FUNCTION__" called\n");
|
||||||
|
|
||||||
|
rot_register(&rpcrot_caps);
|
||||||
|
|
||||||
|
return RIG_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ************************************************************************* */
|
||||||
|
/* end of file */
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
/*
|
||||||
|
* $Id: rpcrot_backend.h,v 1.1 2002-01-16 16:45:11 fgretief Exp $
|
||||||
|
*/
|
||||||
|
#ifndef __RPCROT_BACKEND_H__
|
||||||
|
#define __RPCROT_BACKEND_H__
|
||||||
|
|
||||||
|
/* TODO: for future use */
|
||||||
|
|
||||||
|
#endif
|
||||||
|
/* end of file */
|
||||||
|
|
|
@ -0,0 +1,152 @@
|
||||||
|
/*
|
||||||
|
* Please do not edit this file.
|
||||||
|
* It was generated using rpcgen.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <memory.h> /* for memset */
|
||||||
|
#include "/home/fgretief/src-6/hamlib-cvssh/rpcrot/rpcrot.h"
|
||||||
|
/*
|
||||||
|
* Hamlib Interface - RPC definitions
|
||||||
|
* Copyright (c) 2000,2001 by Stephane Fillod and Frank Singleton
|
||||||
|
* Contributed by Francois Retief <fgretief@sun.ac.za>
|
||||||
|
*
|
||||||
|
* $Id: rpcrot_clnt.c,v 1.1 2002-01-16 16:45:11 fgretief Exp $
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Library 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 Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Default timeout can be changed using clnt_control() */
|
||||||
|
static struct timeval TIMEOUT = { 25, 0 };
|
||||||
|
|
||||||
|
model_x *
|
||||||
|
getmodel_1(void *argp, CLIENT *clnt)
|
||||||
|
{
|
||||||
|
static model_x clnt_res;
|
||||||
|
|
||||||
|
memset((char *)&clnt_res, 0, sizeof(clnt_res));
|
||||||
|
if (clnt_call (clnt, GETMODEL,
|
||||||
|
(xdrproc_t) xdr_void, (caddr_t) argp,
|
||||||
|
(xdrproc_t) xdr_model_x, (caddr_t) &clnt_res,
|
||||||
|
TIMEOUT) != RPC_SUCCESS) {
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
return (&clnt_res);
|
||||||
|
}
|
||||||
|
|
||||||
|
rotstate_res *
|
||||||
|
getrotstate_1(void *argp, CLIENT *clnt)
|
||||||
|
{
|
||||||
|
static rotstate_res clnt_res;
|
||||||
|
|
||||||
|
memset((char *)&clnt_res, 0, sizeof(clnt_res));
|
||||||
|
if (clnt_call (clnt, GETROTSTATE,
|
||||||
|
(xdrproc_t) xdr_void, (caddr_t) argp,
|
||||||
|
(xdrproc_t) xdr_rotstate_res, (caddr_t) &clnt_res,
|
||||||
|
TIMEOUT) != RPC_SUCCESS) {
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
return (&clnt_res);
|
||||||
|
}
|
||||||
|
|
||||||
|
int *
|
||||||
|
setposition_1(position_s *argp, CLIENT *clnt)
|
||||||
|
{
|
||||||
|
static int clnt_res;
|
||||||
|
|
||||||
|
memset((char *)&clnt_res, 0, sizeof(clnt_res));
|
||||||
|
if (clnt_call (clnt, SETPOSITION,
|
||||||
|
(xdrproc_t) xdr_position_s, (caddr_t) argp,
|
||||||
|
(xdrproc_t) xdr_int, (caddr_t) &clnt_res,
|
||||||
|
TIMEOUT) != RPC_SUCCESS) {
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
return (&clnt_res);
|
||||||
|
}
|
||||||
|
|
||||||
|
position_res *
|
||||||
|
getposition_1(void *argp, CLIENT *clnt)
|
||||||
|
{
|
||||||
|
static position_res clnt_res;
|
||||||
|
|
||||||
|
memset((char *)&clnt_res, 0, sizeof(clnt_res));
|
||||||
|
if (clnt_call (clnt, GETPOSITION,
|
||||||
|
(xdrproc_t) xdr_void, (caddr_t) argp,
|
||||||
|
(xdrproc_t) xdr_position_res, (caddr_t) &clnt_res,
|
||||||
|
TIMEOUT) != RPC_SUCCESS) {
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
return (&clnt_res);
|
||||||
|
}
|
||||||
|
|
||||||
|
int *
|
||||||
|
stop_1(void *argp, CLIENT *clnt)
|
||||||
|
{
|
||||||
|
static int clnt_res;
|
||||||
|
|
||||||
|
memset((char *)&clnt_res, 0, sizeof(clnt_res));
|
||||||
|
if (clnt_call (clnt, STOP,
|
||||||
|
(xdrproc_t) xdr_void, (caddr_t) argp,
|
||||||
|
(xdrproc_t) xdr_int, (caddr_t) &clnt_res,
|
||||||
|
TIMEOUT) != RPC_SUCCESS) {
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
return (&clnt_res);
|
||||||
|
}
|
||||||
|
|
||||||
|
int *
|
||||||
|
reset_1(rot_reset_x *argp, CLIENT *clnt)
|
||||||
|
{
|
||||||
|
static int clnt_res;
|
||||||
|
|
||||||
|
memset((char *)&clnt_res, 0, sizeof(clnt_res));
|
||||||
|
if (clnt_call (clnt, RESET,
|
||||||
|
(xdrproc_t) xdr_rot_reset_x, (caddr_t) argp,
|
||||||
|
(xdrproc_t) xdr_int, (caddr_t) &clnt_res,
|
||||||
|
TIMEOUT) != RPC_SUCCESS) {
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
return (&clnt_res);
|
||||||
|
}
|
||||||
|
|
||||||
|
int *
|
||||||
|
park_1(void *argp, CLIENT *clnt)
|
||||||
|
{
|
||||||
|
static int clnt_res;
|
||||||
|
|
||||||
|
memset((char *)&clnt_res, 0, sizeof(clnt_res));
|
||||||
|
if (clnt_call (clnt, PARK,
|
||||||
|
(xdrproc_t) xdr_void, (caddr_t) argp,
|
||||||
|
(xdrproc_t) xdr_int, (caddr_t) &clnt_res,
|
||||||
|
TIMEOUT) != RPC_SUCCESS) {
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
return (&clnt_res);
|
||||||
|
}
|
||||||
|
|
||||||
|
int *
|
||||||
|
move_1(move_s *argp, CLIENT *clnt)
|
||||||
|
{
|
||||||
|
static int clnt_res;
|
||||||
|
|
||||||
|
memset((char *)&clnt_res, 0, sizeof(clnt_res));
|
||||||
|
if (clnt_call (clnt, MOVE,
|
||||||
|
(xdrproc_t) xdr_move_s, (caddr_t) argp,
|
||||||
|
(xdrproc_t) xdr_int, (caddr_t) &clnt_res,
|
||||||
|
TIMEOUT) != RPC_SUCCESS) {
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
return (&clnt_res);
|
||||||
|
}
|
|
@ -0,0 +1,149 @@
|
||||||
|
/*
|
||||||
|
* Hamlib RPC server - procedures
|
||||||
|
* Copyright (c) 2000,2001 by Stephane Fillod and Frank Singleton
|
||||||
|
* Contributed by Francois Retief <fgretief@sun.ac.za>
|
||||||
|
*
|
||||||
|
* $Id: rpcrot_proc.c,v 1.1 2002-01-16 16:45:11 fgretief Exp $
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Library 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 Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, 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, __FUNCTION__" called\n");
|
||||||
|
|
||||||
|
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, __FUNCTION__" called\n");
|
||||||
|
|
||||||
|
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, __FUNCTION__" called\n");
|
||||||
|
|
||||||
|
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, __FUNCTION__" called\n");
|
||||||
|
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, __FUNCTION__" called\n");
|
||||||
|
|
||||||
|
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, __FUNCTION__" called\n");
|
||||||
|
|
||||||
|
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, __FUNCTION__" called\n");
|
||||||
|
|
||||||
|
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, __FUNCTION__" called\n");
|
||||||
|
|
||||||
|
result = rot_move(the_rpc_rot, argp->direction, argp->speed);
|
||||||
|
return &result;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,124 @@
|
||||||
|
/*
|
||||||
|
* Please do not edit this file.
|
||||||
|
* It was generated using rpcgen.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "/home/fgretief/src-6/hamlib-cvssh/rpcrot/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>
|
||||||
|
|
||||||
|
#ifndef SIG_PF
|
||||||
|
#define SIG_PF void(*)(int)
|
||||||
|
#endif
|
||||||
|
/*
|
||||||
|
* Hamlib Interface - RPC definitions
|
||||||
|
* Copyright (c) 2000,2001 by Stephane Fillod and Frank Singleton
|
||||||
|
* Contributed by Francois Retief <fgretief@sun.ac.za>
|
||||||
|
*
|
||||||
|
* $Id: rpcrot_svc.c,v 1.1 2002-01-16 16:45:11 fgretief Exp $
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Library 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 Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
rotprog_1(struct svc_req *rqstp, register SVCXPRT *transp)
|
||||||
|
{
|
||||||
|
union {
|
||||||
|
position_s setposition_1_arg;
|
||||||
|
rot_reset_x reset_1_arg;
|
||||||
|
move_s move_1_arg;
|
||||||
|
} argument;
|
||||||
|
char *result;
|
||||||
|
xdrproc_t _xdr_argument, _xdr_result;
|
||||||
|
char *(*local)(char *, struct svc_req *);
|
||||||
|
|
||||||
|
switch (rqstp->rq_proc) {
|
||||||
|
case NULLPROC:
|
||||||
|
(void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
|
||||||
|
return;
|
||||||
|
|
||||||
|
case GETMODEL:
|
||||||
|
_xdr_argument = (xdrproc_t) xdr_void;
|
||||||
|
_xdr_result = (xdrproc_t) xdr_model_x;
|
||||||
|
local = (char *(*)(char *, struct svc_req *)) getmodel_1_svc;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GETROTSTATE:
|
||||||
|
_xdr_argument = (xdrproc_t) xdr_void;
|
||||||
|
_xdr_result = (xdrproc_t) xdr_rotstate_res;
|
||||||
|
local = (char *(*)(char *, struct svc_req *)) getrotstate_1_svc;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SETPOSITION:
|
||||||
|
_xdr_argument = (xdrproc_t) xdr_position_s;
|
||||||
|
_xdr_result = (xdrproc_t) xdr_int;
|
||||||
|
local = (char *(*)(char *, struct svc_req *)) setposition_1_svc;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GETPOSITION:
|
||||||
|
_xdr_argument = (xdrproc_t) xdr_void;
|
||||||
|
_xdr_result = (xdrproc_t) xdr_position_res;
|
||||||
|
local = (char *(*)(char *, struct svc_req *)) getposition_1_svc;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case STOP:
|
||||||
|
_xdr_argument = (xdrproc_t) xdr_void;
|
||||||
|
_xdr_result = (xdrproc_t) xdr_int;
|
||||||
|
local = (char *(*)(char *, struct svc_req *)) stop_1_svc;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RESET:
|
||||||
|
_xdr_argument = (xdrproc_t) xdr_rot_reset_x;
|
||||||
|
_xdr_result = (xdrproc_t) xdr_int;
|
||||||
|
local = (char *(*)(char *, struct svc_req *)) reset_1_svc;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PARK:
|
||||||
|
_xdr_argument = (xdrproc_t) xdr_void;
|
||||||
|
_xdr_result = (xdrproc_t) xdr_int;
|
||||||
|
local = (char *(*)(char *, struct svc_req *)) park_1_svc;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MOVE:
|
||||||
|
_xdr_argument = (xdrproc_t) xdr_move_s;
|
||||||
|
_xdr_result = (xdrproc_t) xdr_int;
|
||||||
|
local = (char *(*)(char *, struct svc_req *)) move_1_svc;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
svcerr_noproc (transp);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
memset ((char *)&argument, 0, sizeof (argument));
|
||||||
|
if (!svc_getargs (transp, _xdr_argument, (caddr_t) &argument)) {
|
||||||
|
svcerr_decode (transp);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
result = (*local)((char *)&argument, rqstp);
|
||||||
|
if (result != NULL && !svc_sendreply(transp, _xdr_result, result)) {
|
||||||
|
svcerr_systemerr (transp);
|
||||||
|
}
|
||||||
|
if (!svc_freeargs (transp, _xdr_argument, (caddr_t) &argument)) {
|
||||||
|
fprintf (stderr, "%s", "unable to free arguments");
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
|
@ -0,0 +1,156 @@
|
||||||
|
/*
|
||||||
|
* Please do not edit this file.
|
||||||
|
* It was generated using rpcgen.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "/home/fgretief/src-6/hamlib-cvssh/rpcrot/rpcrot.h"
|
||||||
|
/*
|
||||||
|
* Hamlib Interface - RPC definitions
|
||||||
|
* Copyright (c) 2000,2001 by Stephane Fillod and Frank Singleton
|
||||||
|
* Contributed by Francois Retief <fgretief@sun.ac.za>
|
||||||
|
*
|
||||||
|
* $Id: rpcrot_xdr.c,v 1.1 2002-01-16 16:45:11 fgretief Exp $
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Library 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 Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
bool_t
|
||||||
|
xdr_model_x (XDR *xdrs, model_x *objp)
|
||||||
|
{
|
||||||
|
register int32_t *buf;
|
||||||
|
|
||||||
|
if (!xdr_u_int (xdrs, objp))
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool_t
|
||||||
|
xdr_azimuth_x (XDR *xdrs, azimuth_x *objp)
|
||||||
|
{
|
||||||
|
register int32_t *buf;
|
||||||
|
|
||||||
|
if (!xdr_float (xdrs, objp))
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool_t
|
||||||
|
xdr_elevation_x (XDR *xdrs, elevation_x *objp)
|
||||||
|
{
|
||||||
|
register int32_t *buf;
|
||||||
|
|
||||||
|
if (!xdr_float (xdrs, objp))
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool_t
|
||||||
|
xdr_rot_reset_x (XDR *xdrs, rot_reset_x *objp)
|
||||||
|
{
|
||||||
|
register int32_t *buf;
|
||||||
|
|
||||||
|
if (!xdr_u_int (xdrs, objp))
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool_t
|
||||||
|
xdr_position_arg (XDR *xdrs, position_arg *objp)
|
||||||
|
{
|
||||||
|
register int32_t *buf;
|
||||||
|
|
||||||
|
if (!xdr_azimuth_x (xdrs, &objp->az))
|
||||||
|
return FALSE;
|
||||||
|
if (!xdr_elevation_x (xdrs, &objp->el))
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool_t
|
||||||
|
xdr_move_s (XDR *xdrs, move_s *objp)
|
||||||
|
{
|
||||||
|
register int32_t *buf;
|
||||||
|
|
||||||
|
if (!xdr_int (xdrs, &objp->direction))
|
||||||
|
return FALSE;
|
||||||
|
if (!xdr_int (xdrs, &objp->speed))
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool_t
|
||||||
|
xdr_position_s (XDR *xdrs, position_s *objp)
|
||||||
|
{
|
||||||
|
register int32_t *buf;
|
||||||
|
|
||||||
|
if (!xdr_azimuth_x (xdrs, &objp->az))
|
||||||
|
return FALSE;
|
||||||
|
if (!xdr_elevation_x (xdrs, &objp->el))
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool_t
|
||||||
|
xdr_position_res (XDR *xdrs, position_res *objp)
|
||||||
|
{
|
||||||
|
register int32_t *buf;
|
||||||
|
|
||||||
|
if (!xdr_int (xdrs, &objp->rotstatus))
|
||||||
|
return FALSE;
|
||||||
|
switch (objp->rotstatus) {
|
||||||
|
case 0:
|
||||||
|
if (!xdr_position_s (xdrs, &objp->position_res_u.pos))
|
||||||
|
return FALSE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool_t
|
||||||
|
xdr_rotstate_s (XDR *xdrs, rotstate_s *objp)
|
||||||
|
{
|
||||||
|
register int32_t *buf;
|
||||||
|
|
||||||
|
if (!xdr_azimuth_x (xdrs, &objp->az_min))
|
||||||
|
return FALSE;
|
||||||
|
if (!xdr_azimuth_x (xdrs, &objp->az_max))
|
||||||
|
return FALSE;
|
||||||
|
if (!xdr_elevation_x (xdrs, &objp->el_min))
|
||||||
|
return FALSE;
|
||||||
|
if (!xdr_elevation_x (xdrs, &objp->el_max))
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool_t
|
||||||
|
xdr_rotstate_res (XDR *xdrs, rotstate_res *objp)
|
||||||
|
{
|
||||||
|
register int32_t *buf;
|
||||||
|
|
||||||
|
if (!xdr_int (xdrs, &objp->rotstatus))
|
||||||
|
return FALSE;
|
||||||
|
switch (objp->rotstatus) {
|
||||||
|
case 0:
|
||||||
|
if (!xdr_rotstate_s (xdrs, &objp->rotstate_res_u.state))
|
||||||
|
return FALSE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
|
@ -0,0 +1,278 @@
|
||||||
|
/*
|
||||||
|
* rpcrotd - (C) Stephane Fillod 2001
|
||||||
|
*
|
||||||
|
* This program let programs control a rotator through
|
||||||
|
* the mean of RPC services using Hamlib.
|
||||||
|
*
|
||||||
|
* $Id: rpcrotd.c,v 1.1 2002-01-16 16:45:11 fgretief Exp $
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#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>
|
||||||
|
|
||||||
|
|
||||||
|
/* TODO: autoconf should check for getopt support, include libs otherwise */
|
||||||
|
#include <getopt.h>
|
||||||
|
|
||||||
|
#include <hamlib/rotator.h>
|
||||||
|
#include "rpcrot.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: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'},
|
||||||
|
{"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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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] = "";
|
||||||
|
|
||||||
|
/* 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 '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);
|
||||||
|
/* 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 (ROTPROG, ROTVERS);
|
||||||
|
|
||||||
|
transp = svcudp_create(RPC_ANYSOCK); /* Looks like we can spesify a socket number here?? */
|
||||||
|
if (transp == NULL) {
|
||||||
|
fprintf (stderr, "%s", "cannot create udp service.");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (!svc_register(transp, ROTPROG, ROTVERS, rotprog_1, IPPROTO_UDP)) {
|
||||||
|
fprintf (stderr, "%s", "unable to register (ROTPROG, ROTVERS, udp).");
|
||||||
|
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, ROTPROG, ROTVERS, rotprog_1, IPPROTO_TCP)) {
|
||||||
|
fprintf (stderr, "%s", "unable to register (ROTPROG, ROTVERS, tcp).");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
svc_run ();
|
||||||
|
fprintf (stderr, "%s", "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, --rig-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"
|
||||||
|
" -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 */
|
||||||
|
|
Ładowanie…
Reference in New Issue