24 explicit NotVTGException(
const std::string& context,
const std::string& details =
"") :
25 NmeaException(context,
"The sentence is not a VTG sentence", details) {}
57 VTG(std::string talkerId,
58 double courseOverGroundTrue,
59 double courseOverGroundMagnetic,
60 double speedOverGroundKnots,
61 double speedOverGroundKph,
62 std::optional<char> faaModeIndicator = std::nullopt,
63 bool legacyFormat =
false
69 VTG& operator=(
VTG&&) noexcept = default;
71 ~
VTG() override = default;
119 bool operator==(const
VTG& other) const noexcept;
122 double courseOverGroundTrue_{};
123 char courseOverGroundTrueType_{};
124 double courseOverGroundMagnetic_{};
125 char courseOverGroundMagneticType_{};
126 double speedOverGroundKnots_{};
127 char speedOverGroundKnotsType_{};
128 double speedOverGroundKph_{};
129 char speedOverGroundKphType_{};
130 std::optional<char> faaModeIndicator_{};
131 bool legacyFormat_{};
135 VTG(Message0183 baseMessage,
136 double courseOverGroundTrue,
137 char courseOverGroundTrueType,
138 double courseOverGroundMagnetic,
139 char courseOverGroundMagneticType,
140 double speedOverGroundKnots,
141 char speedOverGroundKnotsType,
142 double speedOverGroundKph,
143 char speedOverGroundKphType,
144 std::optional<char> faaModeIndicator,
148 static std::unique_ptr<VTG> create(std::unique_ptr<Message0183> baseMessage);
149 static std::string composeRaw(
const std::string& talkerId,
150 double courseOverGroundTrue,
151 double courseOverGroundMagnetic,
152 double speedOverGroundKnots,
153 double speedOverGroundKph,
154 std::optional<char> faaModeIndicator,
Defines a base class for NMEA messages, encapsulating common properties and behaviors.
Base exception class for all NMEA library errors.
Represents an NMEA 0183 sentence.
Registry for message type creators.
Factory for creating typed NMEA 0183 message objects from raw sentence strings.
Exception thrown when a sentence is not a valid VTG sentence.
NotVTGException(const std::string &context, const std::string &details="")
Construct a NotVTGException with context and optional details.
Represents a parsed NMEA 0183 VTG (Course Over Ground and Ground Speed) sentence.
VTG(VTG &&) noexcept=default
char getSpeedOverGroundKphType() const noexcept
Get km/h unit indicator (typically 'K', or '\0' in legacy format).
double getSpeedOverGroundKnots() const noexcept
Get speed over ground in knots.
bool isLegacyFormat() const noexcept
Return whether this sentence uses legacy compact VTG format.
VTG & operator=(const VTG &)=default
double getCourseOverGroundMagnetic() const noexcept
Get magnetic course over ground in degrees.
VTG(std::string talkerId, double courseOverGroundTrue, double courseOverGroundMagnetic, double speedOverGroundKnots, double speedOverGroundKph, std::optional< char > faaModeIndicator=std::nullopt, bool legacyFormat=false)
Construct a VTG message from individual field values.
char getCourseOverGroundTrueType() const noexcept
Get true course type indicator (typically 'T', or '\0' in legacy format).
std::unique_ptr< nmealib::Message > clone() const override
Create a polymorphic copy of this VTG message.
char getSpeedOverGroundKnotsType() const noexcept
Get knots unit indicator (typically 'N', or '\0' in legacy format).
double getCourseOverGroundTrue() const noexcept
Get true course over ground in degrees.
std::string getStringContent(bool verbose) const noexcept override
Return a human-readable string representation of this message.
char getCourseOverGroundMagneticType() const noexcept
Get magnetic course type indicator (typically 'M', or '\0' in legacy format).
bool hasFaaModeIndicator() const noexcept
Return whether FAA mode indicator is present.
double getSpeedOverGroundKph() const noexcept
Get speed over ground in kilometers per hour.
std::optional< char > getFaaModeIndicator() const noexcept
Get optional FAA mode indicator.