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

Represents a parsed NMEA 0183 GGA (Global Positioning System Fix Data) sentence. More...

#include <gga.h>

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

Public Member Functions

 GGA (std::string talkerId, double timestamp, double latitude, char latitudeDirection, double longitude, char longitudeDirection, unsigned int gpsQuality, unsigned int satellites, double hdop, double altitude, char altitudeUnits, double geoidalSeparation, char geoidalSeparationUnits, double dgpsAge, std::string dgpsReferenceStationId)
 Construct a GGA message from individual field values.
 
 GGA (const GGA &)=default
 
GGAoperator= (const GGA &)=default
 
 GGA (GGA &&) noexcept=default
 
GGAoperator= (GGA &&) noexcept=default
 
 ~GGA () override=default
 
std::unique_ptr< nmealib::Messageclone () const override
 Create a polymorphic copy of this GGA message.
 
double getUtcTime () const noexcept
 Get UTC fix time in hhmmss.ss numeric form.
 
double getLatitude () const noexcept
 Get latitude in decimal degrees.
 
char getLatitudeDirection () const noexcept
 Get latitude hemisphere indicator ('N' or 'S').
 
double getLongitude () const noexcept
 Get longitude in decimal degrees.
 
char getLongitudeDirection () const noexcept
 Get longitude hemisphere indicator ('E' or 'W').
 
unsigned int getGpsQuality () const noexcept
 Get GPS quality indicator.
 
unsigned int getSatellites () const noexcept
 Get number of satellites used.
 
double getHdop () const noexcept
 Get horizontal dilution of precision.
 
double getAltitude () const noexcept
 Get altitude value.
 
char getAltitudeUnits () const noexcept
 Get altitude units (typically 'M').
 
double getGeoidalSeparation () const noexcept
 Get geoidal separation value.
 
char getGeoidalSeparationUnits () const noexcept
 Get geoidal separation units (typically 'M').
 
double getDgpsAge () const noexcept
 Get age of DGPS data in seconds.
 
std::string getDgpsReferenceStationId () const noexcept
 Get DGPS reference station identifier.
 
std::string getStringContent (bool verbose) const noexcept override
 Return a human-readable string representation of this message.
 
bool operator== (const GGA &other) const noexcept
 Compare two GGA 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.
 
std::unique_ptr< nmealib::Messageclone () const override
 Creates a polymorphic deep copy of this Message0183.
 
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 GGA (Global Positioning System Fix Data) sentence.

GGA contains UTC fix time, position, fix quality, and related metadata.

Sentence format:

$--GGA,hhmmss.ss,llll.ll,a,yyyyy.yy,a,x,xx,x.x,x.x,M,x.x,M,x.x,xxxx*hh<CR><LF>
Represents a parsed NMEA 0183 GGA (Global Positioning System Fix Data) sentence.
Definition gga.h:36

Definition at line 36 of file gga.h.

Constructor & Destructor Documentation

◆ GGA() [1/3]

nmealib::nmea0183::GGA::GGA ( std::string  talkerId,
double  timestamp,
double  latitude,
char  latitudeDirection,
double  longitude,
char  longitudeDirection,
unsigned int  gpsQuality,
unsigned int  satellites,
double  hdop,
double  altitude,
char  altitudeUnits,
double  geoidalSeparation,
char  geoidalSeparationUnits,
double  dgpsAge,
std::string  dgpsReferenceStationId 
)

Construct a GGA message from individual field values.

Latitude and longitude are expected in decimal degrees and are serialized to NMEA coordinate format in the wire sentence.

Parameters
talkerIdTwo-character talker identifier.
timestampUTC time in hhmmss.ss format.
latitudeLatitude in decimal degrees.
latitudeDirectionLatitude hemisphere indicator ('N' or 'S').
longitudeLongitude in decimal degrees.
longitudeDirectionLongitude hemisphere indicator ('E' or 'W').
gpsQualityGPS fix quality indicator.
satellitesNumber of satellites used.
hdopHorizontal dilution of precision.
altitudeAntenna altitude above mean sea level.
altitudeUnitsAltitude unit indicator (typically 'M').
geoidalSeparationGeoidal separation from WGS-84 ellipsoid.
geoidalSeparationUnitsGeoidal separation unit indicator (typically 'M').
dgpsAgeAge of DGPS data in seconds.
dgpsReferenceStationIdDGPS reference station identifier.

Definition at line 125 of file gga.cpp.

◆ GGA() [2/3]

nmealib::nmea0183::GGA::GGA ( const GGA )
default

◆ GGA() [3/3]

nmealib::nmea0183::GGA::GGA ( GGA &&  )
defaultnoexcept

◆ ~GGA()

nmealib::nmea0183::GGA::~GGA ( )
overridedefault

Member Function Documentation

◆ clone()

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

Create a polymorphic copy of this GGA message.

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

Implements nmealib::Message.

Definition at line 170 of file gga.cpp.

◆ getAltitude()

double nmealib::nmea0183::GGA::getAltitude ( ) const
noexcept

Get altitude value.

Definition at line 301 of file gga.cpp.

◆ getAltitudeUnits()

char nmealib::nmea0183::GGA::getAltitudeUnits ( ) const
noexcept

Get altitude units (typically 'M').

Definition at line 305 of file gga.cpp.

◆ getDgpsAge()

double nmealib::nmea0183::GGA::getDgpsAge ( ) const
noexcept

Get age of DGPS data in seconds.

Definition at line 317 of file gga.cpp.

◆ getDgpsReferenceStationId()

std::string nmealib::nmea0183::GGA::getDgpsReferenceStationId ( ) const
noexcept

Get DGPS reference station identifier.

Definition at line 321 of file gga.cpp.

◆ getGeoidalSeparation()

double nmealib::nmea0183::GGA::getGeoidalSeparation ( ) const
noexcept

Get geoidal separation value.

Definition at line 309 of file gga.cpp.

◆ getGeoidalSeparationUnits()

char nmealib::nmea0183::GGA::getGeoidalSeparationUnits ( ) const
noexcept

Get geoidal separation units (typically 'M').

Definition at line 313 of file gga.cpp.

◆ getGpsQuality()

unsigned int nmealib::nmea0183::GGA::getGpsQuality ( ) const
noexcept

Get GPS quality indicator.

Definition at line 289 of file gga.cpp.

◆ getHdop()

double nmealib::nmea0183::GGA::getHdop ( ) const
noexcept

Get horizontal dilution of precision.

Definition at line 297 of file gga.cpp.

◆ getLatitude()

double nmealib::nmea0183::GGA::getLatitude ( ) const
noexcept

Get latitude in decimal degrees.

Definition at line 273 of file gga.cpp.

◆ getLatitudeDirection()

char nmealib::nmea0183::GGA::getLatitudeDirection ( ) const
noexcept

Get latitude hemisphere indicator ('N' or 'S').

Definition at line 277 of file gga.cpp.

◆ getLongitude()

double nmealib::nmea0183::GGA::getLongitude ( ) const
noexcept

Get longitude in decimal degrees.

Definition at line 281 of file gga.cpp.

◆ getLongitudeDirection()

char nmealib::nmea0183::GGA::getLongitudeDirection ( ) const
noexcept

Get longitude hemisphere indicator ('E' or 'W').

Definition at line 285 of file gga.cpp.

◆ getSatellites()

unsigned int nmealib::nmea0183::GGA::getSatellites ( ) const
noexcept

Get number of satellites used.

Definition at line 293 of file gga.cpp.

◆ getStringContent()

std::string nmealib::nmea0183::GGA::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 174 of file gga.cpp.

◆ getUtcTime()

double nmealib::nmea0183::GGA::getUtcTime ( ) const
noexcept

Get UTC fix time in hhmmss.ss numeric form.

Definition at line 269 of file gga.cpp.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ operator==()

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

Compare two GGA messages for equality.

Equality delegates to Message0183::operator==.

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

Definition at line 325 of file gga.cpp.

Friends And Related Symbol Documentation

◆ MessageRegistry

friend class MessageRegistry
friend

Definition at line 191 of file gga.h.

◆ Nmea0183Factory

friend class Nmea0183Factory
friend

Definition at line 190 of file gga.h.


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