kopia lustrzana https://github.com/Hamlib/Hamlib
Build system fixes for the Perl/Python/TCL bindings
Various fixes for building the bindings properly. Install TCL binding to $(libdir)/tcl/Hamlib, arbitrarily chosen since there seems to be no standard installation location. When install location is changed, tcltest.tcl documents the needed change to a TCL script. In the Perl and Python test scripts, improved the QRA examples. In all scripts used tabs to line up printed values nicely. Updated INSTALL and NEWS for recent updates. Better documented bindings installation and uninstallation in INSTALL.Hamlib-3.0
rodzic
871d8a44a2
commit
44d99a61cd
18
INSTALL
18
INSTALL
|
@ -254,9 +254,9 @@ are:
|
|||
--without-cxx-binding do not build C++ binding and demo [default=yes]
|
||||
--with-perl-binding build perl binding and demo [default=no]
|
||||
--with-perl-inc directory containing perl includes
|
||||
--with-python-binding build python binding and demo [default=no]
|
||||
--with-tcl-binding build Tcl binding and demo [default=no]
|
||||
--with-tcl=PATH directory containing tcl configuration (tclConfig.sh)
|
||||
--with-python-binding build python binding and demo [default=no]
|
||||
|
||||
Optional features that may require specialized hardware are:
|
||||
|
||||
|
@ -278,3 +278,19 @@ has no effect on rigctld/rotctld). You may get a make error (which means it
|
|||
will quit before compilation is complete) if the
|
||||
--with-[perl|python|tcl]-binding option(s) are given and the Swig package is
|
||||
not installed.
|
||||
|
||||
Perl and Python bindings should be installed into a 'configure' runtime
|
||||
discovered location under the default prefix.
|
||||
|
||||
The TCL binding will be installed into $(libdir)/tcl/Hamlib (default). If a
|
||||
non-default --prefix is passed to 'configure', the 'lappend' line in tcltest.tcl
|
||||
script will need to be modified accordingly so the script can load the Hamlib
|
||||
package. As TCL doesn't seem to have a "standard" location for additional
|
||||
packages and since there seemed to be no common location among distributions,
|
||||
this path was chosen abitrarily. Any patches to improve installation path
|
||||
discovery of local packages are welcome.
|
||||
|
||||
When running 'make uninstall' the installed files for the Python and TCL
|
||||
modules are removed. The Perl files will remain due to a design decision
|
||||
of the Perl MakeMaker module. Installed Perl binding files will need to be
|
||||
removed manually.
|
||||
|
|
7
NEWS
7
NEWS
|
@ -17,6 +17,13 @@ Version 3.0
|
|||
symlinked and put in the build-aux directory, building
|
||||
rigmem and rigmatrix are now user selectable at configure
|
||||
run time, building static libraries are disabled by default.
|
||||
Fixed TCL binding installation, fixed Perl binding build so it
|
||||
is not invoked by 'make dist' and clean up build files. Cleaned
|
||||
up bindings builds to occur in alphabetical order. Use new
|
||||
ax_pkg_swig macro and update ax_python_devel macro.
|
||||
* IC-PCR1500/2500 default write_delay to 0, IC-746/756, IC-PCR8500
|
||||
fixes, pcr.c, pcr1500.c: Add DSP support. TNX Paul, KE7ZZ
|
||||
* WinRadio G313 updates. TNX Julian Campbel
|
||||
|
||||
Version 1.2.15.3
|
||||
2012-11-01
|
||||
|
|
|
@ -27,9 +27,7 @@ if ENABLE_PERL
|
|||
# Perl binding
|
||||
|
||||
BUILT_SOURCES += hamlibperl_wrap.c
|
||||
MOSTLYCLEANFILES += hamlibperl_wrap.c Hamlib.pm Hamlib.bs
|
||||
## DISTCLEANFILES = Hamlib-pl.mk Hamlib-pl.mk.old
|
||||
DISTCLEANFILES = Hamlib-pl.mk.old
|
||||
MOSTLYCLEANFILES += hamlibperl_wrap.c Hamlib.pm Hamlib.bs Hamlib-pl.mk.old
|
||||
|
||||
hamlibperl_wrap.c: hamlib.swg $(SWIGDEP)
|
||||
$(SWIG) -perl5 -shadow @AM_CPPFLAGS@ -I$(top_srcdir)/bindings -o $@ \
|
||||
|
@ -57,6 +55,7 @@ check-perl: all-perl
|
|||
clean-perl: Hamlib-pl.mk
|
||||
$(MAKE) $(AM_MAKEFLAGS) -f Hamlib-pl.mk clean
|
||||
|
||||
## 'distclean' target is a NOOP in Hamlib-pl.mk
|
||||
distclean-perl: ## Hamlib-pl.mk
|
||||
## $(MAKE) $(AM_MAKEFLAGS) -f Hamlib-pl.mk distclean
|
||||
|
||||
|
@ -75,53 +74,10 @@ endif
|
|||
# Perl
|
||||
|
||||
|
||||
if ENABLE_TCL
|
||||
##########################################
|
||||
# Tcl binding
|
||||
|
||||
BUILT_SOURCES+= hamlibtcl_wrap.c
|
||||
MOSTLYCLEANFILES+= hamlibtcl_wrap.c pkgIndex.tcl
|
||||
|
||||
tcl_ltlib = hamlibtcl.la
|
||||
|
||||
tcldir = $(prefix)/lib/tcl
|
||||
|
||||
PKG_VER=1.0
|
||||
DLL=hamlibtcl-$(PKG_VER)@TCL_SHLIB_SUFFIX@
|
||||
|
||||
nodist_hamlibtcl_la_SOURCES = hamlibtcl_wrap.c
|
||||
hamlibtcl_la_LDFLAGS = -no-undefined -module -release $(PKG_VER) -avoid-version @TCL_LIB_SPEC@
|
||||
hamlibtcl_la_LIBADD = $(top_builddir)/src/libhamlib.la
|
||||
|
||||
hamlibtcl_ladir = $(tcldir)
|
||||
hamlibtcl_la_DATA = pkgIndex.tcl
|
||||
|
||||
pkgIndex.tcl: Makefile
|
||||
echo 'package ifneeded Hamlib $(PKG_VER) [list load [file join $$dir $(DLL)] Hamlib]' > pkgIndex.tcl
|
||||
|
||||
hamlibtcl_wrap.c: hamlib.swg $(SWGDEP)
|
||||
$(SWIG) -tcl -pkgversion $(PKG_VER) @AM_CPPFLAGS@ -I$(top_srcdir)/bindings -o $@ \
|
||||
`test -f hamlib.swg || echo '$(srcdir)/'`hamlib.swg
|
||||
|
||||
all-tcl: pkgIndex.tcl $(tcl_ltlib)
|
||||
|
||||
check-tcl: all-tcl
|
||||
TCLLIBPATH=$(builddir)/.libs $(srcdir)/tcltest.tcl || echo "Tcl test failed" 1>&2
|
||||
|
||||
install-tcl:
|
||||
clean-tcl:
|
||||
distclean-tcl: clean-tcl
|
||||
uninstall-tcl:
|
||||
|
||||
endif
|
||||
# TCL
|
||||
|
||||
|
||||
if ENABLE_PYTHON
|
||||
##########################################
|
||||
# Python binding
|
||||
|
||||
if ENABLE_PYTHON
|
||||
|
||||
python_ltlib = _Hamlib.la
|
||||
|
||||
#pythondir = @pythondir@
|
||||
|
@ -157,9 +113,52 @@ endif
|
|||
# Python
|
||||
|
||||
|
||||
if ENABLE_TCL
|
||||
##########################################
|
||||
lib_LTLIBRARIES = $(tcl_ltlib)
|
||||
# lib_LTLIBRARIES = @BINDING_LIB_TARGETS@
|
||||
# Tcl binding
|
||||
|
||||
BUILT_SOURCES+= hamlibtcl_wrap.c
|
||||
MOSTLYCLEANFILES+= hamlibtcl_wrap.c pkgIndex.tcl
|
||||
|
||||
tcl_ltlib = hamlibtcl.la
|
||||
|
||||
tcldir = $(libdir)/tcl/Hamlib
|
||||
|
||||
PKG_VER=@ABI_VERSION@.@ABI_REVISION@
|
||||
DLL=hamlibtcl-$(PKG_VER)@TCL_SHLIB_SUFFIX@
|
||||
|
||||
nodist_hamlibtcl_la_SOURCES = hamlibtcl_wrap.c
|
||||
hamlibtcl_la_LDFLAGS = -no-undefined -module -release $(PKG_VER) -avoid-version @TCL_LIB_SPEC@
|
||||
hamlibtcl_la_LIBADD = $(top_builddir)/src/libhamlib.la
|
||||
|
||||
hamlibtcl_ladir = $(tcldir)
|
||||
hamlibtcl_la_DATA = pkgIndex.tcl
|
||||
|
||||
# Install hamlibtcl.la into the tcltk/Hamlib directory set by $hamlibtcl_ladir
|
||||
hamlibtcl_la_LTLIBRARIES = $(tcl_ltlib)
|
||||
|
||||
# Having the first occurance of 'hamlib' capitalized seemed to cause confusion
|
||||
# for the TCL interpreter loading the Hamlib module.
|
||||
pkgIndex.tcl: Makefile
|
||||
echo 'package ifneeded hamlib $(PKG_VER) [list load [file join $$dir $(DLL)] Hamlib]' > pkgIndex.tcl
|
||||
|
||||
hamlibtcl_wrap.c: hamlib.swg $(SWGDEP)
|
||||
$(SWIG) -tcl -pkgversion $(PKG_VER) @AM_CPPFLAGS@ -I$(top_srcdir)/bindings -o $@ \
|
||||
`test -f hamlib.swg || echo '$(srcdir)/'`hamlib.swg
|
||||
|
||||
all-tcl: pkgIndex.tcl $(tcl_ltlib)
|
||||
|
||||
check-tcl: all-tcl
|
||||
TCLLIBPATH=$(builddir)/.libs $(srcdir)/tcltest.tcl || echo "Tcl test failed" 1>&2
|
||||
|
||||
install-tcl:
|
||||
clean-tcl:
|
||||
distclean-tcl: clean-tcl
|
||||
uninstall-tcl:
|
||||
|
||||
endif
|
||||
# TCL
|
||||
|
||||
|
||||
all-local: @BINDING_ALL@
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use Hamlib;
|
||||
|
||||
print "Perl $] test, version: $Hamlib::hamlib_version\n";
|
||||
print "Perl $] test, version: $Hamlib::hamlib_version\n\n";
|
||||
|
||||
#Hamlib::rig_set_debug($Hamlib::RIG_DEBUG_TRACE);
|
||||
Hamlib::rig_set_debug($Hamlib::RIG_DEBUG_NONE);
|
||||
|
@ -20,66 +20,76 @@ $rig->open();
|
|||
$region = $rig->get_conf(1073741944);
|
||||
$rpath = $rig->get_conf("rig_pathname");
|
||||
$retry = $rig->get_conf("retry");
|
||||
print "get_conf: path=\"$rpath\", retry=$retry, ITU region=$region\n";
|
||||
print "get_conf:\t\tpath = \"$rpath\", retry = $retry, ITU region = $region\n";
|
||||
|
||||
|
||||
$rig->set_freq(14266000, $Hamlib::RIG_VFO_A);
|
||||
|
||||
$f = $rig->get_freq();
|
||||
print "freq: $f\n";
|
||||
print "freq:\t\t\t$f\n";
|
||||
|
||||
($mode, $width) = $rig->get_mode();
|
||||
print "get_mode: ".Hamlib::rig_strrmode($mode).", width: $width\n";
|
||||
print "get_mode:\t\t".Hamlib::rig_strrmode($mode)."\nwidth:\t\t\t$width\n";
|
||||
|
||||
$vfo = $rig->get_vfo();
|
||||
print "get_vfo: ".Hamlib::rig_strvfo($vfo)."\n";
|
||||
print "get_vfo:\t\t".Hamlib::rig_strvfo($vfo)."\n";
|
||||
$rig->set_vfo($Hamlib::RIG_VFO_B);
|
||||
#$rig->set_vfo("VFOA");
|
||||
|
||||
$rig->set_mode($Hamlib::RIG_MODE_CW, $Hamlib::RIG_PASSBAND_NORMAL);
|
||||
|
||||
print "ITU region: $rig->{state}->{itu_region}\n";
|
||||
print "Backend copyright: $rig->{caps}->{copyright}\n";
|
||||
print "ITU region:\t\t$rig->{state}->{itu_region}\n";
|
||||
print "Backend copyright:\t$rig->{caps}->{copyright}\n";
|
||||
$inf = $rig->get_info();
|
||||
|
||||
print "get_info: $inf\n";
|
||||
print "get_info:\t\t$inf\n";
|
||||
|
||||
$rig->set_level("VOX", 1);
|
||||
$lvl = $rig->get_level_i("VOX");
|
||||
print "VOX level: $lvl\n";
|
||||
print "VOX level:\t\t$lvl\n";
|
||||
$rig->set_level($Hamlib::RIG_LEVEL_VOX, 5);
|
||||
$lvl = $rig->get_level_i($Hamlib::RIG_LEVEL_VOX);
|
||||
print "VOX level: $lvl\n";
|
||||
print "VOX level:\t\t$lvl\n";
|
||||
|
||||
$lvl = $rig->get_level_i($Hamlib::RIG_LEVEL_STRENGTH);
|
||||
print "strength: $lvl\n";
|
||||
print "strength:\t\t$lvl\n";
|
||||
|
||||
|
||||
$chan = new Hamlib::channel($Hamlib::RIG_VFO_A);
|
||||
|
||||
$rig->get_channel($chan);
|
||||
print "get_channel status: $rig->{error_status} = ".Hamlib::rigerror($rig->{error_status})."\n";
|
||||
print "get_channel status:\t$rig->{error_status} = ".Hamlib::rigerror($rig->{error_status})."\n";
|
||||
|
||||
print "VFO: ".Hamlib::rig_strvfo($chan->{vfo}).", $chan->{freq}\n";
|
||||
print "VFO:\t\t\t".Hamlib::rig_strvfo($chan->{vfo}).", $chan->{freq}\n";
|
||||
|
||||
$rig->close();
|
||||
|
||||
|
||||
print "\nSome static functions:\n";
|
||||
|
||||
($err, $long1, $lat1, $sw1) = Hamlib::locator2longlat("IN98EC");
|
||||
($err, $long2, $lat2, $sw1) = Hamlib::locator2longlat("DM33DX");
|
||||
$loc1 = Hamlib::longlat2locator($long1, $lat1, 3);
|
||||
$loc2 = Hamlib::longlat2locator($long2, $lat2, 3);
|
||||
print "Loc1: $loc1\n";
|
||||
print "Loc2: $loc2\n";
|
||||
($err, $lon1, $lat1, $sw1) = Hamlib::locator2longlat("IN98XC");
|
||||
($err, $lon2, $lat2, $sw1) = Hamlib::locator2longlat("DM33DX");
|
||||
$loc1 = Hamlib::longlat2locator($lon1, $lat1, 3);
|
||||
$loc2 = Hamlib::longlat2locator($lon2, $lat2, 3);
|
||||
printf("Loc1:\t\tIN98XC -> %9.4f, %9.4f-> %s\n", $lon1, $lat1, $loc1);
|
||||
printf("Loc1:\t\tDM33DX -> %9.4f, %9.4f-> %s\n", $lon2, $lat2, $loc2);
|
||||
|
||||
($err, $dist, $az) = Hamlib::qrb($long1, $lat1, $long2, $lat2);
|
||||
($err, $dist, $az) = Hamlib::qrb($lon1, $lat1, $lon2, $lat2);
|
||||
$longpath = Hamlib::distance_long_path($dist);
|
||||
print "Distance: $dist km, azimuth $az, long path: $longpath\n";
|
||||
($err, $deg, $min, $sec, $sw) = Hamlib::dec2dms($az);
|
||||
$deg = -$deg if ($sw == 1);
|
||||
$az2 = Hamlib::dms2dec($deg, $min, $sec, $sw);
|
||||
print "Bearing: $az, $deg° $min' $sec\", recoded: $az2\n"
|
||||
|
||||
printf("Distance:\t%.3f km, azimuth %.2f, long path: %.3f km\n",
|
||||
$dist, $az, $longpath);
|
||||
|
||||
# dec2dms expects values from 180 to -180
|
||||
# sw is 1 when deg is negative (west or south) as 0 cannot be signed
|
||||
($err, $deg1, $min1, $sec1, $sw1) = Hamlib::dec2dms($lon1);
|
||||
($err, $deg2, $min2, $sec2, $sw2) = Hamlib::dec2dms($lat1);
|
||||
|
||||
$lon3 = Hamlib::dms2dec($deg1, $min1, $sec1, $sw1);
|
||||
$lat3 = Hamlib::dms2dec($deg2, $min2, $sec2, $sw2);
|
||||
|
||||
printf("Longitude:\t%9.4f, %4d° %2d' %2d\" %1s\trecoded: %9.4f\n",
|
||||
$lon1, $deg1, $min1, $sec1, $sw1 ? 'W' : 'E', $lon3);
|
||||
|
||||
printf("Latitude:\t%9.4f, %4d° %2d' %2d\" %1s\trecoded: %9.4f\n",
|
||||
$lat1, $deg2, $min2, $sec2, $sw2 ? 'S' : 'N', $lat3);
|
||||
|
|
|
@ -5,12 +5,11 @@ import sys
|
|||
|
||||
sys.path.append ('.')
|
||||
sys.path.append ('.libs')
|
||||
sys.path.append ('/usr/local/hamlib/python')
|
||||
|
||||
import Hamlib
|
||||
|
||||
def StartUp ():
|
||||
print "Python",sys.version[:5],"test,", Hamlib.cvar.hamlib_version
|
||||
print "Python", sys.version[:5], "test,", Hamlib.cvar.hamlib_version, "\n"
|
||||
|
||||
#Hamlib.rig_set_debug (Hamlib.RIG_DEBUG_TRACE)
|
||||
Hamlib.rig_set_debug (Hamlib.RIG_DEBUG_NONE)
|
||||
|
@ -27,68 +26,75 @@ def StartUp ():
|
|||
region = my_rig.get_conf(1073741944)
|
||||
rpath = my_rig.get_conf("rig_pathname")
|
||||
retry = my_rig.get_conf("retry")
|
||||
print "status(str):",Hamlib.rigerror(my_rig.error_status)
|
||||
print "get_conf: path=",rpath,", retry =",retry,", ITU region=",region
|
||||
print "status(str):\t\t",Hamlib.rigerror(my_rig.error_status)
|
||||
print "get_conf:\t\tpath = %s, retry = %s, ITU region = %s" \
|
||||
% (rpath, retry, region)
|
||||
|
||||
my_rig.set_freq (5700000000,Hamlib.RIG_VFO_B)
|
||||
print "freq:",my_rig.get_freq()
|
||||
print "freq:\t\t\t",my_rig.get_freq()
|
||||
my_rig.set_freq (145550000)
|
||||
my_rig.set_vfo (Hamlib.RIG_VFO_B)
|
||||
#my_rig.set_vfo ("VFOA")
|
||||
|
||||
(mode, width) = my_rig.get_mode()
|
||||
print "mode:",Hamlib.rig_strrmode(mode),", bandwidth:",width
|
||||
print "mode:\t\t\t",Hamlib.rig_strrmode(mode),"\nbandwidth:\t\t",width
|
||||
my_rig.set_mode(Hamlib.RIG_MODE_CW)
|
||||
(mode, width) = my_rig.get_mode()
|
||||
print "mode:",Hamlib.rig_strrmode(mode),", bandwidth:",width
|
||||
print "mode:\t\t\t",Hamlib.rig_strrmode(mode),"\nbandwidth:\t\t",width
|
||||
|
||||
print "ITU_region: ",my_rig.state.itu_region
|
||||
print "Backend copyright: ",my_rig.caps.copyright
|
||||
print "ITU_region:\t\t",my_rig.state.itu_region
|
||||
print "Backend copyright:\t",my_rig.caps.copyright
|
||||
|
||||
print "Model:",my_rig.caps.model_name
|
||||
print "Manufacturer:",my_rig.caps.mfg_name
|
||||
print "Backend version:",my_rig.caps.version
|
||||
print "Backend license:",my_rig.caps.copyright
|
||||
print "Rig info:", my_rig.get_info()
|
||||
print "Model:\t\t\t",my_rig.caps.model_name
|
||||
print "Manufacturer:\t\t",my_rig.caps.mfg_name
|
||||
print "Backend version:\t",my_rig.caps.version
|
||||
print "Backend license:\t",my_rig.caps.copyright
|
||||
print "Rig info:\t\t", my_rig.get_info()
|
||||
|
||||
my_rig.set_level ("VOX", 1)
|
||||
print "VOX level: ",my_rig.get_level_i("VOX")
|
||||
print "VOX level:\t\t",my_rig.get_level_i("VOX")
|
||||
my_rig.set_level (Hamlib.RIG_LEVEL_VOX, 5)
|
||||
print "VOX level: ", my_rig.get_level_i(Hamlib.RIG_LEVEL_VOX)
|
||||
print "VOX level:\t\t", my_rig.get_level_i(Hamlib.RIG_LEVEL_VOX)
|
||||
|
||||
print "strength: ", my_rig.get_level_i(Hamlib.RIG_LEVEL_STRENGTH)
|
||||
print "status: ",my_rig.error_status
|
||||
print "status(str):",Hamlib.rigerror(my_rig.error_status)
|
||||
print "strength:\t\t", my_rig.get_level_i(Hamlib.RIG_LEVEL_STRENGTH)
|
||||
print "status:\t\t\t",my_rig.error_status
|
||||
print "status(str):\t\t",Hamlib.rigerror(my_rig.error_status)
|
||||
|
||||
chan = Hamlib.channel(Hamlib.RIG_VFO_B)
|
||||
|
||||
my_rig.get_channel(chan)
|
||||
print "get_channel status: ",my_rig.error_status
|
||||
print "get_channel status:\t",my_rig.error_status
|
||||
|
||||
print "VFO: ",Hamlib.rig_strvfo(chan.vfo),", ",chan.freq
|
||||
print "VFO:\t\t\t",Hamlib.rig_strvfo(chan.vfo),", ",chan.freq
|
||||
my_rig.close ()
|
||||
|
||||
print "\nSome static functions:"
|
||||
|
||||
err, long1, lat1 = Hamlib.locator2longlat("IN98EC")
|
||||
err, long2, lat2 = Hamlib.locator2longlat("DM33DX")
|
||||
err, loc1 = Hamlib.longlat2locator(long1, lat1, 3)
|
||||
err, loc2 = Hamlib.longlat2locator(long2, lat2, 3)
|
||||
print "Loc1: IN98EC -> ",loc1
|
||||
print "Loc2: DM33DX -> ",loc2
|
||||
err, lon1, lat1 = Hamlib.locator2longlat("IN98XC")
|
||||
err, lon2, lat2 = Hamlib.locator2longlat("DM33DX")
|
||||
err, loc1 = Hamlib.longlat2locator(lon1, lat1, 3)
|
||||
err, loc2 = Hamlib.longlat2locator(lon2, lat2, 3)
|
||||
print "Loc1:\t\tIN98XC -> %9.4f, %9.4f -> %s" % (lon1, lat1, loc1)
|
||||
print "Loc2:\t\tDM33DX -> %9.4f, %9.4f -> %s" % (lon2, lat2, loc2)
|
||||
|
||||
# TODO: qrb should normalize?
|
||||
err, dist, az = Hamlib.qrb(long1, lat1, long2, lat2)
|
||||
if az > 180:
|
||||
az -= 360
|
||||
err, dist, az = Hamlib.qrb(lon1, lat1, lon2, lat2)
|
||||
longpath = Hamlib.distance_long_path(dist)
|
||||
print "Distance: ",dist," km, long path: ",longpath
|
||||
err, deg, min, sec, sw = Hamlib.dec2dms(az)
|
||||
az2 = Hamlib.dms2dec(deg, min, sec, sw)
|
||||
if sw:
|
||||
deg = -deg
|
||||
print "Bearing: ",az,", ",deg,"° ",min,"' ",sec,", recoded: ",az2
|
||||
print "Distance:\t%.3f km, azimuth %.2f, long path:\t%.3f km" \
|
||||
% (dist, az, longpath)
|
||||
|
||||
# dec2dms expects values from 180 to -180
|
||||
# sw is 1 when deg is negative (west or south) as 0 cannot be signed
|
||||
err, deg1, mins1, sec1, sw1 = Hamlib.dec2dms(lon1)
|
||||
err, deg2, mins2, sec2, sw2 = Hamlib.dec2dms(lat1)
|
||||
|
||||
lon3 = Hamlib.dms2dec(deg1, mins1, sec1, sw1)
|
||||
lat3 = Hamlib.dms2dec(deg2, mins2, sec2, sw2)
|
||||
|
||||
print 'Longitude:\t%4.4f, %4d° %2d\' %2d" %1s\trecoded: %9.4f' \
|
||||
% (lon1, deg1, mins1, sec1, ('W' if sw1 else 'E'), lon3)
|
||||
|
||||
print 'Latitude:\t%4.4f, %4d° %2d\' %2d" %1s\trecoded: %9.4f' \
|
||||
% (lat1, deg2, mins2, sec2, ('S' if sw2 else 'N'), lat3)
|
||||
|
||||
if __name__ == '__main__':
|
||||
StartUp ()
|
||||
|
|
|
@ -2,8 +2,14 @@
|
|||
# the next line restarts using tclsh \
|
||||
exec tclsh "$0" "$@"
|
||||
|
||||
load ".libs/hamlibtcl.so" Hamlib
|
||||
#package require Hamlib
|
||||
# Edit the path below to reflect installed Hamlib extension
|
||||
lappend ::auto_path /usr/local/lib/tcl/Hamlib
|
||||
|
||||
## Brute force loading
|
||||
#load "/usr/local/lib/tcltk/Hamlib/hamlibtcl.so" Hamlib
|
||||
|
||||
## Preferred package loading
|
||||
package require hamlib
|
||||
|
||||
set tclver [info tclversion]
|
||||
puts "Tcl $tclver test, $hamlib_version\n"
|
||||
|
@ -17,33 +23,33 @@ Rig my_rig $RIG_MODEL_DUMMY
|
|||
my_rig open
|
||||
my_rig set_freq 145550000
|
||||
|
||||
puts status:[my_rig cget -error_status]
|
||||
puts "status:\t\t[my_rig cget -error_status]"
|
||||
|
||||
# get_mode returns a tuple
|
||||
set moderes [my_rig get_mode]
|
||||
set mode [rig_strrmode [lindex $moderes 0]]
|
||||
puts "mode: $mode, bandwidth:[lindex $moderes 1]Hz"
|
||||
puts "mode:\t\t$mode\nbandwidth:\t[lindex $moderes 1]Hz"
|
||||
|
||||
set state [my_rig cget -state]
|
||||
puts ITU_region:[$state cget -itu_region]
|
||||
puts "ITU_region:\t[$state cget -itu_region]"
|
||||
|
||||
# The following works well also
|
||||
# puts ITU_region:[[my_rig cget -state] cget -itu_region]
|
||||
|
||||
puts getinfo:[my_rig get_info]
|
||||
puts "getinfo:\t[my_rig get_info]"
|
||||
|
||||
my_rig set_level "VOX" 1
|
||||
puts status:[my_rig cget -error_status]
|
||||
puts "VOX level:[my_rig get_level_i "VOX"]"
|
||||
puts status:[my_rig cget -error_status]
|
||||
puts "status:\t\t[my_rig cget -error_status]"
|
||||
puts "VOX level:\t[my_rig get_level_i 'VOX']"
|
||||
puts "status:\t\t[my_rig cget -error_status]"
|
||||
my_rig set_level $RIG_LEVEL_VOX 5
|
||||
puts status:[my_rig cget -error_status]
|
||||
puts "VOX level:[my_rig get_level_i $RIG_LEVEL_VOX]"
|
||||
puts status:[my_rig cget -error_status]
|
||||
puts "status:\t\t[my_rig cget -error_status]"
|
||||
puts "VOX level:\t[my_rig get_level_i $RIG_LEVEL_VOX]"
|
||||
puts "status:\t\t[my_rig cget -error_status]"
|
||||
|
||||
puts strength:[my_rig get_level_i $RIG_LEVEL_STRENGTH]
|
||||
puts status:[my_rig cget -error_status]
|
||||
puts status(str):[rigerror [my_rig cget -error_status]]
|
||||
puts "strength:\t[my_rig get_level_i $RIG_LEVEL_STRENGTH]"
|
||||
puts "status:\t\t[my_rig cget -error_status]"
|
||||
puts "status(str):\t[rigerror [my_rig cget -error_status]]"
|
||||
|
||||
my_rig close
|
||||
#my_rig cleanup
|
||||
|
|
101
configure.ac
101
configure.ac
|
@ -421,35 +421,62 @@ AS_IF([test x"${cf_with_perl_binding}" = "xyes"],[
|
|||
AM_CONDITIONAL([ENABLE_PERL], [test x"${cf_with_perl_binding}" = "xyes"])
|
||||
|
||||
|
||||
dnl Check for python availability, so we can enable HamlibPy
|
||||
# Python bindings
|
||||
AC_MSG_CHECKING([whether to build python binding and demo])
|
||||
AC_ARG_WITH([python-binding],
|
||||
[AS_HELP_STRING([--with-python-binding],
|
||||
[build python binding and demo @<:@default=no@:>@])],
|
||||
[cf_with_python_binding=$withval],
|
||||
[cf_with_python_binding=no])
|
||||
AC_MSG_RESULT([$cf_with_python_binding])
|
||||
|
||||
dnl AX_PYTHON_DEVEL from macros/ax_python_devel.m4
|
||||
AS_IF([test x"${cf_with_python_binding}" = "xyes"],[
|
||||
AM_PATH_PYTHON([2.1],, [:])
|
||||
AX_PYTHON_DEVEL
|
||||
|
||||
BINDING_LIST="${BINDING_LIST} python"
|
||||
BINDING_ALL="${BINDING_ALL} all-py"
|
||||
BINDING_CHECK="${BINDING_CHECK} check-py"
|
||||
BINDING_CLEAN="${BINDING_CLEAN} clean-py"
|
||||
BINDING_DISTCLEAN="${BINDING_DISTCLEAN} distclean-py"
|
||||
BINDING_INSTALL_EXEC="${BINDING_INSTALL_EXEC} install-py"
|
||||
BINDING_UNINSTALL="${BINDING_UNINSTALL} uninstall-py"
|
||||
BINDING_LIB_TARGETS="${BINDING_LIB_TARGETS} \$(python_ltlib)"])
|
||||
|
||||
AM_CONDITIONAL([ENABLE_PYTHON], [test x"${cf_with_python_binding}" = "xyes"])
|
||||
|
||||
|
||||
# Tcl binding
|
||||
AC_MSG_CHECKING([Whether to build Tcl bindings and demos])
|
||||
AC_ARG_WITH([tcl-binding],
|
||||
[AS_HELP_STRING([--with-tcl-binding],
|
||||
[build Tcl binding and demo @<:@default=no@:>@])],
|
||||
[build_tcl=$withval],
|
||||
[build_tcl=no])
|
||||
[AS_HELP_STRING([--with-tcl-binding],
|
||||
[build Tcl binding and demo @<:@default=no@:>@])],
|
||||
[build_tcl=$withval],
|
||||
[build_tcl=no])
|
||||
AC_MSG_RESULT([$build_tcl])
|
||||
|
||||
dnl SC_PATH_TCLCONFIG and SC_LOAD_TCLCONFIG from macros/tcl.m4
|
||||
AS_IF([test x"${build_tcl}" = "xyes"],[
|
||||
SC_PATH_TCLCONFIG
|
||||
SC_LOAD_TCLCONFIG
|
||||
SC_PATH_TCLCONFIG
|
||||
SC_LOAD_TCLCONFIG
|
||||
|
||||
tcl_save_CPPFLAGS=$CPPFLAGS
|
||||
CPPFLAGS="$CPPFLAGS $TCL_INCLUDE_SPEC"
|
||||
AC_CHECK_HEADERS([tcl.h],
|
||||
[],
|
||||
[AC_MSG_ERROR([Unable to find Tcl headers])])
|
||||
CPPFLAGS=$tcl_save_CPPFLAGS
|
||||
tcl_save_CPPFLAGS=$CPPFLAGS
|
||||
CPPFLAGS="$CPPFLAGS $TCL_INCLUDE_SPEC"
|
||||
AC_CHECK_HEADERS([tcl.h],
|
||||
[],
|
||||
[AC_MSG_ERROR([Unable to find Tcl headers])])
|
||||
CPPFLAGS=$tcl_save_CPPFLAGS
|
||||
|
||||
BINDING_LIST="${BINDING_LIST} tcl"
|
||||
BINDING_ALL="${BINDING_ALL} all-tcl"
|
||||
BINDING_CHECK="${BINDING_CHECK} check-tcl"
|
||||
BINDING_CLEAN="${BINDING_CLEAN} clean-tcl"
|
||||
BINDING_DISTCLEAN="${BINDING_DISTCLEAN} distclean-tcl"
|
||||
BINDING_INSTALL_EXEC="${BINDING_INSTALL_EXEC} install-tcl"
|
||||
BINDING_UNINSTALL="${BINDING_UNINSTALL} uninstall-tcl"
|
||||
BINDING_LIB_TARGETS="${BINDING_LIB_TARGETS} \$(tcl_ltlib)"])
|
||||
BINDING_LIST="${BINDING_LIST} tcl"
|
||||
BINDING_ALL="${BINDING_ALL} all-tcl"
|
||||
BINDING_CHECK="${BINDING_CHECK} check-tcl"
|
||||
BINDING_CLEAN="${BINDING_CLEAN} clean-tcl"
|
||||
BINDING_DISTCLEAN="${BINDING_DISTCLEAN} distclean-tcl"
|
||||
BINDING_INSTALL_EXEC="${BINDING_INSTALL_EXEC} install-tcl"
|
||||
BINDING_UNINSTALL="${BINDING_UNINSTALL} uninstall-tcl"
|
||||
BINDING_LIB_TARGETS="${BINDING_LIB_TARGETS} \$(tcl_ltlib)"])
|
||||
|
||||
AM_CONDITIONAL([ENABLE_TCL], [test x"${build_tcl}" = "xyes"])
|
||||
AC_SUBST([TCL_LIB_SPEC])
|
||||
|
@ -457,36 +484,6 @@ AC_SUBST([TCL_INCLUDE_SPEC])
|
|||
AC_SUBST([TCL_SHLIB_SUFFIX])
|
||||
|
||||
|
||||
dnl Not sure where this goes...
|
||||
# TODO: require "${ac_cv_header_sys_socket_h}" = "no"
|
||||
|
||||
|
||||
dnl Check for python availability, so we can enable HamlibPy
|
||||
# Python bindings
|
||||
AC_MSG_CHECKING([whether to build python binding and demo])
|
||||
AC_ARG_WITH([python-binding],
|
||||
[AS_HELP_STRING([--with-python-binding],
|
||||
[build python binding and demo @<:@default=no@:>@])],
|
||||
[cf_with_python_binding=$withval],
|
||||
[cf_with_python_binding=no])
|
||||
AC_MSG_RESULT([$cf_with_python_binding])
|
||||
|
||||
dnl AX_PYTHON_DEVEL from macros/ax_python_devel.m4
|
||||
AS_IF([test x"${cf_with_python_binding}" = "xyes"],[
|
||||
AM_PATH_PYTHON([2.1],, [:])
|
||||
AX_PYTHON_DEVEL
|
||||
|
||||
BINDING_LIST="${BINDING_LIST} python"
|
||||
BINDING_ALL="${BINDING_ALL} all-py"
|
||||
BINDING_CHECK="${BINDING_CHECK} check-py"
|
||||
BINDING_CLEAN="${BINDING_CLEAN} clean-py"
|
||||
BINDING_DISTCLEAN="${BINDING_DISTCLEAN} distclean-py"
|
||||
BINDING_INSTALL_EXEC="${BINDING_INSTALL_EXEC} install-py"
|
||||
BINDING_UNINSTALL="${BINDING_UNINSTALL} uninstall-py"
|
||||
BINDING_LIB_TARGETS="${BINDING_LIB_TARGETS} \$(python_ltlib)"])
|
||||
|
||||
AM_CONDITIONAL([ENABLE_PYTHON], [test x"${cf_with_python_binding}" = "xyes"])
|
||||
|
||||
dnl Only search for Swig if one or more bindings are enabled.
|
||||
AS_IF([test "x${BINDING_ALL}" != "x"],
|
||||
[# macros/ax_pkg_swig.m4
|
||||
|
@ -512,6 +509,10 @@ AC_SUBST([BINDING_LIST])
|
|||
AC_SUBST([BINDING_LIB_TARGETS])
|
||||
|
||||
|
||||
dnl Not sure where this goes...
|
||||
dnl # TODO: require "${ac_cv_header_sys_socket_h}" = "no"
|
||||
|
||||
|
||||
## ----------------- ##
|
||||
## Optional backends ##
|
||||
## ----------------- ##
|
||||
|
|
Ładowanie…
Reference in New Issue