Aprs. WeatherHelpers
(aprs v2.0.1)
View Source
Binary weather field scanning helpers for APRS.
Summary
Functions
The timestamp half of extract_timestamp_and_data/1.
Split a leading timestamp off a weather report.
The data half of extract_timestamp_and_data/1.
Scan a weather report in one left-to-right pass.
Single fields
Return one weather field from a report, or nil when it is absent.
Types
@type weather_values() :: %{required(atom()) => weather_value()}
Functions
The timestamp half of extract_timestamp_and_data/1.
Split a leading timestamp off a weather report.
A positionless report starts with the eight-digit MDHM form, which is
recognised only when it is followed by the wind direction field. Otherwise
the seven-byte DDHHMM form (h, z or /) is looked for anywhere in the
data. Returns {timestamp_or_nil, data_without_timestamp}.
The data half of extract_timestamp_and_data/1.
@spec scan_weather_data(binary()) :: {weather_values(), binary()}
Scan a weather report in one left-to-right pass.
Returns {weather_values, remainder}, where the remainder is the part of the
input that was not a weather field - for a position comment, the comment
text. Fields the report omits are nil. A bare ddd/sss wind pair at the
start is accepted as direction and speed.
Single fields
Return one weather field from a report, or nil when it is absent.
Each of these runs scan_weather_data/1 and picks a single value out, so
parsing a whole report with scan_weather_data/1 is cheaper than calling
them one at a time.