#!/usr/bin/perl -Iblib/arch -Iblib/lib # Modified from perltest.pl included with Hamlib. use Hamlib; print "Perl test, version: $Hamlib::hamlib_version\n"; # Examples showing the values of the mode constants in the Hamlib namespace print "AM: $Hamlib::RIG_MODE_AM\n"; print "CW: $Hamlib::RIG_MODE_CW\n"; print "USB: $Hamlib::RIG_MODE_USB\n"; print "LSB: $Hamlib::RIG_MODE_LSB\n"; print "RTTY: $Hamlib::RIG_MODE_RTTY\n"; print "FM: $Hamlib::RIG_MODE_FM\n"; # Change to RIG_DEBUG_TRACE for diagnostic output Hamlib::rig_set_debug($Hamlib::RIG_DEBUG_NONE); # Create a new instance of class Hamlib::Rig and off we go! # Note! RIG_MODEL_* must be used, the integers used with rigctl will fail. $rig = new Hamlib::Rig($Hamlib::RIG_MODEL_DUMMY); # replace "/dev/Rig" with your path to serial port $rig->set_conf("rig_pathname","/dev/Rig"); # replace with needed serial speed (some backends may not allow change) $rig->set_conf("serial_speed","9600"); $rig->open(); # 1073741944 is token value for "itu_region" (dunno where *that* came from -N0NB) $rpath = $rig->get_conf("rig_pathname"); $rate = $rig->get_conf("serial_speed"); $region = $rig->get_conf(1073741944); print "get_conf: path=\"$rpath\", baud rate=$rate, ITU region=$region\n"; $rig->set_freq(12000000, $Hamlib::RIG_VFO_A); $f = $rig->get_freq(); print "freq: $f\n"; $rig->set_mode($Hamlib::RIG_MODE_CW, $Hamlib::RIG_PASSBAND_NORMAL); ($mode, $width) = $rig->get_mode(); print "get_mode: $mode, width: $width\n"; $rig->set_vfo($Hamlib::RIG_VFO_A); $vfo = $rig->get_vfo(); print "get_vfo: $vfo\n"; # The following is FYI, but probably not too important for XTLF print "ITU region: $rig->{state}->{itu_region}\n"; print "Copyright: $rig->{caps}->{copyright}\n"; $inf = $rig->get_info(); print "get_info: $inf\n"; $rig->set_level("VOX", 1); $lvl = $rig->get_level_i("VOX"); print "level: $lvl\n"; $rig->set_level($Hamlib::RIG_LEVEL_VOX, 5); $lvl = $rig->get_level_i($Hamlib::RIG_LEVEL_VOX); print "level: $lvl\n"; $chan = new Hamlib::Chan($Hamlib::RIG_VFO_A); $rig->get_channel($chan); print "get_channel status: $rig->{error_status}\n"; print "VFO: $chan->{vfo}, $chan->{freq}\n"; $rig->close();