Aprs.CompressedPositionHelpers (aprs v2.0.0)

View Source

Decodes APRS compressed position coordinates, cs pairs, and compression metadata.

Summary

Functions

Decodes a compressed cs pair that has no compression type byte to go with it.

Decodes a compressed cs pair.

Decodes a four-byte base-91 compressed latitude.

Decodes a four-byte base-91 compressed longitude.

Decodes the GPS fix age, NMEA source, and encoder origin from a compression type byte.

Functions

convert_compressed_cs(cs)

@spec convert_compressed_cs(binary()) :: map()

Decodes a compressed cs pair that has no compression type byte to go with it.

convert_compressed_cs(arg1, compression_type)

@spec convert_compressed_cs(binary(), binary()) :: %{
  optional(:course) => pos_integer(),
  optional(:speed) => float(),
  optional(:range) => float(),
  optional(:altitude) => float()
}

Decodes a compressed cs pair.

GGA-originated positions use the pair for altitude in feet. Other positions use it for course and speed in knots, except for the radio-range marker.

convert_compressed_lat(lat)

@spec convert_compressed_lat(binary()) :: {:ok, float()} | {:error, String.t()}

Decodes a four-byte base-91 compressed latitude.

convert_compressed_lon(lon)

@spec convert_compressed_lon(binary()) :: {:ok, float()} | {:error, String.t()}

Decodes a four-byte base-91 compressed longitude.

parse_compression_type(arg1)

@spec parse_compression_type(binary()) :: %{
  gps_fix: :old | :current,
  nmea_source: :other | :gll | :gga | :rmc,
  origin:
    :compressed
    | :tnc_btext
    | :software
    | :tbd
    | :kpc3
    | :pico
    | :other_tracker
    | :digipeater_conversion
}

Decodes the GPS fix age, NMEA source, and encoder origin from a compression type byte.

An empty value, or a leading byte below the base-91 offset, decodes as zero.