CIGIPP/ShortComponentControl.pm

filter: Statementstmt 40.2% 70 / 174 Branchbran 19.1% 13 / 68 Conditioncond 33.3% 16 / 48 MC/DCmcdc 0.0% 0 / 18 Subroutinesub 51.6% 16 / 31 Podpod 100% 27 / 27 totaltotal 38.8% 142 / 366 CC 52 SCAR 31.8
CC
52
Cov
34%
component_class
84.3
data2_float
20.0
new
18.1
CRAP 24.0
« CIGIPP/SymbolTextDefinition.pm ↑ Summary CIGIPP/ComponentControl.pm »
1 #
2 # Rinchi Common Image Generator Interface for Perl
3 # Class Identifier: f78abfbe-200e-11de-bda5-001c25551abc
4 # Author: Brian M. Ames
5 #
6  
7 package Rinchi::CIGIPP::ShortComponentControl;
8  
9 2 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 2 require Exporter;
15  
16 2 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 2 our %EXPORT_TAGS = ( 'all' => [ qw(
26
27 ) ] );
28  
29 2 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
30  
31 2 our @EXPORT = qw(
32
33 );
34  
35 2 our $VERSION = '0.01';
36  
37 # Preloaded methods go here.
38  
39 =head1 NAME
40  
41 Rinchi::CIGIPP::ShortComponentControl - Perl extension for the Common Image
42 Generator Interface - Short Component Control data packet.
43 data packet.
44 =head1 SYNOPSIS
45  
46 use Rinchi::CIGIPP::ShortComponentControl;
47 my $scmp_ctl = Rinchi::CIGIPP::ShortComponentControl->new();
48  
49 $packet_type = $scmp_ctl->packet_type();
50 $packet_size = $scmp_ctl->packet_size();
51 $component_ident = $scmp_ctl->component_ident(8600);
52 $instance_ident = $scmp_ctl->instance_ident(3133);
53 $component_class = $scmp_ctl->component_class(Rinchi::CIGIPP->ViewCC);
54 $component_state = $scmp_ctl->component_state(67);
55 $data1 = $scmp_ctl->data1(43182);
56 $data2 = $scmp_ctl->data2(31535);
57  
58 =head1 DESCRIPTION
59  
60 The Short Component Control packet, like the Component Control packet, is a
61 generic packet used to control a variety of objects or functions on the IG.
62 This packet is provided as a lower-bandwidth alternative to the Component
63 Control packet for components that do not require more than two words of
64 component data.
65  
66 This packet uses the same Component ID and Instance ID mappings as the
67 Component Control packet. If the additional data fields offered by the
68 Component Control packet are not necessary for a component, then the two packet
69 types should be interchangeable. In other words, all components that can be
70 controlled with the Short Component Control packet can also be controlled with
71 the Component Control packet.
72  
73 When receiving a Short Component Control packet, the IG may copy the contents
74 of the packet into a Component Control structure, padding the remainder of the
75 packet with zeros (0). The two packet types can then be processed by the same
76 packet-handling routine.
77  
78 The Component Data 1 and Component Data 2 fields will be byte-swapped, if
79 necessary, as 32-bit data types. Data should be packed into 32-bit units as
80 described for the Component Control packet.
81  
82 =head2 EXPORT
83  
84 None by default.
85  
86 #==============================================================================
87  
88 =item new $scmp_ctl = Rinchi::CIGIPP::ShortComponentControl->new()
89  
90 Constructor for Rinchi::ShortComponentControl.
91  
92 =cut
93  
94 2 ▶sub new {
Subroutine new: called CC=7 SCAR=28.9
Pod documented
95 2 my $class = shift;
96 2 ▶ $class = ref($class) || $class;
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
020
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
97  
98 2 my $self = {
99 '_Buffer' => '',
100 '_ClassIdent' => 'f78abfbe-200e-11de-bda5-001c25551abc',
101 '_Pack' => 'CCSSCCII',
102 '_Swap1' => 'CCvvCCVV',
103 '_Swap2' => 'CCnnCCNN',
104 'packetType' => 5,
105 'packetSize' => 16,
106 'componentIdent' => 0,
107 'instanceIdent' => 0,
108 '_bitfields1' => 0, # Includes bitfields unused7, and componentClass.
109 'componentClass' => 0,
110 'componentState' => 0,
111 'data1' => 0,
112 'data2' => 0,
113 };
114  
115 2 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 2 2
116 0 ▶ if (ref($_[0]) eq 'ARRAY') {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $_[0] eq 'ARRAY') { } 0 0 0
elsif (ref $_[0] eq 'HASH') { } 0 0 0
117 0 $self->{'_Buffer'} = $_[0][0];
118 } elsif (ref($_[0]) eq 'HASH') {
119 0 foreach my $attr (keys %{$_[0]}) {
120 0 ▶ $self->{"_$attr"} = $_[0]->{$attr} unless ($attr =~ /^_/);
Branch: 1 branch
BranchTrueFalseTotal
unless $attr =~ /^_/ 0 0 0
121 }
122 }
123 }
124 2 $self->{'_LittleEndian'} = (CORE::unpack('v',CORE::pack('S',0x8000)) == 0x8000);
125  
126 2 bless($self,$class);
127 2 return $self;
128 }
129  
130 #==============================================================================
131  
132 =item sub packet_type()
133  
134 $value = $scmp_ctl->packet_type();
135  
136 Data Packet Identifier.
137  
138 This attribute identifies this data packet as the Short Component Control
139 packet. The value of this attribute must be 5.
140  
141 =cut
142  
143 2 ▶sub packet_type() {
Subroutine packet_type: called CC=1 SCAR=0.0
Pod documented
144 2 my ($self) = @_;
145 2 return $self->{'packetType'};
146 }
147  
148 #==============================================================================
149  
150 =item sub packet_size()
151  
152 $value = $scmp_ctl->packet_size();
153  
154 Data Packet Size.
155  
156 This attribute indicates the number of bytes in this data packet. The value of
157 this attribute must be 16.
158  
159 =cut
160  
161 2 ▶sub packet_size() {
Subroutine packet_size: called CC=1 SCAR=0.0
Pod documented
162 2 my ($self) = @_;
163 2 return $self->{'packetSize'};
164 }
165  
166 #==============================================================================
167  
168 =item sub component_ident([$newValue])
169  
170 $value = $scmp_ctl->component_ident($newValue);
171  
172 Component Identifier.
173  
174 This attribute uniquely identifies the component to which the data in this
175 packet should be applied.
176  
177 If Component Class is set to Regional Layered Weather (6), the weather layer ID
178 is specified by the most significant byte of Component ID.
179  
180 =cut
181  
182 2 ▶sub component_ident() {
Subroutine component_ident: called CC=2 SCAR=7.0
Pod documented
183 2 my ($self,$nv) = @_;
184 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
185 2 $self->{'componentIdent'} = $nv;
186 }
187 2 return $self->{'componentIdent'};
188 }
189  
190 #==============================================================================
191  
192 =item sub instance_ident([$newValue])
193  
194 $value = $scmp_ctl->instance_ident($newValue);
195  
196 Instance Identifier.
197  
198 This attribute uniquely identifies the object to which the component belongs.
199 This value corresponds to an entity ID, a view or view group ID, a sensor ID,
200 environmental region ID, global weather layer ID, or event ID depending upon
201 the value of the Component Class attribute.
202  
203 =cut
204  
205 2 ▶sub instance_ident() {
Subroutine instance_ident: called CC=2 SCAR=7.0
Pod documented
206 2 my ($self,$nv) = @_;
207 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
208 2 $self->{'instanceIdent'} = $nv;
209 }
210 2 return $self->{'instanceIdent'};
211 }
212  
213 #==============================================================================
214  
215 =item sub component_class([$newValue])
216  
217 $value = $scmp_ctl->component_class($newValue);
218  
219 Component Class.
220  
221 This attribute identifies the type of object to which the Instance ID attribute
222 refers. Both of these attributes are used in conjunction with Component ID to
223 uniquely identify a component in the simulation.
224  
225 EntityCC 0
226 ViewCC 1
227 ViewGroupCC 2
228 SensorCC 3
229 RegionalSeaSurfaceCC 4
230 RegionalTerrainSurfaceCC 5
231 RegionalLayeredWeatherCC 6
232 GlobalSeaSurfaceCC 7
233 GlobalTerrainSurfaceCC 8
234 GlobalLayeredWeatherCC 9
235 AtmosphereCC 10
236 CelestialSphereCC 11
237 EventCC 12
238 SystemCC 13
239 SymbolSurfaceCC 14
240 SymbolCC 15
241  
242 =cut
243  
244 2 ▶sub component_class() {
Subroutine component_class: called CC=18 SCAR=44.3
Pod documented
245 2 my ($self,$nv) = @_;
246 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
247 2 ▶ if (($nv==0) or ($nv==1) or ($nv==2) or ($nv==3) or ($nv==4) or ($nv==5) or ($nv==6) or ($nv==7) or ($nv==8) or ($nv==9) or ($nv==10) or ($nv==11) or ($nv==12) or ($nv==13) or ($nv==14) or ($nv==15)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7 or $nv == 8 or $nv == 9 or $nv == 10 or $nv == 11 or $nv == 12 or $nv == 13 or $nv == 14 or $nv == 15) { } 2 0 2
Condition33%15/45
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7 or $nv == 8 or $nv == 9 or $nv == 10 or $nv == 11 or $nv == 12 or $nv == 13 or $nv == 14 or $nv == 15
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7 or $nv == 8 or $nv == 9 or $nv == 10 or $nv == 11 or $nv == 12 or $nv == 13 or $nv == 14
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7 or $nv == 8 or $nv == 9 or $nv == 10 or $nv == 11 or $nv == 12 or $nv == 13
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7 or $nv == 8 or $nv == 9 or $nv == 10 or $nv == 11 or $nv == 12
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7 or $nv == 8 or $nv == 9 or $nv == 10 or $nv == 11
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7 or $nv == 8 or $nv == 9 or $nv == 10
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7 or $nv == 8 or $nv == 9
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7 or $nv == 8
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1
l!l&&r!l&&!r
020
MC/DC0%0/16
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7 or $nv == 8 or $nv == 9 or $nv == 10 or $nv == 11 or $nv == 12 or $nv == 13 or $nv == 14 or $nv == 15
$nv == 0 $nv == 1 $nv == 2 $nv == 3 $nv == 4 $nv == 5 $nv == 6 $nv == 7 $nv == 8 $nv == 9 $nv == 10 $nv == 11 $nv == 12 $nv == 13 $nv == 14 $nv == 15
Truth table5%1/17
A or B or C or D or E or F or G or H or I or J or K or L or M or N or O or P
A= $nv == 0B= $nv == 1C= $nv == 2D= $nv == 3E= $nv == 4F= $nv == 5G= $nv == 6H= $nv == 7I= $nv == 8J= $nv == 9K= $nv == 10L= $nv == 11M= $nv == 12N= $nv == 13O= $nv == 14P= $nv == 15
ABCDEFGHIJKLMNOPresult
1XXXXXXXXXXXXXXX1
01XXXXXXXXXXXXXX1
001XXXXXXXXXXXXX1
0001XXXXXXXXXXXX1
00001XXXXXXXXXXX1
000001XXXXXXXXXX1
0000001XXXXXXXXX1
00000001XXXXXXXX1
000000001XXXXXXX1
0000000001XXXXXX1
00000000001XXXXX1
000000000001XXXX1
0000000000001XXX1
00000000000001XX1
000000000000001X1
00000000000000011
00000000000000000
248 2 $self->{'componentClass'} = $nv;
249 2 $self->{'_bitfields1'} |= $nv &0x3F;
250 } else {
251 0 carp "component_class must be 0 (EntityCC), 1 (ViewCC), 2 (ViewGroupCC), 3 (SensorCC), 4 (RegionalSeaSurfaceCC), 5 (RegionalTerrainSurfaceCC), 6 (RegionalLayeredWeatherCC), 7 (GlobalSeaSurfaceCC), 8 (GlobalTerrainSurfaceCC), 9 (GlobalLayeredWeatherCC), 10 (AtmosphereCC), 11 (CelestialSphereCC), 12 (EventCC), 13 (SystemCC), 14 (SymbolSurfaceCC), or 15 (SymbolCC).";
252 }
253 }
254 2 return ($self->{'_bitfields1'} & 0x3F);
255 }
256  
257 #==============================================================================
258  
259 =item sub component_state([$newValue])
260  
261 $value = $scmp_ctl->component_state($newValue);
262  
263 Component State.
264  
265 This attribute specifies a discrete state for the component. If a discrete
266 state is not applicable to the component, this attribute is ignored.
267  
268 =cut
269  
270 2 ▶sub component_state() {
Subroutine component_state: called CC=2 SCAR=7.0
Pod documented
271 2 my ($self,$nv) = @_;
272 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
273 2 $self->{'componentState'} = $nv;
274 }
275 2 return $self->{'componentState'};
276 }
277  
278 #==============================================================================
279  
280 =item sub data1([$newValue])
281  
282 $value = $scmp_ctl->data1($newValue);
283  
284 Component Data 1.
285  
286 This attribute represents one of two 32-bit words used for user-defined
287 component data. If this attribute is not needed by the component, this value is
288 ignored.
289  
290 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
291 sender use different byte ordering schemes. If the attribute is used to store
292 multiple 8- or 16-bit values, the data should be packed so that byte swapping
293 will be performed correctly.
294  
295 =cut
296  
297 3 ▶sub data1() {
Subroutine data1: called CC=2 SCAR=7.0
Pod documented
298 3 my ($self,$nv) = @_;
299 3 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 3 0 3
300 3 $self->{'data1'} = $nv;
301 }
302 3 return $self->{'data1'};
303 }
304  
305 #==============================================================================
306  
307 =item sub data1_float([$newValue])
308  
309 $value = $scmp_ctl->data1_float($newValue);
310  
311 Component Data 1.
312  
313 This attribute represents as a float one of two 32-bit words used for user-defined
314 component data. If this attribute is not needed by the component, this value is
315 ignored.
316  
317 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
318 sender use different byte ordering schemes. If the attribute is used to store
319 multiple 8- or 16-bit values, the data should be packed so that byte swapping
320 will be performed correctly.
321  
322 =cut
323  
324 1 ▶sub data1_float() {
Subroutine data1_float: called CC=4 SCAR=20.1
Pod documented
325 1 my ($self,$nv) = @_;
326 1 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 0 1 1
327 0 my $nvp = CORE::pack('f',$nv);
328 0 ▶ if($self->{'_LittleEndian'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_LittleEndian'}) { } 0 0 0
329 0 $self->{'data1'} = CORE::unpack('V',$nvp);
330 } else {
331 0 $self->{'data1'} = CORE::unpack('N',$nvp);
332 }
333 }
334 1 ▶ if($self->{'_LittleEndian'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_LittleEndian'}) { } 1 0 1
335 1 return CORE::unpack('f',CORE::pack('V',$self->{'data1'}));
336 } else {
337 0 return CORE::unpack('f',CORE::pack('N',$self->{'data1'}));
338 }
339 }
340  
341 #==============================================================================
342  
343 =item sub data1_short1([$newValue])
344  
345 $value = $scmp_ctl->data1_short1($newValue);
346  
347 Component Data 1.
348  
349 This attribute represents as a short the two most significant bytes of one of
350 two 32-bit words used for user-defined component data. If this attribute is not
351 needed by the component, this value is ignored.
352  
353 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
354 sender use different byte ordering schemes. If the attribute is used to store
355 multiple 8- or 16-bit values, the data should be packed so that byte swapping
356 will be performed correctly.
357  
358 =cut
359  
360 0 ▶sub data1_short1() {
Subroutine data1_short1: not called CC=2 SCAR=17.9
Pod documented
361 0 my ($self,$nv) = @_;
362 0 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 0 0 0
363 0 $nv = (($nv & 0xFFFF) << 16) | ($self->{'data1'} & 0xFFFF);
364 0 $self->{'data1'} = $nv;
365 }
366 0 return ($self->{'data1'} >> 16) & 0xFFFF;
367 }
368  
369 #==============================================================================
370  
371 =item sub data1_short2([$newValue])
372  
373 $value = $scmp_ctl->data1_short2($newValue);
374  
375 Component Data 1.
376  
377 This attribute represents as a short the two least significant bytes of one of
378 two 32-bit words used for user-defined component data. If this attribute is not
379 needed by the component, this value is ignored.
380  
381 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
382 sender use different byte ordering schemes. If the attribute is used to store
383 multiple 8- or 16-bit values, the data should be packed so that byte swapping
384 will be performed correctly.
385  
386 =cut
387  
388 0 ▶sub data1_short2() {
Subroutine data1_short2: not called CC=2 SCAR=17.9
Pod documented
389 0 my ($self,$nv) = @_;
390 0 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 0 0 0
391 0 $nv = ($nv & 0xFFFF) | ($self->{'data1'} & 0xFFFF0000);
392 0 $self->{'data1'} = $nv;
393 }
394 0 return $self->{'data1'} & 0xFFFF;
395 }
396  
397 #==============================================================================
398  
399 =item sub data1_byte1([$newValue])
400  
401 $value = $scmp_ctl->data1_byte1($newValue);
402  
403 Component Data 1.
404  
405 This attribute represents the most significant byte of one of
406 two 32-bit words used for user-defined component data. If this attribute is not
407 needed by the component, this value is ignored.
408  
409 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
410 sender use different byte ordering schemes. If the attribute is used to store
411 multiple 8- or 16-bit values, the data should be packed so that byte swapping
412 will be performed correctly.
413  
414 =cut
415  
416 0 ▶sub data1_byte1() {
Subroutine data1_byte1: not called CC=2 SCAR=17.9
Pod documented
417 0 my ($self,$nv) = @_;
418 0 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 0 0 0
419 0 $nv = (($nv & 0xFF) << 24) | ($self->{'data1'} & 0xFFFFFF);
420 0 $self->{'data1'} = $nv;
421 }
422 0 return ($self->{'data1'} >> 24) & 0xFF;
423 }
424  
425 #==============================================================================
426  
427 =item sub data1_byte2([$newValue])
428  
429 $value = $scmp_ctl->data1_byte2($newValue);
430  
431 Component Data 1.
432  
433 This attribute represents the second most significant byte of one of
434 two 32-bit words used for user-defined component data. If this attribute is not
435 needed by the component, this value is ignored.
436  
437 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
438 sender use different byte ordering schemes. If the attribute is used to store
439 multiple 8- or 16-bit values, the data should be packed so that byte swapping
440 will be performed correctly.
441  
442 =cut
443  
444 0 ▶sub data1_byte2() {
Subroutine data1_byte2: not called CC=2 SCAR=17.9
Pod documented
445 0 my ($self,$nv) = @_;
446 0 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 0 0 0
447 0 $nv = (($nv & 0xFF) << 16) | ($self->{'data1'} & 0xFF00FFFF);
448 0 $self->{'data1'} = $nv;
449 }
450 0 return ($self->{'data1'} >> 16) & 0xFF;
451 }
452  
453 #==============================================================================
454  
455 =item sub data1_byte3([$newValue])
456  
457 $value = $scmp_ctl->data1_byte3($newValue);
458  
459 Component Data 1.
460  
461 This attribute represents the second least significant byte of one of
462 two 32-bit words used for user-defined component data. If this attribute is not
463 needed by the component, this value is ignored.
464  
465 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
466 sender use different byte ordering schemes. If the attribute is used to store
467 multiple 8- or 16-bit values, the data should be packed so that byte swapping
468 will be performed correctly.
469  
470 =cut
471  
472 0 ▶sub data1_byte3() {
Subroutine data1_byte3: not called CC=2 SCAR=17.9
Pod documented
473 0 my ($self,$nv) = @_;
474 0 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 0 0 0
475 0 $nv = (($nv & 0xFF) << 8) | ($self->{'data1'} & 0xFFFF00FF);
476 0 $self->{'data1'} = $nv;
477 }
478 0 return ($self->{'data1'} >> 8) & 0xFF;
479 }
480  
481 #==============================================================================
482  
483 =item sub data1_byte4([$newValue])
484  
485 $value = $scmp_ctl->data1_byte4($newValue);
486  
487 Component Data 1.
488  
489 This attribute represents the least significant byte of one of
490 two 32-bit words used for user-defined component data. If this attribute is not
491 needed by the component, this value is ignored.
492  
493 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
494 sender use different byte ordering schemes. If the attribute is used to store
495 multiple 8- or 16-bit values, the data should be packed so that byte swapping
496 will be performed correctly.
497  
498 =cut
499  
500 0 ▶sub data1_byte4() {
Subroutine data1_byte4: not called CC=2 SCAR=17.9
Pod documented
501 0 my ($self,$nv) = @_;
502 0 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 0 0 0
503 0 $nv = ($nv & 0xFF) | ($self->{'data1'} & 0xFFFFFF00);
504 0 $self->{'data1'} = $nv;
505 }
506 0 return $self->{'data1'} & 0xFF;
507 }
508  
509 #==============================================================================
510  
511 =item sub data1_and_2_double([$newValue])
512  
513 $value = $scmp_ctl->data1_and_2_double($newValue);
514  
515 Component Data 1.
516  
517 This attribute represents as a double both 32-bit words used for user-defined
518 component data. If this attribute is not needed by the component, this value is
519 ignored.
520  
521 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
522 sender use different byte ordering schemes. If the attribute is used to store
523 multiple 8- or 16-bit values, the data should be packed so that byte swapping
524 will be performed correctly.
525  
526 =cut
527  
528 2 ▶sub data1_and_2_double() {
Subroutine data1_and_2_double: called CC=4 SCAR=15.2
Pod documented
529 2 my ($self,$nv) = @_;
530 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
531 2 my $nvp = CORE::pack('d',$nv);
532 2 ▶ if($self->{'_LittleEndian'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_LittleEndian'}) { } 2 0 2
533 2 ($self->{'data2'}, $self->{'data1'}) = CORE::unpack('VV',$nvp);
534 } else {
535 0 ($self->{'data1'}, $self->{'data2'}) = CORE::unpack('NN',$nvp);
536 }
537 }
538 2 ▶ if($self->{'_LittleEndian'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_LittleEndian'}) { } 2 0 2
539 2 return CORE::unpack('d',CORE::pack('VV',$self->{'data2'}, $self->{'data1'}));
540 } else {
541 0 return CORE::unpack('d',CORE::pack('NV',$self->{'data1'}, $self->{'data2'}));
542 }
543 }
544  
545 #==============================================================================
546  
547 =item sub data2([$newValue])
548  
549 $value = $scmp_ctl->data2($newValue);
550  
551 Component Data 2.
552  
553 This attribute represents one of two 32-bit words used for user-defined
554 component data. If this attribute is not needed by the component, this value is
555 ignored.
556  
557 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
558 sender use different byte ordering schemes. If the attribute is used to store
559 multiple 8- or 16-bit values, the data should be packed so that byte swapping
560 will be performed correctly.
561  
562 =cut
563  
564 3 ▶sub data2() {
Subroutine data2: called CC=2 SCAR=7.0
Pod documented
565 3 my ($self,$nv) = @_;
566 3 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 3 0 3
567 3 $self->{'data2'} = $nv;
568 }
569 3 return $self->{'data2'};
570 }
571  
572 #==============================================================================
573  
574 =item sub data2_float([$newValue])
575  
576 $value = $scmp_ctl->data1_float($newValue);
577  
578 Component Data 2.
579  
580 This attribute represents as a float one of two 32-bit words used for user-defined
581 component data. If this attribute is not needed by the component, this value is
582 ignored.
583 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
584 sender use different byte ordering schemes. If the attribute is used to store
585 multiple 8- or 16-bit values, the data should be packed so that byte swapping
586 will be performed correctly.
587  
588 =cut
589  
590 0 ▶sub data2_float() {
Subroutine data2_float: not called CC=4 SCAR=30.0
Pod documented
591 0 my ($self,$nv) = @_;
592 0 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 0 0 0
593 0 my $nvp = CORE::pack('f',$nv);
594 0 ▶ if($self->{'_LittleEndian'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_LittleEndian'}) { } 0 0 0
595 0 $self->{'data2'} = CORE::unpack('V',$nvp);
596 } else {
597 0 $self->{'data2'} = CORE::unpack('N',$nvp);
598 }
599 }
600 0 ▶ if($self->{'_LittleEndian'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_LittleEndian'}) { } 0 0 0
601 0 return CORE::unpack('f',CORE::pack('V',$self->{'data2'}));
602 } else {
603 0 return CORE::unpack('f',CORE::pack('N',$self->{'data2'}));
604 }
605 }
606  
607 #==============================================================================
608  
609 =item sub data2_short1([$newValue])
610  
611 $value = $scmp_ctl->data2_short1($newValue);
612  
613 Component Data 2.
614  
615 This attribute represents as a short the two most significant bytes of one of
616 two 32-bit words used for user-defined component data. If this attribute is not
617 needed by the component, this value is ignored.
618  
619 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
620 sender use different byte ordering schemes. If the attribute is used to store
621 multiple 8- or 16-bit values, the data should be packed so that byte swapping
622 will be performed correctly.
623  
624 =cut
625  
626 0 ▶sub data2_short1() {
Subroutine data2_short1: not called CC=2 SCAR=17.9
Pod documented
627 0 my ($self,$nv) = @_;
628 0 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 0 0 0
629 0 $nv = (($nv & 0xFFFF) << 16) | ($self->{'data2'} & 0xFFFF);
630 0 $self->{'data2'} = $nv;
631 }
632 0 return ($self->{'data2'} >> 16) & 0xFFFF;
633 }
634  
635 #==============================================================================
636  
637 =item sub data2_short2([$newValue])
638  
639 $value = $scmp_ctl->data2_short2($newValue);
640  
641 Component Data 2.
642  
643 This attribute represents as a short the two least significant bytes of one of
644 two 32-bit words used for user-defined component data. If this attribute is not
645 needed by the component, this value is ignored.
646  
647 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
648 sender use different byte ordering schemes. If the attribute is used to store
649 multiple 8- or 16-bit values, the data should be packed so that byte swapping
650 will be performed correctly.
651  
652 =cut
653  
654 0 ▶sub data2_short2() {
Subroutine data2_short2: not called CC=2 SCAR=17.9
Pod documented
655 0 my ($self,$nv) = @_;
656 0 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 0 0 0
657 0 $nv = ($nv & 0xFFFF) | ($self->{'data2'} & 0xFFFF0000);
658 0 $self->{'data2'} = $nv;
659 }
660 0 return $self->{'data2'} & 0xFFFF;
661 }
662  
663 #==============================================================================
664  
665 =item sub data2_byte1([$newValue])
666  
667 $value = $scmp_ctl->data2_byte1($newValue);
668  
669 Component Data 2.
670  
671 This attribute represents the most significant byte of one of
672 two 32-bit words used for user-defined component data. If this attribute is not
673 needed by the component, this value is ignored.
674  
675 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
676 sender use different byte ordering schemes. If the attribute is used to store
677 multiple 8- or 16-bit values, the data should be packed so that byte swapping
678 will be performed correctly.
679  
680 =cut
681  
682 0 ▶sub data2_byte1() {
Subroutine data2_byte1: not called CC=2 SCAR=17.9
Pod documented
683 0 my ($self,$nv) = @_;
684 0 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 0 0 0
685 0 $nv = (($nv & 0xFF) << 24) | ($self->{'data2'} & 0xFFFFFF);
686 0 $self->{'data2'} = $nv;
687 }
688 0 return ($self->{'data2'} >> 24) & 0xFF;
689 }
690  
691 #==============================================================================
692  
693 =item sub data2_byte2([$newValue])
694  
695 $value = $scmp_ctl->data2_byte2($newValue);
696  
697 Component Data 2.
698  
699 This attribute represents the second most significant byte of one of
700 two 32-bit words used for user-defined component data. If this attribute is not
701 needed by the component, this value is ignored.
702  
703 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
704 sender use different byte ordering schemes. If the attribute is used to store
705 multiple 8- or 16-bit values, the data should be packed so that byte swapping
706 will be performed correctly.
707  
708 =cut
709  
710 0 ▶sub data2_byte2() {
Subroutine data2_byte2: not called CC=2 SCAR=17.9
Pod documented
711 0 my ($self,$nv) = @_;
712 0 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 0 0 0
713 0 $nv = (($nv & 0xFF) << 16) | ($self->{'data2'} & 0xFF00FFFF);
714 0 $self->{'data2'} = $nv;
715 }
716 0 return ($self->{'data2'} >> 16) & 0xFF;
717 }
718  
719 #==============================================================================
720  
721 =item sub data2_byte3([$newValue])
722  
723 $value = $scmp_ctl->data2_byte3($newValue);
724  
725 Component Data 2.
726  
727 This attribute represents the second least significant byte of one of
728 two 32-bit words used for user-defined component data. If this attribute is not
729 needed by the component, this value is ignored.
730  
731 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
732 sender use different byte ordering schemes. If the attribute is used to store
733 multiple 8- or 16-bit values, the data should be packed so that byte swapping
734 will be performed correctly.
735  
736 =cut
737  
738 0 ▶sub data2_byte3() {
Subroutine data2_byte3: not called CC=2 SCAR=17.9
Pod documented
739 0 my ($self,$nv) = @_;
740 0 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 0 0 0
741 0 $nv = (($nv & 0xFF) << 8) | ($self->{'data2'} & 0xFFFF00FF);
742 0 $self->{'data2'} = $nv;
743 }
744 0 return ($self->{'data2'} >> 8) & 0xFF;
745 }
746  
747 #==============================================================================
748  
749 =item sub data2_byte4([$newValue])
750  
751 $value = $scmp_ctl->data2_byte4($newValue);
752  
753 Component Data 2.
754  
755 This attribute represents the least significant byte of one of
756 two 32-bit words used for user-defined component data. If this attribute is not
757 needed by the component, this value is ignored.
758  
759 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
760 sender use different byte ordering schemes. If the attribute is used to store
761 multiple 8- or 16-bit values, the data should be packed so that byte swapping
762 will be performed correctly.
763  
764 =cut
765  
766 0 ▶sub data2_byte4() {
Subroutine data2_byte4: not called CC=2 SCAR=17.9
Pod documented
767 0 my ($self,$nv) = @_;
768 0 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 0 0 0
769 0 $nv = ($nv & 0xFF) | ($self->{'data2'} & 0xFFFFFF00);
770 0 $self->{'data2'} = $nv;
771 }
772 0 return $self->{'data2'} & 0xFF;
773 }
774  
775 #==========================================================================
776  
777 =item sub pack()
778  
779 $value = $scmp_ctl->pack();
780  
781 Returns the packed data packet.
782  
783 =cut
784  
785 2 ▶sub pack($) {
Subroutine pack: called CC=1 SCAR=0.0
Pod documented
786 2 my $self = shift ;
787
788 $self->{'_Buffer'} = CORE::pack($self->{'_Pack'},
789 $self->{'packetType'},
790 $self->{'packetSize'},
791 $self->{'componentIdent'},
792 $self->{'instanceIdent'},
793 $self->{'_bitfields1'}, # Includes bitfields unused7, and componentClass.
794 $self->{'componentState'},
795 $self->{'data1'},
796 2 $self->{'data2'},
797 );
798  
799 2 return $self->{'_Buffer'};
800 }
801  
802 #==========================================================================
803  
804 =item sub unpack()
805  
806 $value = $scmp_ctl->unpack();
807  
808 Unpacks the packed data packet.
809  
810 =cut
811  
812 0 ▶sub unpack($) {
Subroutine unpack: not called CC=2 SCAR=17.9
Pod documented
813 0 my $self = shift @_;
814
815 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
816 0 $self->{'_Buffer'} = shift @_;
817 }
818 0 my ($a,$b,$c,$d,$e,$f,$g,$h) = CORE::unpack($self->{'_Pack'},$self->{'_Buffer'});
819 0 $self->{'packetType'} = $a;
820 0 $self->{'packetSize'} = $b;
821 0 $self->{'componentIdent'} = $c;
822 0 $self->{'instanceIdent'} = $d;
823 0 $self->{'_bitfields1'} = $e; # Includes bitfields unused7, and componentClass.
824 0 $self->{'componentState'} = $f;
825 0 $self->{'data1'} = $g;
826 0 $self->{'data2'} = $h;
827  
828 0 $self->{'componentClass'} = $self->component_class();
829  
830 0 return $self->{'_Buffer'};
831 }
832  
833 #==========================================================================
834  
835 =item sub byte_swap()
836  
837 $obj_name->byte_swap();
838  
839 Byte swaps the packed data packet.
840  
841 =cut
842  
843 0 ▶sub byte_swap($) {
Subroutine byte_swap: not called CC=2 SCAR=17.9
Pod documented
844 0 my $self = shift @_;
845
846 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
847 0 $self->{'_Buffer'} = shift @_;
848 } else {
849 0 $self->pack();
850 }
851 0 my ($a,$b,$c,$d,$e,$f,$g,$h) = CORE::unpack($self->{'_Swap1'},$self->{'_Buffer'});
852  
853 0 $self->{'_Buffer'} = CORE::pack($self->{'_Swap2'},$a,$b,$c,$d,$e,$f,$g,$h);
854 0 $self->unpack();
855  
856 0 return $self->{'_Buffer'};
857 }
858  
859 #==========================================================================
860  
861 2 1;
862 __END__
« CIGIPP/SymbolTextDefinition.pm ↑ Summary CIGIPP/ComponentControl.pm »