2003-04-06 18:45:57 +00:00
|
|
|
|
#!/usr/bin/perl -Iblib/arch -Iblib/lib
|
2002-09-08 22:31:01 +00:00
|
|
|
|
|
2003-04-06 18:45:57 +00:00
|
|
|
|
use Hamlib;
|
2002-09-08 22:31:01 +00:00
|
|
|
|
|
2003-04-06 18:45:57 +00:00
|
|
|
|
print "Version: $Hamlib::hamlib_version\n";
|
|
|
|
|
print "FM: $Hamlib::RIG_MODE_FM\n";
|
2002-09-08 22:31:01 +00:00
|
|
|
|
|
2003-04-06 18:45:57 +00:00
|
|
|
|
Hamlib::rig_set_debug($Hamlib::RIG_DEBUG_TRACE);
|
2002-09-08 22:31:01 +00:00
|
|
|
|
|
2003-04-06 18:45:57 +00:00
|
|
|
|
$rig = new Hamlib::Rig($Hamlib::RIG_MODEL_DUMMY);
|
2004-02-08 17:54:38 +00:00
|
|
|
|
|
|
|
|
|
# replace "/dev/Rig" with your path to serial port
|
|
|
|
|
$rig->set_conf("rig_pathname","/dev/Rig");
|
|
|
|
|
|
2002-09-08 22:31:01 +00:00
|
|
|
|
$rig->open();
|
|
|
|
|
|
2002-10-08 21:54:58 +00:00
|
|
|
|
# 1073741944 is token value for "itu_region"
|
2002-10-07 21:44:51 +00:00
|
|
|
|
$rpath = $rig->get_conf("rig_pathname");
|
|
|
|
|
$region = $rig->get_conf(1073741944);
|
|
|
|
|
print "get_conf: path=\"$rpath\", ITU region=$region\n";
|
|
|
|
|
|
|
|
|
|
|
2003-04-06 18:45:57 +00:00
|
|
|
|
$rig->set_freq(12000000, $Hamlib::RIG_VFO_A);
|
2002-09-08 22:31:01 +00:00
|
|
|
|
|
2002-10-07 21:44:51 +00:00
|
|
|
|
$f = $rig->get_freq();
|
|
|
|
|
print "freq: $f\n";
|
|
|
|
|
|
|
|
|
|
($mode, $width) = $rig->get_mode();
|
|
|
|
|
print "mode: $mode, width: $width\n";
|
|
|
|
|
|
2002-09-08 22:31:01 +00:00
|
|
|
|
print "ITU region: $rig->{state}->{itu_region}\n";
|
|
|
|
|
print "Copyright: $rig->{caps}->{copyright}\n";
|
2002-10-07 21:44:51 +00:00
|
|
|
|
$inf = $rig->get_info();
|
|
|
|
|
|
|
|
|
|
print "get_info: $inf\n";
|
|
|
|
|
|
|
|
|
|
$rig->set_level("VOX", 1);
|
|
|
|
|
$lvl = $rig->get_level_i("VOX");
|
|
|
|
|
print "level: $lvl\n";
|
2003-04-06 18:45:57 +00:00
|
|
|
|
$rig->set_level($Hamlib::RIG_LEVEL_VOX, 5);
|
|
|
|
|
$lvl = $rig->get_level_i($Hamlib::RIG_LEVEL_VOX);
|
2002-10-07 21:44:51 +00:00
|
|
|
|
print "level: $lvl\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-04-06 18:45:57 +00:00
|
|
|
|
$chan = new Hamlib::Chan($Hamlib::RIG_VFO_A);
|
2002-10-07 21:44:51 +00:00
|
|
|
|
|
2002-10-08 21:54:58 +00:00
|
|
|
|
$rig->get_channel($chan);
|
|
|
|
|
print "get_channel status: $rig->{error_status}\n";
|
2002-10-07 21:44:51 +00:00
|
|
|
|
|
2002-10-08 21:54:58 +00:00
|
|
|
|
print "VFO: $chan->{vfo}, $chan->{freq}\n";
|
2002-09-08 22:31:01 +00:00
|
|
|
|
|
|
|
|
|
$rig->close();
|
2002-10-07 21:44:51 +00:00
|
|
|
|
|
2002-10-08 21:54:58 +00:00
|
|
|
|
# TODO:
|
2003-04-06 18:45:57 +00:00
|
|
|
|
($long1, $lat1) = Hamlib::locator2longlat("IN98EC");
|
|
|
|
|
($long2, $lat2) = Hamlib::locator2longlat("DM33DX");
|
|
|
|
|
$loc1 = Hamlib::longlat2locator($long1, $lat1);
|
|
|
|
|
$loc2 = Hamlib::longlat2locator($long2, $lat2);
|
2002-10-07 21:44:51 +00:00
|
|
|
|
print "Loc1: $loc1\n";
|
|
|
|
|
print "Loc2: $loc2\n";
|
|
|
|
|
|
2003-04-06 18:45:57 +00:00
|
|
|
|
($dist, $az) = Hamlib::qrb($long1, $lat1, $long2, $lat2);
|
|
|
|
|
$longpath = Hamlib::distance_long_path($dist);
|
2004-02-08 17:54:38 +00:00
|
|
|
|
print "Distance: $dist km, azimuth $az, long path: $longpath\n";
|
2003-04-06 18:45:57 +00:00
|
|
|
|
($deg, $min, $sec) = Hamlib::dec2dms($az);
|
|
|
|
|
$az2 = Hamlib::dms2dec($deg, $min, $sec);
|
2002-10-07 21:44:51 +00:00
|
|
|
|
print "Bearing: $az, $deg<65> $min' $sec\", recoded: $az2\n"
|
|
|
|
|
|
|
|
|
|
|