CIGIPP/EventNotification.pm

filter: Statementstmt 24.6% 49 / 199 Branchbran 6.2% 5 / 80 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 33.3% 12 / 36 Podpod 100% 32 / 32 totaltotal 28.1% 99 / 352 CC 43 SCAR 22.1
CC
43
Cov
20%
event_data1_float
20.0
event_data1_and_2_double
20.0
event_data2_float
20.0
CRAP 9.1
« CIGIPP/SymbolLineDefinition.pm ↑ Summary CIGIPP/SensorControl.pm »
1 #
2 # Rinchi Common Image Generator Interface for Perl
3 # Class Identifier: f78b3dec-200e-11de-bdd4-001c25551abc
4 # Author: Brian M. Ames
5 #
6  
7 package Rinchi::CIGIPP::EventNotification;
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::EventNotification - Perl extension for the Common Image
42 Generator Interface - Event Notification data packet.
43 data packet.
44 =head1 SYNOPSIS
45  
46 use Rinchi::CIGIPP::EventNotification;
47 my $evt_ntc = Rinchi::CIGIPP::EventNotification->new();
48  
49 $packet_type = $evt_ntc->packet_type();
50 $packet_size = $evt_ntc->packet_size();
51 $event_ident = $evt_ntc->event_ident(37952);
52 $event_data1 = $evt_ntc->event_data1(285);
53 $event_data2 = $evt_ntc->event_data2(36545);
54 $event_data3 = $evt_ntc->event_data3(12715);
55  
56 =head1 DESCRIPTION
57  
58 The Event Notification packet is used to pass event data to the Host. The Host
59 may enable and disable individual events using either the Component Control or
60 Short Component Control packet.
61  
62 This packet contains three user-defined 32-bit word values that may contain
63 data describing the attributes of the event (e.g., time of occurrence,
64 position). These data may be formatted as needed; however, they must be
65 byte-swapped as 32-bit fields when byte swapping is necessary. Refer to the
66 description of the Component Control packet for more information.
67  
68 =head2 EXPORT
69  
70 None by default.
71  
72 #==============================================================================
73  
74 =item new $evt_ntc = Rinchi::CIGIPP::EventNotification->new()
75  
76 Constructor for Rinchi::EventNotification.
77  
78 =cut
79  
80 2 ▶sub new {
Subroutine new: called CC=7 SCAR=28.9
Pod documented
81 2 my $class = shift;
82 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
83  
84 2 my $self = {
85 '_Buffer' => '',
86 '_ClassIdent' => 'f78b3dec-200e-11de-bdd4-001c25551abc',
87 '_Pack' => 'CCSIII',
88 '_Swap1' => 'CCvVVV',
89 '_Swap2' => 'CCnNNN',
90 'packetType' => 116,
91 'packetSize' => 16,
92 'eventIdent' => 0,
93 'eventData1' => 0,
94 'eventData2' => 0,
95 'eventData3' => 0,
96 };
97  
98 2 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 2 2
99 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
100 0 $self->{'_Buffer'} = $_[0][0];
101 } elsif (ref($_[0]) eq 'HASH') {
102 0 foreach my $attr (keys %{$_[0]}) {
103 0 ▶ $self->{"_$attr"} = $_[0]->{$attr} unless ($attr =~ /^_/);
Branch: 1 branch
BranchTrueFalseTotal
unless $attr =~ /^_/ 0 0 0
104 }
105 }
106 }
107 2 $self->{'_LittleEndian'} = (CORE::unpack('v',CORE::pack('S',0x8000)) == 0x8000);
108  
109 2 bless($self,$class);
110 2 return $self;
111 }
112  
113 #==============================================================================
114  
115 =item sub packet_type()
116  
117 $value = $evt_ntc->packet_type();
118  
119 Data Packet Identifier.
120  
121 This attribute identifies this data packet as the Event Notification packet.
122 The value of this attribute must be 116.
123  
124 =cut
125  
126 2 ▶sub packet_type() {
Subroutine packet_type: called CC=1 SCAR=0.0
Pod documented
127 2 my ($self) = @_;
128 2 return $self->{'packetType'};
129 }
130  
131 #==============================================================================
132  
133 =item sub packet_size()
134  
135 $value = $evt_ntc->packet_size();
136  
137 Data Packet Size.
138  
139 This attribute indicates the number of bytes in this data packet. The value of
140 this attribute must be 16.
141  
142 =cut
143  
144 2 ▶sub packet_size() {
Subroutine packet_size: called CC=1 SCAR=0.0
Pod documented
145 2 my ($self) = @_;
146 2 return $self->{'packetSize'};
147 }
148  
149 #==============================================================================
150  
151 =item sub event_ident([$newValue])
152  
153 $value = $evt_ntc->event_ident($newValue);
154  
155 Event ID.
156  
157 This attribute indicates which event has occurred. Event ID assignments are IG-specific.
158  
159 =cut
160  
161 2 ▶sub event_ident() {
Subroutine event_ident: called CC=2 SCAR=7.0
Pod documented
162 2 my ($self,$nv) = @_;
163 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
164 2 $self->{'eventIdent'} = $nv;
165 }
166 2 return $self->{'eventIdent'};
167 }
168  
169 #==============================================================================
170  
171 =item sub event_data1([$newValue])
172  
173 $value = $evt_ntc->event_data1($newValue);
174  
175 Event Data 1.
176  
177 This attribute is one of three 32-bit words used for user-defined event data.
178 If this attribute is not needed to describe the event, this value is ignored.
179  
180 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
181 sender use different byte ordering schemes. If the attribute is used to store
182 multiple 8- or 16-bit values, the data should be packed so that byte swapping
183 will be performed correctly. Use event_data1_short1 and event_data1_short2 for
184 16-bit values, or event_data1_byte1, event_data1_byte2, event_data1_byte3, and
185 event_data1_byte4 for 8-bit values.
186  
187 =cut
188  
189 2 ▶sub event_data1() {
Subroutine event_data1: called CC=2 SCAR=7.0
Pod documented
190 2 my ($self,$nv) = @_;
191 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
192 2 $self->{'eventData1'} = $nv;
193 }
194 2 return $self->{'eventData1'};
195 }
196  
197 #==============================================================================
198  
199 =item sub event_data1_float([$newValue])
200  
201 $value = $evt_ntc->event_data1_float($newValue);
202  
203 Event Data 1.
204  
205 This attribute represents as a float one of three 32-bit words used for user-defined
206 event data. If this attribute is not needed by the event, this value is
207 ignored.
208  
209 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
210 sender use different byte ordering schemes. If the attribute is used to store
211 multiple 8- or 16-bit values, the data should be packed so that byte swapping
212 will be performed correctly.
213  
214 =cut
215  
216 0 ▶sub event_data1_float() {
Subroutine event_data1_float: not called CC=4 SCAR=30.0
Pod documented
217 0 my ($self,$nv) = @_;
218 0 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 0 0 0
219 0 my $nvp = CORE::pack('f',$nv);
220 0 ▶ if($self->{'_LittleEndian'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_LittleEndian'}) { } 0 0 0
221 0 $self->{'eventData1'} = CORE::unpack('V',$nvp);
222 } else {
223 0 $self->{'eventData1'} = CORE::unpack('N',$nvp);
224 }
225 }
226 0 ▶ if($self->{'_LittleEndian'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_LittleEndian'}) { } 0 0 0
227 0 return CORE::unpack('f',CORE::pack('V',$self->{'eventData1'}));
228 } else {
229 0 return CORE::unpack('f',CORE::pack('N',$self->{'eventData1'}));
230 }
231 }
232  
233 #==============================================================================
234  
235 =item sub event_data1_short1([$newValue])
236  
237 $value = $evt_ntc->event_data1_short1($newValue);
238  
239 Event Data 1.
240  
241 This attribute represents as a short the two most significant bytes of one of
242 three 32-bit words used for user-defined event data. If this attribute is not
243 needed by the event, this value is ignored.
244  
245 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
246 sender use different byte ordering schemes. If the attribute is used to store
247 multiple 8- or 16-bit values, the data should be packed so that byte swapping
248 will be performed correctly.
249  
250 =cut
251  
252 0 ▶sub event_data1_short1() {
Subroutine event_data1_short1: not called CC=2 SCAR=17.9
Pod documented
253 0 my ($self,$nv) = @_;
254 0 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 0 0 0
255 0 $nv = (($nv & 0xFFFF) << 16) | ($self->{'eventData1'} & 0xFFFF);
256 0 $self->{'eventData1'} = $nv;
257 }
258 0 return ($self->{'eventData1'} >> 16) & 0xFFFF;
259 }
260  
261 #==============================================================================
262  
263 =item sub event_data1_short2([$newValue])
264  
265 $value = $evt_ntc->event_data1_short2($newValue);
266  
267 Event Data 1.
268  
269 This attribute represents as a short the two least significant bytes of one of
270 three 32-bit words used for user-defined event data. If this attribute is not
271 needed by the event, this value is ignored.
272  
273 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
274 sender use different byte ordering schemes. If the attribute is used to store
275 multiple 8- or 16-bit values, the data should be packed so that byte swapping
276 will be performed correctly.
277  
278 =cut
279  
280 0 ▶sub event_data1_short2() {
Subroutine event_data1_short2: not called CC=2 SCAR=17.9
Pod documented
281 0 my ($self,$nv) = @_;
282 0 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 0 0 0
283 0 $nv = ($nv & 0xFFFF) | ($self->{'eventData1'} & 0xFFFF0000);
284 0 $self->{'eventData1'} = $nv;
285 }
286 0 return $self->{'eventData1'} & 0xFFFF;
287 }
288  
289 #==============================================================================
290  
291 =item sub event_data1_byte1([$newValue])
292  
293 $value = $evt_ntc->event_data1_byte1($newValue);
294  
295 Event Data 1.
296  
297 This attribute represents the most significant byte of one of
298 three 32-bit words used for user-defined event data. If this attribute is not
299 needed by the event, this value is ignored.
300  
301 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
302 sender use different byte ordering schemes. If the attribute is used to store
303 multiple 8- or 16-bit values, the data should be packed so that byte swapping
304 will be performed correctly.
305  
306 =cut
307  
308 0 ▶sub event_data1_byte1() {
Subroutine event_data1_byte1: not called CC=2 SCAR=17.9
Pod documented
309 0 my ($self,$nv) = @_;
310 0 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 0 0 0
311 0 $nv = (($nv & 0xFF) << 24) | ($self->{'eventData1'} & 0xFFFFFF);
312 0 $self->{'eventData1'} = $nv;
313 }
314 0 return ($self->{'eventData1'} >> 24) & 0xFF;
315 }
316  
317 #==============================================================================
318  
319 =item sub event_data1_byte2([$newValue])
320  
321 $value = $evt_ntc->event_data1_byte2($newValue);
322  
323 Event Data 1.
324  
325 This attribute represents the second most significant byte of one of
326 three 32-bit words used for user-defined event data. If this attribute is not
327 needed by the event, this value is ignored.
328  
329 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
330 sender use different byte ordering schemes. If the attribute is used to store
331 multiple 8- or 16-bit values, the data should be packed so that byte swapping
332 will be performed correctly.
333  
334 =cut
335  
336 0 ▶sub event_data1_byte2() {
Subroutine event_data1_byte2: not called CC=2 SCAR=17.9
Pod documented
337 0 my ($self,$nv) = @_;
338 0 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 0 0 0
339 0 $nv = (($nv & 0xFF) << 16) | ($self->{'eventData1'} & 0xFF00FFFF);
340 0 $self->{'eventData1'} = $nv;
341 }
342 0 return ($self->{'eventData1'} >> 16) & 0xFF;
343 }
344  
345 #==============================================================================
346  
347 =item sub event_data1_byte3([$newValue])
348  
349 $value = $evt_ntc->event_data1_byte3($newValue);
350  
351 Event Data 1.
352  
353 This attribute represents the second least significant byte of one of
354 three 32-bit words used for user-defined event data. If this attribute is not
355 needed by the event, this value is ignored.
356  
357 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
358 sender use different byte ordering schemes. If the attribute is used to store
359 multiple 8- or 16-bit values, the data should be packed so that byte swapping
360 will be performed correctly.
361  
362 =cut
363  
364 0 ▶sub event_data1_byte3() {
Subroutine event_data1_byte3: not called CC=2 SCAR=17.9
Pod documented
365 0 my ($self,$nv) = @_;
366 0 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 0 0 0
367 0 $nv = (($nv & 0xFF) << 8) | ($self->{'eventData1'} & 0xFFFF00FF);
368 0 $self->{'eventData1'} = $nv;
369 }
370 0 return ($self->{'eventData1'} >> 8) & 0xFF;
371 }
372  
373 #==============================================================================
374  
375 =item sub event_data1_byte4([$newValue])
376  
377 $value = $evt_ntc->event_data1_byte4($newValue);
378  
379 Event Data 1.
380  
381 This attribute represents the least significant byte of one of
382 three 32-bit words used for user-defined event data. If this attribute is not
383 needed by the event, this value is ignored.
384  
385 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
386 sender use different byte ordering schemes. If the attribute is used to store
387 multiple 8- or 16-bit values, the data should be packed so that byte swapping
388 will be performed correctly.
389  
390 =cut
391  
392 0 ▶sub event_data1_byte4() {
Subroutine event_data1_byte4: not called CC=2 SCAR=17.9
Pod documented
393 0 my ($self,$nv) = @_;
394 0 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 0 0 0
395 0 $nv = ($nv & 0xFF) | ($self->{'eventData1'} & 0xFFFFFF00);
396 0 $self->{'eventData1'} = $nv;
397 }
398 0 return $self->{'eventData1'} & 0xFF;
399 }
400  
401 #==============================================================================
402  
403 =item sub event_data1_and_2_double([$newValue])
404  
405 $value = $evt_ntc->event_data1_and_2_double($newValue);
406  
407 Event Data 1.
408  
409 This attribute represents as a double two of three 32-bit words used for user-defined
410 event data. If this attribute is not needed by the event, this value is
411 ignored.
412  
413 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
414 sender use different byte ordering schemes. If the attribute is used to store
415 multiple 8- or 16-bit values, the data should be packed so that byte swapping
416 will be performed correctly.
417  
418 =cut
419  
420 0 ▶sub event_data1_and_2_double() {
Subroutine event_data1_and_2_double: not called CC=4 SCAR=30.0
Pod documented
421 0 my ($self,$nv) = @_;
422 0 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 0 0 0
423 0 my $nvp = CORE::pack('d',$nv);
424 0 ▶ if($self->{'_LittleEndian'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_LittleEndian'}) { } 0 0 0
425 0 ($self->{'eventData2'}, $self->{'eventData1'}) = CORE::unpack('VV',$nvp);
426 } else {
427 0 ($self->{'eventData1'}, $self->{'eventData2'}) = CORE::unpack('NN',$nvp);
428 }
429 }
430 0 ▶ if($self->{'_LittleEndian'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_LittleEndian'}) { } 0 0 0
431 0 return CORE::unpack('d',CORE::pack('VV',$self->{'eventData2'}, $self->{'eventData1'}));
432 } else {
433 0 return CORE::unpack('d',CORE::pack('NV',$self->{'eventData1'}, $self->{'eventData2'}));
434 }
435 }
436  
437 #==============================================================================
438  
439 =item sub event_data2([$newValue])
440  
441 $value = $evt_ntc->event_data2($newValue);
442  
443 Event Data 2.
444  
445 This attribute is one of three 32-bit words used for user-defined event data.
446 If this attribute is not needed to describe the event, this value is ignored.
447  
448 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
449 sender use different byte ordering schemes. If the attribute is used to store
450 multiple 8- or 16-bit values, the data should be packed so that byte swapping
451 will be performed correctly. Use event_data2_short1 and event_data2_short2 for
452 16-bit values, or event_data2_byte1, event_data2_byte2, event_data2_byte3, and
453 event_data2_byte4 for 8-bit values.
454  
455 =cut
456  
457 2 ▶sub event_data2() {
Subroutine event_data2: called CC=2 SCAR=7.0
Pod documented
458 2 my ($self,$nv) = @_;
459 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
460 2 $self->{'eventData2'} = $nv;
461 }
462 2 return $self->{'eventData2'};
463 }
464  
465 #==============================================================================
466  
467 =item sub event_data2_float([$newValue])
468  
469 $value = $evt_ntc->event_data2_float($newValue);
470  
471 Event Data 2.
472  
473 This attribute represents as a float one of three 32-bit words used for user-defined
474 event data. If this attribute is not needed by the event, this value is
475 ignored.
476  
477 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
478 sender use different byte ordering schemes. If the attribute is used to store
479 multiple 8- or 16-bit values, the data should be packed so that byte swapping
480 will be performed correctly.
481  
482 =cut
483  
484 0 ▶sub event_data2_float() {
Subroutine event_data2_float: not called CC=4 SCAR=30.0
Pod documented
485 0 my ($self,$nv) = @_;
486 0 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 0 0 0
487 0 my $nvp = CORE::pack('f',$nv);
488 0 ▶ if($self->{'_LittleEndian'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_LittleEndian'}) { } 0 0 0
489 0 $self->{'eventData2'} = CORE::unpack('V',$nvp);
490 } else {
491 0 $self->{'eventData2'} = CORE::unpack('N',$nvp);
492 }
493 }
494 0 ▶ if($self->{'_LittleEndian'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_LittleEndian'}) { } 0 0 0
495 0 return CORE::unpack('f',CORE::pack('V',$self->{'eventData2'}));
496 } else {
497 0 return CORE::unpack('f',CORE::pack('N',$self->{'eventData2'}));
498 }
499 }
500  
501 #==============================================================================
502  
503 =item sub event_data2_short1([$newValue])
504  
505 $value = $evt_ntc->event_data2_short1($newValue);
506  
507 Event Data 2.
508  
509 This attribute represents as a short the two most significant bytes of one of
510 three 32-bit words used for user-defined event data. If this attribute is not
511 needed by the event, this value is ignored.
512  
513 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
514 sender use different byte ordering schemes. If the attribute is used to store
515 multiple 8- or 16-bit values, the data should be packed so that byte swapping
516 will be performed correctly.
517  
518 =cut
519  
520 0 ▶sub event_data2_short1() {
Subroutine event_data2_short1: not called CC=2 SCAR=17.9
Pod documented
521 0 my ($self,$nv) = @_;
522 0 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 0 0 0
523 0 $nv = (($nv & 0xFFFF) << 16) | ($self->{'eventData2'} & 0xFFFF);
524 0 $self->{'eventData2'} = $nv;
525 }
526 0 return ($self->{'eventData2'} >> 16) & 0xFFFF;
527 }
528  
529 #==============================================================================
530  
531 =item sub event_data2_short2([$newValue])
532  
533 $value = $evt_ntc->event_data2_short2($newValue);
534  
535 Event Data 2.
536  
537 This attribute represents as a short the two least significant bytes of one of
538 three 32-bit words used for user-defined event data. If this attribute is not
539 needed by the event, this value is ignored.
540  
541 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
542 sender use different byte ordering schemes. If the attribute is used to store
543 multiple 8- or 16-bit values, the data should be packed so that byte swapping
544 will be performed correctly.
545  
546 =cut
547  
548 0 ▶sub event_data2_short2() {
Subroutine event_data2_short2: not called CC=2 SCAR=17.9
Pod documented
549 0 my ($self,$nv) = @_;
550 0 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 0 0 0
551 0 $nv = ($nv & 0xFFFF) | ($self->{'eventData2'} & 0xFFFF0000);
552 0 $self->{'eventData2'} = $nv;
553 }
554 0 return $self->{'eventData2'} & 0xFFFF;
555 }
556  
557 #==============================================================================
558  
559 =item sub event_data2_byte1([$newValue])
560  
561 $value = $evt_ntc->event_data2_byte1($newValue);
562  
563 Event Data 2.
564  
565 This attribute represents the most significant byte of one of
566 three 32-bit words used for user-defined event data. If this attribute is not
567 needed by the event, this value is ignored.
568  
569 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
570 sender use different byte ordering schemes. If the attribute is used to store
571 multiple 8- or 16-bit values, the data should be packed so that byte swapping
572 will be performed correctly.
573  
574 =cut
575  
576 0 ▶sub event_data2_byte1() {
Subroutine event_data2_byte1: not called CC=2 SCAR=17.9
Pod documented
577 0 my ($self,$nv) = @_;
578 0 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 0 0 0
579 0 $nv = (($nv & 0xFF) << 24) | ($self->{'eventData2'} & 0xFFFFFF);
580 0 $self->{'eventData2'} = $nv;
581 }
582 0 return ($self->{'eventData2'} >> 24) & 0xFF;
583 }
584  
585 #==============================================================================
586  
587 =item sub event_data2_byte2([$newValue])
588  
589 $value = $evt_ntc->event_data2_byte2($newValue);
590  
591 Event Data 2.
592  
593 This attribute represents the second most significant byte of one of
594 three 32-bit words used for user-defined event data. If this attribute is not
595 needed by the event, this value is ignored.
596  
597 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
598 sender use different byte ordering schemes. If the attribute is used to store
599 multiple 8- or 16-bit values, the data should be packed so that byte swapping
600 will be performed correctly.
601  
602 =cut
603  
604 0 ▶sub event_data2_byte2() {
Subroutine event_data2_byte2: not called CC=2 SCAR=17.9
Pod documented
605 0 my ($self,$nv) = @_;
606 0 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 0 0 0
607 0 $nv = (($nv & 0xFF) << 16) | ($self->{'eventData2'} & 0xFF00FFFF);
608 0 $self->{'eventData2'} = $nv;
609 }
610 0 return ($self->{'eventData2'} >> 16) & 0xFF;
611 }
612  
613 #==============================================================================
614  
615 =item sub event_data2_byte3([$newValue])
616  
617 $value = $evt_ntc->event_data2_byte3($newValue);
618  
619 Event Data 2.
620  
621 This attribute represents the second least significant byte of one of
622 three 32-bit words used for user-defined event data. If this attribute is not
623 needed by the event, this value is ignored.
624  
625 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
626 sender use different byte ordering schemes. If the attribute is used to store
627 multiple 8- or 16-bit values, the data should be packed so that byte swapping
628 will be performed correctly.
629  
630 =cut
631  
632 0 ▶sub event_data2_byte3() {
Subroutine event_data2_byte3: not called CC=2 SCAR=17.9
Pod documented
633 0 my ($self,$nv) = @_;
634 0 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 0 0 0
635 0 $nv = (($nv & 0xFF) << 8) | ($self->{'eventData2'} & 0xFFFF00FF);
636 0 $self->{'eventData2'} = $nv;
637 }
638 0 return ($self->{'eventData2'} >> 8) & 0xFF;
639 }
640  
641 #==============================================================================
642  
643 =item sub event_data2_byte4([$newValue])
644  
645 $value = $evt_ntc->event_data2_byte4($newValue);
646  
647 Event Data 2.
648  
649 This attribute represents the least significant byte of one of
650 three 32-bit words used for user-defined event data. If this attribute is not
651 needed by the event, this value is ignored.
652  
653 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
654 sender use different byte ordering schemes. If the attribute is used to store
655 multiple 8- or 16-bit values, the data should be packed so that byte swapping
656 will be performed correctly.
657  
658 =cut
659  
660 0 ▶sub event_data2_byte4() {
Subroutine event_data2_byte4: not called CC=2 SCAR=17.9
Pod documented
661 0 my ($self,$nv) = @_;
662 0 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 0 0 0
663 0 $nv = ($nv & 0xFF) | ($self->{'eventData2'} & 0xFFFFFF00);
664 0 $self->{'eventData2'} = $nv;
665 }
666 0 return $self->{'eventData2'} & 0xFF;
667 }
668  
669 #==============================================================================
670  
671 =item sub event_data3([$newValue])
672  
673 $value = $evt_ntc->event_data3($newValue);
674  
675 Event Data 3.
676  
677 This attribute is one of three 32-bit words used for user-defined event data.
678 If this attribute is not needed to describe the event, this value is ignored.
679  
680 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
681 sender use different byte ordering schemes. If the attribute is used to store
682 multiple 8- or 16-bit values, the data should be packed so that byte swapping
683 will be performed correctly. Use event_data3_short1 and event_data3_short2 for
684 16-bit values, or event_data3_byte1, event_data3_byte2, event_data3_byte3, and
685 event_data3_byte4 for 8-bit values.
686  
687 =cut
688  
689 2 ▶sub event_data3() {
Subroutine event_data3: called CC=2 SCAR=7.0
Pod documented
690 2 my ($self,$nv) = @_;
691 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
692 2 $self->{'eventData3'} = $nv;
693 }
694 2 return $self->{'eventData3'};
695 }
696  
697 #==========================================================================
698  
699 =item sub pack()
700  
701 $value = $evt_ntc->pack();
702  
703 Returns the packed data packet.
704  
705 =cut
706  
707 2 ▶sub pack($) {
Subroutine pack: called CC=1 SCAR=0.0
Pod documented
708 2 my $self = shift ;
709
710 $self->{'_Buffer'} = CORE::pack($self->{'_Pack'},
711 $self->{'packetType'},
712 $self->{'packetSize'},
713 $self->{'eventIdent'},
714 $self->{'eventData1'},
715 $self->{'eventData2'},
716 2 $self->{'eventData3'},
717 );
718  
719 2 return $self->{'_Buffer'};
720 }
721  
722 #==========================================================================
723  
724 =item sub unpack()
725  
726 $value = $evt_ntc->unpack();
727  
728 Unpacks the packed data packet.
729  
730 =cut
731  
732 0 ▶sub unpack($) {
Subroutine unpack: not called CC=2 SCAR=17.9
Pod documented
733 0 my $self = shift @_;
734
735 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
736 0 $self->{'_Buffer'} = shift @_;
737 }
738 0 my ($a,$b,$c,$d,$e,$f) = CORE::unpack($self->{'_Pack'},$self->{'_Buffer'});
739 0 $self->{'packetType'} = $a;
740 0 $self->{'packetSize'} = $b;
741 0 $self->{'eventIdent'} = $c;
742 0 $self->{'eventData1'} = $d;
743 0 $self->{'eventData2'} = $e;
744 0 $self->{'eventData3'} = $f;
745  
746 0 return $self->{'_Buffer'};
747 }
748  
749 #==========================================================================
750  
751 =item sub byte_swap()
752  
753 $obj_name->byte_swap();
754  
755 Byte swaps the packed data packet.
756  
757 =cut
758  
759 0 ▶sub byte_swap($) {
Subroutine byte_swap: not called CC=2 SCAR=17.9
Pod documented
760 0 my $self = shift @_;
761
762 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
763 0 $self->{'_Buffer'} = shift @_;
764 } else {
765 0 $self->pack();
766 }
767 0 my ($a,$b,$c,$d,$e,$f) = CORE::unpack($self->{'_Swap1'},$self->{'_Buffer'});
768  
769 0 $self->{'_Buffer'} = CORE::pack($self->{'_Swap2'},$a,$b,$c,$d,$e,$f);
770 0 $self->unpack();
771  
772 0 return $self->{'_Buffer'};
773 }
774  
775 #==============================================================================
776  
777 =item sub event_data3_float([$newValue])
778  
779 $value = $evt_ntc->event_data3_float($newValue);
780  
781 Event Data 3.
782  
783 This attribute represents as a float one of three 32-bit words used for user-defined
784 event data. If this attribute is not needed by the event, this value is
785 ignored.
786  
787 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
788 sender use different byte ordering schemes. If the attribute is used to store
789 multiple 8- or 16-bit values, the data should be packed so that byte swapping
790 will be performed correctly.
791  
792 =cut
793  
794 0 ▶sub event_data3_float() {
Subroutine event_data3_float: not called CC=4 SCAR=30.0
Pod documented
795 0 my ($self,$nv) = @_;
796 0 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 0 0 0
797 0 my $nvp = CORE::pack('f',$nv);
798 0 ▶ if($self->{'_LittleEndian'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_LittleEndian'}) { } 0 0 0
799 0 $self->{'eventData3'} = CORE::unpack('V',$nvp);
800 } else {
801 0 $self->{'eventData3'} = CORE::unpack('N',$nvp);
802 }
803 }
804 0 ▶ if($self->{'_LittleEndian'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_LittleEndian'}) { } 0 0 0
805 0 return CORE::unpack('f',CORE::pack('V',$self->{'eventData3'}));
806 } else {
807 0 return CORE::unpack('f',CORE::pack('N',$self->{'eventData3'}));
808 }
809 }
810  
811 #==============================================================================
812  
813 =item sub event_data3_short1([$newValue])
814  
815 $value = $evt_ntc->event_data3_short1($newValue);
816  
817 Event Data 3.
818  
819 This attribute represents as a short the two most significant bytes of one of
820 three 32-bit words used for user-defined event data. If this attribute is not
821 needed by the event, this value is ignored.
822  
823 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
824 sender use different byte ordering schemes. If the attribute is used to store
825 multiple 8- or 16-bit values, the data should be packed so that byte swapping
826 will be performed correctly.
827  
828 =cut
829  
830 0 ▶sub event_data3_short1() {
Subroutine event_data3_short1: not called CC=2 SCAR=17.9
Pod documented
831 0 my ($self,$nv) = @_;
832 0 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 0 0 0
833 0 $nv = (($nv & 0xFFFF) << 16) | ($self->{'eventData3'} & 0xFFFF);
834 0 $self->{'eventData3'} = $nv;
835 }
836 0 return ($self->{'eventData3'} >> 16) & 0xFFFF;
837 }
838  
839 #==============================================================================
840  
841 =item sub event_data3_short2([$newValue])
842  
843 $value = $evt_ntc->event_data3_short2($newValue);
844  
845 Event Data 3.
846  
847 This attribute represents as a short the two least significant bytes of one of
848 three 32-bit words used for user-defined event data. If this attribute is not
849 needed by the event, this value is ignored.
850  
851 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
852 sender use different byte ordering schemes. If the attribute is used to store
853 multiple 8- or 16-bit values, the data should be packed so that byte swapping
854 will be performed correctly.
855  
856 =cut
857  
858 0 ▶sub event_data3_short2() {
Subroutine event_data3_short2: not called CC=2 SCAR=17.9
Pod documented
859 0 my ($self,$nv) = @_;
860 0 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 0 0 0
861 0 $nv = ($nv & 0xFFFF) | ($self->{'eventData3'} & 0xFFFF0000);
862 0 $self->{'eventData3'} = $nv;
863 }
864 0 return $self->{'eventData3'} & 0xFFFF;
865 }
866  
867 #==============================================================================
868  
869 =item sub event_data3_byte1([$newValue])
870  
871 $value = $evt_ntc->event_data3_byte1($newValue);
872  
873 Event Data 3.
874  
875 This attribute represents the most significant byte of one of
876 three 32-bit words used for user-defined event data. If this attribute is not
877 needed by the event, this value is ignored.
878  
879 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
880 sender use different byte ordering schemes. If the attribute is used to store
881 multiple 8- or 16-bit values, the data should be packed so that byte swapping
882 will be performed correctly.
883  
884 =cut
885  
886 0 ▶sub event_data3_byte1() {
Subroutine event_data3_byte1: not called CC=2 SCAR=17.9
Pod documented
887 0 my ($self,$nv) = @_;
888 0 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 0 0 0
889 0 $nv = (($nv & 0xFF) << 24) | ($self->{'eventData3'} & 0xFFFFFF);
890 0 $self->{'eventData3'} = $nv;
891 }
892 0 return ($self->{'eventData3'} >> 24) & 0xFF;
893 }
894  
895 #==============================================================================
896  
897 =item sub event_data3_byte2([$newValue])
898  
899 $value = $evt_ntc->event_data3_byte2($newValue);
900  
901 Event Data 3.
902  
903 This attribute represents the second most significant byte of one of
904 three 32-bit words used for user-defined event data. If this attribute is not
905 needed by the event, this value is ignored.
906  
907 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
908 sender use different byte ordering schemes. If the attribute is used to store
909 multiple 8- or 16-bit values, the data should be packed so that byte swapping
910 will be performed correctly.
911  
912 =cut
913  
914 0 ▶sub event_data3_byte2() {
Subroutine event_data3_byte2: not called CC=2 SCAR=17.9
Pod documented
915 0 my ($self,$nv) = @_;
916 0 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 0 0 0
917 0 $nv = (($nv & 0xFF) << 16) | ($self->{'eventData3'} & 0xFF00FFFF);
918 0 $self->{'eventData3'} = $nv;
919 }
920 0 return ($self->{'eventData3'} >> 16) & 0xFF;
921 }
922  
923 #==============================================================================
924  
925 =item sub event_data3_byte3([$newValue])
926  
927 $value = $evt_ntc->event_data3_byte3($newValue);
928  
929 Event Data 3.
930  
931 This attribute represents the second least significant byte of one of
932 three 32-bit words used for user-defined event data. If this attribute is not
933 needed by the event, this value is ignored.
934  
935 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
936 sender use different byte ordering schemes. If the attribute is used to store
937 multiple 8- or 16-bit values, the data should be packed so that byte swapping
938 will be performed correctly.
939  
940 =cut
941  
942 0 ▶sub event_data3_byte3() {
Subroutine event_data3_byte3: not called CC=2 SCAR=17.9
Pod documented
943 0 my ($self,$nv) = @_;
944 0 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 0 0 0
945 0 $nv = (($nv & 0xFF) << 8) | ($self->{'eventData3'} & 0xFFFF00FF);
946 0 $self->{'eventData3'} = $nv;
947 }
948 0 return ($self->{'eventData3'} >> 8) & 0xFF;
949 }
950  
951 #==============================================================================
952  
953 =item sub event_data3_byte4([$newValue])
954  
955 $value = $evt_ntc->event_data3_byte4($newValue);
956  
957 Event Data 3.
958  
959 This attribute represents the least significant byte of one of
960 three 32-bit words used for user-defined event data. If this attribute is not
961 needed by the event, this value is ignored.
962  
963 Note: This attribute will be byte-swapped as a 32-bit value if the receiver and
964 sender use different byte ordering schemes. If the attribute is used to store
965 multiple 8- or 16-bit values, the data should be packed so that byte swapping
966 will be performed correctly.
967  
968 =cut
969  
970 0 ▶sub event_data3_byte4() {
Subroutine event_data3_byte4: not called CC=2 SCAR=17.9
Pod documented
971 0 my ($self,$nv) = @_;
972 0 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 0 0 0
973 0 $nv = ($nv & 0xFF) | ($self->{'eventData3'} & 0xFFFFFF00);
974 0 $self->{'eventData3'} = $nv;
975 }
976 0 return $self->{'eventData3'} & 0xFF;
977 }
978  
979 #==============================================================================
980  
981 2 1;
982 __END__
« CIGIPP/SymbolLineDefinition.pm ↑ Summary CIGIPP/SensorControl.pm »