| 1 | # | ||||||||||||||||||||
| 2 | # Rinchi Common Image Generator Interface for Perl | ||||||||||||||||||||
| 3 | # Class Identifier: f78b3354-200e-11de-bdd0-001c25551abc | ||||||||||||||||||||
| 4 | # Author: Brian M. Ames | ||||||||||||||||||||
| 5 | # | ||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | package Rinchi::CIGIPP::AerosolConcentrationResponse; | ||||||||||||||||||||
| 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::AerosolConcentrationResponse - Perl extension for the Common | ||||||||||||||||||||
| 42 | Image Generator Interface - Aerosol Concentration Response data packet. | ||||||||||||||||||||
| 43 | data packet. | ||||||||||||||||||||
| 44 | =head1 SYNOPSIS | ||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | use Rinchi::CIGIPP::AerosolConcentrationResponse; | ||||||||||||||||||||
| 47 | my $ac_resp = Rinchi::CIGIPP::AerosolConcentrationResponse->new(); | ||||||||||||||||||||
| 48 | |||||||||||||||||||||
| 49 | $packet_type = $ac_resp->packet_type(); | ||||||||||||||||||||
| 50 | $packet_size = $ac_resp->packet_size(); | ||||||||||||||||||||
| 51 | $request_ident = $ac_resp->request_ident(38); | ||||||||||||||||||||
| 52 | $layer_ident = $ac_resp->layer_ident(78); | ||||||||||||||||||||
| 53 | $aerosol_concentration = $ac_resp->aerosol_concentration(59.538); | ||||||||||||||||||||
| 54 | |||||||||||||||||||||
| 55 | =head1 DESCRIPTION | ||||||||||||||||||||
| 56 | |||||||||||||||||||||
| 57 | The Aerosol Concentration Response packet is sent in response to an | ||||||||||||||||||||
| 58 | Environmental Conditions Request packet whose Request Type attribute specifies | ||||||||||||||||||||
| 59 | Aerosol Concentrations. The packet describes the concentration of airborne | ||||||||||||||||||||
| 60 | particles associated with a specific weather layer. | ||||||||||||||||||||
| 61 | |||||||||||||||||||||
| 62 | The aerosol type is determined by the weather layer ID. If two or more global | ||||||||||||||||||||
| 63 | or regional weather layers overlap and have the same layer ID, the | ||||||||||||||||||||
| 64 | concentration of that aerosol is the average of the concentrations due to each layer. | ||||||||||||||||||||
| 65 | |||||||||||||||||||||
| 66 | =head2 EXPORT | ||||||||||||||||||||
| 67 | |||||||||||||||||||||
| 68 | None by default. | ||||||||||||||||||||
| 69 | |||||||||||||||||||||
| 70 | #============================================================================== | ||||||||||||||||||||
| 71 | |||||||||||||||||||||
| 72 | =item new $ac_resp = Rinchi::CIGIPP::AerosolConcentrationResponse->new() | ||||||||||||||||||||
| 73 | |||||||||||||||||||||
| 74 | Constructor for Rinchi::AerosolConcentrationResponse. | ||||||||||||||||||||
| 75 | |||||||||||||||||||||
| 76 | =cut | ||||||||||||||||||||
| 77 | |||||||||||||||||||||
| 78 | 2 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=7 SCAR=29.8
Pod
documented
| |||||||||||||||||||||
| 79 | 2 | my $class = shift; | |||||||||||||||||||
| 80 | 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
| |||||||||||||||||||||
| 81 | |||||||||||||||||||||
| 82 | 2 | my $self = { | |||||||||||||||||||
| 83 | '_Buffer' => '', | ||||||||||||||||||||
| 84 | '_ClassIdent' => 'f78b3354-200e-11de-bdd0-001c25551abc', | ||||||||||||||||||||
| 85 | '_Pack' => 'CCCCf', | ||||||||||||||||||||
| 86 | '_Swap1' => 'CCCCV', | ||||||||||||||||||||
| 87 | '_Swap2' => 'CCCCN', | ||||||||||||||||||||
| 88 | 'packetType' => 110, | ||||||||||||||||||||
| 89 | 'packetSize' => 8, | ||||||||||||||||||||
| 90 | 'requestIdent' => 0, | ||||||||||||||||||||
| 91 | 'layerIdent' => 0, | ||||||||||||||||||||
| 92 | 'aerosolConcentration' => 0, | ||||||||||||||||||||
| 93 | }; | ||||||||||||||||||||
| 94 | |||||||||||||||||||||
| 95 | 2 | ▶ | if (@_) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 96 | 0 | ▶ | if (ref($_[0]) eq 'ARRAY') { | ||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||
| 97 | 0 | $self->{'_Buffer'} = $_[0][0]; | |||||||||||||||||||
| 98 | } elsif (ref($_[0]) eq 'HASH') { | ||||||||||||||||||||
| 99 | 0 | foreach my $attr (keys %{$_[0]}) { | |||||||||||||||||||
| 100 | 0 | ▶ | $self->{"_$attr"} = $_[0]->{$attr} unless ($attr =~ /^_/); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 101 | } | ||||||||||||||||||||
| 102 | } | ||||||||||||||||||||
| 103 | } | ||||||||||||||||||||
| 104 | |||||||||||||||||||||
| 105 | 2 | bless($self,$class); | |||||||||||||||||||
| 106 | 2 | return $self; | |||||||||||||||||||
| 107 | } | ||||||||||||||||||||
| 108 | |||||||||||||||||||||
| 109 | #============================================================================== | ||||||||||||||||||||
| 110 | |||||||||||||||||||||
| 111 | =item sub packet_type() | ||||||||||||||||||||
| 112 | |||||||||||||||||||||
| 113 | $value = $ac_resp->packet_type(); | ||||||||||||||||||||
| 114 | |||||||||||||||||||||
| 115 | Data Packet Identifier. | ||||||||||||||||||||
| 116 | |||||||||||||||||||||
| 117 | This attribute identifies this data packet as the Aerosol Concentration | ||||||||||||||||||||
| 118 | Response packet. The value of this attribute must be 110. | ||||||||||||||||||||
| 119 | |||||||||||||||||||||
| 120 | =cut | ||||||||||||||||||||
| 121 | |||||||||||||||||||||
| 122 | 2 | ▶ | sub packet_type() { | ||||||||||||||||||
|
Subroutine
packet_type: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 123 | 2 | my ($self) = @_; | |||||||||||||||||||
| 124 | 2 | return $self->{'packetType'}; | |||||||||||||||||||
| 125 | } | ||||||||||||||||||||
| 126 | |||||||||||||||||||||
| 127 | #============================================================================== | ||||||||||||||||||||
| 128 | |||||||||||||||||||||
| 129 | =item sub packet_size() | ||||||||||||||||||||
| 130 | |||||||||||||||||||||
| 131 | $value = $ac_resp->packet_size(); | ||||||||||||||||||||
| 132 | |||||||||||||||||||||
| 133 | Data Packet Size. | ||||||||||||||||||||
| 134 | |||||||||||||||||||||
| 135 | This attribute indicates the number of bytes in this data packet. The value of | ||||||||||||||||||||
| 136 | this attribute must be 8. | ||||||||||||||||||||
| 137 | |||||||||||||||||||||
| 138 | =cut | ||||||||||||||||||||
| 139 | |||||||||||||||||||||
| 140 | 2 | ▶ | sub packet_size() { | ||||||||||||||||||
|
Subroutine
packet_size: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 141 | 2 | my ($self) = @_; | |||||||||||||||||||
| 142 | 2 | return $self->{'packetSize'}; | |||||||||||||||||||
| 143 | } | ||||||||||||||||||||
| 144 | |||||||||||||||||||||
| 145 | #============================================================================== | ||||||||||||||||||||
| 146 | |||||||||||||||||||||
| 147 | =item sub request_ident([$newValue]) | ||||||||||||||||||||
| 148 | |||||||||||||||||||||
| 149 | $value = $ac_resp->request_ident($newValue); | ||||||||||||||||||||
| 150 | |||||||||||||||||||||
| 151 | Request ID. | ||||||||||||||||||||
| 152 | |||||||||||||||||||||
| 153 | This attribute identifies the environmental conditions request to which this | ||||||||||||||||||||
| 154 | response packet corresponds. | ||||||||||||||||||||
| 155 | |||||||||||||||||||||
| 156 | =cut | ||||||||||||||||||||
| 157 | |||||||||||||||||||||
| 158 | 2 | ▶ | sub request_ident() { | ||||||||||||||||||
|
Subroutine
request_ident: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||
| 159 | 2 | my ($self,$nv) = @_; | |||||||||||||||||||
| 160 | 2 | ▶ | if (defined($nv)) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 161 | 2 | $self->{'requestIdent'} = $nv; | |||||||||||||||||||
| 162 | } | ||||||||||||||||||||
| 163 | 2 | return $self->{'requestIdent'}; | |||||||||||||||||||
| 164 | } | ||||||||||||||||||||
| 165 | |||||||||||||||||||||
| 166 | #============================================================================== | ||||||||||||||||||||
| 167 | |||||||||||||||||||||
| 168 | =item sub layer_ident([$newValue]) | ||||||||||||||||||||
| 169 | |||||||||||||||||||||
| 170 | $value = $ac_resp->layer_ident($newValue); | ||||||||||||||||||||
| 171 | |||||||||||||||||||||
| 172 | Layer ID. | ||||||||||||||||||||
| 173 | |||||||||||||||||||||
| 174 | This attribute identifies the weather layer whose aerosol concentration is | ||||||||||||||||||||
| 175 | being described. Thus, this attribute indicates the aerosol type to which this | ||||||||||||||||||||
| 176 | packet corresponds. | ||||||||||||||||||||
| 177 | |||||||||||||||||||||
| 178 | =cut | ||||||||||||||||||||
| 179 | |||||||||||||||||||||
| 180 | 2 | ▶ | sub layer_ident() { | ||||||||||||||||||
|
Subroutine
layer_ident: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||
| 181 | 2 | my ($self,$nv) = @_; | |||||||||||||||||||
| 182 | 2 | ▶ | if (defined($nv)) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 183 | 2 | $self->{'layerIdent'} = $nv; | |||||||||||||||||||
| 184 | } | ||||||||||||||||||||
| 185 | 2 | return $self->{'layerIdent'}; | |||||||||||||||||||
| 186 | } | ||||||||||||||||||||
| 187 | |||||||||||||||||||||
| 188 | #============================================================================== | ||||||||||||||||||||
| 189 | |||||||||||||||||||||
| 190 | =item sub aerosol_concentration([$newValue]) | ||||||||||||||||||||
| 191 | |||||||||||||||||||||
| 192 | $value = $ac_resp->aerosol_concentration($newValue); | ||||||||||||||||||||
| 193 | |||||||||||||||||||||
| 194 | Aerosol Concentration. | ||||||||||||||||||||
| 195 | |||||||||||||||||||||
| 196 | This attribute identifies the concentration of airborne particlesmeasured in | ||||||||||||||||||||
| 197 | grams/cubic meter. The type of particle is identified by the Layer ID attribute. | ||||||||||||||||||||
| 198 | |||||||||||||||||||||
| 199 | =cut | ||||||||||||||||||||
| 200 | |||||||||||||||||||||
| 201 | 2 | ▶ | sub aerosol_concentration() { | ||||||||||||||||||
|
Subroutine
aerosol_concentration: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||
| 202 | 2 | my ($self,$nv) = @_; | |||||||||||||||||||
| 203 | 2 | ▶ | if (defined($nv)) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 204 | 2 | $self->{'aerosolConcentration'} = $nv; | |||||||||||||||||||
| 205 | } | ||||||||||||||||||||
| 206 | 2 | return $self->{'aerosolConcentration'}; | |||||||||||||||||||
| 207 | } | ||||||||||||||||||||
| 208 | |||||||||||||||||||||
| 209 | #========================================================================== | ||||||||||||||||||||
| 210 | |||||||||||||||||||||
| 211 | =item sub pack() | ||||||||||||||||||||
| 212 | |||||||||||||||||||||
| 213 | $value = $ac_resp->pack(); | ||||||||||||||||||||
| 214 | |||||||||||||||||||||
| 215 | Returns the packed data packet. | ||||||||||||||||||||
| 216 | |||||||||||||||||||||
| 217 | =cut | ||||||||||||||||||||
| 218 | |||||||||||||||||||||
| 219 | 2 | ▶ | sub pack($) { | ||||||||||||||||||
|
Subroutine
pack: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 220 | 2 | my $self = shift ; | |||||||||||||||||||
| 221 | |||||||||||||||||||||
| 222 | $self->{'_Buffer'} = CORE::pack($self->{'_Pack'}, | ||||||||||||||||||||
| 223 | $self->{'packetType'}, | ||||||||||||||||||||
| 224 | $self->{'packetSize'}, | ||||||||||||||||||||
| 225 | $self->{'requestIdent'}, | ||||||||||||||||||||
| 226 | $self->{'layerIdent'}, | ||||||||||||||||||||
| 227 | 2 | $self->{'aerosolConcentration'}, | |||||||||||||||||||
| 228 | ); | ||||||||||||||||||||
| 229 | |||||||||||||||||||||
| 230 | 2 | return $self->{'_Buffer'}; | |||||||||||||||||||
| 231 | } | ||||||||||||||||||||
| 232 | |||||||||||||||||||||
| 233 | #========================================================================== | ||||||||||||||||||||
| 234 | |||||||||||||||||||||
| 235 | =item sub unpack() | ||||||||||||||||||||
| 236 | |||||||||||||||||||||
| 237 | $value = $ac_resp->unpack(); | ||||||||||||||||||||
| 238 | |||||||||||||||||||||
| 239 | Unpacks the packed data packet. | ||||||||||||||||||||
| 240 | |||||||||||||||||||||
| 241 | =cut | ||||||||||||||||||||
| 242 | |||||||||||||||||||||
| 243 | 0 | ▶ | sub unpack($) { | ||||||||||||||||||
|
Subroutine
unpack: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||
| 244 | 0 | my $self = shift @_; | |||||||||||||||||||
| 245 | |||||||||||||||||||||
| 246 | 0 | ▶ | if (@_) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 247 | 0 | $self->{'_Buffer'} = shift @_; | |||||||||||||||||||
| 248 | } | ||||||||||||||||||||
| 249 | 0 | my ($a,$b,$c,$d,$e) = CORE::unpack($self->{'_Pack'},$self->{'_Buffer'}); | |||||||||||||||||||
| 250 | 0 | $self->{'packetType'} = $a; | |||||||||||||||||||
| 251 | 0 | $self->{'packetSize'} = $b; | |||||||||||||||||||
| 252 | 0 | $self->{'requestIdent'} = $c; | |||||||||||||||||||
| 253 | 0 | $self->{'layerIdent'} = $d; | |||||||||||||||||||
| 254 | 0 | $self->{'aerosolConcentration'} = $e; | |||||||||||||||||||
| 255 | |||||||||||||||||||||
| 256 | 0 | return $self->{'_Buffer'}; | |||||||||||||||||||
| 257 | } | ||||||||||||||||||||
| 258 | |||||||||||||||||||||
| 259 | #========================================================================== | ||||||||||||||||||||
| 260 | |||||||||||||||||||||
| 261 | =item sub byte_swap() | ||||||||||||||||||||
| 262 | |||||||||||||||||||||
| 263 | $obj_name->byte_swap(); | ||||||||||||||||||||
| 264 | |||||||||||||||||||||
| 265 | Byte swaps the packed data packet. | ||||||||||||||||||||
| 266 | |||||||||||||||||||||
| 267 | =cut | ||||||||||||||||||||
| 268 | |||||||||||||||||||||
| 269 | 0 | ▶ | sub byte_swap($) { | ||||||||||||||||||
|
Subroutine
byte_swap: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||
| 270 | 0 | my $self = shift @_; | |||||||||||||||||||
| 271 | |||||||||||||||||||||
| 272 | 0 | ▶ | if (@_) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 273 | 0 | $self->{'_Buffer'} = shift @_; | |||||||||||||||||||
| 274 | } else { | ||||||||||||||||||||
| 275 | 0 | $self->pack(); | |||||||||||||||||||
| 276 | } | ||||||||||||||||||||
| 277 | 0 | my ($a,$b,$c,$d,$e) = CORE::unpack($self->{'_Swap1'},$self->{'_Buffer'}); | |||||||||||||||||||
| 278 | |||||||||||||||||||||
| 279 | 0 | $self->{'_Buffer'} = CORE::pack($self->{'_Swap2'},$a,$b,$c,$d,$e); | |||||||||||||||||||
| 280 | 0 | $self->unpack(); | |||||||||||||||||||
| 281 | |||||||||||||||||||||
| 282 | 0 | return $self->{'_Buffer'}; | |||||||||||||||||||
| 283 | } | ||||||||||||||||||||
| 284 | |||||||||||||||||||||
| 285 | 2 | 1; | |||||||||||||||||||
| 286 | __END__ | ||||||||||||||||||||