| 1 | # -*- perl -*- | ||||||||||||||||||||||
| 2 | # | ||||||||||||||||||||||
| 3 | ############################################################################### | ||||||||||||||||||||||
| 4 | # This file is autogenerated by $0. DO NOT EDIT! | ||||||||||||||||||||||
| 5 | ############################################################################### | ||||||||||||||||||||||
| 6 | # | ||||||||||||||||||||||
| 7 | package Device::LaCrosse::WS23xx::MemoryMap; | ||||||||||||||||||||||
| 8 | |||||||||||||||||||||||
| 9 | 3 | ▶ | use strict; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 10 | 3 | ▶ | use warnings; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 11 | 3 | ▶ | use Carp; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 12 | |||||||||||||||||||||||
| 13 | 3 | my $_memory_map = <<'END_MEMORY_MAP'; | |||||||||||||||||||||
| 14 | 000F:1 Wind_unit 0=m/s, 1=knots, 2=beaufort, 3=km/h, 4=mph | ||||||||||||||||||||||
| 15 | 0266:1 LCD_contrast $BCD+1 | ||||||||||||||||||||||
| 16 | 026B:1 Forecast 0=Rainy, 1=Cloudy, 2=Sunny | ||||||||||||||||||||||
| 17 | 026C:1 Tendency 0=Steady, 1=Rising, 2=Falling | ||||||||||||||||||||||
| 18 | 0346:4 Indoor_Temperature [C] $BCD / 100.0 - 30 | ||||||||||||||||||||||
| 19 | 034B:4 Min_Indoor_Temperature [C] $BCD / 100.0 - 30 | ||||||||||||||||||||||
| 20 | 0350:4 Max_Indoor_Temperature [C] $BCD / 100.0 - 30 | ||||||||||||||||||||||
| 21 | 0354:10 Min_Indoor_Temperature_datetime [time_t] _time_convert($BCD, $field) | ||||||||||||||||||||||
| 22 | 035E:10 Max_Indoor_Temperature_datetime [time_t] _time_convert($BCD, $field) | ||||||||||||||||||||||
| 23 | 0369:4 Low_Alarm_Indoor_Temperature [C] $BCD / 100.0 - 30 | ||||||||||||||||||||||
| 24 | 036E:4 High_Alarm_Indoor_Temperature [C] $BCD / 100.0 - 30 | ||||||||||||||||||||||
| 25 | 0373:4 Outdoor_Temperature [C] $BCD / 100.0 - 30 | ||||||||||||||||||||||
| 26 | 0378:4 Min_Outdoor_Temperature [C] $BCD / 100.0 - 30 | ||||||||||||||||||||||
| 27 | 037D:4 Max_Outdoor_Temperature [C] $BCD / 100.0 - 30 | ||||||||||||||||||||||
| 28 | 0381:10 Min_Outdoor_Temperature_datetime [time_t] _time_convert($BCD, $field) | ||||||||||||||||||||||
| 29 | 038B:10 Max_Outdoor_Temperature_datetime [time_t] _time_convert($BCD, $field) | ||||||||||||||||||||||
| 30 | 0396:4 Low_Alarm_Outdoor_Temperature [C] $BCD / 100.0 - 30 | ||||||||||||||||||||||
| 31 | 039B:4 High_Alarm_Outdoor_Temperature [C] $BCD / 100.0 - 30 | ||||||||||||||||||||||
| 32 | 03A0:4 Windchill [C] $BCD / 100.0 - 30 | ||||||||||||||||||||||
| 33 | 03A5:4 Min_Windchill [C] $BCD / 100.0 - 30 | ||||||||||||||||||||||
| 34 | 03AA:4 Max_Windchill [C] $BCD / 100.0 - 30 | ||||||||||||||||||||||
| 35 | 03AE:10 Min_Windchill_datetime [time_t] _time_convert($BCD, $field) | ||||||||||||||||||||||
| 36 | 03B8:10 Max_Windchill_datetime [time_t] _time_convert($BCD, $field) | ||||||||||||||||||||||
| 37 | 03C3:4 Low_Alarm_Windchill [C] $BCD / 100.0 - 30 | ||||||||||||||||||||||
| 38 | 03C8:4 High_Alarm_Windchill [C] $BCD / 100.0 - 30 | ||||||||||||||||||||||
| 39 | 03CE:4 Dewpoint [C] $BCD / 100.0 - 30 | ||||||||||||||||||||||
| 40 | 03D3:4 Min_Dewpoint [C] $BCD / 100.0 - 30 | ||||||||||||||||||||||
| 41 | 03D8:4 Max_Dewpoint [C] $BCD / 100.0 - 30 | ||||||||||||||||||||||
| 42 | 03DC:10 Min_Dewpoint_datetime [time_t] _time_convert($BCD, $field) | ||||||||||||||||||||||
| 43 | 03E6:10 Max_Dewpoint_datetime [time_t] _time_convert($BCD, $field) | ||||||||||||||||||||||
| 44 | 03F1:4 Low_Alarm_Dewpoint [C] $BCD / 100.0 - 30 | ||||||||||||||||||||||
| 45 | 03F6:4 High_Alarm_Dewpoint [C] $BCD / 100.0 - 30 | ||||||||||||||||||||||
| 46 | 03FB:2 Indoor_Humidity [%] $BCD | ||||||||||||||||||||||
| 47 | 03FD:2 Min_Indoor_Humidity [%] $BCD | ||||||||||||||||||||||
| 48 | 03FF:2 Max_Indoor_Humidity [%] $BCD | ||||||||||||||||||||||
| 49 | 0401:10 Min_Indoor_Humidity_datetime [time_t] _time_convert($BCD, $field) | ||||||||||||||||||||||
| 50 | 040B:10 Max_Indoor_Humidity_datetime [time_t] _time_convert($BCD, $field) | ||||||||||||||||||||||
| 51 | 0415:2 Low_Alarm_Indoor_Humidity [%] $BCD | ||||||||||||||||||||||
| 52 | 0417:2 High_Alarm_Indoor_Humidity [%] $BCD | ||||||||||||||||||||||
| 53 | 0419:2 Outdoor_Humidity [%] $BCD | ||||||||||||||||||||||
| 54 | 041B:2 Min_Outdoor_Humidity [%] $BCD | ||||||||||||||||||||||
| 55 | 041D:2 Max_Outdoor_Humidity [%] $BCD | ||||||||||||||||||||||
| 56 | 041F:10 Min_Outdoor_Humidity_datetime [time_t] _time_convert($BCD, $field) | ||||||||||||||||||||||
| 57 | 0429:10 Max_Outdoor_Humidity_datetime [time_t] _time_convert($BCD, $field) | ||||||||||||||||||||||
| 58 | 0433:2 Low_Alarm_Outdoor_Humidity [%] $BCD | ||||||||||||||||||||||
| 59 | 0435:2 High_Alarm_Outdoor_Humidity [%] $BCD | ||||||||||||||||||||||
| 60 | 0497:6 Rain_24hour [mm] $BCD / 100.0 | ||||||||||||||||||||||
| 61 | 049D:6 Max_Rain_24hour [mm] $BCD / 100.0 | ||||||||||||||||||||||
| 62 | 04A3:10 Max_Rain_24hour_datetime [time_t] _time_convert($BCD, $field) | ||||||||||||||||||||||
| 63 | 04B4:6 Rain_1hour [mm] $BCD / 100.0 | ||||||||||||||||||||||
| 64 | 04BA:6 Max_Rain_1hour [mm] $BCD / 100.0 | ||||||||||||||||||||||
| 65 | 04C0:10 Max_Rain_1hour_datetime [time_t] _time_convert($BCD, $field) | ||||||||||||||||||||||
| 66 | 04D2:6 Rain_Total [mm] $BCD / 100.0 | ||||||||||||||||||||||
| 67 | 04D8:10 Rain_Total_datetime [time_t] _time_convert($BCD, $field) | ||||||||||||||||||||||
| 68 | 04EE:4 Min__wind [m/s] hex($BCD) / 360.0 | ||||||||||||||||||||||
| 69 | 04F4:4 Max__wind [m/s] hex($BCD) / 360.0 | ||||||||||||||||||||||
| 70 | 04F8:10 Min_Date/Time_wind_datetime [time_t] _time_convert($BCD, $field) | ||||||||||||||||||||||
| 71 | 0502:10 Max_Date/Time_wind_datetime [time_t] _time_convert($BCD, $field) | ||||||||||||||||||||||
| 72 | 0529:3 Wind_Speed [m/s] hex($BCD) / 10.0 | ||||||||||||||||||||||
| 73 | 052C:1 Wind_Direction [degrees] hex($BCD) * 22.5 | ||||||||||||||||||||||
| 74 | 0533:3 Low_wind_alarm_setting [m/s] $BCD / 10.0 | ||||||||||||||||||||||
| 75 | 0538:3 High_wind_alarm_setting [m/s] $BCD / 10.0 | ||||||||||||||||||||||
| 76 | 054D:1 Connection_Type 0=Cable, 3=lost, F=Wireless | ||||||||||||||||||||||
| 77 | 054F:2 Countdown_time_to_next_datBinary [seconds] hex($BCD) / 2.0 | ||||||||||||||||||||||
| 78 | 05D8:5 Absolute_Pressure [hPa] $BCD / 10.0 | ||||||||||||||||||||||
| 79 | 05E2:5 Relative_Pressure [hPa] $BCD / 10.0 | ||||||||||||||||||||||
| 80 | 05EC:5 Pressure_Correction [hPa] $BCD / 10.0- 1000 | ||||||||||||||||||||||
| 81 | 05F6:5 Min_Absolute_Pressure [hPa] $BCD / 10.0 | ||||||||||||||||||||||
| 82 | 0600:5 Min_Relative_Pressure [hPa] $BCD / 10.0 | ||||||||||||||||||||||
| 83 | 060A:5 Max_Absolute_Pressure [hPa] $BCD / 10.0 | ||||||||||||||||||||||
| 84 | 0614:5 Max_Relative_Pressure [hPa] $BCD / 10.0 | ||||||||||||||||||||||
| 85 | 061E:10 Min_Pressure_datetime [time_t] _time_convert($BCD, $field) | ||||||||||||||||||||||
| 86 | 0628:10 Max_Pressure_datetime [time_t] _time_convert($BCD, $field) | ||||||||||||||||||||||
| 87 | 063C:5 Low_Alarm_Pressure [hPa] $BCD / 10.0 | ||||||||||||||||||||||
| 88 | 0650:5 High_Alarm_Pressure [hPa] $BCD / 10.0 | ||||||||||||||||||||||
| 89 | 06B2:3 History_saving_interval [minutes] hex($BCD) | ||||||||||||||||||||||
| 90 | 06B5:3 Countdown_to_next_saving [minutes] hex($BCD) | ||||||||||||||||||||||
| 91 | 06B8:10 Date/Time_last_record_datetime [time_t] _time_convert($BCD, $field) | ||||||||||||||||||||||
| 92 | 06C2:2 Pointer_to_last_written_Record hex($BCD) | ||||||||||||||||||||||
| 93 | 06C4:2 Number_of_Records hex($BCD) | ||||||||||||||||||||||
| 94 | END_MEMORY_MAP | ||||||||||||||||||||||
| 95 | |||||||||||||||||||||||
| 96 | 3 | my $Canonical = <<'END_CANONICAL'; | |||||||||||||||||||||
| 97 | Max Maximum | Maximal | ||||||||||||||||||||||
| 98 | Min Minimum | Minimal | ||||||||||||||||||||||
| 99 | |||||||||||||||||||||||
| 100 | Indoor Indoors | Inside | In | ||||||||||||||||||||||
| 101 | Outdoor Outdoors | Outside | Out | ||||||||||||||||||||||
| 102 | |||||||||||||||||||||||
| 103 | Pressure Press | Air Pressure | ||||||||||||||||||||||
| 104 | Temperature Temp | ||||||||||||||||||||||
| 105 | Humidity Hum | Relative Humidity | Rel Humidity | ||||||||||||||||||||||
| 106 | Windchill Wind Chill | ||||||||||||||||||||||
| 107 | Wind_Speed Wind Speed | Windspeed | ||||||||||||||||||||||
| 108 | Dewpoint Dew Point | ||||||||||||||||||||||
| 109 | Rain Rainfall | Rain | ||||||||||||||||||||||
| 110 | END_CANONICAL | ||||||||||||||||||||||
| 111 | |||||||||||||||||||||||
| 112 | |||||||||||||||||||||||
| 113 | |||||||||||||||||||||||
| 114 | |||||||||||||||||||||||
| 115 | 1 | ▶ | sub new { | ||||||||||||||||||||
|
Subroutine
new: called CC=7 SCAR=20.5
Pod
documented
| |||||||||||||||||||||||
| 116 | 1 | my $proto = shift; | |||||||||||||||||||||
| 117 | 1 | ▶ | my $class = ref($proto) || $proto; | ||||||||||||||||||||
|
Condition33%1/3
ref $proto || $proto
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table33%1/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||||
| 118 | |||||||||||||||||||||||
| 119 | 1 | my $self = { | |||||||||||||||||||||
| 120 | fields => {}, | ||||||||||||||||||||||
| 121 | }; | ||||||||||||||||||||||
| 122 | |||||||||||||||||||||||
| 123 | # Read and parse the memory map at top. | ||||||||||||||||||||||
| 124 | 1 | for my $line (split "\n", $_memory_map) { | |||||||||||||||||||||
| 125 | 80 | ▶ | next if $line =~ m!^\s*$!; # Skip blank lines | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 126 | 80 | ▶ | next if $line =~ m!^\s*#!; # Skip comments | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 127 | |||||||||||||||||||||||
| 128 | 80 | ▶ | $line =~ /^(\S+):(\S+)\s+(\S+)(\s+\[(.*?)\])?\s+(\S.*\S)/ | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 129 | or die "Internal error: Cannot grok '$line'"; | ||||||||||||||||||||||
| 130 | 80 | ▶ | $self->{fields}{lc $3} = { | ||||||||||||||||||||
|
Condition100%2/2
$5 || '?'
MC/DC100%1/1
$5 || '?'
$5
Truth table100%2/2
A
A= $5
| |||||||||||||||||||||||
| 131 | address => hex($1), | ||||||||||||||||||||||
| 132 | count => $2, | ||||||||||||||||||||||
| 133 | name => $3, | ||||||||||||||||||||||
| 134 | units => $5 || '?', | ||||||||||||||||||||||
| 135 | expr => $6, | ||||||||||||||||||||||
| 136 | }; | ||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||
| 138 | |||||||||||||||||||||||
| 139 | 1 | return bless $self, $class; | |||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||
| 141 | |||||||||||||||||||||||
| 142 | 74 | ▶ | sub find_field { | ||||||||||||||||||||
|
Subroutine
find_field: called CC=5 SCAR=21.5
Pod
documented
| |||||||||||||||||||||||
| 143 | 74 | my $self = shift; | |||||||||||||||||||||
| 144 | 74 | my $field = shift; | |||||||||||||||||||||
| 145 | |||||||||||||||||||||||
| 146 | # Canonicalize the requested field name, e.g. | ||||||||||||||||||||||
| 147 | # 'Indoor Temp Max' => Max_Indoor_Temperature | ||||||||||||||||||||||
| 148 | 74 | my $canonical_field = _canonical_name($field); | |||||||||||||||||||||
| 149 | 74 | ▶ | if (! exists $self->{fields}->{lc $canonical_field}) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 150 | 0 | (my $re = lc $field) =~ s/[ _]+/.*/g; | |||||||||||||||||||||
| 151 | 0 | my @match = grep { /$re/i } keys %{$self->{fields}}; | |||||||||||||||||||||
| 152 | 0 | ▶ | if (@match == 1) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 153 | 0 | $canonical_field = $match[0]; | |||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||
| 156 | |||||||||||||||||||||||
| 157 | # If field doesn't exist at this point, our caller is requesting | ||||||||||||||||||||||
| 158 | # something we just can't handle. The only solution is for our caller | ||||||||||||||||||||||
| 159 | # to change the requested field name in their code. Abort noisily so | ||||||||||||||||||||||
| 160 | # they can do so. | ||||||||||||||||||||||
| 161 | 74 | ▶ | defined $canonical_field | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 162 | or croak "Could not translate '$field' to a known field name"; | ||||||||||||||||||||||
| 163 | 74 | ▶ | exists $self->{fields}->{lc $canonical_field} | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 164 | or croak "'$field' is not a valid WS23xx data field"; | ||||||||||||||||||||||
| 165 | |||||||||||||||||||||||
| 166 | 74 | return $self->{fields}->{lc $canonical_field}; | |||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||
| 168 | |||||||||||||||||||||||
| 169 | |||||||||||||||||||||||
| 170 | ################ | ||||||||||||||||||||||
| 171 | # | ||||||||||||||||||||||
| 172 | # canonical_name | ||||||||||||||||||||||
| 173 | # | ||||||||||||||||||||||
| 174 | 74 | ▶ | sub _canonical_name { | ||||||||||||||||||||
|
Subroutine
_canonical_name: called CC=17 SCAR=28.3
| |||||||||||||||||||||||
| 175 | 74 | my $desc = shift; | |||||||||||||||||||||
| 176 | 74 | my $canonical_name = ''; | |||||||||||||||||||||
| 177 | |||||||||||||||||||||||
| 178 | 74 | $desc =~ s/_/ /g; | |||||||||||||||||||||
| 179 | |||||||||||||||||||||||
| 180 | # Min or Max? | ||||||||||||||||||||||
| 181 | 74 | ▶ | if ($desc =~ s/\bmin(imum)?\b/ /i) { | ||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||
| 182 | 17 | $canonical_name .= 'Min_'; | |||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||
| 184 | elsif ($desc =~ s/\bmax(imum)?\b/ /i) { | ||||||||||||||||||||||
| 185 | 20 | $canonical_name .= 'Max_'; | |||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||
| 187 | elsif ($desc =~ s/\b(High|Low)\s*Alarm\b/ /i) { | ||||||||||||||||||||||
| 188 | 14 | $canonical_name .= ucfirst(lc($1)) . '_Alarm_'; | |||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||
| 190 | elsif ($desc =~ s/\bCurrent\b/ /i) { | ||||||||||||||||||||||
| 191 | # do nothing | ||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||
| 193 | |||||||||||||||||||||||
| 194 | # Where? | ||||||||||||||||||||||
| 195 | 74 | ▶ | if ($desc =~ s/\b(in|out)(doors?)?(\b|$)/ /i) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 196 | 27 | $canonical_name .= ucfirst(lc($1) . 'door') . '_'; | |||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||
| 198 | |||||||||||||||||||||||
| 199 | # What: Temperature, Windchill, Pressure, ... | ||||||||||||||||||||||
| 200 | 74 | ▶ | if ($desc =~ s/\btemp(erature)?\b/ /i) { | ||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||
| 201 | 17 | $canonical_name .= 'Temperature'; | |||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||
| 203 | elsif ($desc =~ s/\bPress(ure)?\b/ /i) { | ||||||||||||||||||||||
| 204 | 11 | $desc =~ s/\bair\b/ /i; | |||||||||||||||||||||
| 205 | |||||||||||||||||||||||
| 206 | 11 | ▶ | if ($desc =~ s/\bAbs(olute)?\b/ /i) { | ||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||
| 207 | 3 | $canonical_name .= 'Absolute_'; | |||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||
| 209 | elsif ($desc =~ s/\bRel(ative)?\b/ /i) { | ||||||||||||||||||||||
| 210 | 3 | $canonical_name .= 'Relative_'; | |||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||
| 212 | 11 | $canonical_name .= 'Pressure'; | |||||||||||||||||||||
| 213 | 11 | ▶ | if ($desc =~ s/\bCorrection\b/ /i) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 214 | 1 | $canonical_name .= '_Correction'; | |||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||
| 217 | elsif ($desc =~ s/\b(Humidity|Windchill|Dewpoint)\b/ /i) { | ||||||||||||||||||||||
| 218 | 25 | $canonical_name .= ucfirst(lc($1)); | |||||||||||||||||||||
| 219 | 25 | $desc =~ s/\bRel(ative)?\b/ /i; | |||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||
| 221 | elsif ($desc =~ s/\b(Rain)\b//i) { | ||||||||||||||||||||||
| 222 | 7 | $canonical_name .= "Rain"; | |||||||||||||||||||||
| 223 | 7 | ▶ | if ($desc =~ s/\b(1|24)(\s*h(ou)?r?)?\b//i) { | ||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||
| 224 | 6 | $canonical_name .= "_$1hour"; | |||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||
| 226 | elsif ($desc =~ s/\btotal\b//i) { | ||||||||||||||||||||||
| 227 | 1 | $canonical_name .= "_Total"; | |||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||
| 230 | else { | ||||||||||||||||||||||
| 231 | 14 | (my $tmp = $desc) =~ s/\s+/_/g; | |||||||||||||||||||||
| 232 | 14 | $canonical_name .= $tmp; | |||||||||||||||||||||
| 233 | # FIXME: warn? | ||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||
| 235 | |||||||||||||||||||||||
| 236 | # Is this a date/time field? | ||||||||||||||||||||||
| 237 | 74 | ▶ | if ($desc =~ s!\bDate/?Time\b! !i) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 238 | 17 | $canonical_name .= '_datetime'; | |||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||
| 240 | |||||||||||||||||||||||
| 241 | 74 | ▶ | if ($desc =~ /\S/) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 242 | # warn "leftover: $desc\n"; | ||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||
| 244 | |||||||||||||||||||||||
| 245 | 74 | $canonical_name =~ s/_$//; | |||||||||||||||||||||
| 246 | |||||||||||||||||||||||
| 247 | 74 | return $canonical_name; | |||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||
| 249 | |||||||||||||||||||||||
| 250 | # END canonical_name | ||||||||||||||||||||||
| 251 | |||||||||||||||||||||||
| 252 | =head1 NAME | ||||||||||||||||||||||
| 253 | |||||||||||||||||||||||
| 254 | Device::LaCrosse::WS23xx::MemoryMap - Weather station address meanings | ||||||||||||||||||||||
| 255 | |||||||||||||||||||||||
| 256 | =head1 SYNOPSIS | ||||||||||||||||||||||
| 257 | |||||||||||||||||||||||
| 258 | use Device::LaCrosse::WS23xx::MemoryMap; | ||||||||||||||||||||||
| 259 | |||||||||||||||||||||||
| 260 | my $map = Device::LaCrosse::WS23xx::MemoryMap->new(); | ||||||||||||||||||||||
| 261 | |||||||||||||||||||||||
| 262 | This is NOT intended as a user-visible module. It is | ||||||||||||||||||||||
| 263 | used internally by Device::LaCrosse::WS23xx. This interface | ||||||||||||||||||||||
| 264 | is subject to change without notice. | ||||||||||||||||||||||
| 265 | |||||||||||||||||||||||
| 266 | =head1 DESCRIPTION | ||||||||||||||||||||||
| 267 | |||||||||||||||||||||||
| 268 | =head1 CONSTRUCTOR | ||||||||||||||||||||||
| 269 | |||||||||||||||||||||||
| 270 | =over 4 | ||||||||||||||||||||||
| 271 | |||||||||||||||||||||||
| 272 | =item B<new>() | ||||||||||||||||||||||
| 273 | |||||||||||||||||||||||
| 274 | Parses the data table contained in the module itself. | ||||||||||||||||||||||
| 275 | |||||||||||||||||||||||
| 276 | =back | ||||||||||||||||||||||
| 277 | |||||||||||||||||||||||
| 278 | =head1 METHODS | ||||||||||||||||||||||
| 279 | |||||||||||||||||||||||
| 280 | =over 4 | ||||||||||||||||||||||
| 281 | |||||||||||||||||||||||
| 282 | =item B<find_field>( FIELD ) | ||||||||||||||||||||||
| 283 | |||||||||||||||||||||||
| 284 | Canonicalizes B<FIELD> and looks it up. If found, returns a | ||||||||||||||||||||||
| 285 | hashref with the following elements: | ||||||||||||||||||||||
| 286 | |||||||||||||||||||||||
| 287 | =over 8 | ||||||||||||||||||||||
| 288 | |||||||||||||||||||||||
| 289 | =item name | ||||||||||||||||||||||
| 290 | |||||||||||||||||||||||
| 291 | Canonical field name. | ||||||||||||||||||||||
| 292 | |||||||||||||||||||||||
| 293 | =item units | ||||||||||||||||||||||
| 294 | |||||||||||||||||||||||
| 295 | Units of the measurement. See Units below. | ||||||||||||||||||||||
| 296 | |||||||||||||||||||||||
| 297 | =item address | ||||||||||||||||||||||
| 298 | |||||||||||||||||||||||
| 299 | Starting address of this field in the WS-23xx memory map | ||||||||||||||||||||||
| 300 | |||||||||||||||||||||||
| 301 | =item count | ||||||||||||||||||||||
| 302 | |||||||||||||||||||||||
| 303 | Length, in nybbles, of the field. | ||||||||||||||||||||||
| 304 | |||||||||||||||||||||||
| 305 | =item expr | ||||||||||||||||||||||
| 306 | |||||||||||||||||||||||
| 307 | Perl expression used to convert data nybbles to a useful form. | ||||||||||||||||||||||
| 308 | |||||||||||||||||||||||
| 309 | =back | ||||||||||||||||||||||
| 310 | |||||||||||||||||||||||
| 311 | If FIELD is not found, returns undef. | ||||||||||||||||||||||
| 312 | |||||||||||||||||||||||
| 313 | =back | ||||||||||||||||||||||
| 314 | |||||||||||||||||||||||
| 315 | =head2 Known Fields | ||||||||||||||||||||||
| 316 | |||||||||||||||||||||||
| 317 | The known data fields -- i.e., what you can use as an | ||||||||||||||||||||||
| 318 | argument to Device::LaCrosse::WS23xx->get() -- are: | ||||||||||||||||||||||
| 319 | |||||||||||||||||||||||
| 320 | Wind_unit | ||||||||||||||||||||||
| 321 | LCD_contrast | ||||||||||||||||||||||
| 322 | Forecast | ||||||||||||||||||||||
| 323 | Tendency | ||||||||||||||||||||||
| 324 | Indoor_Temperature C | ||||||||||||||||||||||
| 325 | Min_Indoor_Temperature C | ||||||||||||||||||||||
| 326 | Max_Indoor_Temperature C | ||||||||||||||||||||||
| 327 | Min_Indoor_Temperature_datetime time_t | ||||||||||||||||||||||
| 328 | Max_Indoor_Temperature_datetime time_t | ||||||||||||||||||||||
| 329 | Low_Alarm_Indoor_Temperature C | ||||||||||||||||||||||
| 330 | High_Alarm_Indoor_Temperature C | ||||||||||||||||||||||
| 331 | Outdoor_Temperature C | ||||||||||||||||||||||
| 332 | Min_Outdoor_Temperature C | ||||||||||||||||||||||
| 333 | Max_Outdoor_Temperature C | ||||||||||||||||||||||
| 334 | Min_Outdoor_Temperature_datetime time_t | ||||||||||||||||||||||
| 335 | Max_Outdoor_Temperature_datetime time_t | ||||||||||||||||||||||
| 336 | Low_Alarm_Outdoor_Temperature C | ||||||||||||||||||||||
| 337 | High_Alarm_Outdoor_Temperature C | ||||||||||||||||||||||
| 338 | Windchill C | ||||||||||||||||||||||
| 339 | Min_Windchill C | ||||||||||||||||||||||
| 340 | Max_Windchill C | ||||||||||||||||||||||
| 341 | Min_Windchill_datetime time_t | ||||||||||||||||||||||
| 342 | Max_Windchill_datetime time_t | ||||||||||||||||||||||
| 343 | Low_Alarm_Windchill C | ||||||||||||||||||||||
| 344 | High_Alarm_Windchill C | ||||||||||||||||||||||
| 345 | Dewpoint C | ||||||||||||||||||||||
| 346 | Min_Dewpoint C | ||||||||||||||||||||||
| 347 | Max_Dewpoint C | ||||||||||||||||||||||
| 348 | Min_Dewpoint_datetime time_t | ||||||||||||||||||||||
| 349 | Max_Dewpoint_datetime time_t | ||||||||||||||||||||||
| 350 | Low_Alarm_Dewpoint C | ||||||||||||||||||||||
| 351 | High_Alarm_Dewpoint C | ||||||||||||||||||||||
| 352 | Indoor_Humidity % | ||||||||||||||||||||||
| 353 | Min_Indoor_Humidity % | ||||||||||||||||||||||
| 354 | Max_Indoor_Humidity % | ||||||||||||||||||||||
| 355 | Min_Indoor_Humidity_datetime time_t | ||||||||||||||||||||||
| 356 | Max_Indoor_Humidity_datetime time_t | ||||||||||||||||||||||
| 357 | Low_Alarm_Indoor_Humidity % | ||||||||||||||||||||||
| 358 | High_Alarm_Indoor_Humidity % | ||||||||||||||||||||||
| 359 | Outdoor_Humidity % | ||||||||||||||||||||||
| 360 | Min_Outdoor_Humidity % | ||||||||||||||||||||||
| 361 | Max_Outdoor_Humidity % | ||||||||||||||||||||||
| 362 | Min_Outdoor_Humidity_datetime time_t | ||||||||||||||||||||||
| 363 | Max_Outdoor_Humidity_datetime time_t | ||||||||||||||||||||||
| 364 | Low_Alarm_Outdoor_Humidity % | ||||||||||||||||||||||
| 365 | High_Alarm_Outdoor_Humidity % | ||||||||||||||||||||||
| 366 | Rain_24hour mm | ||||||||||||||||||||||
| 367 | Max_Rain_24hour mm | ||||||||||||||||||||||
| 368 | Max_Rain_24hour_datetime time_t | ||||||||||||||||||||||
| 369 | Rain_1hour mm | ||||||||||||||||||||||
| 370 | Max_Rain_1hour mm | ||||||||||||||||||||||
| 371 | Max_Rain_1hour_datetime time_t | ||||||||||||||||||||||
| 372 | Rain_Total mm | ||||||||||||||||||||||
| 373 | Rain_Total_datetime time_t | ||||||||||||||||||||||
| 374 | Min__wind m/s | ||||||||||||||||||||||
| 375 | Max__wind m/s | ||||||||||||||||||||||
| 376 | Min_Date/Time_wind_datetime time_t | ||||||||||||||||||||||
| 377 | Max_Date/Time_wind_datetime time_t | ||||||||||||||||||||||
| 378 | Wind_Speed m/s | ||||||||||||||||||||||
| 379 | Wind_Direction degrees | ||||||||||||||||||||||
| 380 | Low_wind_alarm_setting m/s | ||||||||||||||||||||||
| 381 | High_wind_alarm_setting m/s | ||||||||||||||||||||||
| 382 | Connection_Type | ||||||||||||||||||||||
| 383 | Countdown_time_to_next_datBinary seconds | ||||||||||||||||||||||
| 384 | Absolute_Pressure hPa | ||||||||||||||||||||||
| 385 | Relative_Pressure hPa | ||||||||||||||||||||||
| 386 | Pressure_Correction hPa | ||||||||||||||||||||||
| 387 | Min_Absolute_Pressure hPa | ||||||||||||||||||||||
| 388 | Min_Relative_Pressure hPa | ||||||||||||||||||||||
| 389 | Max_Absolute_Pressure hPa | ||||||||||||||||||||||
| 390 | Max_Relative_Pressure hPa | ||||||||||||||||||||||
| 391 | Min_Pressure_datetime time_t | ||||||||||||||||||||||
| 392 | Max_Pressure_datetime time_t | ||||||||||||||||||||||
| 393 | Low_Alarm_Pressure hPa | ||||||||||||||||||||||
| 394 | High_Alarm_Pressure hPa | ||||||||||||||||||||||
| 395 | History_saving_interval minutes | ||||||||||||||||||||||
| 396 | Countdown_to_next_saving minutes | ||||||||||||||||||||||
| 397 | Date/Time_last_record_datetime time_t | ||||||||||||||||||||||
| 398 | Pointer_to_last_written_Record | ||||||||||||||||||||||
| 399 | Number_of_Records | ||||||||||||||||||||||
| 400 | |||||||||||||||||||||||
| 401 | Where applicable, units are displayed to the right of each field. | ||||||||||||||||||||||
| 402 | |||||||||||||||||||||||
| 403 | =head2 Units | ||||||||||||||||||||||
| 404 | |||||||||||||||||||||||
| 405 | The WS-23xx devices return data in the following units: | ||||||||||||||||||||||
| 406 | |||||||||||||||||||||||
| 407 | =over 8 | ||||||||||||||||||||||
| 408 | |||||||||||||||||||||||
| 409 | =item B<C> | ||||||||||||||||||||||
| 410 | |||||||||||||||||||||||
| 411 | Degrees Centigrade (temperature) | ||||||||||||||||||||||
| 412 | |||||||||||||||||||||||
| 413 | =item B<%> | ||||||||||||||||||||||
| 414 | |||||||||||||||||||||||
| 415 | Percent (humidity) | ||||||||||||||||||||||
| 416 | |||||||||||||||||||||||
| 417 | =item B<hPa> | ||||||||||||||||||||||
| 418 | |||||||||||||||||||||||
| 419 | hectoPascals (pressure) | ||||||||||||||||||||||
| 420 | |||||||||||||||||||||||
| 421 | =item B<m/s> | ||||||||||||||||||||||
| 422 | |||||||||||||||||||||||
| 423 | Meters per Second (wind speed) | ||||||||||||||||||||||
| 424 | |||||||||||||||||||||||
| 425 | =item B<mm> | ||||||||||||||||||||||
| 426 | |||||||||||||||||||||||
| 427 | Millimeters (rainfall) | ||||||||||||||||||||||
| 428 | |||||||||||||||||||||||
| 429 | =item B<degrees> | ||||||||||||||||||||||
| 430 | |||||||||||||||||||||||
| 431 | Compass degrees, 0-359, (wind direction) | ||||||||||||||||||||||
| 432 | |||||||||||||||||||||||
| 433 | =item B<minutes> | ||||||||||||||||||||||
| 434 | |||||||||||||||||||||||
| 435 | Minutes. | ||||||||||||||||||||||
| 436 | |||||||||||||||||||||||
| 437 | =item B<seconds> | ||||||||||||||||||||||
| 438 | |||||||||||||||||||||||
| 439 | Seconds. | ||||||||||||||||||||||
| 440 | |||||||||||||||||||||||
| 441 | =item B<time_t> | ||||||||||||||||||||||
| 442 | |||||||||||||||||||||||
| 443 | Seconds since the Epoch; you probably want to use it as | ||||||||||||||||||||||
| 444 | an argument to B<localtime>(). | ||||||||||||||||||||||
| 445 | |||||||||||||||||||||||
| 446 | =back | ||||||||||||||||||||||
| 447 | |||||||||||||||||||||||
| 448 | |||||||||||||||||||||||
| 449 | =head1 AUTHOR | ||||||||||||||||||||||
| 450 | |||||||||||||||||||||||
| 451 | Ed Santiago <esm@cpan.org> | ||||||||||||||||||||||
| 452 | |||||||||||||||||||||||
| 453 | =head1 SEE ALSO | ||||||||||||||||||||||
| 454 | |||||||||||||||||||||||
| 455 | L<Device::LaCrosse::WS23xx> | ||||||||||||||||||||||
| 456 | |||||||||||||||||||||||
| 457 | =cut | ||||||||||||||||||||||
| 458 | |||||||||||||||||||||||
| 459 | |||||||||||||||||||||||
| 460 | 3 | 1; | |||||||||||||||||||||