nmealib 0.0.4
NMEA 0183/NMEA 2000 parsing library
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
nmealib::nmea0183::XTE Class Reference

Represents a parsed NMEA 0183 XTE (Cross-Track Error, Measured) sentence. More...

#include <xte.h>

Inheritance diagram for nmealib::nmea0183::XTE:
Inheritance graph
[legend]
Collaboration diagram for nmealib::nmea0183::XTE:
Collaboration graph
[legend]

Public Member Functions

 XTE (std::string talkerId, char status1, char status2, double crossTrackError, char steerDirection, char crossTrackUnits, std::optional< char > faaModeIndicator=std::nullopt)
 Construct an XTE message from individual field values.
 
 XTE (const XTE &)=default
 
XTEoperator= (const XTE &)=default
 
 XTE (XTE &&) noexcept=default
 
XTEoperator= (XTE &&) noexcept=default
 
 ~XTE () override=default
 
std::unique_ptr< nmealib::Messageclone () const override
 Create a polymorphic copy of this XTE message.
 
char getStatus1 () const noexcept
 Get the first status field.
 
char getStatus2 () const noexcept
 Get the second status field.
 
double getCrossTrackError () const noexcept
 Get the cross-track error magnitude in nautical miles.
 
char getSteerDirection () const noexcept
 Get the steer direction indicator ('L' or 'R').
 
char getCrossTrackUnits () const noexcept
 Get the cross-track units indicator (typically 'N').
 
bool hasFaaModeIndicator () const noexcept
 Return whether FAA mode indicator is present.
 
std::optional< char > getFaaModeIndicator () const noexcept
 Get optional FAA mode indicator.
 
std::string getStringContent (bool verbose) const noexcept override
 Return a human-readable string representation of this message.
 
bool operator== (const XTE &other) const noexcept
 Compare two XTE messages for equality.
 
- Public Member Functions inherited from nmealib::nmea0183::Message0183
 Message0183 (const Message0183 &)=default
 Copy constructor.
 
Message0183operator= (const Message0183 &)=default
 Copy assignment operator.
 
 Message0183 (Message0183 &&) noexcept=default
 Move constructor.
 
Message0183operator= (Message0183 &&) noexcept=default
 Move assignment operator.
 
 ~Message0183 () override=default
 Destructor.
 
char getStartChar () const noexcept
 Returns the start character of the NMEA 0183 sentence.
 
std::string getTalker () const noexcept
 Returns the talker identifier extracted from the sentence.
 
std::string getSentenceType () const noexcept
 Returns the sentence type identifier extracted from the sentence.
 
std::string getPayload () const noexcept
 Returns the payload of the NMEA 0183 sentence.
 
std::string getChecksumStr () const
 Get the checksum string extracted from the raw sentence.
 
std::string getCalculatedChecksumStr () const noexcept
 Get the calculated checksum string for the sentence payload.
 
std::string serialize () const override
 Returns the wire-format representation of the NMEA 0183 sentence, that is, the raw information that was passed when the message was created.
 
bool operator== (const Message0183 &other) const noexcept
 Compares two Message0183 objects for equality based on their content and timestamp.
 
bool validate () const noexcept override
 Returns whether the message is valid or not.
 
- Public Member Functions inherited from nmealib::Message
 Message ()
 
 Message (std::string raw, Type type=Type::Unknown, TimePoint ts=std::chrono::system_clock::now()) noexcept
 
virtual ~Message ()
 
 Message (const Message &)=default
 
Messageoperator= (const Message &)=default
 
 Message (Message &&) noexcept=default
 
Messageoperator= (Message &&) noexcept=default
 
Type getType () const noexcept
 Returns the message type.
 
const std::string & getRawData () const noexcept
 Returns the raw, unmodified data string as received.
 
TimePoint getTimestamp () const noexcept
 Returns the timestamp associated with this message.
 
bool operator== (const Message &other) const noexcept
 Compares two Message objects for equality based on their content.
 

Friends

class Nmea0183Factory
 
class MessageRegistry
 

Additional Inherited Members

- Public Types inherited from nmealib::Message
enum class  Type { Unknown , NMEA0183 , NMEA2000 }
 Defines the type of NMEA message, allowing for differentiation between various standards. More...
 
using TimePoint = std::chrono::system_clock::time_point
 
- Static Public Member Functions inherited from nmealib::nmea0183::Message0183
static double convertNmeaCoordinateToDecimalDegrees (const std::string &nmeaCoordinate)
 Converts an NMEA coordinate in ddmm.mmmm / dddmm.mmmm format to decimal degrees.
 
- Static Public Member Functions inherited from nmealib::Message
static std::string typeToString (Type t)
 Converts a Message::Type enum value to its string representation.
 
- Protected Member Functions inherited from nmealib::nmea0183::Message0183
std::string toString (bool verbose) const noexcept
 Provides the common string representation for every NMEA 0183 message, which can be used by derived classes to implement their own getStringContent method.
 
- Protected Member Functions inherited from nmealib::Message
void setType (Type t) noexcept
 Sets the message type.
 
void setRaw (std::string r) noexcept
 Sets the raw data string.
 
void setTimestamp (TimePoint ts) noexcept
 Sets the message timestamp.
 
- Static Protected Member Functions inherited from nmealib::nmea0183::Message0183
static std::unique_ptr< Message0183create (const std::string &raw, TimePoint ts=std::chrono::system_clock::now())
 Protected factory method to create a Message0183 from a raw sentence string.
 
- Protected Attributes inherited from nmealib::nmea0183::Message0183
char startChar_
 
std::string talker_
 
std::string sentenceType_
 
std::string payload_
 
std::string checksumStr_
 
std::string calculatedChecksumStr_
 
- Protected Attributes inherited from nmealib::Message
std::string rawData_
 
Type type_ {Type::Unknown}
 
TimePoint timestamp_ {}
 

Detailed Description

Represents a parsed NMEA 0183 XTE (Cross-Track Error, Measured) sentence.

XTE supports the classic format and the NMEA 2.3+ format that includes an optional FAA mode indicator.

Classic sentence format:

$--XTE,A,A,x.x,a,N*hh<CR><LF>
Represents a parsed NMEA 0183 XTE (Cross-Track Error, Measured) sentence.
Definition xte.h:44

NMEA 2.3+ sentence format:

$--XTE,A,A,x.x,a,N,m*hh<CR><LF>

Definition at line 44 of file xte.h.

Constructor & Destructor Documentation

◆ XTE() [1/3]

nmealib::nmea0183::XTE::XTE ( std::string  talkerId,
char  status1,
char  status2,
double  crossTrackError,
char  steerDirection,
char  crossTrackUnits,
std::optional< char >  faaModeIndicator = std::nullopt 
)

Construct an XTE message from individual field values.

Parameters
talkerIdTwo-character talker identifier.
status1First status field ('A' valid, 'V' warning).
status2Second status field ('A' valid, 'V' warning).
crossTrackErrorCross-track error magnitude in nautical miles.
steerDirectionDirection to steer ('L' or 'R').
crossTrackUnitsCross-track units (typically 'N').
faaModeIndicatorOptional FAA mode indicator (NMEA 2.3+).

Definition at line 77 of file xte.cpp.

◆ XTE() [2/3]

nmealib::nmea0183::XTE::XTE ( const XTE )
default

◆ XTE() [3/3]

nmealib::nmea0183::XTE::XTE ( XTE &&  )
defaultnoexcept

◆ ~XTE()

nmealib::nmea0183::XTE::~XTE ( )
overridedefault

Member Function Documentation

◆ clone()

std::unique_ptr< nmealib::Message > nmealib::nmea0183::XTE::clone ( ) const
overridevirtual

Create a polymorphic copy of this XTE message.

Returns
std::unique_ptr<nmealib::Message> A heap-allocated copy of this object.

Reimplemented from nmealib::nmea0183::Message0183.

Definition at line 98 of file xte.cpp.

◆ getCrossTrackError()

double nmealib::nmea0183::XTE::getCrossTrackError ( ) const
noexcept

Get the cross-track error magnitude in nautical miles.

Definition at line 170 of file xte.cpp.

◆ getCrossTrackUnits()

char nmealib::nmea0183::XTE::getCrossTrackUnits ( ) const
noexcept

Get the cross-track units indicator (typically 'N').

Definition at line 178 of file xte.cpp.

◆ getFaaModeIndicator()

std::optional< char > nmealib::nmea0183::XTE::getFaaModeIndicator ( ) const
noexcept

Get optional FAA mode indicator.

Definition at line 186 of file xte.cpp.

◆ getStatus1()

char nmealib::nmea0183::XTE::getStatus1 ( ) const
noexcept

Get the first status field.

Definition at line 162 of file xte.cpp.

◆ getStatus2()

char nmealib::nmea0183::XTE::getStatus2 ( ) const
noexcept

Get the second status field.

Definition at line 166 of file xte.cpp.

◆ getSteerDirection()

char nmealib::nmea0183::XTE::getSteerDirection ( ) const
noexcept

Get the steer direction indicator ('L' or 'R').

Definition at line 174 of file xte.cpp.

◆ getStringContent()

std::string nmealib::nmea0183::XTE::getStringContent ( bool  verbose) const
overridevirtualnoexcept

Return a human-readable string representation of this message.

Parameters
verboseWhen true, returns a multi-line detailed representation.
Returns
std::string Formatted string content.

Reimplemented from nmealib::nmea0183::Message0183.

Definition at line 102 of file xte.cpp.

◆ hasFaaModeIndicator()

bool nmealib::nmea0183::XTE::hasFaaModeIndicator ( ) const
noexcept

Return whether FAA mode indicator is present.

Definition at line 182 of file xte.cpp.

◆ operator=() [1/2]

XTE & nmealib::nmea0183::XTE::operator= ( const XTE )
default

◆ operator=() [2/2]

XTE & nmealib::nmea0183::XTE::operator= ( XTE &&  )
defaultnoexcept

◆ operator==()

bool nmealib::nmea0183::XTE::operator== ( const XTE other) const
noexcept

Compare two XTE messages for equality.

Equality checks both base Message0183 state and all XTE-specific fields.

Parameters
otherThe XTE message to compare with.
Returns
bool true if equal, false otherwise.

Definition at line 190 of file xte.cpp.

Friends And Related Symbol Documentation

◆ MessageRegistry

friend class MessageRegistry
friend

Definition at line 142 of file xte.h.

◆ Nmea0183Factory

friend class Nmea0183Factory
friend

Definition at line 141 of file xte.h.


The documentation for this class was generated from the following files: