nmealib 0.0.4
NMEA 0183/NMEA 2000 parsing library
Loading...
Searching...
No Matches
rma.h
Go to the documentation of this file.
1#pragma once
2
3#include <nmealib/nmea0183.h>
4
5namespace nmealib {
6namespace nmea0183 {
7
9public:
10 explicit NotRMAException(const std::string& context, const std::string& details = "") :
11 NmeaException(context, "The sentence is not an RMA sentence", details) {}
12};
13
22class RMA : public Message0183 {
23public:
24 RMA(std::string talkerId,
25 char status,
26 double latitude,
27 char latitudeDirection,
28 double longitude,
29 char longitudeDirection,
30 double timeDifferenceA,
31 double timeDifferenceB,
32 double speedOverGround,
33 double trackMadeGood,
34 double magneticVariation,
35 char variationDirection);
36
37 RMA(const RMA&) = default;
38 RMA& operator=(const RMA&) = default;
39 RMA(RMA&&) noexcept = default;
40 RMA& operator=(RMA&&) noexcept = default;
41
42 ~RMA() override = default;
43
44 std::unique_ptr<nmealib::Message> clone() const override;
45
46 char getStatus() const noexcept;
47 double getLatitude() const noexcept;
48 char getLatitudeDirection() const noexcept;
49 double getLongitude() const noexcept;
50 char getLongitudeDirection() const noexcept;
51 double getTimeDifferenceA() const noexcept;
52 double getTimeDifferenceB() const noexcept;
53 double getSpeedOverGround() const noexcept;
54 double getTrackMadeGood() const noexcept;
55 double getMagneticVariation() const noexcept;
56 char getVariationDirection() const noexcept;
57
58 std::string getStringContent(bool verbose) const noexcept override;
59 bool operator==(const RMA& other) const noexcept;
60
61private:
62 char status_{};
63 double latitude_{};
64 char latitudeDirection_{};
65 double longitude_{};
66 char longitudeDirection_{};
67 double timeDifferenceA_{};
68 double timeDifferenceB_{};
69 double speedOverGround_{};
70 double trackMadeGood_{};
71 double magneticVariation_{};
72 char variationDirection_{};
73
74 RMA() = delete;
75
76 RMA(Message0183 baseMessage,
77 char status,
78 double latitude,
79 char latitudeDirection,
80 double longitude,
81 char longitudeDirection,
82 double timeDifferenceA,
83 double timeDifferenceB,
84 double speedOverGround,
85 double trackMadeGood,
86 double magneticVariation,
87 char variationDirection) noexcept;
88
89 static std::unique_ptr<RMA> create(std::unique_ptr<Message0183> baseMessage);
90 static std::string composeRaw(const std::string& talkerId,
91 char status,
92 double latitude,
93 char latitudeDirection,
94 double longitude,
95 char longitudeDirection,
96 double timeDifferenceA,
97 double timeDifferenceB,
98 double speedOverGround,
99 double trackMadeGood,
100 double magneticVariation,
101 char variationDirection);
102
103 friend class Nmea0183Factory;
104 friend class MessageRegistry;
105};
106
107} // namespace nmea0183
108} // namespace nmealib
Defines a base class for NMEA messages, encapsulating common properties and behaviors.
Definition message.h:14
Base exception class for all NMEA library errors.
Represents an NMEA 0183 sentence.
Definition nmea0183.h:98
Registry for message type creators.
Factory for creating typed NMEA 0183 message objects from raw sentence strings.
NotRMAException(const std::string &context, const std::string &details="")
Definition rma.h:10
Represents a parsed NMEA 0183 RMA (Recommended Minimum Navigation Information) sentence.
Definition rma.h:22
char getStatus() const noexcept
Definition rma.cpp:202
std::string getStringContent(bool verbose) const noexcept override
Returns a human-readable string representation of the message content.
Definition rma.cpp:138
double getTimeDifferenceA() const noexcept
Definition rma.cpp:207
char getLatitudeDirection() const noexcept
Definition rma.cpp:204
double getMagneticVariation() const noexcept
Definition rma.cpp:211
double getLongitude() const noexcept
Definition rma.cpp:205
char getLongitudeDirection() const noexcept
Definition rma.cpp:206
double getLatitude() const noexcept
Definition rma.cpp:203
RMA(RMA &&) noexcept=default
char getVariationDirection() const noexcept
Definition rma.cpp:212
double getTrackMadeGood() const noexcept
Definition rma.cpp:210
RMA(const RMA &)=default
double getSpeedOverGround() const noexcept
Definition rma.cpp:209
RMA & operator=(const RMA &)=default
std::unique_ptr< nmealib::Message > clone() const override
Creates a polymorphic deep copy of this Message0183.
Definition rma.cpp:134
double getTimeDifferenceB() const noexcept
Definition rma.cpp:208
RMA(std::string talkerId, char status, double latitude, char latitudeDirection, double longitude, char longitudeDirection, double timeDifferenceA, double timeDifferenceB, double speedOverGround, double trackMadeGood, double magneticVariation, char variationDirection)
Definition rma.cpp:98