X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fwcy.pl;fp=cmd%2Fwcy.pl;h=c874b2e245b612e588cb86ed7633bcf44664db7e;hb=6a510dc82f3050640dfe6b8d499995348075fe7a;hp=0000000000000000000000000000000000000000;hpb=5198a7d29d9dbafde9de46c04a67d86cf0e548f2;p=spider.git diff --git a/cmd/wcy.pl b/cmd/wcy.pl new file mode 100644 index 00000000..c874b2e2 --- /dev/null +++ b/cmd/wcy.pl @@ -0,0 +1,69 @@ +# +# WCY command +# +# This can only be used if the appropriate flag is enabled. +# +# I would STRONGLY recommend that, unless your callsign is DK8LV, you +# DO NOT ENABLE THIS COMMAND - YES THAT MEANS YOU!!! +# +# The command line sent from DK0WCY (the only known valid source of data +# for this command [and its only legitimate user BTW]):- +# +# WCY k=6,expk=5,a=25,r=220,sf=202,sa=act,gmf=act,au=strong +# +# k: Kiel k-Index (0..9) +# expK: expected Kiel k-index for the current 3-h-measuring period +# A: Kiel A-Index (0..400) +# R: Sunspot Number, SSN (0..300) +# SF: Solar Flux Index (65..300) +# SA: Sun Activity (qui,eru,act,maj,pro,war,nil) +# GMF: Geomagnetic Field (qui,act,min,maj,sev,mag,war,nil) +# AU: Aurora Status (no,aurora,strong) +# +# Copyright (c) 2001 Dirk Koopman G1TLH +# +# $Id$ +# +my ($self, $line) = @_; +my $call = $self->call; +$call =~ s/-\d+$//; +return (1, $self->msg('e5')) unless grep $call eq $_, @WCY::allowed; +my @out; + +# calc 18 minutes past the hour in time_t seconds +my $hour = (gmtime $main::systime)[2]; +my $d = int ($main::systime / 3600) * 3600 + 18 * 60; + +# make a hash out of the args +my %args = map {split /\s*=\s*/} split /\s*,\s*/, lc $line; + +# check the ranges of each one +push @out, $self->msg('wcy1', 'k') unless $args{k} && $args{k} >= 0 && $args{k} <= 9; +push @out, $self->msg('wcy1', 'espk') unless $args{expk} && $args{expk} >= 0 && $args{expk} <= 9; +push @out, $self->msg('wcy1', 'a') unless $args{a} && $args{a} >= 0 && $args{a} <= 400; +push @out, $self->msg('wcy1', 'r') unless $args{r} && $args{r} >= 0 && $args{r} <= 300; +push @out, $self->msg('wcy1', 'sf') unless $args{sf} && $args{sf} >= 65 && $args{sf} <= 300; +push @out, $self->msg('wcy1', 'sa') unless $args{sa} && grep $args{sa} eq $_, qw(qui eru act maj pro war nil); +push @out, $self->msg('wcy1', 'gmf') unless $args{gmf} && grep $args{gmf} eq $_, qw(qui act min maj sev mag war nil); +push @out, $self->msg('wcy1', 'au') unless $args{au} && grep $args{au} eq $_, qw(no aurora strong); + +push @out, $self->msg('wcy2') if WCY::dup($d); +#$DB::single=1; + +return (1, @out) if @out; + +# now this is all subject to change, but it will do for now, I think. +my $today = cldate($main::systime); + +# PC73^14-Dec-2001^15^220^ 3^1^0^212^act^qui^no^DK0WCY-3^DB0SUE-7^H96^ +# Date Hour SFI A K Exp.K R SA GMF Aurora Logger +# 14-Dec-2001 15 220 3 1 0 212 act qui no +my @field = ('PC73',$today,$hour,$args{sf},$args{a},$args{k},$args{expk},$args{r},$args{sa},$args{gmf},$args{au}, $self->call ,$main::mycall, 'H99'); + +my $s = join('^', @field) . '^'; +WCY::update($d, @field[2..12]); +DXProt::send_wcy_spot($self, $s, $d, @field[2..12]); +$self->wcy($s, 0, @field[1..12]); +return (1, @out); + +