Browse Source

DX cluster/bandmap: add "normal" telnet mode, and allow to enter telnet commands (some work to do)

master
Fabian Kurz 4 years ago
parent
commit
cd34442346
  1. 49
      yfk
  2. 58
      yfksubs.pl

49
yfk

@ -1,4 +1,4 @@
#!/usr/bin/perl -w
#!/usr/bin/perl
# indentation looks best with tw=4
@ -717,7 +717,8 @@ while ($status == 2) {
"Edit Name/QTH DB - Edit the database used to save Names and QTHs",
"Import from LoTW - Read LoTW report and update the confirmations",
"Export to LoTW - Generate ADIF file of QSOs not uploaded yet",
"Setup YFKlog - Most logbook settings can be changed here"
"Setup YFKlog - Most logbook settings can be changed here",
"DX cluster - Console for the DX cluster"
);
addstr($whead, 0,0, "YFKlog v$yfkver - Main Menu - Active Logbook: ".
@ -779,6 +780,9 @@ while ($status == 2) {
elsif ($choice == 13) { # Setup mode
$status = 15;
}
elsif ($choice == 14) { # Setup mode
$status = 16;
}
} # end of $status == 2, Main menu
@ -2054,7 +2058,8 @@ while ($status == 15) {
sprintf("lotwlocation=%-15s - LoTW station locations", $yfksubs::lotwlocation),
sprintf("dxchost=%-15s - DX cluster hostname", $yfksubs::dxchost),
sprintf("dxcport=%-15s - DX cluster port", $yfksubs::dxcport),
sprintf("dxccall=%-15s - DX cluster login call", $yfksubs::dxccall)
sprintf("dxccall=%-15s - DX cluster login call", $yfksubs::dxccall),
sprintf("dxcmode=%-15s - DX cluster mode (B = bandmap, N = normal)", $yfksubs::dxcmode)
);
my $choice = &selectlist(\$wmain, 2, 1, $row-6, 78, \@setup);
@ -2416,11 +2421,49 @@ while ($status == 15) {
&changeconfig($original, "dxccall=$ret");
}
}
elsif ($choice == 38) {
$original = "dxcmode=$yfksubs::dxcmode";
my $ret = &askbox(10,5,4,70, '[bn]', "DX cluster mode: b = bandmap, n = normal", $yfksubs::dxcmode);
if ($ret eq 'm') { last }
elsif ($ret ne '') {
&changeconfig($original, "dxcmode=$ret");
}
}
&readconfig;
&readsubconfig;
}
##############################################################################
# DX cluster console
##############################################################################
while ($status == 16) {
my $in;
attron($wmain, COLOR_PAIR(4));
addstr($whead, 0,0, "YFKlog v$yfkver - DX cluster console - Active Logbook: ".
"\U$mycall"." - DB: $dbname @ $dbserver".' ' x 30);
addstr($whelp, 0,0, 'Enter commands to send to the cluster. F1: Menu F12: Quit'.' 'x50);
erase($wmain);
addstr($wmain,0,0, ' 'x(80*($row-2))); # blue background
refresh($wmain);
refresh($whead);
refresh($whelp);
curs_set(1); # cursor visible
$in = &askbox(2, 30, 4, 30, '[^~\n]', "Enter a command", '');
# when the call is "m", go back to menu directly.
unless ($in eq "m") {
&senddxc($in);
}
else {
$status = 2;
}
}
} # end of MAIN PROGRAM LOOP
endwin;

58
yfksubs.pl

@ -34,7 +34,8 @@ changemycall newlogtable oldlogtable choseeditqso geteditqso editw updateqso che
awards statistics qslstatistics editdb editdbw savedbedit lotwimport
databaseupgrade xplanet queryrig tableexists changeconfig readsubconfig
connectdb connectrig jumpfield receive_qso tqslsign getlotwlocations
getlotwstartdate downloadlotw redraw create_windows rundxc getch2 waitkey);
getlotwstartdate downloadlotw redraw create_windows rundxc getch2 waitkey
senddxc);
use strict;
use POSIX; # needed for acos in distance/direction calculation
@ -111,11 +112,16 @@ our $lotwpass=""; # Password for automatic LoTW download
our $dxchost=""; # dx cluster host
our $dxcport=0; # dx cluster telnet port
our $dxccall=""; # dx cluster login callsign
our $dxcmode="N"; # dx cluster mode. N = normal, B = bandmap
my $db_keepalive = time;
my @dxspots;
my @dxspots; # DX cluster thread -> main thread (DX spots)
my @dxlines; # DX cluster thread -> main thread (raw lines)
my @dxinput; # main thread -> DX cluster thread (keyboard input lines)
share(@dxspots);
share(@dxlines);
share(@dxinput);
sub redraw {
endwin();
@ -197,8 +203,19 @@ sub rundxc {
sleep(3);
while (1) {
# push keyboard input to cluster
foreach my $l (@dxinput) {
$t->print($l);
}
@dxinput = ();
my $line = $t->getline();
chomp($line);
push @dxlines, $line;
if ($#dxlines > $rows) { shift @dxlines; }
if ($line =~ /CW/ and $line =~ /DX de .*:\s+([0-9.]+)\s+([A-Z0-9\/]+)/) {
my $dxcall = $2;
my $freq = $1;
@ -255,7 +272,7 @@ sub updatedxc {
$timeout = 300;
}
# print bandmap in wdxc window.
# print dx cluster output or bandmap in wdxc window.
# this is called from the main thread (getch2, on keyboard timeout)
sub showdxc {
@ -268,18 +285,26 @@ sub showdxc {
# of available columns, 80 are already used by the logger, so we can
# calculate the number of bandmap columns as follows:
my $dxccols = int(($main::col - 80) / 25);
addstr($win, 0, 0, " "x($dxccols * 50 * $rows));
my $c = 0;
foreach my $line (@dxspots) {
# we split into columns with a width of 25
my $mrow = $c % $rows;
my $mcol = int($c / $rows);
next if ($mcol >= $dxccols); # don't swap into a non-existing column
next if ($mrow == 0 && $line eq ""); # don't print empty line on top
addstr($win, $mrow , 1 + $mcol*25, $line) if ($win);
$c++;
# "normal" dx cluster mode
if ($dxcmode eq "N") {
my $row = 0;
foreach my $line (@dxlines) {
addstr($win, $row++ , 1, $line);
}
}
elsif ($dxcmode eq "B") {
my $c = 0;
foreach my $line (@dxspots) {
# we split into columns with a width of 25
my $mrow = $c % $rows;
my $mcol = int($c / $rows);
next if ($mcol >= $dxccols); # don't swap into a non-existing column
next if ($mrow == 0 && $line eq ""); # don't print empty line on top
addstr($win, $mrow , 1 + $mcol*25, $line);
$c++;
}
}
refresh($win);
@ -290,6 +315,10 @@ sub showdxc {
ungetchar("~");
}
sub senddxc {
my $line = shift;
push @dxinput, $line;
}
# We read the configuration file .yfklog.
@ -425,6 +454,9 @@ while (defined (my $line = <CONFIG>)) { # Read line into $line
elsif ($line =~ /^dxccall=(.+)/) {
$dxccall = $1;
}
elsif ($line =~ /^dxcmode=(.+)/) {
$dxcmode = $1;
}
}
close CONFIG; # Configuration read.

Loading…
Cancel
Save