CIGIPP/TerrestrialSurfaceConditionsResponse.pm

filter: Statementstmt 63.4% 40 / 63 Branchbran 18.7% 3 / 16 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 83.3% 10 / 12 Podpod 100% 8 / 8 totaltotal 59.6% 62 / 104 CC 11 SCAR 20.8
CC
11
Cov
54%
new
19.6
unpack
6.0
byte_swap
6.0
CRAP 8.0
« CIGIPP/PositionRequest.pm ↑ Summary CIGIPP/SymbolCircleDefinition.pm »
1 #
2 # Rinchi Common Image Generator Interface for Perl
3 # Class Identifier: f78b38a4-200e-11de-bdd2-001c25551abc
4 # Author: Brian M. Ames
5 #
6  
7 package Rinchi::CIGIPP::TerrestrialSurfaceConditionsResponse;
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::TerrestrialSurfaceConditionsResponse - Perl extension for the
42 Common Image Generator Interface - Terrestrial Surface Conditions Response data packet.
43 data packet.
44 =head1 SYNOPSIS
45  
46 use Rinchi::CIGIPP::TerrestrialSurfaceConditionsResponse;
47 my $tsc_resp = Rinchi::CIGIPP::TerrestrialSurfaceConditionsResponse->new();
48  
49 $packet_type = $tsc_resp->packet_type();
50 $packet_size = $tsc_resp->packet_size();
51 $request_ident = $tsc_resp->request_ident(208);
52 $surface_condition_ident = $tsc_resp->surface_condition_ident(53038);
53  
54 =head1 DESCRIPTION
55  
56 The Terrestrial Surface Conditions Response packet is sent in response to an
57 Environmental Conditions Request packet whose Request Type attribute specifies
58 Terrestrial Surface Conditions. The packet describes the terrain surface
59 conditions at the requested geodetic latitude and longitude.
60  
61 =head2 EXPORT
62  
63 None by default.
64  
65 #==============================================================================
66  
67 =item new $tsc_resp = Rinchi::CIGIPP::TerrestrialSurfaceConditionsResponse->new()
68  
69 Constructor for Rinchi::TerrestrialSurfaceConditionsResponse.
70  
71 =cut
72  
73 2 ▶sub new {
Subroutine new: called CC=7 SCAR=29.8
Pod documented
74 2 my $class = shift;
75 2 ▶ $class = ref($class) || $class;
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
020
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
76  
77 2 my $self = {
78 '_Buffer' => '',
79 '_ClassIdent' => 'f78b38a4-200e-11de-bdd2-001c25551abc',
80 '_Pack' => 'CCCCI',
81 '_Swap1' => 'CCCCV',
82 '_Swap2' => 'CCCCN',
83 'packetType' => 112,
84 'packetSize' => 8,
85 'requestIdent' => 0,
86 '_unused82' => 0,
87 'surfaceConditionIdent' => 0,
88 };
89  
90 2 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 2 2
91 0 ▶ if (ref($_[0]) eq 'ARRAY') {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $_[0] eq 'ARRAY') { } 0 0 0
elsif (ref $_[0] eq 'HASH') { } 0 0 0
92 0 $self->{'_Buffer'} = $_[0][0];
93 } elsif (ref($_[0]) eq 'HASH') {
94 0 foreach my $attr (keys %{$_[0]}) {
95 0 ▶ $self->{"_$attr"} = $_[0]->{$attr} unless ($attr =~ /^_/);
Branch: 1 branch
BranchTrueFalseTotal
unless $attr =~ /^_/ 0 0 0
96 }
97 }
98 }
99  
100 2 bless($self,$class);
101 2 return $self;
102 }
103  
104 #==============================================================================
105  
106 =item sub packet_type()
107  
108 $value = $tsc_resp->packet_type();
109  
110 Data Packet Identifier.
111  
112 This attribute identifies this data packet as the Terrestrial Surface
113 Conditions Response packet. The value of this attribute must be 112.
114  
115 =cut
116  
117 2 ▶sub packet_type() {
Subroutine packet_type: called CC=1 SCAR=0.0
Pod documented
118 2 my ($self) = @_;
119 2 return $self->{'packetType'};
120 }
121  
122 #==============================================================================
123  
124 =item sub packet_size()
125  
126 $value = $tsc_resp->packet_size();
127  
128 Data Packet Size.
129  
130 This attribute indicates the number of bytes in this data packet. The value of
131 this attribute must be 8.
132  
133 =cut
134  
135 2 ▶sub packet_size() {
Subroutine packet_size: called CC=1 SCAR=0.0
Pod documented
136 2 my ($self) = @_;
137 2 return $self->{'packetSize'};
138 }
139  
140 #==============================================================================
141  
142 =item sub request_ident([$newValue])
143  
144 $value = $tsc_resp->request_ident($newValue);
145  
146 Request ID.
147  
148 This attribute identifies the environmental conditions request to which this
149 response packet corresponds.
150  
151 =cut
152  
153 2 ▶sub request_ident() {
Subroutine request_ident: called CC=2 SCAR=7.0
Pod documented
154 2 my ($self,$nv) = @_;
155 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
156 2 $self->{'requestIdent'} = $nv;
157 }
158 2 return $self->{'requestIdent'};
159 }
160  
161 #==============================================================================
162  
163 =item sub surface_condition_ident([$newValue])
164  
165 $value = $tsc_resp->surface_condition_ident($newValue);
166  
167 Surface Condition ID.
168  
169 This attribute indicates the presence of a specific surface condition or
170 contaminant at the test point. Surface condition codes are IG-dependent.
171  
172 =cut
173  
174 2 ▶sub surface_condition_ident() {
Subroutine surface_condition_ident: called CC=2 SCAR=7.0
Pod documented
175 2 my ($self,$nv) = @_;
176 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
177 2 $self->{'surfaceConditionIdent'} = $nv;
178 }
179 2 return $self->{'surfaceConditionIdent'};
180 }
181  
182 #==========================================================================
183  
184 =item sub pack()
185  
186 $value = $tsc_resp->pack();
187  
188 Returns the packed data packet.
189  
190 =cut
191  
192 2 ▶sub pack($) {
Subroutine pack: called CC=1 SCAR=0.0
Pod documented
193 2 my $self = shift ;
194
195 $self->{'_Buffer'} = CORE::pack($self->{'_Pack'},
196 $self->{'packetType'},
197 $self->{'packetSize'},
198 $self->{'requestIdent'},
199 $self->{'_unused82'},
200 2 $self->{'surfaceConditionIdent'},
201 );
202  
203 2 return $self->{'_Buffer'};
204 }
205  
206 #==========================================================================
207  
208 =item sub unpack()
209  
210 $value = $tsc_resp->unpack();
211  
212 Unpacks the packed data packet.
213  
214 =cut
215  
216 0 ▶sub unpack($) {
Subroutine unpack: not called CC=2 SCAR=17.9
Pod documented
217 0 my $self = shift @_;
218
219 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
220 0 $self->{'_Buffer'} = shift @_;
221 }
222 0 my ($a,$b,$c,$d,$e) = CORE::unpack($self->{'_Pack'},$self->{'_Buffer'});
223 0 $self->{'packetType'} = $a;
224 0 $self->{'packetSize'} = $b;
225 0 $self->{'requestIdent'} = $c;
226 0 $self->{'_unused82'} = $d;
227 0 $self->{'surfaceConditionIdent'} = $e;
228  
229 0 return $self->{'_Buffer'};
230 }
231  
232 #==========================================================================
233  
234 =item sub byte_swap()
235  
236 $obj_name->byte_swap();
237  
238 Byte swaps the packed data packet.
239  
240 =cut
241  
242 0 ▶sub byte_swap($) {
Subroutine byte_swap: not called CC=2 SCAR=17.9
Pod documented
243 0 my $self = shift @_;
244
245 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
246 0 $self->{'_Buffer'} = shift @_;
247 } else {
248 0 $self->unpack();
249 }
250 0 my ($a,$b,$c,$d,$e) = CORE::unpack($self->{'_Swap1'},$self->{'_Buffer'});
251  
252 0 $self->{'_Buffer'} = CORE::pack($self->{'_Swap2'},$a,$b,$c,$d,$e);
253 0 $self->unpack();
254  
255 0 return $self->{'_Buffer'};
256 }
257  
258 2 1;
259 __END__
« CIGIPP/PositionRequest.pm ↑ Summary CIGIPP/SymbolCircleDefinition.pm »