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

Represents a parsed NMEA 0183 VHW (Water Speed and Heading) sentence. More...

#include <vhw.h>

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

Public Member Functions

 VHW (std::string talkerId, double headingTrue, double headingMagnetic, double speedKnots, double speedKph)
 Construct a VHW message from individual field values.
 
 VHW (const VHW &)=default
 
VHWoperator= (const VHW &)=default
 
 VHW (VHW &&) noexcept=default
 
VHWoperator= (VHW &&) noexcept=default
 
 ~VHW () override=default
 
std::unique_ptr< nmealib::Messageclone () const override
 Create a polymorphic copy of this VHW message.
 
double getHeadingTrue () const noexcept
 Get true heading in degrees.
 
char getHeadingTrueType () const noexcept
 Get true heading type indicator (typically 'T').
 
double getHeadingMagnetic () const noexcept
 Get magnetic heading in degrees.
 
char getHeadingMagneticType () const noexcept
 Get magnetic heading type indicator (typically 'M').
 
double getSpeedKnots () const noexcept
 Get speed through water in knots.
 
char getSpeedKnotsType () const noexcept
 Get knots unit indicator (typically 'N').
 
double getSpeedKph () const noexcept
 Get speed through water in kilometers per hour.
 
char getSpeedKphType () const noexcept
 Get km/h unit indicator (typically 'K').
 
std::string getStringContent (bool verbose) const noexcept override
 Return a human-readable string representation of this message.
 
bool operator== (const VHW &other) const noexcept
 Compare two VHW 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 VHW (Water Speed and Heading) sentence.

VHW carries true/magnetic heading and speed through water in knots and km/h.

Sentence format:

$--VHW,x.x,T,x.x,M,x.x,N,x.x,K*hh<CR><LF>
Represents a parsed NMEA 0183 VHW (Water Speed and Heading) sentence.
Definition vhw.h:36

Definition at line 36 of file vhw.h.

Constructor & Destructor Documentation

◆ VHW() [1/3]

nmealib::nmea0183::VHW::VHW ( std::string  talkerId,
double  headingTrue,
double  headingMagnetic,
double  speedKnots,
double  speedKph 
)

Construct a VHW message from individual field values.

The constructor sets heading/speed unit type indicators to the standard values used by composeRaw: 'T', 'M', 'N', and 'K'.

Parameters
talkerIdTwo-character talker identifier.
headingTrueTrue heading in degrees.
headingMagneticMagnetic heading in degrees.
speedKnotsSpeed through water in knots.
speedKphSpeed through water in kilometers per hour.

Definition at line 86 of file vhw.cpp.

◆ VHW() [2/3]

nmealib::nmea0183::VHW::VHW ( const VHW )
default

◆ VHW() [3/3]

nmealib::nmea0183::VHW::VHW ( VHW &&  )
defaultnoexcept

◆ ~VHW()

nmealib::nmea0183::VHW::~VHW ( )
overridedefault

Member Function Documentation

◆ clone()

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

Create a polymorphic copy of this VHW message.

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

Reimplemented from nmealib::nmea0183::Message0183.

Definition at line 105 of file vhw.cpp.

◆ getHeadingMagnetic()

double nmealib::nmea0183::VHW::getHeadingMagnetic ( ) const
noexcept

Get magnetic heading in degrees.

Definition at line 154 of file vhw.cpp.

◆ getHeadingMagneticType()

char nmealib::nmea0183::VHW::getHeadingMagneticType ( ) const
noexcept

Get magnetic heading type indicator (typically 'M').

Definition at line 158 of file vhw.cpp.

◆ getHeadingTrue()

double nmealib::nmea0183::VHW::getHeadingTrue ( ) const
noexcept

Get true heading in degrees.

Definition at line 146 of file vhw.cpp.

◆ getHeadingTrueType()

char nmealib::nmea0183::VHW::getHeadingTrueType ( ) const
noexcept

Get true heading type indicator (typically 'T').

Definition at line 150 of file vhw.cpp.

◆ getSpeedKnots()

double nmealib::nmea0183::VHW::getSpeedKnots ( ) const
noexcept

Get speed through water in knots.

Definition at line 162 of file vhw.cpp.

◆ getSpeedKnotsType()

char nmealib::nmea0183::VHW::getSpeedKnotsType ( ) const
noexcept

Get knots unit indicator (typically 'N').

Definition at line 166 of file vhw.cpp.

◆ getSpeedKph()

double nmealib::nmea0183::VHW::getSpeedKph ( ) const
noexcept

Get speed through water in kilometers per hour.

Definition at line 170 of file vhw.cpp.

◆ getSpeedKphType()

char nmealib::nmea0183::VHW::getSpeedKphType ( ) const
noexcept

Get km/h unit indicator (typically 'K').

Definition at line 174 of file vhw.cpp.

◆ getStringContent()

std::string nmealib::nmea0183::VHW::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 109 of file vhw.cpp.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ operator==()

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

Compare two VHW messages for equality.

Equality delegates to Message0183::operator==.

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

Definition at line 178 of file vhw.cpp.

Friends And Related Symbol Documentation

◆ MessageRegistry

friend class MessageRegistry
friend

Definition at line 137 of file vhw.h.

◆ Nmea0183Factory

friend class Nmea0183Factory
friend

Definition at line 136 of file vhw.h.


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