Skip to content

ParsedSentence

struct nmeasim::core::nmea0183::ParsedSentence · Library API

A sentence split into its start delimiter, address and data fields.

#include <nmeasim/core/nmea0183/decoder.hpp>

Declared in src/core/include/nmeasim/core/nmea0183/decoder.hpp (line 33)

parse_sentence() produces it; the checksum has already been verified and is not kept.

Summary

Public member functions

Name Description
field() Returns the data field at a position, tolerating short sentences.

Public data members

Name Description
delimiter Start delimiter: $ for parametric sentences, ! for encapsulated ones such as AIS.
talker Talker identifier: P when the address starts with P (a proprietary sentence), otherwise the first two characters of the address.
formatter The rest of the address after the talker: three characters for a standard sentence such as RMC, the manufacturer code and sentence type for a proprietary one such as GRME.
fields Data fields after the address, in order and untrimmed; empty strings for empty fields.
has_checksum True when the sentence carried a *hh checksum, which then matched.

Public member functions

field()

std::string_view field(std::size_t index) const noexcept

Returns the data field at a position, tolerating short sentences.

Parameters

Name Type Description
index std::size_t Zero-based position among the data fields; field 0 is the first field after the address.

Returns std::string_view: A view of the field, or an empty view when the sentence has index fields or fewer. The view refers to fields and stays valid while this object lives and fields is not modified.

Declared in src/core/include/nmeasim/core/nmea0183/decoder.hpp:58 · defined in src/core/src/nmea0183/decoder.cpp:752

Public data members

delimiter

char delimiter{'$'}

Start delimiter: $ for parametric sentences, ! for encapsulated ones such as AIS.

Declared in src/core/include/nmeasim/core/nmea0183/decoder.hpp:35

talker

std::string talker

Talker identifier: P when the address starts with P (a proprietary sentence), otherwise the first two characters of the address.

Declared in src/core/include/nmeasim/core/nmea0183/decoder.hpp:38

formatter

std::string formatter

The rest of the address after the talker: three characters for a standard sentence such as RMC, the manufacturer code and sentence type for a proprietary one such as GRME.

Never empty.

Declared in src/core/include/nmeasim/core/nmea0183/decoder.hpp:42

fields

std::vector<std::string> fields

Data fields after the address, in order and untrimmed; empty strings for empty fields.

The vector is empty when the address is not followed by a comma. A trailing comma yields a trailing empty field, so $SDDPT,,, has three fields.

Declared in src/core/include/nmeasim/core/nmea0183/decoder.hpp:47

has_checksum

bool has_checksum{false}

True when the sentence carried a *hh checksum, which then matched.

Declared in src/core/include/nmeasim/core/nmea0183/decoder.hpp:49