Aprs.Types.MicE (aprs v0.1.4)

View Source

Type struct for MicE

Summary

Functions

Implements the Access behaviour for MicE struct. This allows us to access fields using the access syntax: struct[:field] Additionally, it provides support for dynamic access via get_in/update_in/etc.

Gets a value and updates it with the given function.

Removes the given key from the struct with the default implementation.

Types

direction()

@type direction() :: :north | :south | :east | :west | :unknown

t()

@type t() :: %Aprs.Types.MicE{
  dti: String.t() | nil,
  heading: number(),
  lat_degrees: number(),
  lat_direction: direction(),
  lat_fractional: number(),
  lat_minutes: number(),
  lon_degrees: number(),
  lon_direction: direction(),
  lon_fractional: number(),
  lon_minutes: number(),
  longitude_offset: number(),
  manufacturer: String.t(),
  message: String.t(),
  message_code: String.t() | nil,
  message_description: String.t() | nil,
  speed: number(),
  symbol_code: String.t(),
  symbol_table_id: String.t()
}

Functions

fetch(mic_e, key)

@spec fetch(t(), atom() | String.t()) :: {:ok, any()} | :error

Implements the Access behaviour for MicE struct. This allows us to access fields using the access syntax: struct[:field] Additionally, it provides support for dynamic access via get_in/update_in/etc.

Fetch a key from the MicE struct. Special handling for :latitude and :longitude which are calculated from components.

get_and_update(mic_e, key, fun)

@spec get_and_update(t(), atom() | String.t(), (any() -> {any(), any()} | :pop)) ::
  {any(), t()}

Gets a value and updates it with the given function.

pop(mic_e, key)

@spec pop(t(), atom() | String.t()) :: {any(), t()}

Removes the given key from the struct with the default implementation.