line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# Rinchi Common Image Generator Interface for Perl |
3
|
|
|
|
|
|
|
# Class Identifier: f78b1b62-200e-11de-bdc7-001c25551abc |
4
|
|
|
|
|
|
|
# Author: Brian M. Ames |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package Rinchi::CIGIPP::HAT_HOTResponse; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
19
|
use 5.006; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
37
|
|
10
|
1
|
|
|
1
|
|
136
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
32
|
|
11
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
22
|
|
12
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
2275
|
|
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.02'; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# Preloaded methods go here. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 NAME |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Rinchi::CIGIPP::HAT_HOTResponse - Perl extension for the Common Image Generator |
42
|
|
|
|
|
|
|
Interface - HAT/HOTResponse data packet. |
43
|
|
|
|
|
|
|
data packet. |
44
|
|
|
|
|
|
|
=head1 SYNOPSIS |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
use Rinchi::CIGIPP::HAT_HOTResponse; |
47
|
|
|
|
|
|
|
my $hgt_resp = Rinchi::CIGIPP::HAT_HOTResponse->new(); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
$packet_type = $hgt_resp->packet_type(); |
50
|
|
|
|
|
|
|
$packet_size = $hgt_resp->packet_size(); |
51
|
|
|
|
|
|
|
$response_ident = $hgt_resp->response_ident(47273); |
52
|
|
|
|
|
|
|
$host_frame_number_lsn = $hgt_resp->host_frame_number_lsn(13); |
53
|
|
|
|
|
|
|
$response_type = $hgt_resp->response_type(Rinchi::CIGIPP->HeightAboveTerrain); |
54
|
|
|
|
|
|
|
$valid = $hgt_resp->valid(Rinchi::CIGIPP->Invalid); |
55
|
|
|
|
|
|
|
$height = $hgt_resp->height(51.413); |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 DESCRIPTION |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
The HAT/HOT Response packet is sent by the IG in response to a HAT/HOT Request |
60
|
|
|
|
|
|
|
packet whose Request Type attribute was set to HAT (0) or HOT (1). This packet |
61
|
|
|
|
|
|
|
provides either the Height Above Terrain (HAT) or Height Of Terrain (HOT) for |
62
|
|
|
|
|
|
|
the test point. This packet does not contain the material code or surface |
63
|
|
|
|
|
|
|
normal of the terrain. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
If the Update Period attribute of the originating HAT/HOT Request packet was |
66
|
|
|
|
|
|
|
set to a value greater than zero, then the Host Frame Number LSN attribute of |
67
|
|
|
|
|
|
|
each corresponding HAT/HOT Response packet must contain the least significant |
68
|
|
|
|
|
|
|
nybble of the Host Frame Number value last received by the IG before the HAT or |
69
|
|
|
|
|
|
|
HOT value is calculated. The Host may correlate this LSN to an eyepoint |
70
|
|
|
|
|
|
|
position or may use the value to determine latency. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
The IG can only return the HAT or HOT for a point that is within the bounds of |
73
|
|
|
|
|
|
|
the current database. If the HAT or HOT cannot be returned, the Valid attribute |
74
|
|
|
|
|
|
|
will be set to Invalid (0). |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head2 EXPORT |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
None by default. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
#============================================================================== |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=item new $hgt_resp = Rinchi::CIGIPP::HAT_HOTResponse->new() |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Constructor for Rinchi::HAT_HOTResponse. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=cut |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub new { |
89
|
1
|
|
|
1
|
1
|
59
|
my $class = shift; |
90
|
1
|
|
33
|
|
|
8
|
$class = ref($class) || $class; |
91
|
|
|
|
|
|
|
|
92
|
1
|
|
|
|
|
15
|
my $self = { |
93
|
|
|
|
|
|
|
'_Buffer' => '', |
94
|
|
|
|
|
|
|
'_ClassIdent' => 'f78b1b62-200e-11de-bdc7-001c25551abc', |
95
|
|
|
|
|
|
|
'_Pack' => 'CCSCCSd', |
96
|
|
|
|
|
|
|
'_Swap1' => 'CCvCCvVV', |
97
|
|
|
|
|
|
|
'_Swap2' => 'CCnCCnNN', |
98
|
|
|
|
|
|
|
'packetType' => 102, |
99
|
|
|
|
|
|
|
'packetSize' => 16, |
100
|
|
|
|
|
|
|
'_responseIdent' => 0, |
101
|
|
|
|
|
|
|
'_bitfields1' => 0, # Includes bitfields hostFrameNumberLSN, responseType, and valid. |
102
|
|
|
|
|
|
|
'hostFrameNumberLSN' => 0, |
103
|
|
|
|
|
|
|
'responseType' => 0, |
104
|
|
|
|
|
|
|
'valid' => 0, |
105
|
|
|
|
|
|
|
'_unused67' => 0, |
106
|
|
|
|
|
|
|
'_unused68' => 0, |
107
|
|
|
|
|
|
|
'height' => 0, |
108
|
|
|
|
|
|
|
}; |
109
|
|
|
|
|
|
|
|
110
|
1
|
50
|
|
|
|
5
|
if (@_) { |
111
|
0
|
0
|
|
|
|
0
|
if (ref($_[0]) eq 'ARRAY') { |
|
|
0
|
|
|
|
|
|
112
|
0
|
|
|
|
|
0
|
$self->{'_Buffer'} = $_[0][0]; |
113
|
|
|
|
|
|
|
} elsif (ref($_[0]) eq 'HASH') { |
114
|
0
|
|
|
|
|
0
|
foreach my $attr (keys %{$_[0]}) { |
|
0
|
|
|
|
|
0
|
|
115
|
0
|
0
|
|
|
|
0
|
$self->{"_$attr"} = $_[0]->{$attr} unless ($attr =~ /^_/); |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
1
|
|
|
|
|
3
|
bless($self,$class); |
121
|
1
|
|
|
|
|
19
|
return $self; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
#============================================================================== |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=item sub packet_type() |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
$value = $hgt_resp->packet_type(); |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
Data Packet Identifier. |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
This attribute identifies this data packet as the HAT/HOT Response packet. The |
133
|
|
|
|
|
|
|
value of this attribute must be 102. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=cut |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
sub packet_type() { |
138
|
1
|
|
|
1
|
1
|
8
|
my ($self) = @_; |
139
|
1
|
|
|
|
|
11
|
return $self->{'packetType'}; |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
#============================================================================== |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=item sub packet_size() |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
$value = $hgt_resp->packet_size(); |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Data Packet Size. |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
This attribute indicates the number of bytes in this data packet. The value of |
151
|
|
|
|
|
|
|
this attribute must be 16. |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=cut |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
sub packet_size() { |
156
|
1
|
|
|
1
|
1
|
13
|
my ($self) = @_; |
157
|
1
|
|
|
|
|
5
|
return $self->{'packetSize'}; |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
#============================================================================== |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=item sub response_ident([$newValue]) |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
$value = $hgt_resp->response_ident($newValue); |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
HAT/HOT ID. |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
This attribute identifies the HAT/HOT response. This value corresponds to the |
169
|
|
|
|
|
|
|
value of the HAT/HOT ID attribute in the associated HAT/HOT Request packet. |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=cut |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
sub response_ident() { |
174
|
1
|
|
|
1
|
1
|
6
|
my ($self,$nv) = @_; |
175
|
1
|
50
|
|
|
|
5
|
if (defined($nv)) { |
176
|
1
|
|
|
|
|
3
|
$self->{'_responseIdent'} = $nv; |
177
|
|
|
|
|
|
|
} |
178
|
1
|
|
|
|
|
3
|
return $self->{'_responseIdent'}; |
179
|
|
|
|
|
|
|
} |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
#============================================================================== |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=item sub host_frame_number_lsn([$newValue]) |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
$value = $hgt_resp->host_frame_number_lsn($newValue); |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
Host Frame Number LSN. |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
This attribute contains the least significant nybble of the Host Frame Number |
190
|
|
|
|
|
|
|
attribute of the last IG Control packet received before the HAT or HOT is |
191
|
|
|
|
|
|
|
calculated. |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
This attribute is ignored if the Update Period attribute of the corresponding |
194
|
|
|
|
|
|
|
HAT/HOT Request packet was set to zero (0). |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=cut |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
sub host_frame_number_lsn() { |
199
|
1
|
|
|
1
|
1
|
7
|
my ($self,$nv) = @_; |
200
|
1
|
50
|
|
|
|
4
|
if (defined($nv)) { |
201
|
1
|
|
|
|
|
3
|
$self->{'hostFrameNumberLSN'} = $nv; |
202
|
1
|
|
|
|
|
3
|
$self->{'_bitfields1'} |= ($nv << 4) &0xF0; |
203
|
|
|
|
|
|
|
} |
204
|
1
|
|
|
|
|
4
|
return (($self->{'_bitfields1'} & 0xF0) >> 4); |
205
|
|
|
|
|
|
|
} |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
#============================================================================== |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=item sub response_type([$newValue]) |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
$value = $hgt_resp->response_type($newValue); |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
Response Type. |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
This attribute indicates whether the Height attribute represents Height Above |
216
|
|
|
|
|
|
|
Terrain or Height Of Terrain. |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
HeightAboveTerrain 0 |
219
|
|
|
|
|
|
|
HeightOfTerrain 1 |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=cut |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
sub response_type() { |
224
|
1
|
|
|
1
|
1
|
3
|
my ($self,$nv) = @_; |
225
|
1
|
50
|
|
|
|
4
|
if (defined($nv)) { |
226
|
1
|
50
|
33
|
|
|
6
|
if (($nv==0) or ($nv==1)) { |
227
|
1
|
|
|
|
|
3
|
$self->{'responseType'} = $nv; |
228
|
1
|
|
|
|
|
3
|
$self->{'_bitfields1'} |= ($nv << 1) &0x02; |
229
|
|
|
|
|
|
|
} else { |
230
|
0
|
|
|
|
|
0
|
carp "response_type must be 0 (HeightAboveTerrain), or 1 (HeightOfTerrain)."; |
231
|
|
|
|
|
|
|
} |
232
|
|
|
|
|
|
|
} |
233
|
1
|
|
|
|
|
5
|
return (($self->{'_bitfields1'} & 0x02) >> 1); |
234
|
|
|
|
|
|
|
} |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
#============================================================================== |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
=item sub valid([$newValue]) |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
$value = $hgt_resp->valid($newValue); |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
Valid. |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
This attribute indicates whether the remaining attributes in this packet |
245
|
|
|
|
|
|
|
contain valid numbers. A value of zero (0) indicates that the test point was |
246
|
|
|
|
|
|
|
beyond the database bounds. |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
Invalid 0 |
249
|
|
|
|
|
|
|
Valid 1 |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
=cut |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
sub valid() { |
254
|
1
|
|
|
1
|
1
|
3
|
my ($self,$nv) = @_; |
255
|
1
|
50
|
|
|
|
4
|
if (defined($nv)) { |
256
|
1
|
50
|
33
|
|
|
5
|
if (($nv==0) or ($nv==1)) { |
257
|
1
|
|
|
|
|
3
|
$self->{'valid'} = $nv; |
258
|
1
|
|
|
|
|
3
|
$self->{'_bitfields1'} |= $nv &0x01; |
259
|
|
|
|
|
|
|
} else { |
260
|
0
|
|
|
|
|
0
|
carp "valid must be 0 (Invalid), or 1 (Valid)."; |
261
|
|
|
|
|
|
|
} |
262
|
|
|
|
|
|
|
} |
263
|
1
|
|
|
|
|
3
|
return ($self->{'_bitfields1'} & 0x01); |
264
|
|
|
|
|
|
|
} |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
#============================================================================== |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
=item sub height([$newValue]) |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
$value = $hgt_resp->height($newValue); |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
Height. |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
This attribute contains the requested height. If Request Type is set to HAT |
275
|
|
|
|
|
|
|
(0), this value represents the Height Above Terrain. If Request Type is set to |
276
|
|
|
|
|
|
|
HOT (1), this value represents the Height Of Terrain. |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
This attribute is valid only if the Valid attribute is set to one (1). |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
=cut |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
sub height() { |
283
|
1
|
|
|
1
|
1
|
6
|
my ($self,$nv) = @_; |
284
|
1
|
50
|
|
|
|
54
|
if (defined($nv)) { |
285
|
1
|
|
|
|
|
4
|
$self->{'height'} = $nv; |
286
|
|
|
|
|
|
|
} |
287
|
1
|
|
|
|
|
5
|
return $self->{'height'}; |
288
|
|
|
|
|
|
|
} |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
#========================================================================== |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
=item sub pack() |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
$value = $hgt_resp->pack(); |
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
Returns the packed data packet. |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
=cut |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
sub pack($) { |
301
|
1
|
|
|
1
|
1
|
8
|
my $self = shift ; |
302
|
|
|
|
|
|
|
|
303
|
1
|
|
|
|
|
16
|
$self->{'_Buffer'} = CORE::pack($self->{'_Pack'}, |
304
|
|
|
|
|
|
|
$self->{'packetType'}, |
305
|
|
|
|
|
|
|
$self->{'packetSize'}, |
306
|
|
|
|
|
|
|
$self->{'_responseIdent'}, |
307
|
|
|
|
|
|
|
$self->{'_bitfields1'}, # Includes bitfields hostFrameNumberLSN, unused66, responseType, and valid. |
308
|
|
|
|
|
|
|
$self->{'_unused67'}, |
309
|
|
|
|
|
|
|
$self->{'_unused68'}, |
310
|
|
|
|
|
|
|
$self->{'height'}, |
311
|
|
|
|
|
|
|
); |
312
|
|
|
|
|
|
|
|
313
|
1
|
|
|
|
|
5
|
return $self->{'_Buffer'}; |
314
|
|
|
|
|
|
|
} |
315
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
#========================================================================== |
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
=item sub unpack() |
319
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
$value = $hgt_resp->unpack(); |
321
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
Unpacks the packed data packet. |
323
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
=cut |
325
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
sub unpack($) { |
327
|
0
|
|
|
0
|
1
|
|
my $self = shift @_; |
328
|
|
|
|
|
|
|
|
329
|
0
|
0
|
|
|
|
|
if (@_) { |
330
|
0
|
|
|
|
|
|
$self->{'_Buffer'} = shift @_; |
331
|
|
|
|
|
|
|
} |
332
|
0
|
|
|
|
|
|
my ($a,$b,$c,$d,$e,$f,$g) = CORE::unpack($self->{'_Pack'},$self->{'_Buffer'}); |
333
|
0
|
|
|
|
|
|
$self->{'packetType'} = $a; |
334
|
0
|
|
|
|
|
|
$self->{'packetSize'} = $b; |
335
|
0
|
|
|
|
|
|
$self->{'_responseIdent'} = $c; |
336
|
0
|
|
|
|
|
|
$self->{'_bitfields1'} = $d; # Includes bitfields hostFrameNumberLSN, unused66, responseType, and valid. |
337
|
0
|
|
|
|
|
|
$self->{'_unused67'} = $e; |
338
|
0
|
|
|
|
|
|
$self->{'_unused68'} = $f; |
339
|
0
|
|
|
|
|
|
$self->{'height'} = $g; |
340
|
|
|
|
|
|
|
|
341
|
0
|
|
|
|
|
|
$self->{'hostFrameNumberLSN'} = $self->host_frame_number_lsn(); |
342
|
0
|
|
|
|
|
|
$self->{'responseType'} = $self->response_type(); |
343
|
0
|
|
|
|
|
|
$self->{'valid'} = $self->valid(); |
344
|
|
|
|
|
|
|
|
345
|
0
|
|
|
|
|
|
return $self->{'_Buffer'}; |
346
|
|
|
|
|
|
|
} |
347
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
#========================================================================== |
349
|
|
|
|
|
|
|
|
350
|
|
|
|
|
|
|
=item sub byte_swap() |
351
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
$obj_name->byte_swap(); |
353
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
Byte swaps the packed data packet. |
355
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
=cut |
357
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
sub byte_swap($) { |
359
|
0
|
|
|
0
|
1
|
|
my $self = shift @_; |
360
|
|
|
|
|
|
|
|
361
|
0
|
0
|
|
|
|
|
if (@_) { |
362
|
0
|
|
|
|
|
|
$self->{'_Buffer'} = shift @_; |
363
|
|
|
|
|
|
|
} else { |
364
|
0
|
|
|
|
|
|
$self->pack(); |
365
|
|
|
|
|
|
|
} |
366
|
0
|
|
|
|
|
|
my ($a,$b,$c,$d,$e,$f,$g,$h) = CORE::unpack($self->{'_Swap1'},$self->{'_Buffer'}); |
367
|
|
|
|
|
|
|
|
368
|
0
|
|
|
|
|
|
$self->{'_Buffer'} = CORE::pack($self->{'_Swap2'},$a,$b,$c,$d,$e,$f,$h,$g); |
369
|
0
|
|
|
|
|
|
$self->unpack(); |
370
|
|
|
|
|
|
|
|
371
|
0
|
|
|
|
|
|
return $self->{'_Buffer'}; |
372
|
|
|
|
|
|
|
} |
373
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
1; |
375
|
|
|
|
|
|
|
__END__ |