Hamlib/bindings/tcltest.tcl.in
Nate Bargmann 4f9085f8f5 Bindings tweaks for Python and TCL
Remove execute bits for all test scripts and install them into
doc/examples.

Make sure check-py and check-tcl targets work.

Set a conditional for Python3 or Python2 and install/test the correct
script file.

Use Makefile variables instead of configure substitutions wherever
possible.

Generate tcltest.tcl at make time to insert installation library path
into the script so that tests pass.
2017-07-26 06:33:42 -05:00

70 lines
1.8 KiB
Tcl

#!/bin/sh
# the next line restarts using tclsh \
exec tclsh "$0" "$@"
# Edit the path below to reflect installed Hamlib extension
lappend ::auto_path @tcldir@
## Brute force loading
#load "@tcldir@/hamlibtcl.so" Hamlib
## Preferred package loading
package require hamlib
set tclver [info tclversion]
puts "Tcl $tclver test, $hamlib_version\n"
#rig_set_debug $RIG_DEBUG_TRACE
rig_set_debug $RIG_DEBUG_NONE
# Init RIG_MODEL_DUMMY
Rig my_rig $RIG_MODEL_DUMMY
my_rig open
my_rig set_freq $RIG_VFO_A 145550000
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:\t\t$mode\nbandwidth:\t[lindex $moderes 1]Hz"
set state [my_rig cget -state]
puts "ITU_region:\t[$state cget -itu_region]"
# The following works well also
# puts ITU_region:[[my_rig cget -state] cget -itu_region]
set rigcaps [my_rig cget -caps]
#set model [$rigcaps cget -model_name]
puts "Model:\t\t[$rigcaps cget -model_name]"
puts "Manufacturer:\t\t[$rigcaps cget -mfg_name]"
puts "Backend version:\t[$rigcaps cget -version]"
puts "Backend license:\t[$rigcaps cget -copyright]"
puts "Attenuators:\t[$rigcaps cget -attenuator]"
puts "getinfo:\t[my_rig get_info]"
my_rig set_level "VOX" 1
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:\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:\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]]"
puts "\nSending Morse, '73'"
my_rig send_morse $RIG_VFO_A "73"
my_rig close
#my_rig cleanup
exit 0