Aprs.UtilityHelpers (aprs v0.1.5)

View Source

Utility and ambiguity helpers for APRS.

Summary

Functions

calculate_compressed_position_resolution()

@spec calculate_compressed_position_resolution() :: float()

Calculate position resolution for compressed positions. Compressed positions have much finer resolution.

calculate_position_ambiguity(latitude, longitude)

@spec calculate_position_ambiguity(String.t(), String.t()) :: 0..4

calculate_position_resolution(ambiguity)

@spec calculate_position_resolution(integer()) :: float()

Calculate position resolution in meters based on ambiguity level.

Ambiguity levels and their resolutions:

  • 0: No ambiguity - 18.52 meters (0.01 minute)
  • 1: 0.1 minute - 185.2 meters
  • 2: 1 minute - 1852 meters
  • 3: 10 minutes - 18520 meters
  • 4: 1 degree - 111120 meters

For compressed positions, the resolution is calculated differently.

count_leading_braces(packet)

@spec count_leading_braces(binary()) :: non_neg_integer()

count_leading_braces(arg1, count)

@spec count_leading_braces(binary(), non_neg_integer()) :: non_neg_integer()

count_spaces(str)

@spec count_spaces(String.t()) :: non_neg_integer()

find_matches(regex, text)

@spec find_matches(Regex.t(), String.t()) :: map()

validate_position_data(latitude, longitude)

@spec validate_position_data(String.t(), String.t()) ::
  {:ok, {Decimal.t(), Decimal.t()}} | {:error, :invalid_position}

validate_timestamp(time)

@spec validate_timestamp(any()) :: nil