| 1 | #!usr/bin/perl | ||||||||||||||||||||||||||||
| 2 | # | ||||||||||||||||||||||||||||
| 3 | # Class : Ham::Packet::DXSpider | ||||||||||||||||||||||||||||
| 4 | # Purpose: Provides a remote interface to the DXSpider DX Cluster software. | ||||||||||||||||||||||||||||
| 5 | # Author : Bruce James (custard@cpan.org) | ||||||||||||||||||||||||||||
| 6 | # Date : 7th April 2012 | ||||||||||||||||||||||||||||
| 7 | # | ||||||||||||||||||||||||||||
| 8 | package Ham::Packet::DXSpider; | ||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 2 | ▶ | use IO::Handle; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use IO::Socket; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 2 | ▶ | use POSIX; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | 2 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 2 | our $VERSION="0.04"; | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | =pod | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | =head1 NAME | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | Ham::Packet::DXSpider - Receives DX Spots from the DXCluster | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | # Construct object using address and optional port | ||||||||||||||||||||||||||||
| 27 | my $dx=Ham::Packet::DXSpider->new( | ||||||||||||||||||||||||||||
| 28 | callsign => 'your callsign', | ||||||||||||||||||||||||||||
| 29 | address => 'dxcluster address', | ||||||||||||||||||||||||||||
| 30 | port => 'port', | ||||||||||||||||||||||||||||
| 31 | ); | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | # Construct object using supplied IO::Handle | ||||||||||||||||||||||||||||
| 34 | my $dx=Ham::Packet::DXSpider->new( | ||||||||||||||||||||||||||||
| 35 | callsign => 'your callsign', | ||||||||||||||||||||||||||||
| 36 | handle => IO::Handle | ||||||||||||||||||||||||||||
| 37 | ); | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | # Set a handler for received private messages | ||||||||||||||||||||||||||||
| 40 | $dx->addPrivateMessageHandler( sub { | ||||||||||||||||||||||||||||
| 41 | my %args=@_; | ||||||||||||||||||||||||||||
| 42 | my $from= $args{from} || ''; | ||||||||||||||||||||||||||||
| 43 | my $to= $args{to} || ''; | ||||||||||||||||||||||||||||
| 44 | my $body= $args{body} || 'no message'; | ||||||||||||||||||||||||||||
| 45 | my $subject= $args{subject} || 'no subject'; | ||||||||||||||||||||||||||||
| 46 | my $time= $args{time} || gmtime(time()); | ||||||||||||||||||||||||||||
| 47 | } ); | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | # Set a handler for received DX messages | ||||||||||||||||||||||||||||
| 50 | $dx->addDXMessageHandler( sub { | ||||||||||||||||||||||||||||
| 51 | my %args=@_; | ||||||||||||||||||||||||||||
| 52 | my $from= $args{from}; | ||||||||||||||||||||||||||||
| 53 | my $frequency= $args{frequency}; | ||||||||||||||||||||||||||||
| 54 | my $message= $args{message}; | ||||||||||||||||||||||||||||
| 55 | my $heard= $args{heard}; | ||||||||||||||||||||||||||||
| 56 | my $time= $args{time}; | ||||||||||||||||||||||||||||
| 57 | my $locator= $args{locator}; | ||||||||||||||||||||||||||||
| 58 | } ); | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | # Add a handler for collecting statistics on DX spots received. | ||||||||||||||||||||||||||||
| 61 | $dx->addStatsHandler( sub { | ||||||||||||||||||||||||||||
| 62 | my %args=@_; | ||||||||||||||||||||||||||||
| 63 | my $from= $args{from}; | ||||||||||||||||||||||||||||
| 64 | my $freq= $args{frequency}; | ||||||||||||||||||||||||||||
| 65 | my $message= $args{message}; | ||||||||||||||||||||||||||||
| 66 | my $heard= $args{heard}; | ||||||||||||||||||||||||||||
| 67 | my $time= $args{time}; | ||||||||||||||||||||||||||||
| 68 | my $locator= $args{locator}; | ||||||||||||||||||||||||||||
| 69 | } ); | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | # Send a message | ||||||||||||||||||||||||||||
| 72 | $dx->sendPrivate( $to, $subject, $message ); | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | $dx->start(); | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | =head2 CONSTRUCTOR | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | new( callsign => 'your callsign', address => 'dxcluster address', port => 'port', handle => IO::Handle ); | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | Create a new DXSpider object for the specified callsign. If address and optionally port are | ||||||||||||||||||||||||||||
| 83 | specified, this will also open the connection to the DXSPIDER server. | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | Address can also be an already open IO::Handle object, in which case port becomes meaningless. | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | =head2 METHODS | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | =cut | ||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | 2 | has 'callsign' => (is=>'ro'); | |||||||||||||||||||||||||||
| 93 | 2 | has 'address' => (is=>'ro'); | |||||||||||||||||||||||||||
| 94 | 2 | has 'handle' => (is=>'rw'); | |||||||||||||||||||||||||||
| 95 | 2 | has 'port' => (is=>'ro'); | |||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | 0 | ▶ | has 'private_message_handler' => (is=>'rw', default => sub { [] } ); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||
| 98 | 0 | ▶ | has 'dx_message_handler' => (is=>'rw', default => sub { [] } ); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||
| 99 | 0 | ▶ | has 'stats_handler' => (is=>'rw', default => sub { [] } ); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | 0 | ▶ | has 'pending_messages' => (is=>'rw', default => sub { [] } ); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | =head2 BUILD() | ||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | Moose builder. Called after construction. Opens the handle if necessary. | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | =cut | ||||||||||||||||||||||||||||
| 109 | sub BUILD { | ||||||||||||||||||||||||||||
| 110 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
BUILD: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | 0 | $self->open(); | |||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | =head2 open() | ||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | Opens a connection to a DXSPIDER server located at the address and port specified. | ||||||||||||||||||||||||||||
| 119 | Address can also be an already open IO::Handle object, in which case port becomes meaningless. | ||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | =cut | ||||||||||||||||||||||||||||
| 122 | sub open { | ||||||||||||||||||||||||||||
| 123 | 0 | ▶ | my $self=shift; | ||||||||||||||||||||||||||
|
Subroutine
open: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | 0 | ▶ | return if ( ref($self->handle) && ($self->handle->isa( 'IO::Handle' ))); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $self->handle and $self->handle->isa("IO::Handle")
MC/DC0%0/2
ref $self->handle and $self->handle->isa("IO::Handle")
ref $self->handle
$self->handle->isa("IO::Handle")
Truth table0%0/3
A and B
A= ref $self->handleB= $self->handle->isa("IO::Handle")
| |||||||||||||||||||||||||||||
| 126 | 0 | ▶ | if ($self->address) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 127 | 0 | $self->handle( IO::Socket::INET->new( | |||||||||||||||||||||||||||
| 128 | PeerAddr => $self->address, | ||||||||||||||||||||||||||||
| 129 | PeerPort => $self->port | ||||||||||||||||||||||||||||
| 130 | )); | ||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | =head2 addStatsHandler( $codeRef ) | ||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | Adds a code reference to a function that can be used to collect statistics of the | ||||||||||||||||||||||||||||
| 138 | received DX spot messages. Only DX spot messages will be sent to this handler. | ||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||
| 140 | Handlers are added to a list and will be called in turn when a new DX spot message arrives. | ||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | =cut | ||||||||||||||||||||||||||||
| 143 | sub addStatsHandler { | ||||||||||||||||||||||||||||
| 144 | 0 | ▶ | my $self= shift; | ||||||||||||||||||||||||||
|
Subroutine
addStatsHandler: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 145 | 0 | my $handler= shift; | |||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | 0 | ▶ | return unless( ref($handler) eq 'CODE' ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | 0 | push( @{$self->stats_handler}, $handler ); | |||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | 0 | return $handler; | |||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||
| 154 | =head2 addDXMessageHandler( $codeRef ) | ||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | Adds a code reference to a function that handles DX spot messages. | ||||||||||||||||||||||||||||
| 157 | Handlers are added to a list and will be called in turn when a DX spot message arrives. | ||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | =cut | ||||||||||||||||||||||||||||
| 160 | sub addDXMessageHandler { | ||||||||||||||||||||||||||||
| 161 | 0 | ▶ | my $self= shift; | ||||||||||||||||||||||||||
|
Subroutine
addDXMessageHandler: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 162 | 0 | my $handler= shift; | |||||||||||||||||||||||||||
| 163 | 0 | ▶ | return unless( ref($handler) eq 'CODE' ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||
| 165 | 0 | push( @{$self->dx_message_handler}, $handler ); | |||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | 0 | return $handler; | |||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||
| 170 | =head2 addPrivateMessageHandler( $codeRef ) | ||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||
| 172 | Adds a code reference to a function that handles Private messages directed to the logged | ||||||||||||||||||||||||||||
| 173 | in callsign. | ||||||||||||||||||||||||||||
| 174 | Handlers are added to a list and will be called in turn when a new message arrives. | ||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | =cut | ||||||||||||||||||||||||||||
| 177 | sub addPrivateMessageHandler { | ||||||||||||||||||||||||||||
| 178 | 0 | ▶ | my $self= shift; | ||||||||||||||||||||||||||
|
Subroutine
addPrivateMessageHandler: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 179 | 0 | my $handler= shift; | |||||||||||||||||||||||||||
| 180 | 0 | ▶ | return unless( ref($handler) eq 'CODE' ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | 0 | push( @{$self->private_message_handler}, $handler ); | |||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | 0 | return $handler; | |||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||
| 187 | =head2 start() | ||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||
| 189 | Continuously polls the DXSPIDER for new events. Returns if the handle for the connection | ||||||||||||||||||||||||||||
| 190 | closes or becomes undefined for whatever reason. | ||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | =cut | ||||||||||||||||||||||||||||
| 193 | sub start { | ||||||||||||||||||||||||||||
| 194 | # Continuously poll the handle and process responses | ||||||||||||||||||||||||||||
| 195 | 0 | ▶ | my $self= shift; | ||||||||||||||||||||||||||
|
Subroutine
start: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||
| 197 | 0 | ▶ | while ( $self->{handle} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 198 | 0 | $self->process( $self->{handle} ); | |||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||
| 201 | 0 | return $self->{handle}; | |||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||
| 204 | =head2 poll() | ||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||
| 206 | Polls the DXSPIDER once for a new event. This will block until something is received and the | ||||||||||||||||||||||||||||
| 207 | current transaction is completed. | ||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||
| 209 | TODO: Probably would be a candidate for a timeout when I get time. | ||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||
| 211 | =cut | ||||||||||||||||||||||||||||
| 212 | sub poll { | ||||||||||||||||||||||||||||
| 213 | # Poll the handle once, and process only that response. | ||||||||||||||||||||||||||||
| 214 | 0 | ▶ | my $self= shift; | ||||||||||||||||||||||||||
|
Subroutine
poll: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||
| 216 | 0 | ▶ | if ( $self->{handle} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 217 | 0 | $self->process( $self->{handle} ); | |||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||
| 220 | 0 | return $self->{handle}; | |||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||
| 223 | =head2 sendPrivate( $to, $subject, $body ) | ||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||
| 225 | Sends a private message to the callsign specified. | ||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||
| 227 | =cut | ||||||||||||||||||||||||||||
| 228 | sub sendPrivate { | ||||||||||||||||||||||||||||
| 229 | # Queues a private message for sending. | ||||||||||||||||||||||||||||
| 230 | 0 | ▶ | my $self= shift; | ||||||||||||||||||||||||||
|
Subroutine
sendPrivate: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 231 | 0 | my $to= shift; | |||||||||||||||||||||||||||
| 232 | 0 | my $subject= shift; | |||||||||||||||||||||||||||
| 233 | 0 | my $body= shift; | |||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||
| 235 | 0 | push @{$self->pending_messages}, { | |||||||||||||||||||||||||||
| 236 | to => $to, | ||||||||||||||||||||||||||||
| 237 | subject => $subject, | ||||||||||||||||||||||||||||
| 238 | body => $body, | ||||||||||||||||||||||||||||
| 239 | }; | ||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||
| 241 | 0 | return scalar @{$self->pending_messages}; | |||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||
| 246 | =head2 FUNCTIONS | ||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||
| 248 | Three functions are available for use as default handlers for testing and debugging purposes. | ||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||
| 250 | =over | ||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||
| 252 | =item defaultDXMessageHandler() | ||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||
| 254 | =item defaultStatsHandler() | ||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||
| 256 | =item defaultPrivateMessageHandler() | ||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||
| 258 | =back | ||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||
| 260 | =cut | ||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||
| 262 | sub defaultStatsHandler { | ||||||||||||||||||||||||||||
| 263 | 0 | ▶ | my %args=@_; | ||||||||||||||||||||||||||
|
Subroutine
defaultStatsHandler: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||
| 264 | 0 | my $from= $args{from}; | |||||||||||||||||||||||||||
| 265 | 0 | my $freq= $args{frequency}; | |||||||||||||||||||||||||||
| 266 | 0 | my $message= $args{message}; | |||||||||||||||||||||||||||
| 267 | 0 | my $heard= $args{heard}; | |||||||||||||||||||||||||||
| 268 | 0 | my $time= $args{time}; | |||||||||||||||||||||||||||
| 269 | 0 | my $locator= $args{locator}; | |||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||
| 271 | 0 | ▶ | our $BAND={ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 272 | 80 => [3000,4000], | ||||||||||||||||||||||||||||
| 273 | 40 => [7000,7200], | ||||||||||||||||||||||||||||
| 274 | 20 => [14000,14300], | ||||||||||||||||||||||||||||
| 275 | 10 => [28000,29000] | ||||||||||||||||||||||||||||
| 276 | } unless $BAND; | ||||||||||||||||||||||||||||
| 277 | 0 | our $COUNT; | |||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||
| 279 | 0 | for my $key (keys %{$BAND}) { | |||||||||||||||||||||||||||
| 280 | 0 | my $span=$BAND->{$key}; | |||||||||||||||||||||||||||
| 281 | 0 | my ($min,$max)=@{$span}; | |||||||||||||||||||||||||||
| 282 | 0 | ▶ | if ($freq >= $min and $freq <= $max) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$freq >= $min and $freq <= $max
MC/DC0%0/2
$freq >= $min and $freq <= $max
$freq >= $min
$freq <= $max
Truth table0%0/3
A and B
A= $freq >= $minB= $freq <= $max
| |||||||||||||||||||||||||||||
| 283 | 0 | $COUNT->{$key}++; | |||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||
| 286 | 0 | for my $key (keys %{$COUNT}) { | |||||||||||||||||||||||||||
| 287 | 0 | print( $key." ".$COUNT->{$key}."\n" ); | |||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||
| 291 | sub defaultDXMessageHandler { | ||||||||||||||||||||||||||||
| 292 | 0 | ▶ | my %args=@_; | ||||||||||||||||||||||||||
|
Subroutine
defaultDXMessageHandler: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 293 | 0 | my $from= $args{from}; | |||||||||||||||||||||||||||
| 294 | 0 | my $freq= $args{frequency}; | |||||||||||||||||||||||||||
| 295 | 0 | my $message= $args{message}; | |||||||||||||||||||||||||||
| 296 | 0 | my $heard= $args{heard}; | |||||||||||||||||||||||||||
| 297 | 0 | my $time= $args{time}; | |||||||||||||||||||||||||||
| 298 | 0 | my $locator= $args{locator}; | |||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||
| 300 | 0 | print( "Heard: $heard on $freq by $from at $time location $locator $message\n" ); | |||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||
| 303 | sub defaultPrivateMessageHandler { | ||||||||||||||||||||||||||||
| 304 | 0 | ▶ | my %args=@_; | ||||||||||||||||||||||||||
|
Subroutine
defaultPrivateMessageHandler: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||
| 305 | 0 | ▶ | my $from= $args{from} || ''; | ||||||||||||||||||||||||||
|
Condition0%0/2
$args{'from'} || ''
MC/DC0%0/1
$args{'from'} || ''
$args{'from'}
Truth table0%0/2
A
A= $args{'from'}
| |||||||||||||||||||||||||||||
| 306 | 0 | ▶ | my $to= $args{to} || ''; | ||||||||||||||||||||||||||
|
Condition0%0/2
$args{'to'} || ''
MC/DC0%0/1
$args{'to'} || ''
$args{'to'}
Truth table0%0/2
A
A= $args{'to'}
| |||||||||||||||||||||||||||||
| 307 | 0 | ▶ | my $body= $args{body} || 'no message'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$args{'body'} || 'no message'
MC/DC0%0/1
$args{'body'} || 'no message'
$args{'body'}
Truth table0%0/2
A
A= $args{'body'}
| |||||||||||||||||||||||||||||
| 308 | 0 | ▶ | my $subject= $args{subject} || 'no subject'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$args{'subject'} || 'no subject'
MC/DC0%0/1
$args{'subject'} || 'no subject'
$args{'subject'}
Truth table0%0/2
A
A= $args{'subject'}
| |||||||||||||||||||||||||||||
| 309 | 0 | ▶ | my $time= $args{time} || gmtime(time()); | ||||||||||||||||||||||||||
|
Condition0%0/3
$args{'time'} || gmtime time
MC/DC0%0/2
$args{'time'} || gmtime time
$args{'time'}
gmtime time
Truth table0%0/3
A || B
A= $args{'time'}B= gmtime time
| |||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||
| 311 | 0 | print( "Private to $to from $from at $time subject $subject message $body\n" ); | |||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||
| 314 | ############## | ||||||||||||||||||||||||||||
| 315 | ## PRIVATES ## | ||||||||||||||||||||||||||||
| 316 | ############## | ||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||
| 318 | =head1 Private Methods | ||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||
| 320 | =over | ||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||
| 322 | =item dispatchStats() | ||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||
| 324 | =item dispatchDXMessage() | ||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||
| 326 | =item dispatchPrivateMessage() | ||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||
| 328 | =item _sendPrivate() | ||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||
| 330 | =item processPending() | ||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||
| 332 | =item process() | ||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||
| 334 | =back | ||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||
| 336 | =cut | ||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||
| 338 | sub dispatchStats { | ||||||||||||||||||||||||||||
| 339 | # PRIVATE: Dispatches the message to all the handlers | ||||||||||||||||||||||||||||
| 340 | 0 | ▶ | my $self= shift; | ||||||||||||||||||||||||||
|
Subroutine
dispatchStats: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 341 | 0 | my %args=@_; | |||||||||||||||||||||||||||
| 342 | # Fire each handler in turn. | ||||||||||||||||||||||||||||
| 343 | 0 | foreach my $handler (@{$self->stats_handler}) { | |||||||||||||||||||||||||||
| 344 | 0 | &{$handler}( %args ); | |||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||
| 348 | sub dispatchDXMessage { | ||||||||||||||||||||||||||||
| 349 | # PRIVATE: Dispatches the message to all the handlers | ||||||||||||||||||||||||||||
| 350 | 0 | ▶ | my $self= shift; | ||||||||||||||||||||||||||
|
Subroutine
dispatchDXMessage: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 351 | 0 | my %args=@_; | |||||||||||||||||||||||||||
| 352 | 0 | my $from= $args{from}; | |||||||||||||||||||||||||||
| 353 | 0 | my $frequency= $args{frequency}; | |||||||||||||||||||||||||||
| 354 | 0 | my $message= $args{message}; | |||||||||||||||||||||||||||
| 355 | 0 | my $heard= $args{heard}; | |||||||||||||||||||||||||||
| 356 | 0 | my $time= $args{time}; | |||||||||||||||||||||||||||
| 357 | 0 | my $locator= $args{locator}; | |||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||
| 359 | # Fire each handler in turn. | ||||||||||||||||||||||||||||
| 360 | 0 | foreach my $handler (@{$self->dx_message_handler}) { | |||||||||||||||||||||||||||
| 361 | 0 | &{$handler}( %args ); | |||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||
| 363 | } | ||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||
| 365 | sub dispatchPrivateMessage { | ||||||||||||||||||||||||||||
| 366 | # PRIVATE: Dispatches the message to all the handlers | ||||||||||||||||||||||||||||
| 367 | 0 | ▶ | my $self= shift; | ||||||||||||||||||||||||||
|
Subroutine
dispatchPrivateMessage: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 368 | 0 | my %args=@_; | |||||||||||||||||||||||||||
| 369 | 0 | my $time= $args{time}; | |||||||||||||||||||||||||||
| 370 | 0 | my $from= $args{from}; | |||||||||||||||||||||||||||
| 371 | 0 | my $to= $args{to}; | |||||||||||||||||||||||||||
| 372 | 0 | my $subject= $args{subject}; | |||||||||||||||||||||||||||
| 373 | 0 | my $body= $args{body}; | |||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||
| 375 | 0 | foreach my $handler (@{$self->private_message_handler}) { | |||||||||||||||||||||||||||
| 376 | 0 | &{$handler}( %args ); | |||||||||||||||||||||||||||
| 377 | } | ||||||||||||||||||||||||||||
| 378 | } | ||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||
| 380 | sub _sendPrivate { | ||||||||||||||||||||||||||||
| 381 | # Sends a message using the supplied hashRef | ||||||||||||||||||||||||||||
| 382 | 0 | ▶ | my $self=shift; | ||||||||||||||||||||||||||
|
Subroutine
_sendPrivate: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 383 | 0 | my $hashRef = shift; # hashRef | |||||||||||||||||||||||||||
| 384 | 0 | ▶ | return unless ref($hashRef); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 385 | 0 | my $to = $hashRef->{to}; | |||||||||||||||||||||||||||
| 386 | 0 | my $subject = $hashRef->{subject}; | |||||||||||||||||||||||||||
| 387 | 0 | my $body = $hashRef->{body}; | |||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||
| 389 | 0 | ▶ | if ( $self->{handle} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 390 | 0 | my $fd=$self->{handle}; | |||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||
| 392 | 0 | print( $fd "sp $to\n" ); | |||||||||||||||||||||||||||
| 393 | 0 | print( $fd "$subject\n" ); | |||||||||||||||||||||||||||
| 394 | 0 | print( $fd "$body\n" ); | |||||||||||||||||||||||||||
| 395 | 0 | print( $fd '/ex'."\n" ); | |||||||||||||||||||||||||||
| 396 | } | ||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||
| 398 | 0 | return $self->{handle}; | |||||||||||||||||||||||||||
| 399 | } | ||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||
| 401 | sub processPending { | ||||||||||||||||||||||||||||
| 402 | # Sends any pending messages from the queue | ||||||||||||||||||||||||||||
| 403 | 0 | ▶ | my $self=shift; | ||||||||||||||||||||||||||
|
Subroutine
processPending: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||
| 405 | 0 | ▶ | while( my $message = shift( @{$self->pending_messages}) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 406 | 0 | $self->_sendPrivate( $message ); | |||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||
| 408 | } | ||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||
| 410 | sub process { | ||||||||||||||||||||||||||||
| 411 | # PRIVATE: Watches the connection, and parses dx spider results. | ||||||||||||||||||||||||||||
| 412 | # Returns when any messages have been read and the spider | ||||||||||||||||||||||||||||
| 413 | # has returned to a prompt. | ||||||||||||||||||||||||||||
| 414 | # returns 1 if idle, Or undef if a timeout occurs (not yet implemented) | ||||||||||||||||||||||||||||
| 415 | 0 | ▶ | my $self=shift; | ||||||||||||||||||||||||||
|
Subroutine
process: not called CC=14 SCAR=53.5
Pod
documented
| |||||||||||||||||||||||||||||
| 416 | 0 | my $fd=shift; | |||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||
| 418 | 0 | $fd->blocking(0); | |||||||||||||||||||||||||||
| 419 | 0 | my %message=( type=>'start poll' ); | |||||||||||||||||||||||||||
| 420 | 0 | ▶ | while ( %message ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 421 | 0 | ▶ | last unless $fd; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 422 | 0 | $_ = <$fd>; | |||||||||||||||||||||||||||
| 423 | 0 | ▶ | unless($_) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 424 | #Wait for more input if none available. | ||||||||||||||||||||||||||||
| 425 | 0 | sleep 1; | |||||||||||||||||||||||||||
| 426 | 0 | next; | |||||||||||||||||||||||||||
| 427 | } | ||||||||||||||||||||||||||||
| 428 | 0 | chomp; | |||||||||||||||||||||||||||
| 429 | 0 | s/(\r|\n)//g; | |||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||
| 431 | 0 | ▶ | (/^Enter your \*real\* Callsign to continue|login:/i) && do { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 432 | # Login | ||||||||||||||||||||||||||||
| 433 | 0 | sleep 1; | |||||||||||||||||||||||||||
| 434 | 0 | print( $fd $self->{callsign}."\n" ); | |||||||||||||||||||||||||||
| 435 | 0 | next; | |||||||||||||||||||||||||||
| 436 | }; | ||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||
| 438 | 0 | ▶ | (/^DX de ([^:]+):\s+([\d.]+)\s+(\S+)\s+(.*)$/) && do { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 439 | #DX de I5WEA: 7058.0 IV3/IK3SSW/P DCI-UD036 Op. TONY | ||||||||||||||||||||||||||||
| 440 | #DX de PA3GDY: 50108.6 UX2KA/P 599 KO31<es>JO21 1350Z JO21 | ||||||||||||||||||||||||||||
| 441 | 0 | my ($from,$freq,$heard,$comment)=($1,$2,$3,$4); | |||||||||||||||||||||||||||
| 442 | 0 | my ($locator,$time)=('',gmtime(time)); | |||||||||||||||||||||||||||
| 443 | 0 | $comment=~s/([A-Z]{2}\d{2})\s*/$locator=$1,''/e; | |||||||||||||||||||||||||||
| 444 | 0 | $comment=~s/(\d{4}[A-Z]{1})\s*/$time=$1,''/e; | |||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||
| 446 | 0 | my %dx = ( | |||||||||||||||||||||||||||
| 447 | time => $time, | ||||||||||||||||||||||||||||
| 448 | from => $from, | ||||||||||||||||||||||||||||
| 449 | frequency => $freq, | ||||||||||||||||||||||||||||
| 450 | heard => $heard, | ||||||||||||||||||||||||||||
| 451 | locator => $locator, | ||||||||||||||||||||||||||||
| 452 | message => $comment | ||||||||||||||||||||||||||||
| 453 | ); | ||||||||||||||||||||||||||||
| 454 | 0 | $self->dispatchStats( %dx ); | |||||||||||||||||||||||||||
| 455 | 0 | $self->dispatchDXMessage( %dx ); | |||||||||||||||||||||||||||
| 456 | 0 | $self->processPending(); # Process any mesages to send | |||||||||||||||||||||||||||
| 457 | 0 | next; | |||||||||||||||||||||||||||
| 458 | }; | ||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||
| 460 | 0 | ▶ | (/dxspider >$/i) && do { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 461 | #M1BSC de GB7EDX 16-Jun-2005 0857Z dxspider > | ||||||||||||||||||||||||||||
| 462 | # If we're back at a prompt, then no messages are being handled! | ||||||||||||||||||||||||||||
| 463 | 0 | ▶ | if (%message && ($message{type} eq 'private')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
%message and $message{"type"} eq "private"
MC/DC0%0/2
%message and $message{"type"} eq "private"
%message
$message{"type"} eq "private"
Truth table0%0/3
A and B
A= %messageB= $message{"type"} eq "private"
| |||||||||||||||||||||||||||||
| 464 | # Got a private message | ||||||||||||||||||||||||||||
| 465 | 0 | $self->dispatchPrivateMessage( %message ); | |||||||||||||||||||||||||||
| 466 | }; | ||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||
| 468 | 0 | $self->processPending(); # Process any mesages to send | |||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||
| 470 | 0 | %message=(); # Clear the received message | |||||||||||||||||||||||||||
| 471 | 0 | next; | |||||||||||||||||||||||||||
| 472 | }; | ||||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||
| 474 | 0 | ▶ | (/^New mail has arrived for you/i) && do { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 475 | #New mail has arrived for you | ||||||||||||||||||||||||||||
| 476 | 0 | print( $fd "read\n" ); | |||||||||||||||||||||||||||
| 477 | 0 | next; | |||||||||||||||||||||||||||
| 478 | }; | ||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||
| 480 | 0 | ▶ | (/^Msg: (\d+) From: (\S+) Date:\s+(\S+)\s+(\S+) Subj: (.*)$/) && do { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 481 | # Read subject and start body reading | ||||||||||||||||||||||||||||
| 482 | #Msg: 3960 From: M1BSC Date: 3-Jun 1022Z Subj: m1bsc 145.450 13:00 5/9 | ||||||||||||||||||||||||||||
| 483 | 0 | my ($id,$from,$date,$time,$subject)=($1,$2,$3,$4,$5); | |||||||||||||||||||||||||||
| 484 | %message=( | ||||||||||||||||||||||||||||
| 485 | type => 'private', | ||||||||||||||||||||||||||||
| 486 | from => $from, | ||||||||||||||||||||||||||||
| 487 | to => $self->{callsign}, | ||||||||||||||||||||||||||||
| 488 | 0 | subject => $subject, | |||||||||||||||||||||||||||
| 489 | body => '', | ||||||||||||||||||||||||||||
| 490 | time => $date, | ||||||||||||||||||||||||||||
| 491 | ); | ||||||||||||||||||||||||||||
| 492 | 0 | next; | |||||||||||||||||||||||||||
| 493 | }; | ||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||
| 495 | 0 | ▶ | (%message && $message{type} =~ /(private|public)/) && do { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
%message and $message{"type"} =~ /(private|public)/
MC/DC0%0/2
%message and $message{"type"} =~ /(private|public)/
%message
$message{"type"} =~ /(private|public)/
Truth table0%0/3
A and B
A= %messageB= $message{"type"} =~ /(private|public)/
| |||||||||||||||||||||||||||||
| 496 | # Read body text | ||||||||||||||||||||||||||||
| 497 | 0 | $message{body}.=$_."\n"; | |||||||||||||||||||||||||||
| 498 | 0 | next; | |||||||||||||||||||||||||||
| 499 | }; | ||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||
| 502 | 0 | ▶ | (/^To ([\w\d]+) de /) && do { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 503 | #To ALL de 9A8A: LZ2HM: FB..here band closed, for now..? | ||||||||||||||||||||||||||||
| 504 | 0 | next; | |||||||||||||||||||||||||||
| 505 | }; | ||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||
| 507 | } | ||||||||||||||||||||||||||||
| 508 | |||||||||||||||||||||||||||||
| 509 | 0 | return 1; | |||||||||||||||||||||||||||
| 510 | } | ||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||
| 512 | =head1 PREREQUISITES | ||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||
| 514 | =over | ||||||||||||||||||||||||||||
| 515 | |||||||||||||||||||||||||||||
| 516 | =item IO::Handle | ||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||
| 518 | =item IO::Socket | ||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||
| 520 | =item IO::Socket::INET | ||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||
| 522 | =item Moose | ||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||
| 524 | =item POSIX | ||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||
| 526 | =item Test::More | ||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||
| 528 | =back | ||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||
| 530 | =head1 OSNAMES | ||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||
| 532 | Unix or Unix-likes. | ||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||
| 534 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||
| 536 | Bruce James - custard@cpan.org | ||||||||||||||||||||||||||||
| 537 | |||||||||||||||||||||||||||||
| 538 | =head1 VERSION | ||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||
| 540 | 0.04 | ||||||||||||||||||||||||||||
| 541 | |||||||||||||||||||||||||||||
| 542 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||
| 544 | Copyright 2012, Bruce James | ||||||||||||||||||||||||||||
| 545 | |||||||||||||||||||||||||||||
| 546 | =head1 LICENSE | ||||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||
| 548 | This library is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 549 | it under the same terms as Perl itself. | ||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||
| 551 | =cut | ||||||||||||||||||||||||||||
| 552 | |||||||||||||||||||||||||||||
| 553 | 2 | 1; | |||||||||||||||||||||||||||
| 554 | |||||||||||||||||||||||||||||