line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# Rinchi Common Image Generator Interface for Perl |
3
|
|
|
|
|
|
|
# Class Identifier: f78b28b4-200e-11de-bdcc-001c25551abc |
4
|
|
|
|
|
|
|
# Author: Brian M. Ames |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package Rinchi::CIGIPP::SensorResponse; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
26
|
use 5.006; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
79
|
|
10
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
11
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
12
|
1
|
|
|
1
|
|
7
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
2036
|
|
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::SensorResponse - Perl extension for the Common Image Generator |
42
|
|
|
|
|
|
|
Interface - Sensor Response data packet. |
43
|
|
|
|
|
|
|
data packet. |
44
|
|
|
|
|
|
|
=head1 SYNOPSIS |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
use Rinchi::CIGIPP::SensorResponse; |
47
|
|
|
|
|
|
|
my $sensor_resp = Rinchi::CIGIPP::SensorResponse->new(); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
$packet_type = $sensor_resp->packet_type(); |
50
|
|
|
|
|
|
|
$packet_size = $sensor_resp->packet_size(); |
51
|
|
|
|
|
|
|
$view_ident = $sensor_resp->view_ident(7825); |
52
|
|
|
|
|
|
|
$sensor_ident = $sensor_resp->sensor_ident(71); |
53
|
|
|
|
|
|
|
$sensor_status = $sensor_resp->sensor_status(Rinchi::CIGIPP->Tracking); |
54
|
|
|
|
|
|
|
$gate_xsize = $sensor_resp->gate_xsize(21687); |
55
|
|
|
|
|
|
|
$gate_ysize = $sensor_resp->gate_ysize(11524); |
56
|
|
|
|
|
|
|
$gate_xposition = $sensor_resp->gate_xposition(53.246); |
57
|
|
|
|
|
|
|
$gate_yposition = $sensor_resp->gate_yposition(75.892); |
58
|
|
|
|
|
|
|
$host_frame_number = $sensor_resp->host_frame_number(19728); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 DESCRIPTION |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
The Sensor Response packet is used to report the gate size and position on a |
63
|
|
|
|
|
|
|
sensor display to the Host. The sensor gate size and position are defined with |
64
|
|
|
|
|
|
|
respect to the 2D view coordinate system. The +X axis is to the right of the |
65
|
|
|
|
|
|
|
screen and the +Y axis is up. The origin is at the intersection of the viewing |
66
|
|
|
|
|
|
|
vector with the view plane. The gate position is measured in degrees along each |
67
|
|
|
|
|
|
|
axis from the origin to the center of the gate. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
The Gate X Position and Gate Y Position angles correspond to the horizontal and |
70
|
|
|
|
|
|
|
vertical angles formed between the sensor's viewing vector and a vector from |
71
|
|
|
|
|
|
|
the sensor eyepoint to the track point. Scaling of the sensor view can be |
72
|
|
|
|
|
|
|
performed with a View Definition packet. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
The Host Frame Number attribute contains value of the Host Frame Number |
75
|
|
|
|
|
|
|
attribute of the IG Control packet last received by the IG before the gate and |
76
|
|
|
|
|
|
|
line-of-sight intersection data are calculated. The Host may correlate this |
77
|
|
|
|
|
|
|
value to an eyepoint position or may use the value to determine sensor sampling |
78
|
|
|
|
|
|
|
rate latency. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Either this packet or the Sensor Extended Response packet must be sent to the |
81
|
|
|
|
|
|
|
Host during each frame that the specified sensor is active. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head2 EXPORT |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
None by default. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
#============================================================================== |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=item new $sensor_resp = Rinchi::CIGIPP::SensorResponse->new() |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Constructor for Rinchi::SensorResponse. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=cut |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub new { |
96
|
1
|
|
|
1
|
1
|
51
|
my $class = shift; |
97
|
1
|
|
33
|
|
|
7
|
$class = ref($class) || $class; |
98
|
|
|
|
|
|
|
|
99
|
1
|
|
|
|
|
20
|
my $self = { |
100
|
|
|
|
|
|
|
'_Buffer' => '', |
101
|
|
|
|
|
|
|
'_ClassIdent' => 'f78b28b4-200e-11de-bdcc-001c25551abc', |
102
|
|
|
|
|
|
|
'_Pack' => 'CCSCCSSSffI', |
103
|
|
|
|
|
|
|
'_Swap1' => 'CCvCCvvvVVV', |
104
|
|
|
|
|
|
|
'_Swap2' => 'CCnCCnnnNNN', |
105
|
|
|
|
|
|
|
'packetType' => 106, |
106
|
|
|
|
|
|
|
'packetSize' => 24, |
107
|
|
|
|
|
|
|
'viewIdent' => 0, |
108
|
|
|
|
|
|
|
'sensorIdent' => 0, |
109
|
|
|
|
|
|
|
'_bitfields1' => 0, # Includes bitfields unused74, and sensorStatus. |
110
|
|
|
|
|
|
|
'sensorStatus' => 0, |
111
|
|
|
|
|
|
|
'_unused75' => 0, |
112
|
|
|
|
|
|
|
'gateXSize' => 0, |
113
|
|
|
|
|
|
|
'gateYSize' => 0, |
114
|
|
|
|
|
|
|
'gateXPosition' => 0, |
115
|
|
|
|
|
|
|
'gateYPosition' => 0, |
116
|
|
|
|
|
|
|
'hostFrameNumber' => 0, |
117
|
|
|
|
|
|
|
}; |
118
|
|
|
|
|
|
|
|
119
|
1
|
50
|
|
|
|
4
|
if (@_) { |
120
|
0
|
0
|
|
|
|
0
|
if (ref($_[0]) eq 'ARRAY') { |
|
|
0
|
|
|
|
|
|
121
|
0
|
|
|
|
|
0
|
$self->{'_Buffer'} = $_[0][0]; |
122
|
|
|
|
|
|
|
} elsif (ref($_[0]) eq 'HASH') { |
123
|
0
|
|
|
|
|
0
|
foreach my $attr (keys %{$_[0]}) { |
|
0
|
|
|
|
|
0
|
|
124
|
0
|
0
|
|
|
|
0
|
$self->{"_$attr"} = $_[0]->{$attr} unless ($attr =~ /^_/); |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
1
|
|
|
|
|
3
|
bless($self,$class); |
130
|
1
|
|
|
|
|
3
|
return $self; |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
#============================================================================== |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=item sub packet_type() |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
$value = $sensor_resp->packet_type(); |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Data Packet Identifier. |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
This attribute identifies this data packet as the Sensor Response packet. The |
142
|
|
|
|
|
|
|
value of this attribute must be 106. |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=cut |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
sub packet_type() { |
147
|
1
|
|
|
1
|
1
|
7
|
my ($self) = @_; |
148
|
1
|
|
|
|
|
6
|
return $self->{'packetType'}; |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
#============================================================================== |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=item sub packet_size() |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
$value = $sensor_resp->packet_size(); |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
Data Packet Size. |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
This attribute indicates the number of bytes in this data packet. The value of |
160
|
|
|
|
|
|
|
this attribute must be 24. |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=cut |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
sub packet_size() { |
165
|
1
|
|
|
1
|
1
|
6
|
my ($self) = @_; |
166
|
1
|
|
|
|
|
2
|
return $self->{'packetSize'}; |
167
|
|
|
|
|
|
|
} |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
#============================================================================== |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=item sub view_ident([$newValue]) |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
$value = $sensor_resp->view_ident($newValue); |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
View ID. |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
This attribute specifies the view that represents the sensor display. |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=cut |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
sub view_ident() { |
182
|
1
|
|
|
1
|
1
|
11
|
my ($self,$nv) = @_; |
183
|
1
|
50
|
|
|
|
9
|
if (defined($nv)) { |
184
|
1
|
|
|
|
|
3
|
$self->{'viewIdent'} = $nv; |
185
|
|
|
|
|
|
|
} |
186
|
1
|
|
|
|
|
3
|
return $self->{'viewIdent'}; |
187
|
|
|
|
|
|
|
} |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
#============================================================================== |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=item sub sensor_ident([$newValue]) |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
$value = $sensor_resp->sensor_ident($newValue); |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
Sensor ID. |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
This attribute specifies the sensor to which the data in this packet apply. |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=cut |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
sub sensor_ident() { |
202
|
1
|
|
|
1
|
1
|
6
|
my ($self,$nv) = @_; |
203
|
1
|
50
|
|
|
|
5
|
if (defined($nv)) { |
204
|
1
|
|
|
|
|
2
|
$self->{'sensorIdent'} = $nv; |
205
|
|
|
|
|
|
|
} |
206
|
1
|
|
|
|
|
3
|
return $self->{'sensorIdent'}; |
207
|
|
|
|
|
|
|
} |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
#============================================================================== |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=item sub sensor_status([$newValue]) |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
$value = $sensor_resp->sensor_status($newValue); |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
Sensor Status. |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
This attribute indicates the current tracking state of the sensor. |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
Searching 0 |
220
|
|
|
|
|
|
|
Tracking 1 |
221
|
|
|
|
|
|
|
ImpendingBreaklock 2 |
222
|
|
|
|
|
|
|
Breaklock 3 |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=cut |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
sub sensor_status() { |
227
|
1
|
|
|
1
|
1
|
2
|
my ($self,$nv) = @_; |
228
|
1
|
50
|
|
|
|
4
|
if (defined($nv)) { |
229
|
1
|
50
|
33
|
|
|
12
|
if (($nv==0) or ($nv==1) or ($nv==2) or ($nv==3)) { |
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
230
|
1
|
|
|
|
|
2
|
$self->{'sensorStatus'} = $nv; |
231
|
1
|
|
|
|
|
2
|
$self->{'_bitfields1'} |= $nv &0x03; |
232
|
|
|
|
|
|
|
} else { |
233
|
0
|
|
|
|
|
0
|
carp "sensor_status must be 0 (Searching), 1 (Tracking), 2 (ImpendingBreaklock), or 3 (Breaklock)."; |
234
|
|
|
|
|
|
|
} |
235
|
|
|
|
|
|
|
} |
236
|
1
|
|
|
|
|
4
|
return ($self->{'_bitfields1'} & 0x03); |
237
|
|
|
|
|
|
|
} |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
#============================================================================== |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
=item sub gate_xsize([$newValue]) |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
$value = $sensor_resp->gate_xsize($newValue); |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
Gate X Size. |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
This attribute specifies the gate symbol size along the view's X axis. |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
Note: This size is specified in either pixels or raster lines depending upon |
250
|
|
|
|
|
|
|
the orientation of the display. |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
=cut |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
sub gate_xsize() { |
255
|
1
|
|
|
1
|
1
|
6
|
my ($self,$nv) = @_; |
256
|
1
|
50
|
|
|
|
4
|
if (defined($nv)) { |
257
|
1
|
|
|
|
|
2
|
$self->{'gateXSize'} = $nv; |
258
|
|
|
|
|
|
|
} |
259
|
1
|
|
|
|
|
5
|
return $self->{'gateXSize'}; |
260
|
|
|
|
|
|
|
} |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
#============================================================================== |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
=item sub gate_ysize([$newValue]) |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
$value = $sensor_resp->gate_ysize($newValue); |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
Gate Y Size. |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
This attribute specifies the gate symbol size along the view's Y axis. |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
Note: This size is specified in either pixels or raster lines depending upon |
273
|
|
|
|
|
|
|
the orientation of the display. |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
=cut |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
sub gate_ysize() { |
278
|
1
|
|
|
1
|
1
|
5
|
my ($self,$nv) = @_; |
279
|
1
|
50
|
|
|
|
3
|
if (defined($nv)) { |
280
|
1
|
|
|
|
|
3
|
$self->{'gateYSize'} = $nv; |
281
|
|
|
|
|
|
|
} |
282
|
1
|
|
|
|
|
3
|
return $self->{'gateYSize'}; |
283
|
|
|
|
|
|
|
} |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
#============================================================================== |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
=item sub gate_xposition([$newValue]) |
288
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
$value = $sensor_resp->gate_xposition($newValue); |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
Gate X Position. |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
This attribute specifies the gate symbol's position along the view's X axis. |
294
|
|
|
|
|
|
|
This position is given as the horizontal angle formed at the sensor eyepoint |
295
|
|
|
|
|
|
|
between the sensor's viewing vector and the center of the track point. |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
=cut |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
sub gate_xposition() { |
300
|
1
|
|
|
1
|
1
|
7
|
my ($self,$nv) = @_; |
301
|
1
|
50
|
|
|
|
4
|
if (defined($nv)) { |
302
|
1
|
|
|
|
|
7
|
$self->{'gateXPosition'} = $nv; |
303
|
|
|
|
|
|
|
} |
304
|
1
|
|
|
|
|
3
|
return $self->{'gateXPosition'}; |
305
|
|
|
|
|
|
|
} |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
#============================================================================== |
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
=item sub gate_yposition([$newValue]) |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
$value = $sensor_resp->gate_yposition($newValue); |
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
Gate Y Position. |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
This attribute specifies the gate symbol's position along the view's Y axis. |
316
|
|
|
|
|
|
|
This position is given as the vertical angle formed at the sensor eyepoint |
317
|
|
|
|
|
|
|
between the sensor's viewing vector and the center of the track point. |
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
=cut |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
sub gate_yposition() { |
322
|
1
|
|
|
1
|
1
|
4
|
my ($self,$nv) = @_; |
323
|
1
|
50
|
|
|
|
5
|
if (defined($nv)) { |
324
|
1
|
|
|
|
|
2
|
$self->{'gateYPosition'} = $nv; |
325
|
|
|
|
|
|
|
} |
326
|
1
|
|
|
|
|
3
|
return $self->{'gateYPosition'}; |
327
|
|
|
|
|
|
|
} |
328
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
#============================================================================== |
330
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
=item sub host_frame_number([$newValue]) |
332
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
$value = $sensor_resp->host_frame_number($newValue); |
334
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
Host Frame Number. |
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
This attribute indicates the Host frame number at the time that the IG |
338
|
|
|
|
|
|
|
calculates the gate and line-of-sight intersection data. |
339
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
=cut |
341
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
sub host_frame_number() { |
343
|
1
|
|
|
1
|
1
|
6
|
my ($self,$nv) = @_; |
344
|
1
|
50
|
|
|
|
4
|
if (defined($nv)) { |
345
|
1
|
|
|
|
|
9
|
$self->{'hostFrameNumber'} = $nv; |
346
|
|
|
|
|
|
|
} |
347
|
1
|
|
|
|
|
3
|
return $self->{'hostFrameNumber'}; |
348
|
|
|
|
|
|
|
} |
349
|
|
|
|
|
|
|
|
350
|
|
|
|
|
|
|
#========================================================================== |
351
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
=item sub pack() |
353
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
$value = $sensor_resp->pack(); |
355
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
Returns the packed data packet. |
357
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
=cut |
359
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
sub pack($) { |
361
|
1
|
|
|
1
|
1
|
5
|
my $self = shift ; |
362
|
|
|
|
|
|
|
|
363
|
1
|
|
|
|
|
6
|
$self->{'_Buffer'} = CORE::pack($self->{'_Pack'}, |
364
|
|
|
|
|
|
|
$self->{'packetType'}, |
365
|
|
|
|
|
|
|
$self->{'packetSize'}, |
366
|
|
|
|
|
|
|
$self->{'viewIdent'}, |
367
|
|
|
|
|
|
|
$self->{'sensorIdent'}, |
368
|
|
|
|
|
|
|
$self->{'_bitfields1'}, # Includes bitfields unused74, and sensorStatus. |
369
|
|
|
|
|
|
|
$self->{'_unused75'}, |
370
|
|
|
|
|
|
|
$self->{'gateXSize'}, |
371
|
|
|
|
|
|
|
$self->{'gateYSize'}, |
372
|
|
|
|
|
|
|
$self->{'gateXPosition'}, |
373
|
|
|
|
|
|
|
$self->{'gateYPosition'}, |
374
|
|
|
|
|
|
|
$self->{'hostFrameNumber'}, |
375
|
|
|
|
|
|
|
); |
376
|
|
|
|
|
|
|
|
377
|
1
|
|
|
|
|
3
|
return $self->{'_Buffer'}; |
378
|
|
|
|
|
|
|
} |
379
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
#========================================================================== |
381
|
|
|
|
|
|
|
|
382
|
|
|
|
|
|
|
=item sub unpack() |
383
|
|
|
|
|
|
|
|
384
|
|
|
|
|
|
|
$value = $sensor_resp->unpack(); |
385
|
|
|
|
|
|
|
|
386
|
|
|
|
|
|
|
Unpacks the packed data packet. |
387
|
|
|
|
|
|
|
|
388
|
|
|
|
|
|
|
=cut |
389
|
|
|
|
|
|
|
|
390
|
|
|
|
|
|
|
sub unpack($) { |
391
|
0
|
|
|
0
|
1
|
|
my $self = shift @_; |
392
|
|
|
|
|
|
|
|
393
|
0
|
0
|
|
|
|
|
if (@_) { |
394
|
0
|
|
|
|
|
|
$self->{'_Buffer'} = shift @_; |
395
|
|
|
|
|
|
|
} |
396
|
0
|
|
|
|
|
|
my ($a,$b,$c,$d,$e,$f,$g,$h,$i,$j,$k) = CORE::unpack($self->{'_Pack'},$self->{'_Buffer'}); |
397
|
0
|
|
|
|
|
|
$self->{'packetType'} = $a; |
398
|
0
|
|
|
|
|
|
$self->{'packetSize'} = $b; |
399
|
0
|
|
|
|
|
|
$self->{'viewIdent'} = $c; |
400
|
0
|
|
|
|
|
|
$self->{'sensorIdent'} = $d; |
401
|
0
|
|
|
|
|
|
$self->{'_bitfields1'} = $e; # Includes bitfields unused74, and sensorStatus. |
402
|
0
|
|
|
|
|
|
$self->{'_unused75'} = $f; |
403
|
0
|
|
|
|
|
|
$self->{'gateXSize'} = $g; |
404
|
0
|
|
|
|
|
|
$self->{'gateYSize'} = $h; |
405
|
0
|
|
|
|
|
|
$self->{'gateXPosition'} = $i; |
406
|
0
|
|
|
|
|
|
$self->{'gateYPosition'} = $j; |
407
|
0
|
|
|
|
|
|
$self->{'hostFrameNumber'} = $k; |
408
|
|
|
|
|
|
|
|
409
|
0
|
|
|
|
|
|
$self->{'sensorStatus'} = $self->sensor_status(); |
410
|
|
|
|
|
|
|
|
411
|
0
|
|
|
|
|
|
return $self->{'_Buffer'}; |
412
|
|
|
|
|
|
|
} |
413
|
|
|
|
|
|
|
|
414
|
|
|
|
|
|
|
#========================================================================== |
415
|
|
|
|
|
|
|
|
416
|
|
|
|
|
|
|
=item sub byte_swap() |
417
|
|
|
|
|
|
|
|
418
|
|
|
|
|
|
|
$obj_name->byte_swap(); |
419
|
|
|
|
|
|
|
|
420
|
|
|
|
|
|
|
Byte swaps the packed data packet. |
421
|
|
|
|
|
|
|
|
422
|
|
|
|
|
|
|
=cut |
423
|
|
|
|
|
|
|
|
424
|
|
|
|
|
|
|
sub byte_swap($) { |
425
|
0
|
|
|
0
|
1
|
|
my $self = shift @_; |
426
|
|
|
|
|
|
|
|
427
|
0
|
0
|
|
|
|
|
if (@_) { |
428
|
0
|
|
|
|
|
|
$self->{'_Buffer'} = shift @_; |
429
|
|
|
|
|
|
|
} else { |
430
|
0
|
|
|
|
|
|
$self->unpack(); |
431
|
|
|
|
|
|
|
} |
432
|
0
|
|
|
|
|
|
my ($a,$b,$c,$d,$e,$f,$g,$h,$i,$j,$k) = CORE::unpack($self->{'_Swap1'},$self->{'_Buffer'}); |
433
|
|
|
|
|
|
|
|
434
|
0
|
|
|
|
|
|
$self->{'_Buffer'} = CORE::pack($self->{'_Swap2'},$a,$b,$c,$d,$e,$f,$g,$h,$i,$j,$k); |
435
|
0
|
|
|
|
|
|
$self->unpack(); |
436
|
|
|
|
|
|
|
|
437
|
0
|
|
|
|
|
|
return $self->{'_Buffer'}; |
438
|
|
|
|
|
|
|
} |
439
|
|
|
|
|
|
|
|
440
|
|
|
|
|
|
|
1; |
441
|
|
|
|
|
|
|
__END__ |