File Coverage

blib/lib/Rinchi/CIGIPP/AnimationStopNotification.pm
Criterion Covered Total %
statement 29 51 56.8
branch 2 14 14.2
condition 1 3 33.3
subroutine 9 11 81.8
pod 7 7 100.0
total 48 86 55.8


line stmt bran cond sub pod time code
1             #
2             # Rinchi Common Image Generator Interface for Perl
3             # Class Identifier: f78b3deb-200e-11de-bdd4-001c25551abc
4             # Author: Brian M. Ames
5             #
6              
7             package Rinchi::CIGIPP::AnimationStopNotification;
8              
9 1     1   19 use 5.006;
  1         130  
  1         47  
10 1     1   7 use strict;
  1         2  
  1         29  
11 1     1   5 use warnings;
  1         1  
  1         34  
12 1     1   5 use Carp;
  1         2  
  1         1073  
13              
14             require Exporter;
15              
16             our @ISA = qw(Exporter);
17              
18             # Items to export into callers namespace by default. Note: do not export
19             # names by default without a very good reason. Use EXPORT_OK instead.
20             # Do not simply export all your public functions/methods/constants.
21              
22             # This allows declaration use Rinchi::CIGI::AtmosphereControl ':all';
23             # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
24             # will save memory.
25             our %EXPORT_TAGS = ( 'all' => [ qw(
26            
27             ) ] );
28              
29             our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
30              
31             our @EXPORT = qw(
32            
33             );
34              
35             our $VERSION = '0.01';
36              
37             # Preloaded methods go here.
38              
39             =head1 NAME
40              
41             Rinchi::CIGIPP::AnimationStopNotification - Perl extension for the Common Image
42             Generator Interface - Animation Stop Notification data packet.
43             data packet.
44             =head1 SYNOPSIS
45              
46             use Rinchi::CIGIPP::AnimationStopNotification;
47             my $stop_ntc = Rinchi::CIGIPP::AnimationStopNotification->new();
48              
49             $packet_type = $stop_ntc->packet_type();
50             $packet_size = $stop_ntc->packet_size();
51             $entity_ident = $stop_ntc->entity_ident(44464);
52              
53             =head1 DESCRIPTION
54              
55             The Animation Stop Notification packet is used to indicate to the Host when an
56             animation has played to the end of its animation sequence.
57              
58             =head2 EXPORT
59              
60             None by default.
61              
62             #==============================================================================
63              
64             =item new $stop_ntc = Rinchi::CIGIPP::AnimationStopNotification->new()
65              
66             Constructor for Rinchi::AnimationStopNotification.
67              
68             =cut
69              
70             sub new {
71 1     1 1 58 my $class = shift;
72 1   33     6 $class = ref($class) || $class;
73              
74 1         16 my $self = {
75             '_Buffer' => '',
76             '_ClassIdent' => 'f78b3deb-200e-11de-bdd4-001c25551abc',
77             '_Pack' => 'CCSI',
78             '_Swap1' => 'CCvV',
79             '_Swap2' => 'CCnN',
80             'packetType' => 115,
81             'packetSize' => 8,
82             'entityIdent' => 0,
83             '_unused88' => 0,
84             };
85              
86 1 50       3 if (@_) {
87 0 0       0 if (ref($_[0]) eq 'ARRAY') {
    0          
88 0         0 $self->{'_Buffer'} = $_[0][0];
89             } elsif (ref($_[0]) eq 'HASH') {
90 0         0 foreach my $attr (keys %{$_[0]}) {
  0         0  
91 0 0       0 $self->{"_$attr"} = $_[0]->{$attr} unless ($attr =~ /^_/);
92             }
93             }
94             }
95              
96 1         3 bless($self,$class);
97 1         3 return $self;
98             }
99              
100             #==============================================================================
101              
102             =item sub packet_type()
103              
104             $value = $stop_ntc->packet_type();
105              
106             Data Packet Identifier.
107              
108             This attribute identifies this data packet as the Animation Stop Notification
109             packet. The value of this attribute must be 115.
110              
111             =cut
112              
113             sub packet_type() {
114 1     1 1 12 my ($self) = @_;
115 1         7 return $self->{'packetType'};
116             }
117              
118             #==============================================================================
119              
120             =item sub packet_size()
121              
122             $value = $stop_ntc->packet_size();
123              
124             Data Packet Size.
125              
126             This attribute indicates the number of bytes in this data packet. The value of
127             this attribute must be 8.
128              
129             =cut
130              
131             sub packet_size() {
132 1     1 1 7 my ($self) = @_;
133 1         4 return $self->{'packetSize'};
134             }
135              
136             #==============================================================================
137              
138             =item sub entity_ident([$newValue])
139              
140             $value = $stop_ntc->entity_ident($newValue);
141              
142             Entity ID.
143              
144             This attribute indicates the entity ID of the animation that has stopped.
145              
146             =cut
147              
148             sub entity_ident() {
149 1     1 1 5 my ($self,$nv) = @_;
150 1 50       4 if (defined($nv)) {
151 1         2 $self->{'entityIdent'} = $nv;
152             }
153 1         2 return $self->{'entityIdent'};
154             }
155              
156             #==========================================================================
157              
158             =item sub pack()
159              
160             $value = $stop_ntc->pack();
161              
162             Returns the packed data packet.
163              
164             =cut
165              
166             sub pack($) {
167 1     1 1 5 my $self = shift ;
168            
169 1         5 $self->{'_Buffer'} = CORE::pack($self->{'_Pack'},
170             $self->{'packetType'},
171             $self->{'packetSize'},
172             $self->{'entityIdent'},
173             $self->{'_unused88'},
174             );
175              
176 1         3 return $self->{'_Buffer'};
177             }
178              
179             #==========================================================================
180              
181             =item sub unpack()
182              
183             $value = $stop_ntc->unpack();
184              
185             Unpacks the packed data packet.
186              
187             =cut
188              
189             sub unpack($) {
190 0     0 1   my $self = shift @_;
191            
192 0 0         if (@_) {
193 0           $self->{'_Buffer'} = shift @_;
194             }
195 0           my ($a,$b,$c,$d) = CORE::unpack($self->{'_Pack'},$self->{'_Buffer'});
196 0           $self->{'packetType'} = $a;
197 0           $self->{'packetSize'} = $b;
198 0           $self->{'entityIdent'} = $c;
199 0           $self->{'_unused88'} = $d;
200              
201 0           return $self->{'_Buffer'};
202             }
203              
204             #==========================================================================
205              
206             =item sub byte_swap()
207              
208             $obj_name->byte_swap();
209              
210             Byte swaps the packed data packet.
211              
212             =cut
213              
214             sub byte_swap($) {
215 0     0 1   my $self = shift @_;
216            
217 0 0         if (@_) {
218 0           $self->{'_Buffer'} = shift @_;
219             } else {
220 0           $self->pack();
221             }
222 0           my ($a,$b,$c,$d) = CORE::unpack($self->{'_Swap1'},$self->{'_Buffer'});
223              
224 0           $self->{'_Buffer'} = CORE::pack($self->{'_Swap2'},$a,$b,$c,$d);
225 0           $self->unpack();
226              
227 0           return $self->{'_Buffer'};
228             }
229              
230             1;
231             __END__