File Coverage

blib/lib/Rinchi/CIGIPP/ComponentControl.pm
Criterion Covered Total %
statement 81 361 22.4
branch 16 160 10.0
condition 3 48 6.2
subroutine 21 65 32.3
pod 61 61 100.0
total 182 695 26.1


line stmt bran cond sub pod time code
1             #
2             # Rinchi Common Image Generator Interface for Perl
3             # Class Identifier: f78abd0c-200e-11de-bda4-001c25551abc
4             # Author: Brian M. Ames
5             #
6              
7             package Rinchi::CIGIPP::ComponentControl;
8              
9 1     1   35 use 5.006;
  1         4  
  1         54  
10 1     1   7 use strict;
  1         2  
  1         41  
11 1     1   7 use warnings;
  1         2  
  1         2355  
12 1     1   15 use Carp;
  1         2  
  1         20936  
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::ComponentControl - Perl extension for the Common Image
42             Generator Interface - Component Control data packet.
43             data packet.
44             =head1 SYNOPSIS
45              
46             use Rinchi::CIGIPP::ComponentControl;
47             my $cmp_ctl = Rinchi::CIGIPP::ComponentControl->new();
48              
49             $packet_type = $cmp_ctl->packet_type();
50             $packet_size = $cmp_ctl->packet_size();
51             $component_ident = $cmp_ctl->component_ident(37562);
52             $instance_ident = $cmp_ctl->instance_ident(26282);
53             $component_class = $cmp_ctl->component_class(Rinchi::CIGIPP->EntityCC);
54             $component_state = $cmp_ctl->component_state(245);
55             $data1 = $cmp_ctl->data1(26);
56             $data2 = $cmp_ctl->data2(383);
57             $data3 = $cmp_ctl->data3(25589);
58             $data4 = $cmp_ctl->data4(28613);
59             $data5 = $cmp_ctl->data5(23541);
60             $data6 = $cmp_ctl->data6(43464);
61              
62             =head1 DESCRIPTION
63              
64             The Component Control packet is provided as a generic mechanism to control
65             various components within the simulation. Because CIGI is designed to be a
66             general-purpose interface, only the most common attributes of entities, views,
67             and other objects are explicitly represented by attributes within specific data
68             packets. Other attributes can be represented by components.
69              
70             Components may correspond to parts or properties of entities, views and view
71             groups, sensors, weather and environment, terrain, and even the IG itself. The
72             type of object possessing the component is identified by the Component Class
73             attribute. The specific instance of that object is specified by the Instance ID
74             attribute. Depending upon the value of the Component Class attribute, the
75             instance ID might correspond to an Entity ID, a view ID, an environmental
76             attribute, etc. The Component ID attribute uniquely identifies the component
77             for the instance.
78              
79             Each component has zero or more discrete states, and/or up to six user-defined
80             values. The user-defined values may either be integers or floating-point real
81             numbers. A light, for instance, might have two discrete states (On and Off), an
82             RGB color value represented as a 32-bit integer, and a real-value intensity
83             level. A component representing the global lightpoint intensity value might
84             have a real-value intensity level and no discrete states.
85              
86             Regardless of how the six user-defined data fields are formatted, they will be
87             byte-swapped as separate 32-bit values if the Host and IG use different byte
88             ordering schemes. This ensures that all Component Control packets are
89             byte-swapped in a consistent manner. The data should be packaged using masks
90             and bit-wise operations so that the values are not changed when the 32-bit
91             words are byte-swapped.
92              
93             =head2 EXPORT
94              
95             None by default.
96              
97             #==============================================================================
98              
99             =item new $cmp_ctl = Rinchi::CIGIPP::ComponentControl->new()
100              
101             Constructor for Rinchi::ComponentControl.
102              
103             =cut
104              
105             sub new {
106 1     1 1 256 my $class = shift;
107 1   33     6 $class = ref($class) || $class;
108              
109 1         17 my $self = {
110             '_Buffer' => '',
111             '_ClassIdent' => 'f78abd0c-200e-11de-bda4-001c25551abc',
112             '_Pack' => 'CCSSCCIIIIII',
113             '_Swap1' => 'CCvvCCVVVVVV',
114             '_Swap2' => 'CCnnCCNNNNNN',
115             'packetType' => 4,
116             'packetSize' => 32,
117             'componentIdent' => 0,
118             'instanceIdent' => 0,
119             '_bitfields1' => 0, # Includes bitfields unused6, and componentClass.
120             'componentClass' => 0,
121             'componentState' => 0,
122             'data1' => 0,
123             'data2' => 0,
124             'data3' => 0,
125             'data4' => 0,
126             'data5' => 0,
127             'data6' => 0,
128             };
129              
130 1 50       5 if (@_) {
131 0 0       0 if (ref($_[0]) eq 'ARRAY') {
    0          
132 0         0 $self->{'_Buffer'} = $_[0][0];
133             } elsif (ref($_[0]) eq 'HASH') {
134 0         0 foreach my $attr (keys %{$_[0]}) {
  0         0  
135 0 0       0 $self->{"_$attr"} = $_[0]->{$attr} unless ($attr =~ /^_/);
136             }
137             }
138             }
139 1         7 $self->{'_LittleEndian'} = (CORE::unpack('v',CORE::pack('S',0x8000)) == 0x8000);
140              
141 1         3 bless($self,$class);
142 1         4 return $self;
143             }
144              
145             #==============================================================================
146              
147             =item sub packet_type()
148              
149             $value = $cmp_ctl->packet_type();
150              
151             Data Packet Identifier.
152              
153             This attribute identifies this data packet as the Component Control packet. The
154             value of this attribute must be 4.
155              
156             =cut
157              
158             sub packet_type() {
159 1     1 1 6 my ($self) = @_;
160 1         8 return $self->{'packetType'};
161             }
162              
163             #==============================================================================
164              
165             =item sub packet_size()
166              
167             $value = $cmp_ctl->packet_size();
168              
169             Data Packet Size.
170              
171             This attribute indicates the number of bytes in this data packet. The value of
172             this attribute must be 32.
173              
174             =cut
175              
176             sub packet_size() {
177 1     1 1 6 my ($self) = @_;
178 1         3 return $self->{'packetSize'};
179             }
180              
181             #==============================================================================
182              
183             =item sub component_ident([$newValue])
184              
185             $value = $cmp_ctl->component_ident($newValue);
186              
187             Component Identifier.
188              
189             This attribute uniquely identifies the component to which the data in this
190             packet should be applied.
191              
192             If Component Class is set to Regional Layered Weather (6), the weather layer ID
193             is specified by the most significant byte of Component ID.
194              
195             =cut
196              
197             sub component_ident() {
198 1     1 1 6 my ($self,$nv) = @_;
199 1 50       5 if (defined($nv)) {
200 1         2 $self->{'componentIdent'} = $nv;
201             }
202 1         3 return $self->{'componentIdent'};
203             }
204              
205             #==============================================================================
206              
207             =item sub instance_ident([$newValue])
208              
209             $value = $cmp_ctl->instance_ident($newValue);
210              
211             Instance Identifier.
212              
213             This attribute uniquely identifies the object to which the component belongs.
214             This value corresponds to an entity ID, a view or view group ID, a sensor ID,
215             environmental region ID, global weather layer ID, or event ID depending upon
216             the value of the Component Class attribute.
217              
218             =cut
219              
220             sub instance_ident() {
221 1     1 1 5 my ($self,$nv) = @_;
222 1 50       4 if (defined($nv)) {
223 1         2 $self->{'instanceIdent'} = $nv;
224             }
225 1         3 return $self->{'instanceIdent'};
226             }
227              
228             #==============================================================================
229              
230             =item sub component_class([$newValue])
231              
232             $value = $cmp_ctl->component_class($newValue);
233              
234             Component Class.
235              
236             This attribute identifies the type of object to which the Instance ID attribute
237             refers. Both of these attributes are used in conjunction with Component ID to
238             uniquely identify a component in the simulation.
239              
240             EntityCC 0
241             ViewCC 1
242             ViewGroupCC 2
243             SensorCC 3
244             RegionalSeaSurfaceCC 4
245             RegionalTerrainSurfaceCC 5
246             RegionalLayeredWeatherCC 6
247             GlobalSeaSurfaceCC 7
248             GlobalTerrainSurfaceCC 8
249             GlobalLayeredWeatherCC 9
250             AtmosphereCC 10
251             CelestialSphereCC 11
252             EventCC 12
253             SystemCC 13
254             SymbolSurfaceCC 14
255             SymbolCC 15
256              
257             =cut
258              
259             sub component_class() {
260 1     1 1 2 my ($self,$nv) = @_;
261 1 50       16 if (defined($nv)) {
262 1 50 33     6 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)) {
      33        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
263 1         3 $self->{'componentClass'} = $nv;
264 1         3 $self->{'_bitfields1'} |= $nv &0x3F;
265             } else {
266 0         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).";
267             }
268             }
269 1         3 return ($self->{'_bitfields1'} & 0x3F);
270             }
271              
272             #==============================================================================
273              
274             =item sub component_state([$newValue])
275              
276             $value = $cmp_ctl->component_state($newValue);
277              
278             Component State.
279              
280             This attribute specifies a discrete state for the component. If a discrete
281             state is not applicable to the component, this attribute is ignored.
282              
283             =cut
284              
285             sub component_state() {
286 1     1 1 5 my ($self,$nv) = @_;
287 1 50       4 if (defined($nv)) {
288 1         2 $self->{'componentState'} = $nv;
289             }
290 1         3 return $self->{'componentState'};
291             }
292              
293             #==============================================================================
294              
295             =item sub data1([$newValue])
296              
297             $value = $cmp_ctl->data1($newValue);
298              
299             Component Data 1.
300              
301             This attribute represents one of six 32-bit words used for user-defined
302             component data. If this attribute is not needed by the component, this value is
303             ignored.
304              
305             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
306             sender use different byte ordering schemes. If the attribute is used to store
307             multiple 8- or 16-bit values, the data should be packed so that byte swapping
308             will be performed correctly. Use data1_short1 and data1_short2 for 16-bit values,
309             or data1_byte1, data1_byte2, data1_byte3, and data1_byte4 for 8-bit values.
310              
311             =cut
312              
313             sub data1() {
314 1     1 1 5 my ($self,$nv) = @_;
315 1 50       3 if (defined($nv)) {
316 1         3 $self->{'data1'} = $nv;
317             }
318 1         3 return $self->{'data1'};
319             }
320              
321             #==============================================================================
322              
323             =item sub data1_float([$newValue])
324              
325             $value = $cmp_ctl->data1_float($newValue);
326              
327             Component Data 1.
328              
329             This attribute represents as a float one of six 32-bit words used for user-defined
330             component data. If this attribute is not needed by the component, this value is
331             ignored.
332              
333             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
334             sender use different byte ordering schemes. If the attribute is used to store
335             multiple 8- or 16-bit values, the data should be packed so that byte swapping
336             will be performed correctly.
337              
338             =cut
339              
340             sub data1_float() {
341 1     1 1 5 my ($self,$nv) = @_;
342 1 50       5 if (defined($nv)) {
343 0         0 my $nvp = CORE::pack('f',$nv);
344 0 0       0 if($self->{'_LittleEndian'}) {
345 0         0 $self->{'data1'} = CORE::unpack('V',$nvp);
346             } else {
347 0         0 $self->{'data1'} = CORE::unpack('N',$nvp);
348             }
349             }
350 1 50       3 if($self->{'_LittleEndian'}) {
351 1         7 return CORE::unpack('f',CORE::pack('V',$self->{'data1'}));
352             } else {
353 0         0 return CORE::unpack('f',CORE::pack('N',$self->{'data1'}));
354             }
355             }
356              
357             #==============================================================================
358              
359             =item sub data1_short1([$newValue])
360              
361             $value = $cmp_ctl->data1_short1($newValue);
362              
363             Component Data 1.
364              
365             This attribute represents as a short the two most significant bytes of one of
366             six 32-bit words used for user-defined component data. If this attribute is not
367             needed by the component, this value is ignored.
368              
369             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
370             sender use different byte ordering schemes. If the attribute is used to store
371             multiple 8- or 16-bit values, the data should be packed so that byte swapping
372             will be performed correctly.
373              
374             =cut
375              
376             sub data1_short1() {
377 0     0 1 0 my ($self,$nv) = @_;
378 0 0       0 if (defined($nv)) {
379 0         0 $nv = (($nv & 0xFFFF) << 16) | ($self->{'data1'} & 0xFFFF);
380 0         0 $self->{'data1'} = $nv;
381             }
382 0         0 return ($self->{'data1'} >> 16) & 0xFFFF;
383             }
384              
385             #==============================================================================
386              
387             =item sub data1_short2([$newValue])
388              
389             $value = $cmp_ctl->data1_short2($newValue);
390              
391             Component Data 1.
392              
393             This attribute represents as a short the two least significant bytes of one of
394             six 32-bit words used for user-defined component data. If this attribute is not
395             needed by the component, this value is ignored.
396              
397             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
398             sender use different byte ordering schemes. If the attribute is used to store
399             multiple 8- or 16-bit values, the data should be packed so that byte swapping
400             will be performed correctly.
401              
402             =cut
403              
404             sub data1_short2() {
405 0     0 1 0 my ($self,$nv) = @_;
406 0 0       0 if (defined($nv)) {
407 0         0 $nv = ($nv & 0xFFFF) | ($self->{'data1'} & 0xFFFF0000);
408 0         0 $self->{'data1'} = $nv;
409             }
410 0         0 return $self->{'data1'} & 0xFFFF;
411             }
412              
413             #==============================================================================
414              
415             =item sub data1_byte1([$newValue])
416              
417             $value = $cmp_ctl->data1_byte1($newValue);
418              
419             Component Data 1.
420              
421             This attribute represents the most significant byte of one of
422             six 32-bit words used for user-defined component data. If this attribute is not
423             needed by the component, this value is ignored.
424              
425             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
426             sender use different byte ordering schemes. If the attribute is used to store
427             multiple 8- or 16-bit values, the data should be packed so that byte swapping
428             will be performed correctly.
429              
430             =cut
431              
432             sub data1_byte1() {
433 0     0 1 0 my ($self,$nv) = @_;
434 0 0       0 if (defined($nv)) {
435 0         0 $nv = (($nv & 0xFF) << 24) | ($self->{'data1'} & 0xFFFFFF);
436 0         0 $self->{'data1'} = $nv;
437             }
438 0         0 return ($self->{'data1'} >> 24) & 0xFF;
439             }
440              
441             #==============================================================================
442              
443             =item sub data1_byte2([$newValue])
444              
445             $value = $cmp_ctl->data1_byte2($newValue);
446              
447             Component Data 1.
448              
449             This attribute represents the second most significant byte of one of
450             six 32-bit words used for user-defined component data. If this attribute is not
451             needed by the component, this value is ignored.
452              
453             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
454             sender use different byte ordering schemes. If the attribute is used to store
455             multiple 8- or 16-bit values, the data should be packed so that byte swapping
456             will be performed correctly.
457              
458             =cut
459              
460             sub data1_byte2() {
461 0     0 1 0 my ($self,$nv) = @_;
462 0 0       0 if (defined($nv)) {
463 0         0 $nv = (($nv & 0xFF) << 16) | ($self->{'data1'} & 0xFF00FFFF);
464 0         0 $self->{'data1'} = $nv;
465             }
466 0         0 return ($self->{'data1'} >> 16) & 0xFF;
467             }
468              
469             #==============================================================================
470              
471             =item sub data1_byte3([$newValue])
472              
473             $value = $cmp_ctl->data1_byte3($newValue);
474              
475             Component Data 1.
476              
477             This attribute represents the second least significant byte of one of
478             six 32-bit words used for user-defined component data. If this attribute is not
479             needed by the component, this value is ignored.
480              
481             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
482             sender use different byte ordering schemes. If the attribute is used to store
483             multiple 8- or 16-bit values, the data should be packed so that byte swapping
484             will be performed correctly.
485              
486             =cut
487              
488             sub data1_byte3() {
489 0     0 1 0 my ($self,$nv) = @_;
490 0 0       0 if (defined($nv)) {
491 0         0 $nv = (($nv & 0xFF) << 8) | ($self->{'data1'} & 0xFFFF00FF);
492 0         0 $self->{'data1'} = $nv;
493             }
494 0         0 return ($self->{'data1'} >> 8) & 0xFF;
495             }
496              
497             #==============================================================================
498              
499             =item sub data1_byte4([$newValue])
500              
501             $value = $cmp_ctl->data1_byte4($newValue);
502              
503             Component Data 1.
504              
505             This attribute represents the least significant byte of one of
506             six 32-bit words used for user-defined component data. If this attribute is not
507             needed by the component, this value is ignored.
508              
509             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
510             sender use different byte ordering schemes. If the attribute is used to store
511             multiple 8- or 16-bit values, the data should be packed so that byte swapping
512             will be performed correctly.
513              
514             =cut
515              
516             sub data1_byte4() {
517 0     0 1 0 my ($self,$nv) = @_;
518 0 0       0 if (defined($nv)) {
519 0         0 $nv = ($nv & 0xFF) | ($self->{'data1'} & 0xFFFFFF00);
520 0         0 $self->{'data1'} = $nv;
521             }
522 0         0 return $self->{'data1'} & 0xFF;
523             }
524              
525             #==============================================================================
526              
527             =item sub data1_and_2_double([$newValue])
528              
529             $value = $cmp_ctl->data1_and_2_double($newValue);
530              
531             Component Data 1.
532              
533             This attribute represents as a double two of six 32-bit words used for user-defined
534             component data. If this attribute is not needed by the component, this value is
535             ignored.
536              
537             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
538             sender use different byte ordering schemes. If the attribute is used to store
539             multiple 8- or 16-bit values, the data should be packed so that byte swapping
540             will be performed correctly.
541              
542             =cut
543              
544             sub data1_and_2_double() {
545 0     0 1 0 my ($self,$nv) = @_;
546 0 0       0 if (defined($nv)) {
547 0         0 my $nvp = CORE::pack('d',$nv);
548 0 0       0 if($self->{'_LittleEndian'}) {
549 0         0 ($self->{'data2'}, $self->{'data1'}) = CORE::unpack('VV',$nvp);
550             } else {
551 0         0 ($self->{'data1'}, $self->{'data2'}) = CORE::unpack('NN',$nvp);
552             }
553             }
554 0 0       0 if($self->{'_LittleEndian'}) {
555 0         0 return CORE::unpack('d',CORE::pack('VV',$self->{'data2'}, $self->{'data1'}));
556             } else {
557 0         0 return CORE::unpack('d',CORE::pack('NV',$self->{'data1'}, $self->{'data2'}));
558             }
559             }
560              
561             #==============================================================================
562              
563             =item sub data2([$newValue])
564              
565             $value = $cmp_ctl->data2($newValue);
566              
567             Component Data 2.
568              
569             This attribute represents one of six 32-bit words used for user-defined
570             component data. If this attribute is not needed by the component, this value is
571             ignored.
572              
573             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
574             sender use different byte ordering schemes. If the attribute is used to store
575             multiple 8- or 16-bit values, the data should be packed so that byte swapping
576             will be performed correctly. Use data2_short1 and data2_short2 for 16-bit values,
577             or data2_byte1, data2_byte2, data2_byte3, and data2_byte4 for 8-bit values.
578              
579             =cut
580              
581             sub data2() {
582 1     1 1 6 my ($self,$nv) = @_;
583 1 50       3 if (defined($nv)) {
584 0         0 $self->{'data2'} = $nv;
585             }
586 1         11 return $self->{'data2'};
587             }
588              
589             #==============================================================================
590              
591             =item sub data2_float([$newValue])
592              
593             $value = $cmp_ctl->data2_float($newValue);
594              
595             Component Data 2.
596              
597             This attribute represents as a float one of six 32-bit words used for user-defined
598             component data. If this attribute is not needed by the component, this value is
599             ignored.
600              
601             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
602             sender use different byte ordering schemes. If the attribute is used to store
603             multiple 8- or 16-bit values, the data should be packed so that byte swapping
604             will be performed correctly.
605              
606             =cut
607              
608             sub data2_float() {
609 0     0 1 0 my ($self,$nv) = @_;
610 0 0       0 if (defined($nv)) {
611 0         0 my $nvp = CORE::pack('f',$nv);
612 0 0       0 if($self->{'_LittleEndian'}) {
613 0         0 $self->{'data2'} = CORE::unpack('V',$nvp);
614             } else {
615 0         0 $self->{'data2'} = CORE::unpack('N',$nvp);
616             }
617             }
618 0 0       0 if($self->{'_LittleEndian'}) {
619 0         0 return CORE::unpack('f',CORE::pack('V',$self->{'data2'}));
620             } else {
621 0         0 return CORE::unpack('f',CORE::pack('N',$self->{'data2'}));
622             }
623             }
624              
625             #==============================================================================
626              
627             =item sub data2_short1([$newValue])
628              
629             $value = $cmp_ctl->data2_short1($newValue);
630              
631             Component Data 2.
632              
633             This attribute represents as a short the two most significant bytes of one of
634             six 32-bit words used for user-defined component data. If this attribute is not
635             needed by the component, this value is ignored.
636              
637             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
638             sender use different byte ordering schemes. If the attribute is used to store
639             multiple 8- or 16-bit values, the data should be packed so that byte swapping
640             will be performed correctly.
641              
642             =cut
643              
644             sub data2_short1() {
645 1     1 1 3 my ($self,$nv) = @_;
646 1 50       4 if (defined($nv)) {
647 1         4 $nv = (($nv & 0xFFFF) << 16) | ($self->{'data2'} & 0xFFFF);
648 1         2 $self->{'data2'} = $nv;
649             }
650 1         3 return ($self->{'data2'} >> 16) & 0xFFFF;
651             }
652              
653             #==============================================================================
654              
655             =item sub data2_short2([$newValue])
656              
657             $value = $cmp_ctl->data2_short2($newValue);
658              
659             Component Data 2.
660              
661             This attribute represents as a short the two least significant bytes of one of
662             six 32-bit words used for user-defined component data. If this attribute is not
663             needed by the component, this value is ignored.
664              
665             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
666             sender use different byte ordering schemes. If the attribute is used to store
667             multiple 8- or 16-bit values, the data should be packed so that byte swapping
668             will be performed correctly.
669              
670             =cut
671              
672             sub data2_short2() {
673 1     1 1 5 my ($self,$nv) = @_;
674 1 50       4 if (defined($nv)) {
675 1         3 $nv = ($nv & 0xFFFF) | ($self->{'data2'} & 0xFFFF0000);
676 1         2 $self->{'data2'} = $nv;
677             }
678 1         4 return $self->{'data2'} & 0xFFFF;
679             }
680              
681             #==============================================================================
682              
683             =item sub data2_byte1([$newValue])
684              
685             $value = $cmp_ctl->data2_byte1($newValue);
686              
687             Component Data 2.
688              
689             This attribute represents the most significant byte of one of
690             six 32-bit words used for user-defined component data. If this attribute is not
691             needed by the component, this value is ignored.
692              
693             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
694             sender use different byte ordering schemes. If the attribute is used to store
695             multiple 8- or 16-bit values, the data should be packed so that byte swapping
696             will be performed correctly.
697              
698             =cut
699              
700             sub data2_byte1() {
701 0     0 1 0 my ($self,$nv) = @_;
702 0 0       0 if (defined($nv)) {
703 0         0 $nv = (($nv & 0xFF) << 24) | ($self->{'data2'} & 0xFFFFFF);
704 0         0 $self->{'data2'} = $nv;
705             }
706 0         0 return ($self->{'data2'} >> 24) & 0xFF;
707             }
708              
709             #==============================================================================
710              
711             =item sub data2_byte2([$newValue])
712              
713             $value = $cmp_ctl->data2_byte2($newValue);
714              
715             Component Data 2.
716              
717             This attribute represents the second most significant byte of one of
718             six 32-bit words used for user-defined component data. If this attribute is not
719             needed by the component, this value is ignored.
720              
721             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
722             sender use different byte ordering schemes. If the attribute is used to store
723             multiple 8- or 16-bit values, the data should be packed so that byte swapping
724             will be performed correctly.
725              
726             =cut
727              
728             sub data2_byte2() {
729 0     0 1 0 my ($self,$nv) = @_;
730 0 0       0 if (defined($nv)) {
731 0         0 $nv = (($nv & 0xFF) << 16) | ($self->{'data2'} & 0xFF00FFFF);
732 0         0 $self->{'data2'} = $nv;
733             }
734 0         0 return ($self->{'data2'} >> 16) & 0xFF;
735             }
736              
737             #==============================================================================
738              
739             =item sub data2_byte3([$newValue])
740              
741             $value = $cmp_ctl->data2_byte3($newValue);
742              
743             Component Data 2.
744              
745             This attribute represents the second least significant byte of one of
746             six 32-bit words used for user-defined component data. If this attribute is not
747             needed by the component, this value is ignored.
748              
749             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
750             sender use different byte ordering schemes. If the attribute is used to store
751             multiple 8- or 16-bit values, the data should be packed so that byte swapping
752             will be performed correctly.
753              
754             =cut
755              
756             sub data2_byte3() {
757 0     0 1 0 my ($self,$nv) = @_;
758 0 0       0 if (defined($nv)) {
759 0         0 $nv = (($nv & 0xFF) << 8) | ($self->{'data2'} & 0xFFFF00FF);
760 0         0 $self->{'data2'} = $nv;
761             }
762 0         0 return ($self->{'data2'} >> 8) & 0xFF;
763             }
764              
765             #==============================================================================
766              
767             =item sub data2_byte4([$newValue])
768              
769             $value = $cmp_ctl->data2_byte4($newValue);
770              
771             Component Data 2.
772              
773             This attribute represents the least significant byte of one of
774             six 32-bit words used for user-defined component data. If this attribute is not
775             needed by the component, this value is ignored.
776              
777             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
778             sender use different byte ordering schemes. If the attribute is used to store
779             multiple 8- or 16-bit values, the data should be packed so that byte swapping
780             will be performed correctly.
781              
782             =cut
783              
784             sub data2_byte4() {
785 0     0 1 0 my ($self,$nv) = @_;
786 0 0       0 if (defined($nv)) {
787 0         0 $nv = ($nv & 0xFF) | ($self->{'data2'} & 0xFFFFFF00);
788 0         0 $self->{'data2'} = $nv;
789             }
790 0         0 return $self->{'data2'} & 0xFF;
791             }
792              
793             #==============================================================================
794              
795             =item sub data3([$newValue])
796              
797             $value = $cmp_ctl->data3($newValue);
798              
799             Component Data 3.
800              
801             This attribute represents one of six 32-bit words used for user-defined
802             component data. If this attribute is not needed by the component, this value is
803             ignored.
804              
805             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
806             sender use different byte ordering schemes. If the attribute is used to store
807             multiple 8- or 16-bit values, the data should be packed so that byte swapping
808             will be performed correctly. Use data3_short1 and data3_short2 for 16-bit values,
809             or data3_byte1, data3_byte2, data3_byte3, and data3_byte4 for 8-bit values.
810              
811             =cut
812              
813             sub data3() {
814 1     1 1 3 my ($self,$nv) = @_;
815 1 50       3 if (defined($nv)) {
816 1         2 $self->{'data3'} = $nv;
817             }
818 1         4 return $self->{'data3'};
819             }
820              
821             #==============================================================================
822              
823             =item sub data3_float([$newValue])
824              
825             $value = $cmp_ctl->data3_float($newValue);
826              
827             Component Data 3.
828              
829             This attribute represents as a float one of six 32-bit words used for user-defined
830             component data. If this attribute is not needed by the component, this value is
831             ignored.
832              
833             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
834             sender use different byte ordering schemes. If the attribute is used to store
835             multiple 8- or 16-bit values, the data should be packed so that byte swapping
836             will be performed correctly.
837              
838             =cut
839              
840             sub data3_float() {
841 0     0 1 0 my ($self,$nv) = @_;
842 0 0       0 if (defined($nv)) {
843 0         0 my $nvp = CORE::pack('f',$nv);
844 0 0       0 if($self->{'_LittleEndian'}) {
845 0         0 $self->{'data3'} = CORE::unpack('V',$nvp);
846             } else {
847 0         0 $self->{'data3'} = CORE::unpack('N',$nvp);
848             }
849             }
850 0 0       0 if($self->{'_LittleEndian'}) {
851 0         0 return CORE::unpack('f',CORE::pack('V',$self->{'data3'}));
852             } else {
853 0         0 return CORE::unpack('f',CORE::pack('N',$self->{'data3'}));
854             }
855             }
856              
857             #==============================================================================
858              
859             =item sub data3_short1([$newValue])
860              
861             $value = $cmp_ctl->data3_short1($newValue);
862              
863             Component Data 3.
864              
865             This attribute represents as a short the two most significant bytes of one of
866             six 32-bit words used for user-defined component data. If this attribute is not
867             needed by the component, this value is ignored.
868              
869             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
870             sender use different byte ordering schemes. If the attribute is used to store
871             multiple 8- or 16-bit values, the data should be packed so that byte swapping
872             will be performed correctly.
873              
874             =cut
875              
876             sub data3_short1() {
877 0     0 1 0 my ($self,$nv) = @_;
878 0 0       0 if (defined($nv)) {
879 0         0 $nv = (($nv & 0xFFFF) << 16) | ($self->{'data3'} & 0xFFFF);
880 0         0 $self->{'data3'} = $nv;
881             }
882 0         0 return ($self->{'data3'} >> 16) & 0xFFFF;
883             }
884              
885             #==============================================================================
886              
887             =item sub data3_short2([$newValue])
888              
889             $value = $cmp_ctl->data3_short2($newValue);
890              
891             Component Data 3.
892              
893             This attribute represents as a short the two least significant bytes of one of
894             six 32-bit words used for user-defined component data. If this attribute is not
895             needed by the component, this value is ignored.
896              
897             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
898             sender use different byte ordering schemes. If the attribute is used to store
899             multiple 8- or 16-bit values, the data should be packed so that byte swapping
900             will be performed correctly.
901              
902             =cut
903              
904             sub data3_short2() {
905 0     0 1 0 my ($self,$nv) = @_;
906 0 0       0 if (defined($nv)) {
907 0         0 $nv = ($nv & 0xFFFF) | ($self->{'data3'} & 0xFFFF0000);
908 0         0 $self->{'data3'} = $nv;
909             }
910 0         0 return $self->{'data3'} & 0xFFFF;
911             }
912              
913             #==============================================================================
914              
915             =item sub data3_byte1([$newValue])
916              
917             $value = $cmp_ctl->data3_byte1($newValue);
918              
919             Component Data 3.
920              
921             This attribute represents the most significant byte of one of
922             six 32-bit words used for user-defined component data. If this attribute is not
923             needed by the component, this value is ignored.
924              
925             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
926             sender use different byte ordering schemes. If the attribute is used to store
927             multiple 8- or 16-bit values, the data should be packed so that byte swapping
928             will be performed correctly.
929              
930             =cut
931              
932             sub data3_byte1() {
933 0     0 1 0 my ($self,$nv) = @_;
934 0 0       0 if (defined($nv)) {
935 0         0 $nv = (($nv & 0xFF) << 24) | ($self->{'data3'} & 0xFFFFFF);
936 0         0 $self->{'data3'} = $nv;
937             }
938 0         0 return ($self->{'data3'} >> 24) & 0xFF;
939             }
940              
941             #==============================================================================
942              
943             =item sub data3_byte2([$newValue])
944              
945             $value = $cmp_ctl->data3_byte2($newValue);
946              
947             Component Data 3.
948              
949             This attribute represents the second most significant byte of one of
950             six 32-bit words used for user-defined component data. If this attribute is not
951             needed by the component, this value is ignored.
952              
953             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
954             sender use different byte ordering schemes. If the attribute is used to store
955             multiple 8- or 16-bit values, the data should be packed so that byte swapping
956             will be performed correctly.
957              
958             =cut
959              
960             sub data3_byte2() {
961 0     0 1 0 my ($self,$nv) = @_;
962 0 0       0 if (defined($nv)) {
963 0         0 $nv = (($nv & 0xFF) << 16) | ($self->{'data3'} & 0xFF00FFFF);
964 0         0 $self->{'data3'} = $nv;
965             }
966 0         0 return ($self->{'data3'} >> 16) & 0xFF;
967             }
968              
969             #==============================================================================
970              
971             =item sub data3_byte3([$newValue])
972              
973             $value = $cmp_ctl->data3_byte3($newValue);
974              
975             Component Data 3.
976              
977             This attribute represents the second least significant byte of one of
978             six 32-bit words used for user-defined component data. If this attribute is not
979             needed by the component, this value is ignored.
980              
981             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
982             sender use different byte ordering schemes. If the attribute is used to store
983             multiple 8- or 16-bit values, the data should be packed so that byte swapping
984             will be performed correctly.
985              
986             =cut
987              
988             sub data3_byte3() {
989 0     0 1 0 my ($self,$nv) = @_;
990 0 0       0 if (defined($nv)) {
991 0         0 $nv = (($nv & 0xFF) << 8) | ($self->{'data3'} & 0xFFFF00FF);
992 0         0 $self->{'data3'} = $nv;
993             }
994 0         0 return ($self->{'data3'} >> 8) & 0xFF;
995             }
996              
997             #==============================================================================
998              
999             =item sub data3_byte4([$newValue])
1000              
1001             $value = $cmp_ctl->data3_byte4($newValue);
1002              
1003             Component Data 3.
1004              
1005             This attribute represents the least significant byte of one of
1006             six 32-bit words used for user-defined component data. If this attribute is not
1007             needed by the component, this value is ignored.
1008              
1009             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
1010             sender use different byte ordering schemes. If the attribute is used to store
1011             multiple 8- or 16-bit values, the data should be packed so that byte swapping
1012             will be performed correctly.
1013              
1014             =cut
1015              
1016             sub data3_byte4() {
1017 0     0 1 0 my ($self,$nv) = @_;
1018 0 0       0 if (defined($nv)) {
1019 0         0 $nv = ($nv & 0xFF) | ($self->{'data3'} & 0xFFFFFF00);
1020 0         0 $self->{'data3'} = $nv;
1021             }
1022 0         0 return $self->{'data3'} & 0xFF;
1023             }
1024              
1025             #==============================================================================
1026              
1027             =item sub data3_and_4_double([$newValue])
1028              
1029             $value = $cmp_ctl->data3_and_4_double($newValue);
1030              
1031             Component Data 3 and 4.
1032              
1033             This attribute represents as a double two of six 32-bit words used for user-defined
1034             component data. If this attribute is not needed by the component, this value is
1035             ignored.
1036              
1037             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
1038             sender use different byte ordering schemes. If the attribute is used to store
1039             multiple 8- or 16-bit values, the data should be packed so that byte swapping
1040             will be performed correctly.
1041              
1042             =cut
1043              
1044             sub data3_and_4_double() {
1045 0     0 1 0 my ($self,$nv) = @_;
1046 0 0       0 if (defined($nv)) {
1047 0         0 my $nvp = CORE::pack('d',$nv);
1048 0 0       0 if($self->{'_LittleEndian'}) {
1049 0         0 ($self->{'data4'}, $self->{'data3'}) = CORE::unpack('VV',$nvp);
1050             } else {
1051 0         0 ($self->{'data3'}, $self->{'data4'}) = CORE::unpack('NN',$nvp);
1052             }
1053             }
1054 0 0       0 if($self->{'_LittleEndian'}) {
1055 0         0 return CORE::unpack('d',CORE::pack('VV',$self->{'data4'}, $self->{'data3'}));
1056             } else {
1057 0         0 return CORE::unpack('d',CORE::pack('NV',$self->{'data3'}, $self->{'data4'}));
1058             }
1059             }
1060              
1061             #==============================================================================
1062              
1063             =item sub data4([$newValue])
1064              
1065             $value = $cmp_ctl->data4($newValue);
1066              
1067             Component Data 4.
1068              
1069             This attribute represents one of six 32-bit words used for user-defined
1070             component data. If this attribute is not needed by the component, this value is
1071             ignored.
1072              
1073             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
1074             sender use different byte ordering schemes. If the attribute is used to store
1075             multiple 8- or 16-bit values, the data should be packed so that byte swapping
1076             will be performed correctly. Use data4_short1 and data4_short2 for 16-bit values,
1077             or data4_byte1, data4_byte2, data4_byte3, and data4_byte4 for 8-bit values.
1078              
1079             =cut
1080              
1081             sub data4() {
1082 1     1 1 7 my ($self,$nv) = @_;
1083 1 50       4 if (defined($nv)) {
1084 1         3 $self->{'data4'} = $nv;
1085             }
1086 1         3 return $self->{'data4'};
1087             }
1088              
1089             #==============================================================================
1090              
1091             =item sub data4_float([$newValue])
1092              
1093             $value = $cmp_ctl->data1_float($newValue);
1094              
1095             Component Data 4.
1096              
1097             This attribute represents as a float one of six 32-bit words used for user-defined
1098             component data. If this attribute is not needed by the component, this value is
1099             ignored.
1100              
1101             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
1102             sender use different byte ordering schemes. If the attribute is used to store
1103             multiple 8- or 16-bit values, the data should be packed so that byte swapping
1104             will be performed correctly.
1105              
1106             =cut
1107              
1108             sub data4_float() {
1109 0     0 1 0 my ($self,$nv) = @_;
1110 0 0       0 if (defined($nv)) {
1111 0         0 my $nvp = CORE::pack('f',$nv);
1112 0 0       0 if($self->{'_LittleEndian'}) {
1113 0         0 $self->{'data4'} = CORE::unpack('V',$nvp);
1114             } else {
1115 0         0 $self->{'data4'} = CORE::unpack('N',$nvp);
1116             }
1117             }
1118 0 0       0 if($self->{'_LittleEndian'}) {
1119 0         0 return CORE::unpack('f',CORE::pack('V',$self->{'data4'}));
1120             } else {
1121 0         0 return CORE::unpack('f',CORE::pack('N',$self->{'data4'}));
1122             }
1123             }
1124              
1125             #==============================================================================
1126              
1127             =item sub data4_short1([$newValue])
1128              
1129             $value = $cmp_ctl->data4_short1($newValue);
1130              
1131             Component Data 4.
1132              
1133             This attribute represents as a short the two most significant bytes of one of
1134             six 32-bit words used for user-defined component data. If this attribute is not
1135             needed by the component, this value is ignored.
1136              
1137             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
1138             sender use different byte ordering schemes. If the attribute is used to store
1139             multiple 8- or 16-bit values, the data should be packed so that byte swapping
1140             will be performed correctly.
1141              
1142             =cut
1143              
1144             sub data4_short1() {
1145 0     0 1 0 my ($self,$nv) = @_;
1146 0 0       0 if (defined($nv)) {
1147 0         0 $nv = (($nv & 0xFFFF) << 16) | ($self->{'data4'} & 0xFFFF);
1148 0         0 $self->{'data4'} = $nv;
1149             }
1150 0         0 return ($self->{'data4'} >> 16) & 0xFFFF;
1151             }
1152              
1153             #==============================================================================
1154              
1155             =item sub data4_short2([$newValue])
1156              
1157             $value = $cmp_ctl->data4_short2($newValue);
1158              
1159             Component Data 4.
1160              
1161             This attribute represents as a short the two least significant bytes of one of
1162             six 32-bit words used for user-defined component data. If this attribute is not
1163             needed by the component, this value is ignored.
1164              
1165             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
1166             sender use different byte ordering schemes. If the attribute is used to store
1167             multiple 8- or 16-bit values, the data should be packed so that byte swapping
1168             will be performed correctly.
1169              
1170             =cut
1171              
1172             sub data4_short2() {
1173 0     0 1 0 my ($self,$nv) = @_;
1174 0 0       0 if (defined($nv)) {
1175 0         0 $nv = ($nv & 0xFFFF) | ($self->{'data4'} & 0xFFFF0000);
1176 0         0 $self->{'data4'} = $nv;
1177             }
1178 0         0 return $self->{'data4'} & 0xFFFF;
1179             }
1180              
1181             #==============================================================================
1182              
1183             =item sub data4_byte1([$newValue])
1184              
1185             $value = $cmp_ctl->data4_byte1($newValue);
1186              
1187             Component Data 4.
1188              
1189             This attribute represents the most significant byte of one of
1190             six 32-bit words used for user-defined component data. If this attribute is not
1191             needed by the component, this value is ignored.
1192              
1193             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
1194             sender use different byte ordering schemes. If the attribute is used to store
1195             multiple 8- or 16-bit values, the data should be packed so that byte swapping
1196             will be performed correctly.
1197              
1198             =cut
1199              
1200             sub data4_byte1() {
1201 0     0 1 0 my ($self,$nv) = @_;
1202 0 0       0 if (defined($nv)) {
1203 0         0 $nv = (($nv & 0xFF) << 24) | ($self->{'data4'} & 0xFFFFFF);
1204 0         0 $self->{'data4'} = $nv;
1205             }
1206 0         0 return ($self->{'data4'} >> 24) & 0xFF;
1207             }
1208              
1209             #==============================================================================
1210              
1211             =item sub data4_byte2([$newValue])
1212              
1213             $value = $cmp_ctl->data4_byte2($newValue);
1214              
1215             Component Data 4.
1216              
1217             This attribute represents the second most significant byte of one of
1218             six 32-bit words used for user-defined component data. If this attribute is not
1219             needed by the component, this value is ignored.
1220              
1221             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
1222             sender use different byte ordering schemes. If the attribute is used to store
1223             multiple 8- or 16-bit values, the data should be packed so that byte swapping
1224             will be performed correctly.
1225              
1226             =cut
1227              
1228             sub data4_byte2() {
1229 0     0 1 0 my ($self,$nv) = @_;
1230 0 0       0 if (defined($nv)) {
1231 0         0 $nv = (($nv & 0xFF) << 16) | ($self->{'data4'} & 0xFF00FFFF);
1232 0         0 $self->{'data4'} = $nv;
1233             }
1234 0         0 return ($self->{'data4'} >> 16) & 0xFF;
1235             }
1236              
1237             #==============================================================================
1238              
1239             =item sub data4_byte3([$newValue])
1240              
1241             $value = $cmp_ctl->data4_byte3($newValue);
1242              
1243             Component Data 4.
1244              
1245             This attribute represents the second least significant byte of one of
1246             six 32-bit words used for user-defined component data. If this attribute is not
1247             needed by the component, this value is ignored.
1248              
1249             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
1250             sender use different byte ordering schemes. If the attribute is used to store
1251             multiple 8- or 16-bit values, the data should be packed so that byte swapping
1252             will be performed correctly.
1253              
1254             =cut
1255              
1256             sub data4_byte3() {
1257 0     0 1 0 my ($self,$nv) = @_;
1258 0 0       0 if (defined($nv)) {
1259 0         0 $nv = (($nv & 0xFF) << 8) | ($self->{'data4'} & 0xFFFF00FF);
1260 0         0 $self->{'data4'} = $nv;
1261             }
1262 0         0 return ($self->{'data4'} >> 8) & 0xFF;
1263             }
1264              
1265             #==============================================================================
1266              
1267             =item sub data4_byte4([$newValue])
1268              
1269             $value = $cmp_ctl->data4_byte4($newValue);
1270              
1271             Component Data 4.
1272              
1273             This attribute represents the least significant byte of one of
1274             six 32-bit words used for user-defined component data. If this attribute is not
1275             needed by the component, this value is ignored.
1276              
1277             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
1278             sender use different byte ordering schemes. If the attribute is used to store
1279             multiple 8- or 16-bit values, the data should be packed so that byte swapping
1280             will be performed correctly.
1281              
1282             =cut
1283              
1284             sub data4_byte4() {
1285 0     0 1 0 my ($self,$nv) = @_;
1286 0 0       0 if (defined($nv)) {
1287 0         0 $nv = ($nv & 0xFF) | ($self->{'data4'} & 0xFFFFFF00);
1288 0         0 $self->{'data4'} = $nv;
1289             }
1290 0         0 return $self->{'data4'} & 0xFF;
1291             }
1292              
1293             #==============================================================================
1294              
1295             =item sub data5([$newValue])
1296              
1297             $value = $cmp_ctl->data5($newValue);
1298              
1299             Component Data 5.
1300              
1301             This attribute represents one of six 32-bit words used for user-defined
1302             component data. If this attribute is not needed by the component, this value is
1303             ignored.
1304              
1305             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
1306             sender use different byte ordering schemes. If the attribute is used to store
1307             multiple 8- or 16-bit values, the data should be packed so that byte swapping
1308             will be performed correctly. Use data5_short1 and data5_short2 for 16-bit values,
1309             or data5_byte1, data5_byte2, data5_byte3, and data5_byte4 for 8-bit values.
1310              
1311             =cut
1312              
1313             sub data5() {
1314 1     1 1 5 my ($self,$nv) = @_;
1315 1 50       4 if (defined($nv)) {
1316 1         2 $self->{'data5'} = $nv;
1317             }
1318 1         3 return $self->{'data5'};
1319             }
1320              
1321             #==============================================================================
1322              
1323             =item sub data5_float([$newValue])
1324              
1325             $value = $cmp_ctl->data1_float($newValue);
1326              
1327             Component Data 5.
1328              
1329             This attribute represents as a float one of six 32-bit words used for user-defined
1330             component data. If this attribute is not needed by the component, this value is
1331             ignored.
1332              
1333             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
1334             sender use different byte ordering schemes. If the attribute is used to store
1335             multiple 8- or 16-bit values, the data should be packed so that byte swapping
1336             will be performed correctly.
1337              
1338             =cut
1339              
1340             sub data5_float() {
1341 0     0 1 0 my ($self,$nv) = @_;
1342 0 0       0 if (defined($nv)) {
1343 0         0 my $nvp = CORE::pack('f',$nv);
1344 0 0       0 if($self->{'_LittleEndian'}) {
1345 0         0 $self->{'data5'} = CORE::unpack('V',$nvp);
1346             } else {
1347 0         0 $self->{'data5'} = CORE::unpack('N',$nvp);
1348             }
1349             }
1350 0 0       0 if($self->{'_LittleEndian'}) {
1351 0         0 return CORE::unpack('f',CORE::pack('V',$self->{'data5'}));
1352             } else {
1353 0         0 return CORE::unpack('f',CORE::pack('N',$self->{'data5'}));
1354             }
1355             }
1356              
1357             #==============================================================================
1358              
1359             =item sub data5_short1([$newValue])
1360              
1361             $value = $cmp_ctl->data5_short1($newValue);
1362              
1363             Component Data 5.
1364              
1365             This attribute represents as a short the two most significant bytes of one of
1366             six 32-bit words used for user-defined component data. If this attribute is not
1367             needed by the component, this value is ignored.
1368              
1369             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
1370             sender use different byte ordering schemes. If the attribute is used to store
1371             multiple 8- or 16-bit values, the data should be packed so that byte swapping
1372             will be performed correctly.
1373              
1374             =cut
1375              
1376             sub data5_short1() {
1377 0     0 1 0 my ($self,$nv) = @_;
1378 0 0       0 if (defined($nv)) {
1379 0         0 $nv = (($nv & 0xFFFF) << 16) | ($self->{'data5'} & 0xFFFF);
1380 0         0 $self->{'data5'} = $nv;
1381             }
1382 0         0 return ($self->{'data5'} >> 16) & 0xFFFF;
1383             }
1384              
1385             #==============================================================================
1386              
1387             =item sub data5_short2([$newValue])
1388              
1389             $value = $cmp_ctl->data5_short2($newValue);
1390              
1391             Component Data 5.
1392              
1393             This attribute represents as a short the two least significant bytes of one of
1394             six 32-bit words used for user-defined component data. If this attribute is not
1395             needed by the component, this value is ignored.
1396              
1397             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
1398             sender use different byte ordering schemes. If the attribute is used to store
1399             multiple 8- or 16-bit values, the data should be packed so that byte swapping
1400             will be performed correctly.
1401              
1402             =cut
1403              
1404             sub data5_short2() {
1405 0     0 1 0 my ($self,$nv) = @_;
1406 0 0       0 if (defined($nv)) {
1407 0         0 $nv = ($nv & 0xFFFF) | ($self->{'data5'} & 0xFFFF0000);
1408 0         0 $self->{'data5'} = $nv;
1409             }
1410 0         0 return $self->{'data5'} & 0xFFFF;
1411             }
1412              
1413             #==============================================================================
1414              
1415             =item sub data5_byte1([$newValue])
1416              
1417             $value = $cmp_ctl->data5_byte1($newValue);
1418              
1419             Component Data 5.
1420              
1421             This attribute represents the most significant byte of one of
1422             six 32-bit words used for user-defined component data. If this attribute is not
1423             needed by the component, this value is ignored.
1424              
1425             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
1426             sender use different byte ordering schemes. If the attribute is used to store
1427             multiple 8- or 16-bit values, the data should be packed so that byte swapping
1428             will be performed correctly.
1429              
1430             =cut
1431              
1432             sub data5_byte1() {
1433 0     0 1 0 my ($self,$nv) = @_;
1434 0 0       0 if (defined($nv)) {
1435 0         0 $nv = (($nv & 0xFF) << 24) | ($self->{'data5'} & 0xFFFFFF);
1436 0         0 $self->{'data5'} = $nv;
1437             }
1438 0         0 return ($self->{'data5'} >> 24) & 0xFF;
1439             }
1440              
1441             #==============================================================================
1442              
1443             =item sub data5_byte2([$newValue])
1444              
1445             $value = $cmp_ctl->data5_byte2($newValue);
1446              
1447             Component Data 5.
1448              
1449             This attribute represents the second most significant byte of one of
1450             six 32-bit words used for user-defined component data. If this attribute is not
1451             needed by the component, this value is ignored.
1452              
1453             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
1454             sender use different byte ordering schemes. If the attribute is used to store
1455             multiple 8- or 16-bit values, the data should be packed so that byte swapping
1456             will be performed correctly.
1457              
1458             =cut
1459              
1460             sub data5_byte2() {
1461 0     0 1 0 my ($self,$nv) = @_;
1462 0 0       0 if (defined($nv)) {
1463 0         0 $nv = (($nv & 0xFF) << 16) | ($self->{'data5'} & 0xFF00FFFF);
1464 0         0 $self->{'data5'} = $nv;
1465             }
1466 0         0 return ($self->{'data5'} >> 16) & 0xFF;
1467             }
1468              
1469             #==============================================================================
1470              
1471             =item sub data5_byte3([$newValue])
1472              
1473             $value = $cmp_ctl->data5_byte3($newValue);
1474              
1475             Component Data 5.
1476              
1477             This attribute represents the second least significant byte of one of
1478             six 32-bit words used for user-defined component data. If this attribute is not
1479             needed by the component, this value is ignored.
1480              
1481             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
1482             sender use different byte ordering schemes. If the attribute is used to store
1483             multiple 8- or 16-bit values, the data should be packed so that byte swapping
1484             will be performed correctly.
1485              
1486             =cut
1487              
1488             sub data5_byte3() {
1489 0     0 1 0 my ($self,$nv) = @_;
1490 0 0       0 if (defined($nv)) {
1491 0         0 $nv = (($nv & 0xFF) << 8) | ($self->{'data5'} & 0xFFFF00FF);
1492 0         0 $self->{'data5'} = $nv;
1493             }
1494 0         0 return ($self->{'data5'} >> 8) & 0xFF;
1495             }
1496              
1497             #==============================================================================
1498              
1499             =item sub data5_byte4([$newValue])
1500              
1501             $value = $cmp_ctl->data5_byte4($newValue);
1502              
1503             Component Data 5.
1504              
1505             This attribute represents the least significant byte of one of
1506             six 32-bit words used for user-defined component data. If this attribute is not
1507             needed by the component, this value is ignored.
1508              
1509             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
1510             sender use different byte ordering schemes. If the attribute is used to store
1511             multiple 8- or 16-bit values, the data should be packed so that byte swapping
1512             will be performed correctly.
1513              
1514             =cut
1515              
1516             sub data5_byte4() {
1517 0     0 1 0 my ($self,$nv) = @_;
1518 0 0       0 if (defined($nv)) {
1519 0         0 $nv = ($nv & 0xFF) | ($self->{'data5'} & 0xFFFFFF00);
1520 0         0 $self->{'data5'} = $nv;
1521             }
1522 0         0 return $self->{'data5'} & 0xFF;
1523             }
1524              
1525             #==============================================================================
1526              
1527             =item sub data5_and_6_double([$newValue])
1528              
1529             $value = $cmp_ctl->data5_and_6_double($newValue);
1530              
1531             Component Data 5 and 6.
1532              
1533             This attribute represents as a double two of six 32-bit words used for user-defined
1534             component data. If this attribute is not needed by the component, this value is
1535             ignored.
1536              
1537             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
1538             sender use different byte ordering schemes. If the attribute is used to store
1539             multiple 8- or 16-bit values, the data should be packed so that byte swapping
1540             will be performed correctly.
1541              
1542             =cut
1543              
1544             sub data5_and_6_double() {
1545 0     0 1 0 my ($self,$nv) = @_;
1546 0 0       0 if (defined($nv)) {
1547 0         0 my $nvp = CORE::pack('d',$nv);
1548 0 0       0 if($self->{'_LittleEndian'}) {
1549 0         0 ($self->{'data6'}, $self->{'data5'}) = CORE::unpack('VV',$nvp);
1550             } else {
1551 0         0 ($self->{'data5'}, $self->{'data6'}) = CORE::unpack('NN',$nvp);
1552             }
1553             }
1554 0 0       0 if($self->{'_LittleEndian'}) {
1555 0         0 return CORE::unpack('d',CORE::pack('VV',$self->{'data6'}, $self->{'data5'}));
1556             } else {
1557 0         0 return CORE::unpack('d',CORE::pack('NV',$self->{'data5'}, $self->{'data6'}));
1558             }
1559             }
1560              
1561             #==============================================================================
1562              
1563             =item sub data6([$newValue])
1564              
1565             $value = $cmp_ctl->data6($newValue);
1566              
1567             Component Data 6.
1568              
1569             This attribute represents one of six 32-bit words used for user-defined
1570             component data. If this attribute is not needed by the component, this value is
1571             ignored.
1572              
1573             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
1574             sender use different byte ordering schemes. If the attribute is used to store
1575             multiple 8- or 16-bit values, the data should be packed so that byte swapping
1576             will be performed correctly. Use data6_short1 and data6_short2 for 16-bit values,
1577             or data6_byte1, data6_byte2, data6_byte3, and data6_byte4 for 8-bit values.
1578              
1579             =cut
1580              
1581             sub data6() {
1582 1     1 1 5 my ($self,$nv) = @_;
1583 1 50       5 if (defined($nv)) {
1584 1         2 $self->{'data6'} = $nv;
1585             }
1586 1         3 return $self->{'data6'};
1587             }
1588              
1589             #==============================================================================
1590              
1591             =item sub data6_float([$newValue])
1592              
1593             $value = $cmp_ctl->data1_float($newValue);
1594              
1595             Component Data 6.
1596              
1597             This attribute represents as a float one of six 32-bit words used for user-defined
1598             component data. If this attribute is not needed by the component, this value is
1599             ignored.
1600              
1601             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
1602             sender use different byte ordering schemes. If the attribute is used to store
1603             multiple 8- or 16-bit values, the data should be packed so that byte swapping
1604             will be performed correctly.
1605              
1606             =cut
1607              
1608             sub data6_float() {
1609 0     0 1 0 my ($self,$nv) = @_;
1610 0 0       0 if (defined($nv)) {
1611 0         0 my $nvp = CORE::pack('f',$nv);
1612 0 0       0 if($self->{'_LittleEndian'}) {
1613 0         0 $self->{'data6'} = CORE::unpack('V',$nvp);
1614             } else {
1615 0         0 $self->{'data6'} = CORE::unpack('N',$nvp);
1616             }
1617             }
1618 0 0       0 if($self->{'_LittleEndian'}) {
1619 0         0 return CORE::unpack('f',CORE::pack('V',$self->{'data6'}));
1620             } else {
1621 0         0 return CORE::unpack('f',CORE::pack('N',$self->{'data6'}));
1622             }
1623             }
1624              
1625             #==============================================================================
1626              
1627             =item sub data6_short1([$newValue])
1628              
1629             $value = $cmp_ctl->data6_short1($newValue);
1630              
1631             Component Data 6.
1632              
1633             This attribute represents as a short the two most significant bytes of one of
1634             six 32-bit words used for user-defined component data. If this attribute is not
1635             needed by the component, this value is ignored.
1636              
1637             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
1638             sender use different byte ordering schemes. If the attribute is used to store
1639             multiple 8- or 16-bit values, the data should be packed so that byte swapping
1640             will be performed correctly.
1641              
1642             =cut
1643              
1644             sub data6_short1() {
1645 0     0 1 0 my ($self,$nv) = @_;
1646 0 0       0 if (defined($nv)) {
1647 0         0 $nv = (($nv & 0xFFFF) << 16) | ($self->{'data6'} & 0xFFFF);
1648 0         0 $self->{'data6'} = $nv;
1649             }
1650 0         0 return ($self->{'data6'} >> 16) & 0xFFFF;
1651             }
1652              
1653             #==============================================================================
1654              
1655             =item sub data6_short2([$newValue])
1656              
1657             $value = $cmp_ctl->data6_short2($newValue);
1658              
1659             Component Data 6.
1660              
1661             This attribute represents as a short the two least significant bytes of one of
1662             six 32-bit words used for user-defined component data. If this attribute is not
1663             needed by the component, this value is ignored.
1664              
1665             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
1666             sender use different byte ordering schemes. If the attribute is used to store
1667             multiple 8- or 16-bit values, the data should be packed so that byte swapping
1668             will be performed correctly.
1669              
1670             =cut
1671              
1672             sub data6_short2() {
1673 0     0 1 0 my ($self,$nv) = @_;
1674 0 0       0 if (defined($nv)) {
1675 0         0 $nv = ($nv & 0xFFFF) | ($self->{'data6'} & 0xFFFF0000);
1676 0         0 $self->{'data6'} = $nv;
1677             }
1678 0         0 return $self->{'data6'} & 0xFFFF;
1679             }
1680              
1681             #==============================================================================
1682              
1683             =item sub data6_byte1([$newValue])
1684              
1685             $value = $cmp_ctl->data6_byte1($newValue);
1686              
1687             Component Data 6.
1688              
1689             This attribute represents the most significant byte of one of
1690             six 32-bit words used for user-defined component data. If this attribute is not
1691             needed by the component, this value is ignored.
1692              
1693             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
1694             sender use different byte ordering schemes. If the attribute is used to store
1695             multiple 8- or 16-bit values, the data should be packed so that byte swapping
1696             will be performed correctly.
1697              
1698             =cut
1699              
1700             sub data6_byte1() {
1701 0     0 1 0 my ($self,$nv) = @_;
1702 0 0       0 if (defined($nv)) {
1703 0         0 $nv = (($nv & 0xFF) << 24) | ($self->{'data6'} & 0xFFFFFF);
1704 0         0 $self->{'data6'} = $nv;
1705             }
1706 0         0 return ($self->{'data6'} >> 24) & 0xFF;
1707             }
1708              
1709             #==============================================================================
1710              
1711             =item sub data6_byte2([$newValue])
1712              
1713             $value = $cmp_ctl->data6_byte2($newValue);
1714              
1715             Component Data 6.
1716              
1717             This attribute represents the second most significant byte of one of
1718             six 32-bit words used for user-defined component data. If this attribute is not
1719             needed by the component, this value is ignored.
1720              
1721             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
1722             sender use different byte ordering schemes. If the attribute is used to store
1723             multiple 8- or 16-bit values, the data should be packed so that byte swapping
1724             will be performed correctly.
1725              
1726             =cut
1727              
1728             sub data6_byte2() {
1729 0     0 1 0 my ($self,$nv) = @_;
1730 0 0       0 if (defined($nv)) {
1731 0         0 $nv = (($nv & 0xFF) << 16) | ($self->{'data6'} & 0xFF00FFFF);
1732 0         0 $self->{'data6'} = $nv;
1733             }
1734 0         0 return ($self->{'data6'} >> 16) & 0xFF;
1735             }
1736              
1737             #==============================================================================
1738              
1739             =item sub data6_byte3([$newValue])
1740              
1741             $value = $cmp_ctl->data6_byte3($newValue);
1742              
1743             Component Data 6.
1744              
1745             This attribute represents the second least significant byte of one of
1746             six 32-bit words used for user-defined component data. If this attribute is not
1747             needed by the component, this value is ignored.
1748              
1749             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
1750             sender use different byte ordering schemes. If the attribute is used to store
1751             multiple 8- or 16-bit values, the data should be packed so that byte swapping
1752             will be performed correctly.
1753              
1754             =cut
1755              
1756             sub data6_byte3() {
1757 0     0 1 0 my ($self,$nv) = @_;
1758 0 0       0 if (defined($nv)) {
1759 0         0 $nv = (($nv & 0xFF) << 8) | ($self->{'data6'} & 0xFFFF00FF);
1760 0         0 $self->{'data6'} = $nv;
1761             }
1762 0         0 return ($self->{'data6'} >> 8) & 0xFF;
1763             }
1764              
1765             #==============================================================================
1766              
1767             =item sub data6_byte4([$newValue])
1768              
1769             $value = $cmp_ctl->data6_byte4($newValue);
1770              
1771             Component Data 6.
1772              
1773             This attribute represents the least significant byte of one of
1774             six 32-bit words used for user-defined component data. If this attribute is not
1775             needed by the component, this value is ignored.
1776              
1777             Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
1778             sender use different byte ordering schemes. If the attribute is used to store
1779             multiple 8- or 16-bit values, the data should be packed so that byte swapping
1780             will be performed correctly.
1781              
1782             =cut
1783              
1784             sub data6_byte4() {
1785 0     0 1 0 my ($self,$nv) = @_;
1786 0 0       0 if (defined($nv)) {
1787 0         0 $nv = ($nv & 0xFF) | ($self->{'data6'} & 0xFFFFFF00);
1788 0         0 $self->{'data6'} = $nv;
1789             }
1790 0         0 return $self->{'data6'} & 0xFF;
1791             }
1792              
1793             #==========================================================================
1794              
1795             =item sub pack()
1796              
1797             $value = $cmp_ctl->pack();
1798              
1799             Returns the packed data packet.
1800              
1801             =cut
1802              
1803             sub pack($) {
1804 1     1 1 6 my $self = shift ;
1805            
1806 1         9 $self->{'_Buffer'} = CORE::pack($self->{'_Pack'},
1807             $self->{'packetType'},
1808             $self->{'packetSize'},
1809             $self->{'componentIdent'},
1810             $self->{'instanceIdent'},
1811             $self->{'_bitfields1'}, # Includes bitfields unused6, and componentClass.
1812             $self->{'componentState'},
1813             $self->{'data1'},
1814             $self->{'data2'},
1815             $self->{'data3'},
1816             $self->{'data4'},
1817             $self->{'data5'},
1818             $self->{'data6'},
1819             );
1820              
1821 1         3 return $self->{'_Buffer'};
1822             }
1823              
1824             #==========================================================================
1825              
1826             =item sub unpack()
1827              
1828             $value = $cmp_ctl->unpack();
1829              
1830             Unpacks the packed data packet.
1831              
1832             =cut
1833              
1834             sub unpack($) {
1835 0     0 1   my $self = shift @_;
1836            
1837 0 0         if (@_) {
1838 0           $self->{'_Buffer'} = shift @_;
1839             }
1840 0           my ($a,$b,$c,$d,$e,$f,$g,$h,$i,$j,$k,$l) = CORE::unpack($self->{'_Pack'},$self->{'_Buffer'});
1841 0           $self->{'packetType'} = $a;
1842 0           $self->{'packetSize'} = $b;
1843 0           $self->{'componentIdent'} = $c;
1844 0           $self->{'instanceIdent'} = $d;
1845 0           $self->{'_bitfields1'} = $e; # Includes bitfields unused6, and componentClass.
1846 0           $self->{'componentState'} = $f;
1847 0           $self->{'data1'} = $g;
1848 0           $self->{'data2'} = $h;
1849 0           $self->{'data3'} = $i;
1850 0           $self->{'data4'} = $j;
1851 0           $self->{'data5'} = $k;
1852 0           $self->{'data6'} = $l;
1853              
1854 0           $self->{'componentClass'} = $self->component_class();
1855              
1856 0           return $self->{'_Buffer'};
1857             }
1858              
1859             #==========================================================================
1860              
1861             =item sub byte_swap()
1862              
1863             $obj_name->byte_swap();
1864              
1865             Byte swaps the packed data packet.
1866              
1867             =cut
1868              
1869             sub byte_swap($) {
1870 0     0 1   my $self = shift @_;
1871            
1872 0 0         if (@_) {
1873 0           $self->{'_Buffer'} = shift @_;
1874             } else {
1875 0           $self->pack();
1876             }
1877 0           my ($a,$b,$c,$d,$e,$f,$g,$h,$i,$j,$k,$l) = CORE::unpack($self->{'_Swap1'},$self->{'_Buffer'});
1878              
1879 0           $self->{'_Buffer'} = CORE::pack($self->{'_Swap2'},$a,$b,$c,$d,$e,$f,$g,$h,$i,$j,$k,$l);
1880 0           $self->unpack();
1881              
1882 0           return $self->{'_Buffer'};
1883             }
1884              
1885             #==========================================================================
1886              
1887             1;
1888             __END__