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

Represents a parsed NMEA 0183 VWR sentence (Relative Wind Speed and Angle). More...

#include <vwr.h>

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

Public Member Functions

 VWR (std::string talkerId, double windAngle, char windSide, double speedKnots, double speedMps, double speedKph)
 Construct a VWR sentence from individual field values.
 
 VWR (const VWR &)=default
 
VWRoperator= (const VWR &)=default
 
 VWR (VWR &&) noexcept=default
 
VWRoperator= (VWR &&) noexcept=default
 
 ~VWR () override=default
 
std::unique_ptr< nmealib::Messageclone () const override
 Creates a polymorphic deep copy of this Message0183.
 
double getWindAngle () const noexcept
 Returns the wind direction magnitude in degrees (0–180).
 
char getWindSide () const noexcept
 Returns the wind direction side relative to the vessel.
 
double getSpeedKnots () const noexcept
 Returns the wind speed in knots.
 
char getSpeedKnotsUnit () const noexcept
 Returns the knots unit indicator character.
 
double getSpeedMps () const noexcept
 Returns the wind speed in meters per second.
 
char getSpeedMpsUnit () const noexcept
 Returns the meters-per-second unit indicator character.
 
double getSpeedKph () const noexcept
 Returns the wind speed in kilometers per hour.
 
char getSpeedKphUnit () const noexcept
 Returns the kilometers-per-hour unit indicator character.
 
std::string getStringContent (bool verbose) const noexcept override
 Returns a human-readable string representation of the message content.
 
bool operator== (const VWR &other) const noexcept
 
- 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 VWR sentence (Relative Wind Speed and Angle).

The VWR sentence reports wind speed and direction relative to the vessel.

Sentence format:

$--VWR,x.x,a,x.x,N,x.x,M,x.x,K*hh
Represents a parsed NMEA 0183 VWR sentence (Relative Wind Speed and Angle).
Definition vwr.h:37

Fields:

Definition at line 37 of file vwr.h.

Constructor & Destructor Documentation

◆ VWR() [1/3]

nmealib::nmea0183::VWR::VWR ( std::string  talkerId,
double  windAngle,
char  windSide,
double  speedKnots,
double  speedMps,
double  speedKph 
)

Construct a VWR sentence from individual field values.

Parameters
talkerIdTwo-character talker identifier (e.g., "II", "WI").
windAngleWind direction magnitude in degrees from 0 to 180.
windSideSide of the wind relative to the vessel: 'L' (port) or 'R' (starboard).
speedKnotsWind speed in knots.
speedMpsWind speed in meters per second.
speedKphWind speed in kilometers per hour.

Definition at line 86 of file vwr.cpp.

◆ VWR() [2/3]

nmealib::nmea0183::VWR::VWR ( const VWR )
default

◆ VWR() [3/3]

nmealib::nmea0183::VWR::VWR ( VWR &&  )
defaultnoexcept

◆ ~VWR()

nmealib::nmea0183::VWR::~VWR ( )
overridedefault

Member Function Documentation

◆ clone()

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

Creates a polymorphic deep copy of this Message0183.

Returns
std::unique_ptr<nmealib::Message> A unique pointer to the cloned message.

Reimplemented from nmealib::nmea0183::Message0183.

Definition at line 107 of file vwr.cpp.

◆ getSpeedKnots()

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

Returns the wind speed in knots.

Returns
double Wind speed in knots.

Definition at line 159 of file vwr.cpp.

◆ getSpeedKnotsUnit()

char nmealib::nmea0183::VWR::getSpeedKnotsUnit ( ) const
noexcept

Returns the knots unit indicator character.

Returns
char Always 'N'.

Definition at line 163 of file vwr.cpp.

◆ getSpeedKph()

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

Returns the wind speed in kilometers per hour.

Returns
double Wind speed in km/h.

Definition at line 175 of file vwr.cpp.

◆ getSpeedKphUnit()

char nmealib::nmea0183::VWR::getSpeedKphUnit ( ) const
noexcept

Returns the kilometers-per-hour unit indicator character.

Returns
char Always 'K'.

Definition at line 179 of file vwr.cpp.

◆ getSpeedMps()

double nmealib::nmea0183::VWR::getSpeedMps ( ) const
noexcept

Returns the wind speed in meters per second.

Returns
double Wind speed in m/s.

Definition at line 167 of file vwr.cpp.

◆ getSpeedMpsUnit()

char nmealib::nmea0183::VWR::getSpeedMpsUnit ( ) const
noexcept

Returns the meters-per-second unit indicator character.

Returns
char Always 'M'.

Definition at line 171 of file vwr.cpp.

◆ getStringContent()

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

Returns a human-readable string representation of the message content.

Parameters
verboseSelects whether to print a one-liner or a more detailed multi-line string with field names and values.
Returns
std::string The string representation of the message content

Reimplemented from nmealib::nmea0183::Message0183.

Definition at line 111 of file vwr.cpp.

◆ getWindAngle()

double nmealib::nmea0183::VWR::getWindAngle ( ) const
noexcept

Returns the wind direction magnitude in degrees (0–180).

Returns
double Wind direction magnitude.

Definition at line 151 of file vwr.cpp.

◆ getWindSide()

char nmealib::nmea0183::VWR::getWindSide ( ) const
noexcept

Returns the wind direction side relative to the vessel.

Returns
char 'L' for port (left), 'R' for starboard (right).

Definition at line 155 of file vwr.cpp.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ operator==()

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

Definition at line 183 of file vwr.cpp.

Friends And Related Symbol Documentation

◆ MessageRegistry

friend class MessageRegistry
friend

Definition at line 157 of file vwr.h.

◆ Nmea0183Factory

friend class Nmea0183Factory
friend

Definition at line 156 of file vwr.h.


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