kopia lustrzana https://github.com/Hamlib/Hamlib
New backend for rotators
git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@865 7ae35d74-ebe9-4afe-98af-79ac388436b8Hamlib-1.1.3
rodzic
e504298aa0
commit
e2766bc309
|
@ -0,0 +1,7 @@
|
|||
|
||||
lib_LTLIBRARIES = libhamlib-easycomm.la
|
||||
libhamlib_easycomm_la_SOURCES = easycomm.c
|
||||
libhamlib_easycomm_la_LDFLAGS = -no-undefined -module -version-info 0:0:0
|
||||
libhamlib_easycomm_la_LIBADD = ../src/libhamlib.la
|
||||
|
||||
noinst_HEADERS = easycomm.h
|
|
@ -0,0 +1,343 @@
|
|||
# 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@
|
||||
|
||||
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@
|
||||
|
||||
lib_LTLIBRARIES = libhamlib-easycomm.la
|
||||
libhamlib_easycomm_la_SOURCES = easycomm.c
|
||||
libhamlib_easycomm_la_LDFLAGS = -no-undefined -module -version-info 0:0:0
|
||||
libhamlib_easycomm_la_LIBADD = ../src/libhamlib.la
|
||||
|
||||
noinst_HEADERS = easycomm.h
|
||||
subdir = easycomm
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = $(top_builddir)/include/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
|
||||
libhamlib_easycomm_la_DEPENDENCIES = ../src/libhamlib.la
|
||||
am_libhamlib_easycomm_la_OBJECTS = easycomm.lo
|
||||
libhamlib_easycomm_la_OBJECTS = $(am_libhamlib_easycomm_la_OBJECTS)
|
||||
|
||||
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)/easycomm.Plo
|
||||
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_easycomm_la_SOURCES)
|
||||
HEADERS = $(noinst_HEADERS)
|
||||
|
||||
DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in
|
||||
SOURCES = $(libhamlib_easycomm_la_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 easycomm/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-easycomm.la: $(libhamlib_easycomm_la_OBJECTS) $(libhamlib_easycomm_la_DEPENDENCIES)
|
||||
$(LINK) -rpath $(libdir) $(libhamlib_easycomm_la_LDFLAGS) $(libhamlib_easycomm_la_OBJECTS) $(libhamlib_easycomm_la_LIBADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT) core *.core
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/easycomm.Plo@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:
|
||||
|
||||
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) $(HEADERS)
|
||||
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir)
|
||||
|
||||
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 \
|
||||
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-exec-am: install-libLTLIBRARIES
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man:
|
||||
|
||||
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
|
||||
|
||||
.PHONY: GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-libLTLIBRARIES clean-libtool 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-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
|
||||
|
||||
# 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,333 @@
|
|||
/*
|
||||
* Hamlib Rotator backend - Easycom
|
||||
* Copyright (c) 2001,2002 by Stephane Fillod
|
||||
* Contributed by Francois Retief <fgretief@sun.ac.za>
|
||||
*
|
||||
* $Id: easycomm.c,v 1.1 2002-01-16 16:35:22 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 "easycomm.h"
|
||||
|
||||
#define USE_CUSTOM_CODE 1
|
||||
|
||||
/* ************************************************************************* */
|
||||
/**
|
||||
* easycomm_transaction
|
||||
*
|
||||
* Assumes rot!=NULL and cmdstr!=NULL
|
||||
*
|
||||
* cmdstr - string to send to rotator
|
||||
* data - buffer for reply string
|
||||
* data_len - (input) Maximum size of buffer
|
||||
* (output) Number of bytes read.
|
||||
*/
|
||||
static int
|
||||
easycomm_transaction (ROT *rot, const char *cmdstr, char *data, size_t data_len)
|
||||
{
|
||||
struct rot_state *rs;
|
||||
int retval;
|
||||
|
||||
rs = &rot->state;
|
||||
retval = write_block(&rs->rotport, cmdstr, strlen(cmdstr));
|
||||
if (retval != RIG_OK) {
|
||||
return retval;
|
||||
}
|
||||
|
||||
if (data == NULL || data_len <= 0)
|
||||
return RIG_OK; /* don't want a reply */
|
||||
|
||||
retval = read_string(&rs->rotport, data, data_len, "\n");
|
||||
if (retval < 0)
|
||||
return retval; /* error */
|
||||
|
||||
/* TODO: Error checking */
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
||||
static int
|
||||
easycomm_rot_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
||||
{
|
||||
unsigned char cmdstr[64], ackstr[64];
|
||||
int retval;
|
||||
rig_debug(RIG_DEBUG_TRACE, __FUNCTION__" called: %f %f\n", az, el);
|
||||
|
||||
sprintf(cmdstr, "AZ%.1f EL%.1f UP000 XXX DN000 XXX\n", az, el);
|
||||
retval = easycomm_transaction(rot, cmdstr, ackstr, sizeof(ackstr));
|
||||
if (retval != RIG_OK) {
|
||||
return retval;
|
||||
}
|
||||
/* TODO: Error processing */
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
easycomm_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
|
||||
{
|
||||
unsigned char cmdstr[16], ackbuf[32];
|
||||
int retval;
|
||||
int t;
|
||||
rig_debug(RIG_DEBUG_TRACE, __FUNCTION__" called\n");
|
||||
|
||||
#ifdef USE_CUSTOM_CODE
|
||||
sprintf(cmdstr, "!"); /* Custom implementation: Remove later */
|
||||
#else
|
||||
sprintf(cmdstr, "AZ EL \n");
|
||||
#endif
|
||||
|
||||
retval = easycomm_transaction(rot, cmdstr, ackbuf, sizeof(ackbuf));
|
||||
if (retval != RIG_OK) {
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* Parse parse string to extract AZ,EL values */
|
||||
#ifdef USE_CUSTOM_CODE
|
||||
retval = sscanf(ackbuf, "TM%i AZ%f EL%f", &t, az, el);
|
||||
if (retval != 3) {
|
||||
rig_debug(RIG_DEBUG_ERR, __FUNCTION__": unknown replay (%s)\n", ackbuf);
|
||||
return -RIG_ERJCTED;
|
||||
}
|
||||
#ifndef USETESTCODE
|
||||
/* Correct for desimal point. */
|
||||
*az /= 10.0;
|
||||
*el /= 10.0;
|
||||
#else
|
||||
/* Debugging code, remove later */
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, " (az, el) = (%.1f, %.1f)\n", *az, *el);
|
||||
|
||||
*az /= 10.0;
|
||||
*el /= 10.0;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, " (az, el) = (%f, %f)\n", *az, *el);
|
||||
rig_debug(RIG_DEBUG_TRACE, " (az, el) = (%.2f, %.2f)\n", *az, *el);
|
||||
|
||||
/* Note: For some reason I found that the result of this expression
|
||||
* does not give accurate results.
|
||||
* The first printf give the correct value.
|
||||
* The second printf give incorrect value, while
|
||||
* the third printf give correct values.
|
||||
*
|
||||
* I get az = 42.79999 when it should be 42.8
|
||||
*/
|
||||
#endif
|
||||
|
||||
#else
|
||||
*az = 45.3;
|
||||
*el = 10.3;
|
||||
#endif
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
easycomm_rot_stop(ROT *rot)
|
||||
{
|
||||
unsigned char ackbuf[32];
|
||||
int retval;
|
||||
rig_debug(RIG_DEBUG_TRACE, __FUNCTION__" called\n");
|
||||
|
||||
retval = easycomm_transaction(rot, "SA SE \n", ackbuf, sizeof(ackbuf));
|
||||
if (retval != RIG_OK)
|
||||
return retval;
|
||||
|
||||
/* TODO: error processing */
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
easycomm_rot_reset(ROT *rot, rot_reset_t rst)
|
||||
{
|
||||
unsigned char ackbuf[32];
|
||||
int retval;
|
||||
rig_debug(RIG_DEBUG_TRACE, __FUNCTION__" called\n");
|
||||
|
||||
retval = easycomm_transaction(rot, "RESET\n", ackbuf, sizeof(ackbuf));
|
||||
if (retval != RIG_OK) /* Custom command (not in Easycomm) */
|
||||
return retval;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
easycomm_rot_park(ROT *rot)
|
||||
{
|
||||
unsigned char ackbuf[32];
|
||||
int retval;
|
||||
rig_debug(RIG_DEBUG_TRACE, __FUNCTION__" called\n");
|
||||
|
||||
retval = easycomm_transaction(rot, "PARK\n", ackbuf, sizeof(ackbuf));
|
||||
if (retval != RIG_OK) /* Custom command (not in Easycomm) */
|
||||
return retval;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
easycomm_rot_move(ROT *rot, int direction, int speed)
|
||||
{
|
||||
char cmdstr[24], ackbuf[32];
|
||||
int retval;
|
||||
rig_debug(RIG_DEBUG_TRACE, __FUNCTION__" called\n");
|
||||
|
||||
/* Note: speed is unused at the moment */
|
||||
switch (direction) {
|
||||
case ROT_MOVE_UP: /* Elevation increase */
|
||||
sprintf(cmdstr, "MU\n");
|
||||
break;
|
||||
case ROT_MOVE_DOWN: /* Elevation decrease */
|
||||
sprintf(cmdstr, "MD\n");
|
||||
break;
|
||||
case ROT_MOVE_LEFT: /* Azimuth decrease */
|
||||
sprintf(cmdstr, "ML\n");
|
||||
break;
|
||||
case ROT_MOVE_RIGHT: /* Azimuth increase */
|
||||
sprintf(cmdstr, "MR\n");
|
||||
break;
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR,__FUNCTION__": Invalid direction value! (%d)\n", direction);
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
retval = easycomm_transaction(rot, cmdstr, ackbuf, sizeof(ackbuf));
|
||||
if (retval != RIG_OK)
|
||||
return retval;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
/*
|
||||
* Easycomm rotator capabilities.
|
||||
*/
|
||||
|
||||
/** EasycommI implement essentially only the set position function, but
|
||||
* I included the stop command too. The radio control tags is only included
|
||||
* as dummy entries because the spec require them.
|
||||
*/
|
||||
const struct rot_caps easycomm1_rot_caps = {
|
||||
rot_model: ROT_MODEL_EASYCOMM1,
|
||||
model_name: "EasycommI",
|
||||
mfg_name: "Hamlib",
|
||||
version: "0.1",
|
||||
copyright: "LGPL",
|
||||
status: RIG_STATUS_ALPHA,
|
||||
rot_type: ROT_TYPE_OTHER,
|
||||
port_type: RIG_PORT_SERIAL,
|
||||
serial_rate_min: 9600,
|
||||
serial_rate_max: 19200,
|
||||
serial_data_bits: 8,
|
||||
serial_stop_bits: 1,
|
||||
serial_parity: RIG_PARITY_NONE,
|
||||
serial_handshake: RIG_HANDSHAKE_NONE,
|
||||
write_delay: 0,
|
||||
post_write_delay: 0,
|
||||
timeout: 200,
|
||||
retry: 3,
|
||||
|
||||
min_az: -180.0,
|
||||
max_az: 180.0,
|
||||
min_el: 0.0,
|
||||
max_el: 90.0,
|
||||
|
||||
priv: NULL, /* priv */
|
||||
|
||||
set_position: easycomm_rot_set_position,
|
||||
stop: easycomm_rot_stop,
|
||||
};
|
||||
|
||||
/* EasycommII implement most of the functions. Again the radio tags
|
||||
* is only dummy values.
|
||||
*/
|
||||
const struct rot_caps easycomm2_rot_caps = {
|
||||
rot_model: ROT_MODEL_EASYCOMM2,
|
||||
model_name: "EasycommII",
|
||||
mfg_name: "Hamlib",
|
||||
version: "0.1",
|
||||
copyright: "LGPL",
|
||||
status: RIG_STATUS_ALPHA,
|
||||
rot_type: ROT_TYPE_OTHER,
|
||||
port_type: RIG_PORT_SERIAL,
|
||||
serial_rate_min: 9600,
|
||||
serial_rate_max: 19200,
|
||||
serial_data_bits: 8,
|
||||
serial_stop_bits: 1,
|
||||
serial_parity: RIG_PARITY_NONE,
|
||||
serial_handshake: RIG_HANDSHAKE_NONE,
|
||||
write_delay: 0,
|
||||
post_write_delay: 0,
|
||||
timeout: 200,
|
||||
retry: 3,
|
||||
|
||||
min_az: -180.0,
|
||||
max_az: 180.0,
|
||||
min_el: 0.0,
|
||||
max_el: 90.0,
|
||||
|
||||
priv: NULL, /* priv */
|
||||
|
||||
rot_init: NULL,
|
||||
rot_cleanup: NULL,
|
||||
rot_open: NULL,
|
||||
rot_close: NULL,
|
||||
|
||||
get_position: easycomm_rot_get_position,
|
||||
set_position: easycomm_rot_set_position,
|
||||
stop: easycomm_rot_stop,
|
||||
park: easycomm_rot_park,
|
||||
reset: easycomm_rot_reset,
|
||||
move: easycomm_rot_move,
|
||||
|
||||
get_info: NULL,
|
||||
};
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
||||
int initrots_easycomm(void *be_handle)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, __FUNCTION__" called\n");
|
||||
|
||||
rot_register(&easycomm1_rot_caps);
|
||||
rot_register(&easycomm2_rot_caps);
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
/* end of file */
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Hamlib Rotator backend - Easycomm interface protocol
|
||||
* Copyright (c) 2001,2002 by Stephane Fillod
|
||||
* Contributed by Francois Retief <fgretief@sun.ac.za>
|
||||
*
|
||||
* $Id: easycomm.h,v 1.1 2002-01-16 16:35:22 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _ROT_EASYCOMM_H
|
||||
#define _ROT_EASYCOMM_H 1
|
||||
|
||||
extern const struct rot_caps easycomm1_rot_caps;
|
||||
extern const struct rot_caps easycomm2_rot_caps;
|
||||
|
||||
extern BACKEND_EXPORT(int) initrots_easycomm(void *be_handle);
|
||||
|
||||
#endif /* _ROT_EASYCOMM_H */
|
|
@ -0,0 +1,85 @@
|
|||
The following are the specifications for the EasyComm interfaces which
|
||||
are available with the WiSP programs. Both EasyComm 1 and EasyComm2 are
|
||||
available in WiSP32. Only EasyComm1 is available with WiSP31. The EasyComm
|
||||
interfaces are for use by those who wish to design their own radio and rotor
|
||||
controllers.
|
||||
|
||||
EASYCOMM I Standard
|
||||
-------------------
|
||||
|
||||
The EasyComm 1 standard is a simple ASCII character based standard for
|
||||
controling antennas and rotators.
|
||||
|
||||
The host PC issues a single line command as follows -:
|
||||
|
||||
AZaaa.a ELeee.e UPuuuuuuuuu UUU DNddddddddd DDD
|
||||
|
||||
The Az and El values (aaa.a and eee.e) are not fixed width. They are in
|
||||
degrees and include 1 decimal place.
|
||||
|
||||
The Up and Dn frequencies are in Hz.
|
||||
|
||||
UUU and DDD are the uplink and downlink mode.
|
||||
|
||||
EASYCOMM II Standard
|
||||
--------------------
|
||||
|
||||
The EasyComm 2 standard is an enhanced protocol to allow full station
|
||||
control and also feedback from external systems.
|
||||
|
||||
The host PC issues commands to the controller by sending a 2 character
|
||||
command identifier followed by the command value. Commands are
|
||||
separated by either a space or carriage return or linefeed.
|
||||
Not all commands need to be implemented, and the most basic system
|
||||
may only decode the rotator control commands.
|
||||
|
||||
The Host PC can issue the following commands -:
|
||||
|
||||
Command Meaning Perameters
|
||||
------- ------- ----------
|
||||
|
||||
AZ Azimuth number - 1 decimal place
|
||||
EL Elevation number - 1 decimal place
|
||||
UP Uplink freq in Hertz
|
||||
DN Downlink freq in Hertz
|
||||
DM Downlink Mode ascii, eg SSB, FM
|
||||
UM Uplink Mode ascii, eg SSB, FM
|
||||
DR Downlink Radio number
|
||||
UR Uplink Radio number
|
||||
ML Move Left
|
||||
MR Move Right
|
||||
MU Move Up
|
||||
MD Move Down
|
||||
SA Stop azimuth moving
|
||||
SE Stop elevation moving
|
||||
AO AOS
|
||||
LO LOS
|
||||
OP Set output number
|
||||
IP Read an input number
|
||||
AN Read analogue input number
|
||||
ST Set time YY:MM:DD:HH:MM:SS
|
||||
VE Request Version
|
||||
|
||||
For those commands that require a response, the response is an echo of
|
||||
the command followed by the response. If the command specifies a field
|
||||
number (eq. AN or IP), then the two numbers are delimited with a comma.
|
||||
eg. To read an analogue value, the host sends ANx where x is the
|
||||
analogue channel number.
|
||||
|
||||
In response the controller will reply with ANx,yyy where yyy is the
|
||||
value read on the analogue port.
|
||||
eg. To find the controller version number, the host sends VE.
|
||||
In response the controller sends VExxx where xxx is an ascii string
|
||||
containing the version number.
|
||||
|
||||
All strings sent in either direction are not of fixed length.
|
||||
The controller can also send unsolicited information back to the
|
||||
host. This information may be used by the host for alarms or just
|
||||
control feedback. All of the above commands may be sent by the
|
||||
controller for information, and in addition the following may also
|
||||
be sent
|
||||
|
||||
ALxxx Alarm, where xxxx is an ascii string with the alarm info.
|
||||
|
||||
Chris Jackson, G7UPN
|
||||
|
Ładowanie…
Reference in New Issue