NMEA 0183 parsing, epoch accumulation, and GGA writing.
Summary
Types
Stable string kind: missing, non_finite, not_positive, negative, out_of_range, float_parse, int_parse, invalid_civil_date, or invalid_civil_time.
Stable string kind: unrepresentable_satellite, unsupported_record_type, malformed_field, out_of_range_epoch, truncated, unsupported_unit, unknown_block, or inconsistent_record.
Stable warning string: checksum, clamped, degraded, mismatch, overlap, or missing_metadata.
Functions
Create an incremental accumulator for chunked NMEA streams.
Finish an accumulator and return the trailing epoch, if any.
Finish buffered input and return all final sentences, snapshots, and parser
diagnostics. Use this additive API when the final unterminated line may
contain results that the legacy finish/1 snapshot return cannot represent.
Parse a text buffer and group decoded sentences into epochs.
Forgiving parse of a text buffer into supported NMEA sentences.
Parse one NMEA sentence.
Push bytes into an accumulator.
Number of retained partial-line bytes in an accumulator.
Write a GGA sentence from validated GGA fields.
Types
@type diagnostics() :: %{skips: [skip_diagnostic()], warnings: [warning_diagnostic()]}
@type field_error() :: %{ kind: field_error_kind(), field: String.t(), min: number() | nil, max: number() | nil, upper_inclusive: boolean() | nil, value: String.t() | nil, year: integer() | nil, month: integer() | nil, day: integer() | nil, hour: integer() | nil, minute: integer() | nil, second: number() | nil }
@type field_error_kind() :: String.t()
Stable string kind: missing, non_finite, not_positive, negative, out_of_range, float_parse, int_parse, invalid_civil_date, or invalid_civil_time.
@type record_ref() :: %{ line: non_neg_integer() | nil, record_index: non_neg_integer() | nil, satellite: String.t() | nil }
@type skip_diagnostic() :: %{ at: record_ref(), reason: String.t(), detail: String.t() | nil, reason_kind: skip_reason_kind(), record_type: String.t() | nil, unit: String.t() | nil, block: String.t() | nil, inconsistent_reason: String.t() | nil, cause: field_error() | nil }
@type skip_reason_kind() :: String.t()
Stable string kind: unrepresentable_satellite, unsupported_record_type, malformed_field, out_of_range_epoch, truncated, unsupported_unit, unknown_block, or inconsistent_record.
@type warning_diagnostic() :: %{at: record_ref(), kind: warning_kind()}
@type warning_kind() :: String.t()
Stable warning string: checksum, clamped, degraded, mismatch, overlap, or missing_metadata.
Functions
@spec accumulator(keyword()) :: {:ok, Sidereon.GNSS.NMEA.Accumulator.t()} | {:error, term()}
Create an incremental accumulator for chunked NMEA streams.
@spec finish(Sidereon.GNSS.NMEA.Accumulator.t()) :: {:ok, Sidereon.GNSS.NMEA.Snapshot.t() | nil} | {:error, term()}
Finish an accumulator and return the trailing epoch, if any.
@spec finish_with_output(Sidereon.GNSS.NMEA.Accumulator.t()) :: {:ok, %{ sentences: [Sidereon.GNSS.NMEA.Sentence.t()], snapshots: [Sidereon.GNSS.NMEA.Snapshot.t()], diagnostics: diagnostics() }} | {:error, term()}
Finish buffered input and return all final sentences, snapshots, and parser
diagnostics. Use this additive API when the final unterminated line may
contain results that the legacy finish/1 snapshot return cannot represent.
@spec group_epochs(String.t()) :: {:ok, %{ sentences: [Sidereon.GNSS.NMEA.Sentence.t()], epochs: [Sidereon.GNSS.NMEA.Snapshot.t()], diagnostics: diagnostics() }} | {:error, term()}
Parse a text buffer and group decoded sentences into epochs.
@spec parse(String.t()) :: {:ok, %{sentences: [Sidereon.GNSS.NMEA.Sentence.t()], diagnostics: diagnostics()}} | {:error, term()}
Forgiving parse of a text buffer into supported NMEA sentences.
@spec parse_sentence(String.t()) :: {:ok, %{sentence: Sidereon.GNSS.NMEA.Sentence.t(), diagnostics: diagnostics()}} | {:error, term()}
Parse one NMEA sentence.
@spec push(Sidereon.GNSS.NMEA.Accumulator.t(), binary()) :: {:ok, %{ sentences: [Sidereon.GNSS.NMEA.Sentence.t()], snapshots: [Sidereon.GNSS.NMEA.Snapshot.t()], diagnostics: diagnostics() }} | {:error, term()}
Push bytes into an accumulator.
@spec retained_len(Sidereon.GNSS.NMEA.Accumulator.t()) :: non_neg_integer()
Number of retained partial-line bytes in an accumulator.
Write a GGA sentence from validated GGA fields.