Sidereon.GNSS.NMEA (Sidereon v0.26.1)

Copy Markdown View Source

NMEA 0183 parsing, epoch accumulation, and GGA writing.

Summary

Functions

Create an incremental accumulator for chunked NMEA streams.

Finish an accumulator and return the trailing epoch, if any.

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.

Functions

accumulator(opts \\ [])

@spec accumulator(keyword()) ::
  {:ok, Sidereon.GNSS.NMEA.Accumulator.t()} | {:error, term()}

Create an incremental accumulator for chunked NMEA streams.

finish(accumulator)

@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.

group_epochs(text)

@spec group_epochs(String.t()) ::
  {:ok,
   %{
     sentences: [Sidereon.GNSS.NMEA.Sentence.t()],
     epochs: [Sidereon.GNSS.NMEA.Snapshot.t()],
     diagnostics: map()
   }}

Parse a text buffer and group decoded sentences into epochs.

parse(text)

@spec parse(String.t()) ::
  {:ok, %{sentences: [Sidereon.GNSS.NMEA.Sentence.t()], diagnostics: map()}}
  | {:error, term()}

Forgiving parse of a text buffer into supported NMEA sentences.

parse_sentence(line)

@spec parse_sentence(String.t()) ::
  {:ok, %{sentence: Sidereon.GNSS.NMEA.Sentence.t(), diagnostics: map()}}
  | {:error, term()}

Parse one NMEA sentence.

push(accumulator, bytes)

@spec push(Sidereon.GNSS.NMEA.Accumulator.t(), binary()) ::
  {:ok,
   %{
     sentences: [Sidereon.GNSS.NMEA.Sentence.t()],
     snapshots: [Sidereon.GNSS.NMEA.Snapshot.t()],
     diagnostics: map()
   }}
  | {:error, term()}

Push bytes into an accumulator.

retained_len(accumulator)

Number of retained partial-line bytes in an accumulator.

write_gga(fields)

@spec write_gga(keyword() | map()) :: {:ok, String.t()} | {:error, term()}

Write a GGA sentence from validated GGA fields.