2 # module to manage the band list
4 # Copyright (c) 1998 - Dirk Koopman G1TLH
16 use vars qw(%bands %regions %aliases $bandsfn %valid);
18 %bands = (); # the 'raw' band data
19 %regions = (); # list of regions for shortcuts eg vhf ssb
20 %aliases = (); # list of aliases
21 $bandsfn = "$main::data/bands.pl";
24 cw => '0,CW,parraypairs',
25 ssb => '0,SSB,parraypairs',
26 data => '0,DATA,parraypairs',
27 sstv => '0,SSTV,parraypairs',
28 fstv => '0,FSTV,parraypairs',
29 rtty => '0,RTTY,parraypairs',
30 pactor => '0,PACTOR,parraypairs',
31 packet => '0,PACKET,parraypairs',
32 repeater => '0,REPEATER,parraypairs',
33 fax => '0,FAX,parraypairs',
34 beacon => '0,BEACON,parraypairs',
35 band => '0,BAND,parraypairs',
46 # obtain a band object by callsign [$obj = Band::get($call)]
50 my $ncall = $aliases{$call};
51 $call = $ncall if $ncall;
55 # obtain all the band objects
58 return values(%bands);
61 # get all the band keys
67 # get all the region keys
70 return keys(%regions);
73 # get all the alias keys
76 return keys(%aliases);
83 return $regions{$reg};
86 # get all the frequency pairs associated with the band and sub-band offered
87 # the band can be a region, sub-band can be missing
89 # called Bands::get_freq(band-label, subband-label)
92 my ($band, $subband) = @_;
97 $subband = 'band' if !$subband;
99 # first look in the region
100 $b = $regions{$band};
102 @band = ($band) if @band == 0;
104 # we now have a list of bands to scan for sub bands
108 my $sb = $wb->{$subband};
109 push @out, @$sb if $sb;
116 # return a list of valid elements
125 # return a prompt for a field
130 my ($self, $ele) = @_;
138 my $name = $AUTOLOAD;
139 return if $name =~ /::DESTROY$/;
142 # this clever line of code creates a subroutine which takes over from autoload
143 # from OO Perl - Conway
144 *$AUTOLOAD = sub {@_ > 1 ? $_[0]->{$name} = $_[1] : $_[0]->{$name}};