| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# |
|
2
|
|
|
|
|
|
|
# Rinchi Common Image Generator Interface for Perl |
|
3
|
|
|
|
|
|
|
# Class Identifier: f78afb28-200e-11de-bdbb-001c25551abc |
|
4
|
|
|
|
|
|
|
# Author: Brian M. Ames |
|
5
|
|
|
|
|
|
|
# |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package Rinchi::CIGIPP::PositionRequest; |
|
8
|
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
26
|
use 5.006; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
41
|
|
|
10
|
1
|
|
|
1
|
|
7
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
34
|
|
|
11
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
34
|
|
|
12
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
1611
|
|
|
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::PositionRequest - Perl extension for the Common Image Generator |
|
42
|
|
|
|
|
|
|
Interface - Position Request data packet. |
|
43
|
|
|
|
|
|
|
data packet. |
|
44
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
use Rinchi::CIGIPP::PositionRequest; |
|
47
|
|
|
|
|
|
|
my $pos_rqst = Rinchi::CIGIPP::PositionRequest->new(); |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
$packet_type = $pos_rqst->packet_type(); |
|
50
|
|
|
|
|
|
|
$packet_size = $pos_rqst->packet_size(); |
|
51
|
|
|
|
|
|
|
$object_ident = $pos_rqst->object_ident(43377); |
|
52
|
|
|
|
|
|
|
$articulated_part_ident = $pos_rqst->articulated_part_ident(145); |
|
53
|
|
|
|
|
|
|
$coordinate_system = $pos_rqst->coordinate_system(Rinchi::CIGIPP->ParentEntityCS); |
|
54
|
|
|
|
|
|
|
$object_class = $pos_rqst->object_class(Rinchi::CIGIPP->EntityOC); |
|
55
|
|
|
|
|
|
|
$update_mode = $pos_rqst->update_mode(0); |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
The Position Request packet is used to query the IG for the current position of |
|
60
|
|
|
|
|
|
|
an entity, articulated part, view,view group, or motion tracker. This feature |
|
61
|
|
|
|
|
|
|
is useful for determining the locations of autonomous IG-driven entities, child |
|
62
|
|
|
|
|
|
|
entities and articulated parts, and view eyepoints. It can also be used for |
|
63
|
|
|
|
|
|
|
determining the instantaneous position and orientation of head trackers and |
|
64
|
|
|
|
|
|
|
other tracked input devices. |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 EXPORT |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
None by default. |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
#============================================================================== |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=item new $pos_rqst = Rinchi::CIGIPP::PositionRequest->new() |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Constructor for Rinchi::PositionRequest. |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=cut |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub new { |
|
79
|
1
|
|
|
1
|
1
|
167
|
my $class = shift; |
|
80
|
1
|
|
33
|
|
|
8
|
$class = ref($class) || $class; |
|
81
|
|
|
|
|
|
|
|
|
82
|
1
|
|
|
|
|
13
|
my $self = { |
|
83
|
|
|
|
|
|
|
'_Buffer' => '', |
|
84
|
|
|
|
|
|
|
'_ClassIdent' => 'f78afb28-200e-11de-bdbb-001c25551abc', |
|
85
|
|
|
|
|
|
|
'_Pack' => 'CCSCCS', |
|
86
|
|
|
|
|
|
|
'_Swap1' => 'CCvCCv', |
|
87
|
|
|
|
|
|
|
'_Swap2' => 'CCnCCn', |
|
88
|
|
|
|
|
|
|
'packetType' => 27, |
|
89
|
|
|
|
|
|
|
'packetSize' => 8, |
|
90
|
|
|
|
|
|
|
'objectIdent' => 0, |
|
91
|
|
|
|
|
|
|
'articulatedPartIdent' => 0, |
|
92
|
|
|
|
|
|
|
'_bitfields1' => 0, # Includes bitfields unused47, coordinateSystem, objectClass, and updateMode. |
|
93
|
|
|
|
|
|
|
'coordinateSystem' => 0, |
|
94
|
|
|
|
|
|
|
'objectClass' => 0, |
|
95
|
|
|
|
|
|
|
'updateMode' => 0, |
|
96
|
|
|
|
|
|
|
'_unused48' => 0, |
|
97
|
|
|
|
|
|
|
}; |
|
98
|
|
|
|
|
|
|
|
|
99
|
1
|
50
|
|
|
|
15
|
if (@_) { |
|
100
|
0
|
0
|
|
|
|
0
|
if (ref($_[0]) eq 'ARRAY') { |
|
|
|
0
|
|
|
|
|
|
|
101
|
0
|
|
|
|
|
0
|
$self->{'_Buffer'} = $_[0][0]; |
|
102
|
|
|
|
|
|
|
} elsif (ref($_[0]) eq 'HASH') { |
|
103
|
0
|
|
|
|
|
0
|
foreach my $attr (keys %{$_[0]}) { |
|
|
0
|
|
|
|
|
0
|
|
|
104
|
0
|
0
|
|
|
|
0
|
$self->{"_$attr"} = $_[0]->{$attr} unless ($attr =~ /^_/); |
|
105
|
|
|
|
|
|
|
} |
|
106
|
|
|
|
|
|
|
} |
|
107
|
|
|
|
|
|
|
} |
|
108
|
|
|
|
|
|
|
|
|
109
|
1
|
|
|
|
|
4
|
bless($self,$class); |
|
110
|
1
|
|
|
|
|
4
|
return $self; |
|
111
|
|
|
|
|
|
|
} |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
#============================================================================== |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=item sub packet_type() |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
$value = $pos_rqst->packet_type(); |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Data Packet Identifier. |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
This attribute identifies this data packet as the Position Request packet. The |
|
122
|
|
|
|
|
|
|
value of this attribute must be 27. |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=cut |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub packet_type() { |
|
127
|
1
|
|
|
1
|
1
|
7
|
my ($self) = @_; |
|
128
|
1
|
|
|
|
|
8
|
return $self->{'packetType'}; |
|
129
|
|
|
|
|
|
|
} |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
#============================================================================== |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=item sub packet_size() |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
$value = $pos_rqst->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 8. |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=cut |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
sub packet_size() { |
|
145
|
1
|
|
|
1
|
1
|
6
|
my ($self) = @_; |
|
146
|
1
|
|
|
|
|
4
|
return $self->{'packetSize'}; |
|
147
|
|
|
|
|
|
|
} |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
#============================================================================== |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=item sub object_ident([$newValue]) |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
$value = $pos_rqst->object_ident($newValue); |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
Object ID. |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
This attribute identifies the entity, view, view group, or motion tracking |
|
158
|
|
|
|
|
|
|
device whose position is being requested. |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
If Object Class is set to Articulated Part (1), this attribute specifies the |
|
161
|
|
|
|
|
|
|
entity whose part is identified by the Articulated Part ID attribute. |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=cut |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
sub object_ident() { |
|
166
|
1
|
|
|
1
|
1
|
5
|
my ($self,$nv) = @_; |
|
167
|
1
|
50
|
|
|
|
5
|
if (defined($nv)) { |
|
168
|
1
|
|
|
|
|
2
|
$self->{'objectIdent'} = $nv; |
|
169
|
|
|
|
|
|
|
} |
|
170
|
1
|
|
|
|
|
4
|
return $self->{'objectIdent'}; |
|
171
|
|
|
|
|
|
|
} |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
#============================================================================== |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=item sub articulated_part_ident([$newValue]) |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
$value = $pos_rqst->articulated_part_ident($newValue); |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
Articulated Part ID. |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
This attribute identifies the articulated part whose position is being |
|
182
|
|
|
|
|
|
|
requested. The entity to which the part belongs is specified by the Object ID |
|
183
|
|
|
|
|
|
|
attribute. This attribute is valid only when Object Class is set to Articulated |
|
184
|
|
|
|
|
|
|
Part (1). |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=cut |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
sub articulated_part_ident() { |
|
189
|
1
|
|
|
1
|
1
|
6
|
my ($self,$nv) = @_; |
|
190
|
1
|
50
|
|
|
|
63
|
if (defined($nv)) { |
|
191
|
1
|
|
|
|
|
2
|
$self->{'articulatedPartIdent' } = $nv; |
|
192
|
|
|
|
|
|
|
} |
|
193
|
1
|
|
|
|
|
4
|
return $self->{'articulatedPartIdent' }; |
|
194
|
|
|
|
|
|
|
} |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
#============================================================================== |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=item sub coordinate_system([$newValue]) |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
$value = $pos_rqst->coordinate_system($newValue); |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
Coordinate System. |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
This attribute specifies the desired coordinate system relative to which the |
|
205
|
|
|
|
|
|
|
position and orientation should be given. |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
Geodetic – Position will be specified as a geodetic latitude, longitude, and |
|
208
|
|
|
|
|
|
|
altitude. Orientation is given with respect to the reference plane. |
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
Parent Entity – Position and orientation are with respect to the entity to |
|
211
|
|
|
|
|
|
|
which the specified entity or view is attached. This value is invalid for |
|
212
|
|
|
|
|
|
|
top-level entities. |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
Submodel – Position and orientation will be specified with respect to the |
|
215
|
|
|
|
|
|
|
articulated part's reference coordinate system. This value is valid only when |
|
216
|
|
|
|
|
|
|
Object Class is set to Articulated Part (1). |
|
217
|
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
Note: If Object Class is set to Motion Tracker (3), The coordinate system is |
|
219
|
|
|
|
|
|
|
defined by the tracking device and this attribute is ignored. |
|
220
|
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
GeodeticCS 0 |
|
222
|
|
|
|
|
|
|
ParentEntityCS 1 |
|
223
|
|
|
|
|
|
|
SubmodelCS 2 |
|
224
|
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
=cut |
|
226
|
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
sub coordinate_system() { |
|
228
|
1
|
|
|
1
|
1
|
3
|
my ($self,$nv) = @_; |
|
229
|
1
|
50
|
|
|
|
3
|
if (defined($nv)) { |
|
230
|
1
|
50
|
33
|
|
|
10
|
if (($nv==0) or ($nv==1) or ($nv==2)) { |
|
|
|
|
33
|
|
|
|
|
|
231
|
1
|
|
|
|
|
2
|
$self->{'coordinateSystem'} = $nv; |
|
232
|
1
|
|
|
|
|
2
|
$self->{'_bitfields1'} |= ($nv << 4) &0x30; |
|
233
|
|
|
|
|
|
|
} else { |
|
234
|
0
|
|
|
|
|
0
|
carp "coordinate_system must be 0 (GeodeticCS), 1 (ParentEntityCS), or 2 (SubmodelCS)."; |
|
235
|
|
|
|
|
|
|
} |
|
236
|
|
|
|
|
|
|
} |
|
237
|
1
|
|
|
|
|
4
|
return (($self->{'_bitfields1'} & 0x30) >> 4); |
|
238
|
|
|
|
|
|
|
} |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
#============================================================================== |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
=item sub object_class([$newValue]) |
|
243
|
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
$value = $pos_rqst->object_class($newValue); |
|
245
|
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
Object Class. |
|
247
|
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
This attribute specifies the type of object whose position is being requested. |
|
249
|
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
EntityOC 0 |
|
251
|
|
|
|
|
|
|
ArticulatedPartOC 1 |
|
252
|
|
|
|
|
|
|
ViewOC 2 |
|
253
|
|
|
|
|
|
|
ViewGroupOC 3 |
|
254
|
|
|
|
|
|
|
MotionTrackerOC 4 |
|
255
|
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
=cut |
|
257
|
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
sub object_class() { |
|
259
|
1
|
|
|
1
|
1
|
3
|
my ($self,$nv) = @_; |
|
260
|
1
|
50
|
|
|
|
5
|
if (defined($nv)) { |
|
261
|
1
|
50
|
33
|
|
|
13
|
if (($nv==0) or ($nv==1) or ($nv==2) or ($nv==3) or ($nv==4)) { |
|
|
|
|
33
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
262
|
1
|
|
|
|
|
3
|
$self->{'objectClass'} = $nv; |
|
263
|
1
|
|
|
|
|
5
|
$self->{'_bitfields1'} |= ($nv << 1) &0x0E; |
|
264
|
|
|
|
|
|
|
} else { |
|
265
|
0
|
|
|
|
|
0
|
carp "object_class must be 0 (EntityOC), 1 (ArticulatedPartOC), 2 (ViewOC), 3 (ViewGroupOC), or 4 (MotionTrackerOC)."; |
|
266
|
|
|
|
|
|
|
} |
|
267
|
|
|
|
|
|
|
} |
|
268
|
1
|
|
|
|
|
3
|
return (($self->{'_bitfields1'} & 0x0E) >> 1); |
|
269
|
|
|
|
|
|
|
} |
|
270
|
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
#============================================================================== |
|
272
|
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
=item sub update_mode([$newValue]) |
|
274
|
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
$value = $pos_rqst->update_mode($newValue); |
|
276
|
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
Update Mode. |
|
278
|
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
This attribute specifies whether the IG should report the position of the |
|
280
|
|
|
|
|
|
|
requested object each frame. If this attribute is set to One-Shot (0), the IG |
|
281
|
|
|
|
|
|
|
should report the position only one time. |
|
282
|
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
=cut |
|
284
|
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
sub update_mode() { |
|
286
|
1
|
|
|
1
|
1
|
6
|
my ($self,$nv) = @_; |
|
287
|
1
|
50
|
|
|
|
5
|
if (defined($nv)) { |
|
288
|
1
|
|
|
|
|
2
|
$self->{'updateMode'} = $nv; |
|
289
|
1
|
|
|
|
|
3
|
$self->{'_bitfields1'} |= $nv &0x01; |
|
290
|
|
|
|
|
|
|
} |
|
291
|
1
|
|
|
|
|
3
|
return ($self->{'_bitfields1'} & 0x01); |
|
292
|
|
|
|
|
|
|
} |
|
293
|
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
#========================================================================== |
|
295
|
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
=item sub pack() |
|
297
|
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
$value = $pos_rqst->pack(); |
|
299
|
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
Returns the packed data packet. |
|
301
|
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
=cut |
|
303
|
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
sub pack($) { |
|
305
|
1
|
|
|
1
|
1
|
6
|
my $self = shift ; |
|
306
|
|
|
|
|
|
|
|
|
307
|
1
|
|
|
|
|
8
|
$self->{'_Buffer'} = CORE::pack($self->{'_Pack'}, |
|
308
|
|
|
|
|
|
|
$self->{'packetType'}, |
|
309
|
|
|
|
|
|
|
$self->{'packetSize'}, |
|
310
|
|
|
|
|
|
|
$self->{'objectIdent'}, |
|
311
|
|
|
|
|
|
|
$self->{'articulatedPartIdent' }, |
|
312
|
|
|
|
|
|
|
$self->{'_bitfields1'}, # Includes bitfields unused47, coordinateSystem, objectClass, and updateMode. |
|
313
|
|
|
|
|
|
|
$self->{'_unused48'}, |
|
314
|
|
|
|
|
|
|
); |
|
315
|
|
|
|
|
|
|
|
|
316
|
1
|
|
|
|
|
3
|
return $self->{'_Buffer'}; |
|
317
|
|
|
|
|
|
|
} |
|
318
|
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
#========================================================================== |
|
320
|
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
=item sub unpack() |
|
322
|
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
$value = $pos_rqst->unpack(); |
|
324
|
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
Unpacks the packed data packet. |
|
326
|
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
=cut |
|
328
|
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
sub unpack($) { |
|
330
|
0
|
|
|
0
|
1
|
|
my $self = shift @_; |
|
331
|
|
|
|
|
|
|
|
|
332
|
0
|
0
|
|
|
|
|
if (@_) { |
|
333
|
0
|
|
|
|
|
|
$self->{'_Buffer'} = shift @_; |
|
334
|
|
|
|
|
|
|
} |
|
335
|
0
|
|
|
|
|
|
my ($a,$b,$c,$d,$e,$f) = CORE::unpack($self->{'_Pack'},$self->{'_Buffer'}); |
|
336
|
0
|
|
|
|
|
|
$self->{'packetType'} = $a; |
|
337
|
0
|
|
|
|
|
|
$self->{'packetSize'} = $b; |
|
338
|
0
|
|
|
|
|
|
$self->{'objectIdent'} = $c; |
|
339
|
0
|
|
|
|
|
|
$self->{'articulatedPartIdent' } = $d; |
|
340
|
0
|
|
|
|
|
|
$self->{'_bitfields1'} = $e; # Includes bitfields unused47, coordinateSystem, objectClass, and updateMode. |
|
341
|
0
|
|
|
|
|
|
$self->{'_unused48'} = $f; |
|
342
|
|
|
|
|
|
|
|
|
343
|
0
|
|
|
|
|
|
$self->{'coordinateSystem'} = $self->coordinate_system(); |
|
344
|
0
|
|
|
|
|
|
$self->{'objectClass'} = $self->object_class(); |
|
345
|
0
|
|
|
|
|
|
$self->{'updateMode'} = $self->update_mode(); |
|
346
|
|
|
|
|
|
|
|
|
347
|
0
|
|
|
|
|
|
return $self->{'_Buffer'}; |
|
348
|
|
|
|
|
|
|
} |
|
349
|
|
|
|
|
|
|
|
|
350
|
|
|
|
|
|
|
#========================================================================== |
|
351
|
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
=item sub byte_swap() |
|
353
|
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
$obj_name->byte_swap(); |
|
355
|
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
Byte swaps the packed data packet. |
|
357
|
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
=cut |
|
359
|
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
sub byte_swap($) { |
|
361
|
0
|
|
|
0
|
1
|
|
my $self = shift @_; |
|
362
|
|
|
|
|
|
|
|
|
363
|
0
|
0
|
|
|
|
|
if (@_) { |
|
364
|
0
|
|
|
|
|
|
$self->{'_Buffer'} = shift @_; |
|
365
|
|
|
|
|
|
|
} else { |
|
366
|
0
|
|
|
|
|
|
$self->pack(); |
|
367
|
|
|
|
|
|
|
} |
|
368
|
0
|
|
|
|
|
|
my ($a,$b,$c,$d,$e,$f) = CORE::unpack($self->{'_Swap1'},$self->{'_Buffer'}); |
|
369
|
|
|
|
|
|
|
|
|
370
|
0
|
|
|
|
|
|
$self->{'_Buffer'} = CORE::pack($self->{'_Swap2'},$a,$b,$c,$d,$e,$f); |
|
371
|
0
|
|
|
|
|
|
$self->unpack(); |
|
372
|
|
|
|
|
|
|
|
|
373
|
0
|
|
|
|
|
|
return $self->{'_Buffer'}; |
|
374
|
|
|
|
|
|
|
} |
|
375
|
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
1; |
|
377
|
|
|
|
|
|
|
__END__ |