nmealib 0.0.4
NMEA 0183/NMEA 2000 parsing library
Loading...
Searching...
No Matches
gll.h
Go to the documentation of this file.
1#pragma once
2
3#include <nmealib/nmea0183.h>
4
5namespace nmealib {
6namespace nmea0183 {
7
15public:
22 explicit NotGLLException(const std::string& context, const std::string& details = "") :
23 NmeaException(context, "The sentence is not a GLL sentence", details) {}
24};
25
36class GLL : public Message0183 {
37public:
53 GLL(std::string talkerId,
54 double latitude,
55 char latitudeDirection,
56 double longitude,
57 char longitudeDirection,
58 double timestamp,
59 char status,
60 char modeIndicator
61 );
62
63 GLL(const GLL&) = default;
64 GLL& operator=(const GLL&) = default;
65 GLL(GLL&&) noexcept = default;
66 GLL& operator=(GLL&&) noexcept = default;
67
68 ~GLL() override = default;
69
75 std::unique_ptr<nmealib::Message> clone() const override;
76
78 double getLatitude() const noexcept;
80 char getLatitudeDirection() const noexcept;
82 double getLongitude() const noexcept;
84 char getLongitudeDirection() const noexcept;
86 double getUtcTime() const noexcept;
88 char getStatus() const noexcept;
90 char getModeIndicator() const noexcept;
91
98 std::string getStringContent(bool verbose) const noexcept override;
99
108 bool operator==(const GLL& other) const noexcept;
109
110private:
111 double latitude_{};
112 char latitudeDirection_{};
113 double longitude_{};
114 char longitudeDirection_{};
115 double utcTime_{};
116 char status_{};
117 char modeIndicator_{};
118
119 GLL() = delete;
120
121 GLL(Message0183 baseMessage,
122 double latitude,
123 char latitudeDirection,
124 double longitude,
125 char longitudeDirection,
126 double timestamp,
127 char status,
128 char modeIndicator
129 ) noexcept;
130
131 static std::unique_ptr<GLL> create(std::unique_ptr<Message0183> baseMessage);
132 static std::string composeRaw(const std::string& talkerId,
133 double latitude,
134 char latitudeDirection,
135 double longitude,
136 char longitudeDirection,
137 double timestamp,
138 char status,
139 char modeIndicator);
140
141 friend class Nmea0183Factory;
142 friend class MessageRegistry;
143};
144
145} // namespace nmea0183
146} // 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 a parsed NMEA 0183 GLL (Geographic Position - Latitude/Longitude) sentence.
Definition gll.h:36
GLL(GLL &&) noexcept=default
double getUtcTime() const noexcept
Get UTC time in hhmmss.ss numeric form.
Definition gll.cpp:187
double getLatitude() const noexcept
Get latitude in decimal degrees.
Definition gll.cpp:171
std::unique_ptr< nmealib::Message > clone() const override
Create a polymorphic copy of this GLL message.
Definition gll.cpp:108
char getLongitudeDirection() const noexcept
Get longitude hemisphere indicator ('E' or 'W').
Definition gll.cpp:183
std::string getStringContent(bool verbose) const noexcept override
Return a human-readable string representation of this message.
Definition gll.cpp:112
char getLatitudeDirection() const noexcept
Get latitude hemisphere indicator ('N' or 'S').
Definition gll.cpp:175
GLL(std::string talkerId, double latitude, char latitudeDirection, double longitude, char longitudeDirection, double timestamp, char status, char modeIndicator)
Construct a GLL message from individual field values.
Definition gll.cpp:84
double getLongitude() const noexcept
Get longitude in decimal degrees.
Definition gll.cpp:179
GLL(const GLL &)=default
char getStatus() const noexcept
Get status indicator (typically 'A' or 'V').
Definition gll.cpp:191
GLL & operator=(const GLL &)=default
char getModeIndicator() const noexcept
Get mode indicator character.
Definition gll.cpp:195
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.
Exception thrown when a sentence is not a valid GLL sentence.
Definition gll.h:14
NotGLLException(const std::string &context, const std::string &details="")
Construct a NotGLLException with context and optional details.
Definition gll.h:22