IoT::GNSS::NMEA

class Sentence

File Information

Library: IoT/GNSS/NMEA
Package: Decoder
Header: IoT/GNSS/NMEA/Sentence.h

Description

This class represents an NMEA 0183 sentence consisting of talker ID, sentence type and a variable number of comma-separated fields, followed by a checksum.

For a complete description of the NMEA 0183 message format see the NMEA 0183 document available from the National Marine Electronics Association.

An informal description of the NMEA 0183 message format can be found at <http://www.catb.org/gpsd/NMEA.html>.

Member Summary

Member Functions: addField, field, operator =, operator [], reset, size, swap, talkerId, type

Constructors

Sentence

Sentence();

Creates an empty Sentence, with the talker ID and type set to "XX" and "XXX", respectively.

Sentence

Sentence(
    const std::string & talkerIdAndSentenceType
);

Creates an empty NMEA sentence using the given talker ID and sentence type, which must be exactly five characters long.

Sentence

Sentence(
    const Sentence & other
);

Creates a Sentence by copying another one.

Sentence

Sentence(
    const std::string & talkerId,
    const std::string & sentenceType
);

Creates an empty NMEA sentence with the given talker ID and sentence type. Talker ID must be two characters and message type must be three characters long.

Destructor

~Sentence

~Sentence();

Destroys the Sentence.

Member Functions

addField

void addField(
    const std::string & field
);

Adds a field to the Sentence.

field inline

const std::string & field(
    std::size_t index
) const;

Returns the value of the field with the given index.

operator =

Sentence & operator = (
    const Sentence & other
);

Assigns a Sentence to another.

operator []

const std::string & operator[] (
    std::size_t index
) const;

Returns the value of the field with the given index.

reset

void reset(
    const std::string & talkerIdAndSentenceType
);

Sets the talker ID and sentence type and clears all fields.

reset

void reset();

Sets the talker ID and sentence type to XXXXX and clears all fields.

size inline

std::size_t size() const;

Returns the number of fields in the message.

swap

void swap(
    Sentence & other
);

Swaps the contents of the Sentence with another one.

talkerId inline

const std::string & talkerId() const;

Returns the two-character talker ID (typically "GP" for GNSS receivers.

type inline

const std::string & type() const;

Returns the three-character message type, e.g. "AAM" or "RMC".

Securely control IoT edge devices from anywhere   Connect a Device