4 # This can only be used if the appropriate flag is enabled.
6 # I would STRONGLY recommend that you
7 # DO NOT ENABLE THIS COMMAND - YES THAT MEANS YOU!!!
9 # There are enough internet sources of WWV, you should really
10 # only enable a callsign for posting WWV spots if it is some
11 # RELIABLE automatic feed from somewhere.
13 # If you want to allow this command then you need to know that
14 # you must set/var @Geomag::allowed = qw(call call call) for EVERY
15 # callsign that issues wwv not just on your node but from outside
18 # I am making this deliberately hard because I believe that you are
19 # either a RELIABLE (probably machine generated) source of WWV or
20 # you shouldn't be doing it (and will have consequent problems).
22 # Copyright (c) 2001 Dirk Koopman G1TLH
26 my ($self, $line) = @_;
27 my $call = $self->call;
29 return (1, $self->msg('e5')) unless grep $call eq $_, @Geomag::allowed;
35 # calc 18 minutes past the hour in time_t seconds
36 my $hour = (gmtime $main::systime)[2];
37 my $d = int ($main::systime / 3600) * 3600 + 18 * 60;
41 my @l = split /\s*,\s*/, $line;
42 my $forecast = pop @l;
44 # make a hash out of the args
45 my %args = map {split /\s*=\s*/, lc $_} @l;
47 # check the ranges of each one
48 push @out, $self->msg('wwv1', 'k') unless defined $args{k} && $args{k} >= 0 && $args{k} <= 9;
49 push @out, $self->msg('wwv1', 'a') unless defined $args{a} && $args{a} >= 0 && $args{a} <= 400;
50 push @out, $self->msg('wwv1', 'sf') unless defined $args{sf} && $args{sf} >= 65 && $args{sf} <= 300;
51 push @out, $self->msg('wwv1', 'forecast') unless $forecast;
52 push @out, $self->msg('wwv2') if Geomag::dup($d, $args{sf}, $args{k}, $args{a}, $forecast);
54 return (1, @out) if @out;
56 # now this is all subject to change, but it will do for now, I think.
57 my $today = cldate($main::systime);
60 # PC23^14-Dec-2001^15^220^ 4^ 1^R=212 SA:mo=>mo-hi GF:qu=>qu-un^KH2D^KH2D^H48^~
61 # Date Hour SFI A K Forecast Logger
62 # 14-Dec-2001 15 220 4 1 R=212 SA:mo=>mo-hi GF:qu=>qu-un <KH2D>
64 my @field = ('PC23',$today,$hour,$args{sf},$args{a},$args{k},$forecast, $self->call ,$main::mycall, 'H99');
66 my $s = join('^', @field) . '^';
67 my ($r) = $forecast =~ /R=(\d+)/;
68 Geomag::update($d, @field[2..8], $r);
69 DXProt::send_wwv_spot($self, $s, $d, @field[2..8]);
70 #$self->wwv($s, 0, @field[1..8]);