line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
4
|
|
|
4
|
|
52050
|
use utf8; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
18
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Net::EGTS::Packet::Response; |
4
|
4
|
|
|
4
|
|
489
|
use namespace::autoclean; |
|
4
|
|
|
|
|
12911
|
|
|
4
|
|
|
|
|
14
|
|
5
|
4
|
|
|
4
|
|
510
|
use Mouse; |
|
4
|
|
|
|
|
20161
|
|
|
4
|
|
|
|
|
16
|
|
6
|
|
|
|
|
|
|
extends qw(Net::EGTS::Packet); |
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
1292
|
use Carp; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
192
|
|
9
|
4
|
|
|
4
|
|
420
|
use List::MoreUtils qw(natatime); |
|
4
|
|
|
|
|
8914
|
|
|
4
|
|
|
|
|
26
|
|
10
|
|
|
|
|
|
|
|
11
|
4
|
|
|
4
|
|
2528
|
use Net::EGTS::Types; |
|
4
|
|
|
|
|
73
|
|
|
4
|
|
|
|
|
90
|
|
12
|
4
|
|
|
4
|
|
279
|
use Net::EGTS::Codes; |
|
4
|
|
|
|
|
61
|
|
|
4
|
|
|
|
|
1000
|
|
13
|
4
|
|
|
4
|
|
270
|
use Net::EGTS::Util qw(usize); |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
347
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# Response Packet ID |
16
|
|
|
|
|
|
|
has RPID => is => 'rw', isa => 'USHORT'; |
17
|
|
|
|
|
|
|
# Processing Result |
18
|
|
|
|
|
|
|
has PR => is => 'rw', isa => 'BYTE'; |
19
|
|
|
|
|
|
|
# Service Data Record |
20
|
|
|
|
|
|
|
has SDR => is => 'rw', isa => 'Maybe[BINARY]'; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
after 'decode' => sub { |
23
|
|
|
|
|
|
|
my ($self) = @_; |
24
|
4
|
|
|
4
|
|
25
|
use bytes; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
24
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
die 'Packet not EGTS_PT_RESPONSE type' |
27
|
|
|
|
|
|
|
unless $self->PT == EGTS_PT_RESPONSE; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
return unless defined $self->SFRD; |
30
|
|
|
|
|
|
|
return unless length $self->SFRD; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
my $bin = $self->SFRD; |
33
|
|
|
|
|
|
|
$self->RPID( $self->nip(\$bin => 'S') ); |
34
|
|
|
|
|
|
|
$self->PR( $self->nip(\$bin => 'C') ); |
35
|
|
|
|
|
|
|
$self->SDR( $self->nip(\$bin => 'a*' => length($bin)) ); |
36
|
|
|
|
|
|
|
}; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
before 'encode' => sub { |
39
|
|
|
|
|
|
|
my ($self) = @_; |
40
|
4
|
|
|
4
|
|
529
|
use bytes; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
9
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
die 'Packet not EGTS_PT_RESPONSE type' |
43
|
|
|
|
|
|
|
unless $self->PT == EGTS_PT_RESPONSE; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
my $bin = pack 'S C' => $self->RPID, $self->PR; |
46
|
|
|
|
|
|
|
$bin .= pack 'a*' => $self->SDR if defined $self->SDR; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
$self->SFRD( $bin ); |
49
|
|
|
|
|
|
|
}; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
around BUILDARGS => sub { |
52
|
|
|
|
|
|
|
my $orig = shift; |
53
|
|
|
|
|
|
|
my $class = shift; |
54
|
|
|
|
|
|
|
return $class->$orig( @_, PT => EGTS_PT_RESPONSE ); |
55
|
|
|
|
|
|
|
}; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
augment as_debug => sub { |
58
|
|
|
|
|
|
|
my ($self) = @_; |
59
|
4
|
|
|
4
|
|
512
|
use bytes; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
16
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
my @bytes = ((unpack('B*', $self->SFRD)) =~ m{.{8}}g); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
my @str; |
64
|
|
|
|
|
|
|
push @str => sprintf('RPID: %s %s', splice @bytes, 0 => usize('S')); |
65
|
|
|
|
|
|
|
push @str => sprintf('PR: %s', splice @bytes, 0 => usize('C')); |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
my $it = natatime 4, @bytes; |
68
|
|
|
|
|
|
|
my @chunks; |
69
|
|
|
|
|
|
|
while (my @vals = $it->()) { |
70
|
|
|
|
|
|
|
push @chunks, join(' ', @vals); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
push @str => sprintf('SDR: %s', join("\n ", @chunks)); |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
return @str; |
75
|
|
|
|
|
|
|
}; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable(); |