23 NmeaException(context,
"NMEA 0183 sentence exceeds maximum length of 82 characters", details) {}
38 NmeaException(context,
"NMEA 0183 sentence must start with '$' or '!'", details) {}
53 NmeaException(context,
"This sentence does not contain a checksum", details) {}
68 NmeaException(context,
"NMEA 0183 sentence must end with <CR><LF>", details) {}
83 NmeaException(context,
"NMEA 0183 sentence does not contain enough fields", details) {}
201 bool operator==(const
Message0183& other) const noexcept;
209 bool validate() const noexcept override;
247 std::
string toString(
bool verbose) const noexcept;
254 std::
string sentenceType,
255 std::
string payload) noexcept;
260 std::
string sentenceType,
262 std::
string checksumStr) noexcept;
264 static std::
string computeChecksum(const std::
string& payload) noexcept;
265 static
bool isHexByte(const std::
string& s) noexcept;
266 static
bool validateFormat(const std::
string& context, const std::
string& raw);
Defines a base class for NMEA messages, encapsulating common properties and behaviors.
std::chrono::system_clock::time_point TimePoint
Base exception class for all NMEA library errors.
Exception thrown when an NMEA 0183 sentence does not start with '$' or '!'.
InvalidStartCharacterException(const std::string &context, const std::string &details="")
Constructs an InvalidStartCharacterException.
Represents an NMEA 0183 sentence.
bool validate() const noexcept override
Returns whether the message is valid or not.
std::string serialize() const override
Returns the wire-format representation of the NMEA 0183 sentence, that is, the raw information that w...
std::string getChecksumStr() const
Get the checksum string extracted from the raw sentence.
std::string getSentenceType() const noexcept
Returns the sentence type identifier extracted from the sentence.
virtual std::string getStringContent(bool verbose) const noexcept
Returns a human-readable string representation of the message content.
Message0183(Message0183 &&) noexcept=default
Move constructor.
std::unique_ptr< nmealib::Message > clone() const override
Creates a polymorphic deep copy of this Message0183.
std::string calculatedChecksumStr_
std::string getTalker() const noexcept
Returns the talker identifier extracted from the sentence.
std::string getPayload() const noexcept
Returns the payload of the NMEA 0183 sentence.
static double convertNmeaCoordinateToDecimalDegrees(const std::string &nmeaCoordinate)
Converts an NMEA coordinate in ddmm.mmmm / dddmm.mmmm format to decimal degrees.
Message0183(const Message0183 &)=default
Copy constructor.
char getStartChar() const noexcept
Returns the start character of the NMEA 0183 sentence.
std::string sentenceType_
std::string getCalculatedChecksumStr() const noexcept
Get the calculated checksum string for the sentence payload.
std::string toString(bool verbose) const noexcept
Provides the common string representation for every NMEA 0183 message, which can be used by derived c...
Message0183 & operator=(const Message0183 &)=default
Copy assignment operator.
static std::unique_ptr< Message0183 > create(const std::string &raw, TimePoint ts=std::chrono::system_clock::now())
Protected factory method to create a Message0183 from a raw sentence string.
Factory for creating typed NMEA 0183 message objects from raw sentence strings.
Exception thrown when an operation requires a checksum but none is present in the sentence.
NoChecksumException(const std::string &context, const std::string &details="")
Constructs a NoChecksumException.
Exception thrown when an NMEA 0183 sentence is missing the required <CR><LF> terminator.
NoEndlineException(const std::string &context, const std::string &details="")
Constructs a NoEndlineException.
Exception thrown when an NMEA 0183 sentence does not contain enough comma-separated fields.
NotEnoughFieldsException(const std::string &context, const std::string &details="")
Constructs a NotEnoughFieldsException.