dbg("AGW error Unsolicited Data!");
}
} elsif ($sort eq 'I' || $sort eq 'S' || $sort eq 'U' || $sort eq 'M' || $sort eq 'T') {
dbg("AGW error Unsolicited Data!");
}
} elsif ($sort eq 'I' || $sort eq 'S' || $sort eq 'U' || $sort eq 'M' || $sort eq 'T') {
my $d = unpack "Z*", $data;
$d =~ s/\cM\cJ?$//;
dbg("AGW Connect port: $port pid: $pid '$from'->'$to' \"$d\"") if isdbg('agw');
my $d = unpack "Z*", $data;
$d =~ s/\cM\cJ?$//;
dbg("AGW Connect port: $port pid: $pid '$from'->'$to' \"$d\"") if isdbg('agw');
- if ($call =~ /^(\w+)-(\d\d?)$/) {
- my $c = $1;
- my $s = $2;
- $s = 15 - $s;
- if ($s <= 8 && $s > 0) {
- $call = "${c}-${s}";
- } else {
- $call = $c;
- }
+ if (my ($c, $s) = $call =~ /^(\w+)-(\d\d?)$/) {
+ $s = 15 - $s if $s > 8;
+ $call = $s > 0 ? "${c}-${s}" : $c;
my $d = unpack "Z*", $data;
$d =~ s/\cM\cJ?$//;
dbg("AGW '$from'->'$to' port: $port Disconnected ($d)") if isdbg('agw');
my $d = unpack "Z*", $data;
$d =~ s/\cM\cJ?$//;
dbg("AGW '$from'->'$to' port: $port Disconnected ($d)") if isdbg('agw');
my ($frames) = unpack "V", $data;
dbg("AGW Frames Outstanding on port $port = $frames") if isdbg('agwpollans');
my $conn = _find($from);
$conn->{oframes} = $frames if $conn;
} elsif ($sort eq 'Y') {
my ($frames) = unpack "V", $data;
dbg("AGW Frames Outstanding on port $port = $frames") if isdbg('agwpollans');
my $conn = _find($from);
$conn->{oframes} = $frames if $conn;
} elsif ($sort eq 'Y') {
my ($frames) = unpack "V", $data;
dbg("AGW Frames Outstanding on circuit '$from'->'$to' = $frames") if isdbg('agw');
my $conn = _find($from eq $main::mycall ? $to : $from);
$conn->{oframes} = $frames if $conn;
} elsif ($sort eq 'H') {
my ($frames) = unpack "V", $data;
dbg("AGW Frames Outstanding on circuit '$from'->'$to' = $frames") if isdbg('agw');
my $conn = _find($from eq $main::mycall ? $to : $from);
$conn->{oframes} = $frames if $conn;
} elsif ($sort eq 'H') {
unless ($from =~ /^\s+$/) {
my $d = unpack "Z*", $data;
$d =~ s/\cM\cJ?$//;
dbg("AGW Heard port: $port \"$d\"") if isdbg('agw');
}
} elsif ($sort eq 'X') {
unless ($from =~ /^\s+$/) {
my $d = unpack "Z*", $data;
$d =~ s/\cM\cJ?$//;
dbg("AGW Heard port: $port \"$d\"") if isdbg('agw');
}
} elsif ($sort eq 'X') {
my ($r) = unpack "C", $data;
$r = $r ? "Successful" : "Failed";
dbg("AGW Register $from $r");
finish() unless $r;
} elsif ($sort eq 'R') {
my ($r) = unpack "C", $data;
$r = $r ? "Successful" : "Failed";
dbg("AGW Register $from $r");
finish() unless $r;
} elsif ($sort eq 'R') {
my ($major, $minor) = unpack "v x2 v x2", $data;
dbg("AGW Version $major.$minor") if isdbg('agw');
} elsif ($sort eq 'G') {
my ($major, $minor) = unpack "v x2 v x2", $data;
dbg("AGW Version $major.$minor") if isdbg('agw');
} elsif ($sort eq 'G') {
my @ports = split /;/, $data;
$noports = shift @ports || '0';
dbg("AGW $noports Ports available") if isdbg('agw');
my @ports = split /;/, $data;
$noports = shift @ports || '0';
dbg("AGW $noports Ports available") if isdbg('agw');
_sendf('g', undef, undef, $i);
}
} else {
_sendf('g', undef, undef, $i);
}
} else {
my $d = unpack "Z*", $data;
dbg("AGW decode $sort port: $port pid: $pid '$from'->'$to' length: $len \"$d\"") if isdbg('agw');
}
my $d = unpack "Z*", $data;
dbg("AGW decode $sort port: $port pid: $pid '$from'->'$to' length: $len \"$d\"") if isdbg('agw');
}