Aprs.CompressedPositionHelpers (aprs v0.1.5)

View Source

Compressed position helpers for APRS packets.

Summary

Functions

Calculate position resolution (ambiguity) from the compression type byte.

Parse the compression type byte to extract all encoded information.

Functions

calculate_compressed_ambiguity(arg1)

@spec calculate_compressed_ambiguity(binary()) :: integer()

Calculate position resolution (ambiguity) from the compression type byte.

In compressed format, the compression type byte encodes:

  • Bits 0-1: GPS fix type/NMEA source
  • Bits 2-4: Position resolution
  • Bit 5: Old/Current GPS data

Position resolution values:

  • 0: No resolution specified (full precision)
  • 1: 0.1' (about 600 feet)
  • 2: 1' (about 0.01 degree)
  • 3: 10' (about 0.1 degree)
  • 4: 1 degree

convert_compressed_cs(cs)

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

convert_compressed_lat(lat)

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

convert_compressed_lon(lon)

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

parse_compression_type(arg1)

@spec parse_compression_type(binary()) :: map()

Parse the compression type byte to extract all encoded information.

Returns a map with:

  • gps_fix_type: NMEA source/GPS fix type (0-3)
  • position_resolution: Position ambiguity level (0-4)
  • old_gps_data: Whether this is old GPS data