CIGIPP/MaritimeSurfaceConditionsResponse.pm

filter: Statementstmt 65.7% 48 / 73 Branchbran 25.0% 5 / 20 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 85.7% 12 / 14 Podpod 100% 10 / 10 totaltotal 62.3% 76 / 122 CC 13 SCAR 19.6
CC
13
Cov
56%
new
19.6
unpack
6.0
byte_swap
6.0
CRAP 7.1
« CIGIPP/ConformalClampedEntityControl.pm ↑ Summary CIGIPP/StartOfFrame.pm »
1 #
2 # Rinchi Common Image Generator Interface for Perl
3 # Class Identifier: f78b35f2-200e-11de-bdd1-001c25551abc
4 # Author: Brian M. Ames
5 #
6  
7 package Rinchi::CIGIPP::MaritimeSurfaceConditionsResponse;
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::MaritimeSurfaceConditionsResponse - Perl extension for the
42 Common Image Generator Interface - Maritime Surface Conditions Response data packet.
43 data packet.
44 =head1 SYNOPSIS
45  
46 use Rinchi::CIGIPP::MaritimeSurfaceConditionsResponse;
47 my $msc_resp = Rinchi::CIGIPP::MaritimeSurfaceConditionsResponse->new();
48  
49 $packet_type = $msc_resp->packet_type();
50 $packet_size = $msc_resp->packet_size();
51 $request_ident = $msc_resp->request_ident(122);
52 $sea_surface_height = $msc_resp->sea_surface_height(9.874);
53 $surface_water_temperature = $msc_resp->surface_water_temperature(82.083);
54 $surface_clarity = $msc_resp->surface_clarity(8.774);
55  
56 =head1 DESCRIPTION
57  
58 The Maritime Surface Conditions Response packet is sent in response to an
59 Environmental Conditions Request packet whose Request Type attribute specifies
60 Maritime Surface Conditions. The packet describes the sea surface state at the
61 requested geodetic latitude and longitude.
62  
63 =head2 EXPORT
64  
65 None by default.
66  
67 #==============================================================================
68  
69 =item new $msc_resp = Rinchi::CIGIPP::MaritimeSurfaceConditionsResponse->new()
70  
71 Constructor for Rinchi::MaritimeSurfaceConditionsResponse.
72  
73 =cut
74  
75 2 ▶sub new {
Subroutine new: called CC=7 SCAR=29.8
Pod documented
76 2 my $class = shift;
77 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
78  
79 2 my $self = {
80 '_Buffer' => '',
81 '_ClassIdent' => 'f78b35f2-200e-11de-bdd1-001c25551abc',
82 '_Pack' => 'CCCCfff',
83 '_Swap1' => 'CCCCVVV',
84 '_Swap2' => 'CCCCNNN',
85 'packetType' => 111,
86 'packetSize' => 16,
87 'requestIdent' => 0,
88 '_unused81' => 0,
89 'seaSurfaceHeight' => 0,
90 'surfaceWaterTemperature' => 0,
91 'surfaceClarity' => 0,
92 };
93  
94 2 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 2 2
95 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
96 0 $self->{'_Buffer'} = $_[0][0];
97 } elsif (ref($_[0]) eq 'HASH') {
98 0 foreach my $attr (keys %{$_[0]}) {
99 0 ▶ $self->{"_$attr"} = $_[0]->{$attr} unless ($attr =~ /^_/);
Branch: 1 branch
BranchTrueFalseTotal
unless $attr =~ /^_/ 0 0 0
100 }
101 }
102 }
103  
104 2 bless($self,$class);
105 2 return $self;
106 }
107  
108 #==============================================================================
109  
110 =item sub packet_type()
111  
112 $value = $msc_resp->packet_type();
113  
114 Data Packet Identifier.
115  
116 This attribute identifies this data packet as the Maritime Surface Conditions
117 Response packet. The value of this attribute must be 111.
118  
119 =cut
120  
121 2 ▶sub packet_type() {
Subroutine packet_type: called CC=1 SCAR=0.0
Pod documented
122 2 my ($self) = @_;
123 2 return $self->{'packetType'};
124 }
125  
126 #==============================================================================
127  
128 =item sub packet_size()
129  
130 $value = $msc_resp->packet_size();
131  
132 Data Packet Size.
133  
134 This attribute indicates the number of bytes in this data packet. The value of
135 this attribute must be 16.
136  
137 =cut
138  
139 2 ▶sub packet_size() {
Subroutine packet_size: called CC=1 SCAR=0.0
Pod documented
140 2 my ($self) = @_;
141 2 return $self->{'packetSize'};
142 }
143  
144 #==============================================================================
145  
146 =item sub request_ident([$newValue])
147  
148 $value = $msc_resp->request_ident($newValue);
149  
150 Request ID.
151  
152 This attribute identifies the environmental conditions request to which this
153 response packet corresponds.
154  
155 =cut
156  
157 2 ▶sub request_ident() {
Subroutine request_ident: called CC=2 SCAR=7.0
Pod documented
158 2 my ($self,$nv) = @_;
159 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
160 2 $self->{'requestIdent'} = $nv;
161 }
162 2 return $self->{'requestIdent'};
163 }
164  
165 #==============================================================================
166  
167 =item sub sea_surface_height([$newValue])
168  
169 $value = $msc_resp->sea_surface_height($newValue);
170  
171 Sea Surface Height.
172  
173 This attribute indicates the height of the sea surface at equilibrium (i.e.,
174 without waves).
175  
176 Note that the instantaneous elevation of the water including wave displacement
177 may be determined from a Height Of Terrain request.
178  
179 =cut
180  
181 2 ▶sub sea_surface_height() {
Subroutine sea_surface_height: called CC=2 SCAR=7.0
Pod documented
182 2 my ($self,$nv) = @_;
183 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
184 2 $self->{'seaSurfaceHeight'} = $nv;
185 }
186 2 return $self->{'seaSurfaceHeight'};
187 }
188  
189 #==============================================================================
190  
191 =item sub surface_water_temperature([$newValue])
192  
193 $value = $msc_resp->surface_water_temperature($newValue);
194  
195 Surface Water Temperature
196  
197 This attribute indicates the water temperature at the sea surface.
198  
199 =cut
200  
201 2 ▶sub surface_water_temperature() {
Subroutine surface_water_temperature: called CC=2 SCAR=7.0
Pod documented
202 2 my ($self,$nv) = @_;
203 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
204 2 $self->{'surfaceWaterTemperature'} = $nv;
205 }
206 2 return $self->{'surfaceWaterTemperature'};
207 }
208  
209 #==============================================================================
210  
211 =item sub surface_clarity([$newValue])
212  
213 $value = $msc_resp->surface_clarity($newValue);
214  
215 Surface Clarity.
216  
217 This attribute indicates the clarity of the water at its surface. A value of
218 100% indicates pristine water, while a value of 0% indicates extremely turbid water.
219  
220 =cut
221  
222 2 ▶sub surface_clarity() {
Subroutine surface_clarity: called CC=2 SCAR=7.0
Pod documented
223 2 my ($self,$nv) = @_;
224 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
225 2 $self->{'surfaceClarity'} = $nv;
226 }
227 2 return $self->{'surfaceClarity'};
228 }
229  
230 #==========================================================================
231  
232 =item sub pack()
233  
234 $value = $msc_resp->pack();
235  
236 Returns the packed data packet.
237  
238 =cut
239  
240 2 ▶sub pack($) {
Subroutine pack: called CC=1 SCAR=0.0
Pod documented
241 2 my $self = shift ;
242
243 $self->{'_Buffer'} = CORE::pack($self->{'_Pack'},
244 $self->{'packetType'},
245 $self->{'packetSize'},
246 $self->{'requestIdent'},
247 $self->{'_unused81'},
248 $self->{'seaSurfaceHeight'},
249 $self->{'surfaceWaterTemperature'},
250 2 $self->{'surfaceClarity'},
251 );
252  
253 2 return $self->{'_Buffer'};
254 }
255  
256 #==========================================================================
257  
258 =item sub unpack()
259  
260 $value = $msc_resp->unpack();
261  
262 Unpacks the packed data packet.
263  
264 =cut
265  
266 0 ▶sub unpack($) {
Subroutine unpack: not called CC=2 SCAR=17.9
Pod documented
267 0 my $self = shift @_;
268
269 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
270 0 $self->{'_Buffer'} = shift @_;
271 }
272 0 my ($a,$b,$c,$d,$e,$f,$g) = CORE::unpack($self->{'_Pack'},$self->{'_Buffer'});
273 0 $self->{'packetType'} = $a;
274 0 $self->{'packetSize'} = $b;
275 0 $self->{'requestIdent'} = $c;
276 0 $self->{'_unused81'} = $d;
277 0 $self->{'seaSurfaceHeight'} = $e;
278 0 $self->{'surfaceWaterTemperature'} = $f;
279 0 $self->{'surfaceClarity'} = $g;
280  
281 0 return $self->{'_Buffer'};
282 }
283  
284 #==========================================================================
285  
286 =item sub byte_swap()
287  
288 $obj_name->byte_swap();
289  
290 Byte swaps the packed data packet.
291  
292 =cut
293  
294 0 ▶sub byte_swap($) {
Subroutine byte_swap: not called CC=2 SCAR=17.9
Pod documented
295 0 my $self = shift @_;
296
297 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
298 0 $self->{'_Buffer'} = shift @_;
299 } else {
300 0 $self->pack();
301 }
302 0 my ($a,$b,$c,$d,$e,$f,$g) = CORE::unpack($self->{'_Swap1'},$self->{'_Buffer'});
303  
304 0 $self->{'_Buffer'} = CORE::pack($self->{'_Swap2'},$a,$b,$c,$d,$e,$f,$g);
305 0 $self->unpack();
306  
307 0 return $self->{'_Buffer'};
308 }
309  
310 2 1;
311 __END__
« CIGIPP/ConformalClampedEntityControl.pm ↑ Summary CIGIPP/StartOfFrame.pm »