| 1 | # | ||||||||||||||||||||||||||||
| 2 | # Rinchi Common Image Generator Interface for Perl | ||||||||||||||||||||||||||||
| 3 | # Class Identifier: f78ae2d2-200e-11de-bdb2-001c25551abc | ||||||||||||||||||||||||||||
| 4 | # Author: Brian M. Ames | ||||||||||||||||||||||||||||
| 5 | # | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | package Rinchi::CIGIPP::MotionTrackerControl; | ||||||||||||||||||||||||||||
| 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::MotionTrackerControl - Perl extension for the Common Image | ||||||||||||||||||||||||||||
| 42 | Generator Interface - Motion Tracker Control data packet. | ||||||||||||||||||||||||||||
| 43 | data packet. | ||||||||||||||||||||||||||||
| 44 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | use Rinchi::CIGIPP::MotionTrackerControl; | ||||||||||||||||||||||||||||
| 47 | my $mt_ctl = Rinchi::CIGIPP::MotionTrackerControl->new(); | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | $packet_type = $mt_ctl->packet_type(); | ||||||||||||||||||||||||||||
| 50 | $packet_size = $mt_ctl->packet_size(); | ||||||||||||||||||||||||||||
| 51 | $view_ident = $mt_ctl->view_ident(10606); | ||||||||||||||||||||||||||||
| 52 | $tracker_ident = $mt_ctl->tracker_ident(122); | ||||||||||||||||||||||||||||
| 53 | $yaw_enable = $mt_ctl->yaw_enable(Rinchi::CIGIPP->Enable); | ||||||||||||||||||||||||||||
| 54 | $pitch_enable = $mt_ctl->pitch_enable(Rinchi::CIGIPP->Enable); | ||||||||||||||||||||||||||||
| 55 | $roll_enable = $mt_ctl->roll_enable(Rinchi::CIGIPP->Disable); | ||||||||||||||||||||||||||||
| 56 | $z_enable = $mt_ctl->z_enable(Rinchi::CIGIPP->Enable); | ||||||||||||||||||||||||||||
| 57 | $y_enable = $mt_ctl->y_enable(Rinchi::CIGIPP->Disable); | ||||||||||||||||||||||||||||
| 58 | $x_enable = $mt_ctl->x_enable(Rinchi::CIGIPP->Enable); | ||||||||||||||||||||||||||||
| 59 | $boresight_enable = $mt_ctl->boresight_enable(Rinchi::CIGIPP->Disable); | ||||||||||||||||||||||||||||
| 60 | $tracker_enable = $mt_ctl->tracker_enable(Rinchi::CIGIPP->Disable); | ||||||||||||||||||||||||||||
| 61 | $view_group = $mt_ctl->view_group(Rinchi::CIGIPP->View); | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | The Motion Tracker Control packet is used to initialize and change properties | ||||||||||||||||||||||||||||
| 66 | of tracked input devices connected to the IG. These devices may include head | ||||||||||||||||||||||||||||
| 67 | trackers, eye trackers, wands, trackballs, etc. If more than one head tracker | ||||||||||||||||||||||||||||
| 68 | is used to control a view or view group, the order in which the transformations | ||||||||||||||||||||||||||||
| 69 | are applied is determined by the IG. | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | The Host may request the instantaneous position and orientation of a tracker | ||||||||||||||||||||||||||||
| 72 | device by sending a Position Request packet with its Object Class attribute set | ||||||||||||||||||||||||||||
| 73 | to Motion Tracker (4). | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | Note that if tracked input devices are connected to the Host, the Host should | ||||||||||||||||||||||||||||
| 76 | interpret the tracked input data and send the appropriate CIGI packets to | ||||||||||||||||||||||||||||
| 77 | achieve the desired effect on the IG. For example, the Host would interpret | ||||||||||||||||||||||||||||
| 78 | input from a connected head tracker and send View Control packets to the IG to | ||||||||||||||||||||||||||||
| 79 | move the eyepoint of the appropriate view or view group. | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | =head2 EXPORT | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | None by default. | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | #============================================================================== | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | =item new $mt_ctl = Rinchi::CIGIPP::MotionTrackerControl->new() | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | Constructor for Rinchi::MotionTrackerControl. | ||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | =cut | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | 2 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=7 SCAR=29.8
Pod
documented
| |||||||||||||||||||||||||||||
| 94 | 2 | my $class = shift; | |||||||||||||||||||||||||||
| 95 | 2 | ▶ | $class = ref($class) || $class; | ||||||||||||||||||||||||||
|
Condition33%1/3
ref $class || $class
MC/DC0%0/2
ref $class || $class
ref $class
$class
Truth table33%1/3
A || B
A= ref $classB= $class
| |||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | 2 | my $self = { | |||||||||||||||||||||||||||
| 98 | '_Buffer' => '', | ||||||||||||||||||||||||||||
| 99 | '_ClassIdent' => 'f78ae2d2-200e-11de-bdb2-001c25551abc', | ||||||||||||||||||||||||||||
| 100 | '_Pack' => 'CCSCCCC', | ||||||||||||||||||||||||||||
| 101 | '_Swap1' => 'CCvCCCC', | ||||||||||||||||||||||||||||
| 102 | '_Swap2' => 'CCnCCCC', | ||||||||||||||||||||||||||||
| 103 | 'packetType' => 18, | ||||||||||||||||||||||||||||
| 104 | 'packetSize' => 8, | ||||||||||||||||||||||||||||
| 105 | 'viewIdent' => 0, | ||||||||||||||||||||||||||||
| 106 | 'trackerIdent' => 0, | ||||||||||||||||||||||||||||
| 107 | '_bitfields1' => 0, # Includes bitfields yawEnable, pitchEnable, rollEnable, zEnable, yEnable, xEnable, boresightEnable, and trackerEnable. | ||||||||||||||||||||||||||||
| 108 | 'yawEnable' => 0, | ||||||||||||||||||||||||||||
| 109 | 'pitchEnable' => 0, | ||||||||||||||||||||||||||||
| 110 | 'rollEnable' => 0, | ||||||||||||||||||||||||||||
| 111 | 'zEnable' => 0, | ||||||||||||||||||||||||||||
| 112 | 'yEnable' => 0, | ||||||||||||||||||||||||||||
| 113 | 'xEnable' => 0, | ||||||||||||||||||||||||||||
| 114 | 'boresightEnable' => 0, | ||||||||||||||||||||||||||||
| 115 | 'trackerEnable' => 0, | ||||||||||||||||||||||||||||
| 116 | '_bitfields2' => 0, # Includes bitfields unused32, and viewGroup. | ||||||||||||||||||||||||||||
| 117 | 'viewGroup' => 0, | ||||||||||||||||||||||||||||
| 118 | '_unused33' => 0, | ||||||||||||||||||||||||||||
| 119 | }; | ||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | 2 | ▶ | if (@_) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 122 | 0 | ▶ | if (ref($_[0]) eq 'ARRAY') { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 123 | 0 | $self->{'_Buffer'} = $_[0][0]; | |||||||||||||||||||||||||||
| 124 | } elsif (ref($_[0]) eq 'HASH') { | ||||||||||||||||||||||||||||
| 125 | 0 | foreach my $attr (keys %{$_[0]}) { | |||||||||||||||||||||||||||
| 126 | 0 | ▶ | $self->{"_$attr"} = $_[0]->{$attr} unless ($attr =~ /^_/); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | 2 | bless($self,$class); | |||||||||||||||||||||||||||
| 132 | 2 | return $self; | |||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | #============================================================================== | ||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | =item sub packet_type() | ||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | $value = $mt_ctl->packet_type(); | ||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | Data Packet Identifier. | ||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | This attribute identifies this data packet as the Motion Tracker Control | ||||||||||||||||||||||||||||
| 144 | packet. The value of this attribute must be 18. | ||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | =cut | ||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | 2 | ▶ | sub packet_type() { | ||||||||||||||||||||||||||
|
Subroutine
packet_type: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 149 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||
| 150 | 2 | return $self->{'packetType'}; | |||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||
| 153 | #============================================================================== | ||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | =item sub packet_size() | ||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||
| 157 | $value = $mt_ctl->packet_size(); | ||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | Data Packet Size. | ||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | This attribute indicates the number of bytes in this data packet. The value of | ||||||||||||||||||||||||||||
| 162 | this attribute must be 8. | ||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | =cut | ||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | 2 | ▶ | sub packet_size() { | ||||||||||||||||||||||||||
|
Subroutine
packet_size: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 167 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||
| 168 | 2 | return $self->{'packetSize'}; | |||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||
| 171 | #============================================================================== | ||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||
| 173 | =item sub view_ident([$newValue]) | ||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | $value = $mt_ctl->view_ident($newValue); | ||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||
| 177 | View/View Group ID. | ||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||
| 179 | This attribute specifies the view or view group to which the tracking device is attached. | ||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||
| 181 | =cut | ||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||
| 183 | 2 | ▶ | sub view_ident() { | ||||||||||||||||||||||||||
|
Subroutine
view_ident: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 184 | 2 | my ($self,$nv) = @_; | |||||||||||||||||||||||||||
| 185 | 2 | ▶ | if (defined($nv)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 186 | 2 | $self->{'viewIdent'} = $nv; | |||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||
| 188 | 2 | return $self->{'viewIdent'}; | |||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||
| 191 | #============================================================================== | ||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||
| 193 | =item sub tracker_ident([$newValue]) | ||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||
| 195 | $value = $mt_ctl->tracker_ident($newValue); | ||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||
| 197 | Tracker ID. | ||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||
| 199 | This attribute specifies the tracker whose state the data in this packet represents. | ||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||
| 201 | =cut | ||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||
| 203 | 2 | ▶ | sub tracker_ident() { | ||||||||||||||||||||||||||
|
Subroutine
tracker_ident: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 204 | 2 | my ($self,$nv) = @_; | |||||||||||||||||||||||||||
| 205 | 2 | ▶ | if (defined($nv)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 206 | 2 | $self->{'trackerIdent'} = $nv; | |||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||
| 208 | 2 | return $self->{'trackerIdent'}; | |||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||
| 211 | #============================================================================== | ||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||
| 213 | =item sub yaw_enable([$newValue]) | ||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||
| 215 | $value = $mt_ctl->yaw_enable($newValue); | ||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||
| 217 | Yaw Enable. | ||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||
| 219 | This attribute is used to enable or disable the yaw (Z-axis rotation) of the | ||||||||||||||||||||||||||||
| 220 | motion tracker. | ||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||
| 222 | Disable 0 | ||||||||||||||||||||||||||||
| 223 | Enable 1 | ||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||
| 225 | =cut | ||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||
| 227 | 2 | ▶ | sub yaw_enable() { | ||||||||||||||||||||||||||
|
Subroutine
yaw_enable: called CC=4 SCAR=15.5
Pod
documented
| |||||||||||||||||||||||||||||
| 228 | 2 | my ($self,$nv) = @_; | |||||||||||||||||||||||||||
| 229 | 2 | ▶ | if (defined($nv)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 230 | 2 | ▶ | if (($nv==0) or ($nv==1)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$nv == 0 or $nv == 1
MC/DC0%0/2
$nv == 0 or $nv == 1
$nv == 0
$nv == 1
Truth table33%1/3
A or B
A= $nv == 0B= $nv == 1
| |||||||||||||||||||||||||||||
| 231 | 2 | $self->{'yawEnable'} = $nv; | |||||||||||||||||||||||||||
| 232 | 2 | $self->{'_bitfields1'} |= ($nv << 7) &0x80; | |||||||||||||||||||||||||||
| 233 | } else { | ||||||||||||||||||||||||||||
| 234 | 0 | carp "yaw_enable must be 0 (Disable), or 1 (Enable)."; | |||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||
| 237 | 2 | return (($self->{'_bitfields1'} & 0x80) >> 7); | |||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||
| 240 | #============================================================================== | ||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||
| 242 | =item sub pitch_enable([$newValue]) | ||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||
| 244 | $value = $mt_ctl->pitch_enable($newValue); | ||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||
| 246 | Pitch Enable. | ||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||
| 248 | This attribute is used to enable or disable the pitch (Y-axis rotation) of the | ||||||||||||||||||||||||||||
| 249 | motion tracker. | ||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||
| 251 | Disable 0 | ||||||||||||||||||||||||||||
| 252 | Enable 1 | ||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||
| 254 | =cut | ||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||
| 256 | 2 | ▶ | sub pitch_enable() { | ||||||||||||||||||||||||||
|
Subroutine
pitch_enable: called CC=4 SCAR=15.5
Pod
documented
| |||||||||||||||||||||||||||||
| 257 | 2 | my ($self,$nv) = @_; | |||||||||||||||||||||||||||
| 258 | 2 | ▶ | if (defined($nv)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 259 | 2 | ▶ | if (($nv==0) or ($nv==1)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$nv == 0 or $nv == 1
MC/DC0%0/2
$nv == 0 or $nv == 1
$nv == 0
$nv == 1
Truth table33%1/3
A or B
A= $nv == 0B= $nv == 1
| |||||||||||||||||||||||||||||
| 260 | 2 | $self->{'pitchEnable'} = $nv; | |||||||||||||||||||||||||||
| 261 | 2 | $self->{'_bitfields1'} |= ($nv << 6) &0x40; | |||||||||||||||||||||||||||
| 262 | } else { | ||||||||||||||||||||||||||||
| 263 | 0 | carp "pitch_enable must be 0 (Disable), or 1 (Enable)."; | |||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||
| 266 | 2 | return (($self->{'_bitfields1'} & 0x40) >> 6); | |||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||
| 269 | #============================================================================== | ||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||
| 271 | =item sub roll_enable([$newValue]) | ||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||
| 273 | $value = $mt_ctl->roll_enable($newValue); | ||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||
| 275 | Roll Enable. | ||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||
| 277 | This attribute is used to enable or disable the roll (X-axis rotation) of the | ||||||||||||||||||||||||||||
| 278 | motion tracker. | ||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||
| 280 | Disable 0 | ||||||||||||||||||||||||||||
| 281 | Enable 1 | ||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||
| 283 | =cut | ||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||
| 285 | 2 | ▶ | sub roll_enable() { | ||||||||||||||||||||||||||
|
Subroutine
roll_enable: called CC=4 SCAR=15.5
Pod
documented
| |||||||||||||||||||||||||||||
| 286 | 2 | my ($self,$nv) = @_; | |||||||||||||||||||||||||||
| 287 | 2 | ▶ | if (defined($nv)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 288 | 2 | ▶ | if (($nv==0) or ($nv==1)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$nv == 0 or $nv == 1
MC/DC0%0/2
$nv == 0 or $nv == 1
$nv == 0
$nv == 1
Truth table33%1/3
A or B
A= $nv == 0B= $nv == 1
| |||||||||||||||||||||||||||||
| 289 | 2 | $self->{'rollEnable'} = $nv; | |||||||||||||||||||||||||||
| 290 | 2 | $self->{'_bitfields1'} |= ($nv << 5) &0x20; | |||||||||||||||||||||||||||
| 291 | } else { | ||||||||||||||||||||||||||||
| 292 | 0 | carp "roll_enable must be 0 (Disable), or 1 (Enable)."; | |||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||
| 295 | 2 | return (($self->{'_bitfields1'} & 0x20) >> 5); | |||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||
| 298 | #============================================================================== | ||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||
| 300 | =item sub z_enable([$newValue]) | ||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||
| 302 | $value = $mt_ctl->z_enable($newValue); | ||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||
| 304 | Z Enable. | ||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||
| 306 | This attribute is used to enable or disable the Z-axis position of the motion tracker. | ||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||
| 308 | Disable 0 | ||||||||||||||||||||||||||||
| 309 | Enable 1 | ||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||
| 311 | =cut | ||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||
| 313 | 2 | ▶ | sub z_enable() { | ||||||||||||||||||||||||||
|
Subroutine
z_enable: called CC=4 SCAR=15.5
Pod
documented
| |||||||||||||||||||||||||||||
| 314 | 2 | my ($self,$nv) = @_; | |||||||||||||||||||||||||||
| 315 | 2 | ▶ | if (defined($nv)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 316 | 2 | ▶ | if (($nv==0) or ($nv==1)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$nv == 0 or $nv == 1
MC/DC0%0/2
$nv == 0 or $nv == 1
$nv == 0
$nv == 1
Truth table33%1/3
A or B
A= $nv == 0B= $nv == 1
| |||||||||||||||||||||||||||||
| 317 | 2 | $self->{'zEnable'} = $nv; | |||||||||||||||||||||||||||
| 318 | 2 | $self->{'_bitfields1'} |= ($nv << 4) &0x10; | |||||||||||||||||||||||||||
| 319 | } else { | ||||||||||||||||||||||||||||
| 320 | 0 | carp "z_enable must be 0 (Disable), or 1 (Enable)."; | |||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||
| 323 | 2 | return (($self->{'_bitfields1'} & 0x10) >> 4); | |||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||
| 326 | #============================================================================== | ||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||
| 328 | =item sub y_enable([$newValue]) | ||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||
| 330 | $value = $mt_ctl->y_enable($newValue); | ||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||
| 332 | Y Enable. | ||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||
| 334 | This attribute is used to enable or disable the Y-axis position of the motion tracker. | ||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||
| 336 | Disable 0 | ||||||||||||||||||||||||||||
| 337 | Enable 1 | ||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||
| 339 | =cut | ||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||
| 341 | 2 | ▶ | sub y_enable() { | ||||||||||||||||||||||||||
|
Subroutine
y_enable: called CC=4 SCAR=15.5
Pod
documented
| |||||||||||||||||||||||||||||
| 342 | 2 | my ($self,$nv) = @_; | |||||||||||||||||||||||||||
| 343 | 2 | ▶ | if (defined($nv)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 344 | 2 | ▶ | if (($nv==0) or ($nv==1)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$nv == 0 or $nv == 1
MC/DC0%0/2
$nv == 0 or $nv == 1
$nv == 0
$nv == 1
Truth table33%1/3
A or B
A= $nv == 0B= $nv == 1
| |||||||||||||||||||||||||||||
| 345 | 2 | $self->{'yEnable'} = $nv; | |||||||||||||||||||||||||||
| 346 | 2 | $self->{'_bitfields1'} |= ($nv << 3) &0x08; | |||||||||||||||||||||||||||
| 347 | } else { | ||||||||||||||||||||||||||||
| 348 | 0 | carp "y_enable must be 0 (Disable), or 1 (Enable)."; | |||||||||||||||||||||||||||
| 349 | } | ||||||||||||||||||||||||||||
| 350 | } | ||||||||||||||||||||||||||||
| 351 | 2 | return (($self->{'_bitfields1'} & 0x08) >> 3); | |||||||||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||
| 354 | #============================================================================== | ||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||
| 356 | =item sub x_enable([$newValue]) | ||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||
| 358 | $value = $mt_ctl->x_enable($newValue); | ||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||
| 360 | X Enable. | ||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||
| 362 | This attribute is used to enable or disable the X-axis position of the motion tracker. | ||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||
| 364 | Disable 0 | ||||||||||||||||||||||||||||
| 365 | Enable 1 | ||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||
| 367 | =cut | ||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||
| 369 | 2 | ▶ | sub x_enable() { | ||||||||||||||||||||||||||
|
Subroutine
x_enable: called CC=4 SCAR=15.5
Pod
documented
| |||||||||||||||||||||||||||||
| 370 | 2 | my ($self,$nv) = @_; | |||||||||||||||||||||||||||
| 371 | 2 | ▶ | if (defined($nv)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 372 | 2 | ▶ | if (($nv==0) or ($nv==1)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$nv == 0 or $nv == 1
MC/DC0%0/2
$nv == 0 or $nv == 1
$nv == 0
$nv == 1
Truth table33%1/3
A or B
A= $nv == 0B= $nv == 1
| |||||||||||||||||||||||||||||
| 373 | 2 | $self->{'xEnable'} = $nv; | |||||||||||||||||||||||||||
| 374 | 2 | $self->{'_bitfields1'} |= ($nv << 2) &0x04; | |||||||||||||||||||||||||||
| 375 | } else { | ||||||||||||||||||||||||||||
| 376 | 0 | carp "x_enable must be 0 (Disable), or 1 (Enable)."; | |||||||||||||||||||||||||||
| 377 | } | ||||||||||||||||||||||||||||
| 378 | } | ||||||||||||||||||||||||||||
| 379 | 2 | return (($self->{'_bitfields1'} & 0x04) >> 2); | |||||||||||||||||||||||||||
| 380 | } | ||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||
| 382 | #============================================================================== | ||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||
| 384 | =item sub boresight_enable([$newValue]) | ||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||
| 386 | $value = $mt_ctl->boresight_enable($newValue); | ||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||
| 388 | Boresight Enable. | ||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||
| 390 | This attribute is used to set the boresight state of the external tracking | ||||||||||||||||||||||||||||
| 391 | device. This mode is used to reestablish the tracker's “center” position at the | ||||||||||||||||||||||||||||
| 392 | current position and orientation. | ||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||
| 394 | Note: If boresighting is enabled, the Host must send a Motion Tracker Control | ||||||||||||||||||||||||||||
| 395 | packet with Boresight Enable set to Disable (0) to return the tracker to normal | ||||||||||||||||||||||||||||
| 396 | operation. The IG will continue to update the boresight position each frame | ||||||||||||||||||||||||||||
| 397 | until that occurs. | ||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||
| 399 | Disable 0 | ||||||||||||||||||||||||||||
| 400 | Enable 1 | ||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||
| 402 | =cut | ||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||
| 404 | 2 | ▶ | sub boresight_enable() { | ||||||||||||||||||||||||||
|
Subroutine
boresight_enable: called CC=4 SCAR=15.5
Pod
documented
| |||||||||||||||||||||||||||||
| 405 | 2 | my ($self,$nv) = @_; | |||||||||||||||||||||||||||
| 406 | 2 | ▶ | if (defined($nv)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 407 | 2 | ▶ | if (($nv==0) or ($nv==1)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$nv == 0 or $nv == 1
MC/DC0%0/2
$nv == 0 or $nv == 1
$nv == 0
$nv == 1
Truth table33%1/3
A or B
A= $nv == 0B= $nv == 1
| |||||||||||||||||||||||||||||
| 408 | 2 | $self->{'boresightEnable'} = $nv; | |||||||||||||||||||||||||||
| 409 | 2 | $self->{'_bitfields1'} |= ($nv << 1) &0x02; | |||||||||||||||||||||||||||
| 410 | } else { | ||||||||||||||||||||||||||||
| 411 | 0 | carp "boresight_enable must be 0 (Disable), or 1 (Enable)."; | |||||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||||
| 413 | } | ||||||||||||||||||||||||||||
| 414 | 2 | return (($self->{'_bitfields1'} & 0x02) >> 1); | |||||||||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||
| 417 | #============================================================================== | ||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||
| 419 | =item sub tracker_enable([$newValue]) | ||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||
| 421 | $value = $mt_ctl->tracker_enable($newValue); | ||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||
| 423 | Tracker Enable. | ||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||
| 425 | This attribute specifies whether the tracking device is enabled. | ||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||
| 427 | Disable 0 | ||||||||||||||||||||||||||||
| 428 | Enable 1 | ||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||
| 430 | =cut | ||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||
| 432 | 2 | ▶ | sub tracker_enable() { | ||||||||||||||||||||||||||
|
Subroutine
tracker_enable: called CC=4 SCAR=15.5
Pod
documented
| |||||||||||||||||||||||||||||
| 433 | 2 | my ($self,$nv) = @_; | |||||||||||||||||||||||||||
| 434 | 2 | ▶ | if (defined($nv)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 435 | 2 | ▶ | if (($nv==0) or ($nv==1)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$nv == 0 or $nv == 1
MC/DC0%0/2
$nv == 0 or $nv == 1
$nv == 0
$nv == 1
Truth table33%1/3
A or B
A= $nv == 0B= $nv == 1
| |||||||||||||||||||||||||||||
| 436 | 2 | $self->{'trackerEnable'} = $nv; | |||||||||||||||||||||||||||
| 437 | 2 | $self->{'_bitfields1'} |= $nv &0x01; | |||||||||||||||||||||||||||
| 438 | } else { | ||||||||||||||||||||||||||||
| 439 | 0 | carp "tracker_enable must be 0 (Disable), or 1 (Enable)."; | |||||||||||||||||||||||||||
| 440 | } | ||||||||||||||||||||||||||||
| 441 | } | ||||||||||||||||||||||||||||
| 442 | 2 | return ($self->{'_bitfields1'} & 0x01); | |||||||||||||||||||||||||||
| 443 | } | ||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||
| 445 | #============================================================================== | ||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||
| 447 | =item sub view_group([$newValue]) | ||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||
| 449 | $value = $mt_ctl->view_group($newValue); | ||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||
| 451 | View/View Group Select. | ||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||
| 453 | This attribute specifies whether the tracking device is attached to a single | ||||||||||||||||||||||||||||
| 454 | view or a view group. If set to View (0), the View/View Group ID attribute | ||||||||||||||||||||||||||||
| 455 | identifies a single view. If set to View Group (1), that attribute identifies a | ||||||||||||||||||||||||||||
| 456 | view group. | ||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||
| 458 | View 0 | ||||||||||||||||||||||||||||
| 459 | ViewGroup 1 | ||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||
| 461 | =cut | ||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||
| 463 | 2 | ▶ | sub view_group() { | ||||||||||||||||||||||||||
|
Subroutine
view_group: called CC=4 SCAR=15.5
Pod
documented
| |||||||||||||||||||||||||||||
| 464 | 2 | my ($self,$nv) = @_; | |||||||||||||||||||||||||||
| 465 | 2 | ▶ | if (defined($nv)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 466 | 2 | ▶ | if (($nv==0) or ($nv==1)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$nv == 0 or $nv == 1
MC/DC0%0/2
$nv == 0 or $nv == 1
$nv == 0
$nv == 1
Truth table33%1/3
A or B
A= $nv == 0B= $nv == 1
| |||||||||||||||||||||||||||||
| 467 | 2 | $self->{'viewGroup'} = $nv; | |||||||||||||||||||||||||||
| 468 | 2 | $self->{'_bitfields2'} |= $nv &0x01; | |||||||||||||||||||||||||||
| 469 | } else { | ||||||||||||||||||||||||||||
| 470 | 0 | carp "view_group must be 0 (View), or 1 (ViewGroup)."; | |||||||||||||||||||||||||||
| 471 | } | ||||||||||||||||||||||||||||
| 472 | } | ||||||||||||||||||||||||||||
| 473 | 2 | return ($self->{'_bitfields2'} & 0x01); | |||||||||||||||||||||||||||
| 474 | } | ||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||
| 476 | #========================================================================== | ||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||
| 478 | =item sub pack() | ||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||
| 480 | $value = $mt_ctl->pack(); | ||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||
| 482 | Returns the packed data packet. | ||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||
| 484 | =cut | ||||||||||||||||||||||||||||
| 485 | |||||||||||||||||||||||||||||
| 486 | 2 | ▶ | sub pack($) { | ||||||||||||||||||||||||||
|
Subroutine
pack: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 487 | 2 | my $self = shift ; | |||||||||||||||||||||||||||
| 488 | |||||||||||||||||||||||||||||
| 489 | $self->{'_Buffer'} = CORE::pack($self->{'_Pack'}, | ||||||||||||||||||||||||||||
| 490 | $self->{'packetType'}, | ||||||||||||||||||||||||||||
| 491 | $self->{'packetSize'}, | ||||||||||||||||||||||||||||
| 492 | $self->{'viewIdent'}, | ||||||||||||||||||||||||||||
| 493 | $self->{'trackerIdent'}, | ||||||||||||||||||||||||||||
| 494 | $self->{'_bitfields1'}, # Includes bitfields yawEnable, pitchEnable, rollEnable, zEnable, yEnable, xEnable, boresightEnable, and trackerEnable. | ||||||||||||||||||||||||||||
| 495 | $self->{'_bitfields2'}, # Includes bitfields unused32, and viewGroup. | ||||||||||||||||||||||||||||
| 496 | 2 | $self->{'_unused33'}, | |||||||||||||||||||||||||||
| 497 | ); | ||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||
| 499 | 2 | return $self->{'_Buffer'}; | |||||||||||||||||||||||||||
| 500 | } | ||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||
| 502 | #========================================================================== | ||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||
| 504 | =item sub unpack() | ||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||
| 506 | $value = $mt_ctl->unpack(); | ||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||
| 508 | Unpacks the packed data packet. | ||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||
| 510 | =cut | ||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||
| 512 | 0 | ▶ | sub unpack($) { | ||||||||||||||||||||||||||
|
Subroutine
unpack: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 513 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||
| 515 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 516 | 0 | $self->{'_Buffer'} = shift @_; | |||||||||||||||||||||||||||
| 517 | } | ||||||||||||||||||||||||||||
| 518 | 0 | my ($a,$b,$c,$d,$e,$f,$g) = CORE::unpack($self->{'_Pack'},$self->{'_Buffer'}); | |||||||||||||||||||||||||||
| 519 | 0 | $self->{'packetType'} = $a; | |||||||||||||||||||||||||||
| 520 | 0 | $self->{'packetSize'} = $b; | |||||||||||||||||||||||||||
| 521 | 0 | $self->{'viewIdent'} = $c; | |||||||||||||||||||||||||||
| 522 | 0 | $self->{'trackerIdent'} = $d; | |||||||||||||||||||||||||||
| 523 | 0 | $self->{'_bitfields1'} = $e; # Includes bitfields yawEnable, pitchEnable, rollEnable, zEnable, yEnable, xEnable, boresightEnable, and trackerEnable. | |||||||||||||||||||||||||||
| 524 | 0 | $self->{'_bitfields2'} = $f; # Includes bitfields unused32, and viewGroup. | |||||||||||||||||||||||||||
| 525 | 0 | $self->{'_unused33'} = $g; | |||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||
| 527 | 0 | $self->{'yawEnable'} = $self->yaw_enable(); | |||||||||||||||||||||||||||
| 528 | 0 | $self->{'pitchEnable'} = $self->pitch_enable(); | |||||||||||||||||||||||||||
| 529 | 0 | $self->{'rollEnable'} = $self->roll_enable(); | |||||||||||||||||||||||||||
| 530 | 0 | $self->{'zEnable'} = $self->z_enable(); | |||||||||||||||||||||||||||
| 531 | 0 | $self->{'yEnable'} = $self->y_enable(); | |||||||||||||||||||||||||||
| 532 | 0 | $self->{'xEnable'} = $self->x_enable(); | |||||||||||||||||||||||||||
| 533 | 0 | $self->{'boresightEnable'} = $self->boresight_enable(); | |||||||||||||||||||||||||||
| 534 | 0 | $self->{'trackerEnable'} = $self->tracker_enable(); | |||||||||||||||||||||||||||
| 535 | 0 | $self->{'viewGroup'} = $self->view_group(); | |||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||
| 537 | 0 | return $self->{'_Buffer'}; | |||||||||||||||||||||||||||
| 538 | } | ||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||
| 540 | #========================================================================== | ||||||||||||||||||||||||||||
| 541 | |||||||||||||||||||||||||||||
| 542 | =item sub byte_swap() | ||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||
| 544 | $obj_name->byte_swap(); | ||||||||||||||||||||||||||||
| 545 | |||||||||||||||||||||||||||||
| 546 | Byte swaps the packed data packet. | ||||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||
| 548 | =cut | ||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||
| 550 | 0 | ▶ | sub byte_swap($) { | ||||||||||||||||||||||||||
|
Subroutine
byte_swap: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 551 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||
| 552 | |||||||||||||||||||||||||||||
| 553 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 554 | 0 | $self->{'_Buffer'} = shift @_; | |||||||||||||||||||||||||||
| 555 | } else { | ||||||||||||||||||||||||||||
| 556 | 0 | $self->pack(); | |||||||||||||||||||||||||||
| 557 | } | ||||||||||||||||||||||||||||
| 558 | 0 | my ($a,$b,$c,$d,$e,$f,$g) = CORE::unpack($self->{'_Swap1'},$self->{'_Buffer'}); | |||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||
| 560 | 0 | $self->{'_Buffer'} = CORE::pack($self->{'_Swap2'},$a,$b,$c,$d,$e,$f,$g); | |||||||||||||||||||||||||||
| 561 | 0 | $self->unpack(); | |||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||
| 563 | 0 | return $self->{'_Buffer'}; | |||||||||||||||||||||||||||
| 564 | } | ||||||||||||||||||||||||||||
| 565 | |||||||||||||||||||||||||||||
| 566 | 2 | 1; | |||||||||||||||||||||||||||
| 567 | __END__ | ||||||||||||||||||||||||||||