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

Represents a parsed NMEA 0183 GSA (GNSS DOP and Active Satellites) sentence. More...

#include <gsa.h>

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

Public Member Functions

 GSA (std::string talkerId, char selectionMode, unsigned int mode, std::array< unsigned int, 12 > satelliteIds, double pdop, double hdop, double vdop, std::optional< unsigned int > systemId=std::nullopt)
 Construct a GSA message from individual field values.
 
 GSA (const GSA &)=default
 
GSAoperator= (const GSA &)=default
 
 GSA (GSA &&) noexcept=default
 
GSAoperator= (GSA &&) noexcept=default
 
 ~GSA () override=default
 
std::unique_ptr< nmealib::Messageclone () const override
 Create a polymorphic copy of this GSA message.
 
char getSelectionMode () const noexcept
 Get selection mode indicator.
 
unsigned int getMode () const noexcept
 Get fix dimension mode.
 
std::array< unsigned int, 12 > getSatelliteIds () const noexcept
 Get all 12 satellite ID slots (0 for empty).
 
unsigned int getSatelliteId (size_t index) const noexcept
 Get one satellite ID by slot index.
 
double getPdop () const noexcept
 Get PDOP value.
 
double getHdop () const noexcept
 Get HDOP value.
 
double getVdop () const noexcept
 Get VDOP value.
 
bool hasSystemId () const noexcept
 Return whether an optional system ID is present.
 
std::optional< unsigned int > getSystemId () const noexcept
 Get optional GNSS system ID.
 
std::string getStringContent (bool verbose) const noexcept override
 Return a human-readable string representation of this message.
 
bool operator== (const GSA &other) const noexcept
 Compare two GSA 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 GSA (GNSS DOP and Active Satellites) sentence.

GSA contains selection mode, fix dimension, active satellite IDs, and DOP metrics. The message may optionally include a GNSS system ID as a trailing field.

Sentence format:

$--GSA,a,x,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,p.p,h.h,v.v[,s]*hh<CR><LF>
Represents a parsed NMEA 0183 GSA (GNSS DOP and Active Satellites) sentence.
Definition gsa.h:40

Definition at line 40 of file gsa.h.

Constructor & Destructor Documentation

◆ GSA() [1/3]

nmealib::nmea0183::GSA::GSA ( std::string  talkerId,
char  selectionMode,
unsigned int  mode,
std::array< unsigned int, 12 >  satelliteIds,
double  pdop,
double  hdop,
double  vdop,
std::optional< unsigned int >  systemId = std::nullopt 
)

Construct a GSA message from individual field values.

Parameters
talkerIdTwo-character talker identifier.
selectionModeSelection mode ('M' manual or 'A' automatic).
modeFix dimension mode (1=no fix, 2=2D, 3=3D).
satelliteIdsUp to 12 satellite identifiers (0 for empty slots).
pdopPosition dilution of precision.
hdopHorizontal dilution of precision.
vdopVertical dilution of precision.
systemIdOptional GNSS system ID.

Definition at line 98 of file gsa.cpp.

◆ GSA() [2/3]

nmealib::nmea0183::GSA::GSA ( const GSA )
default

◆ GSA() [3/3]

nmealib::nmea0183::GSA::GSA ( GSA &&  )
defaultnoexcept

◆ ~GSA()

nmealib::nmea0183::GSA::~GSA ( )
overridedefault

Member Function Documentation

◆ clone()

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

Create a polymorphic copy of this GSA message.

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

Implements nmealib::Message.

Definition at line 122 of file gsa.cpp.

◆ getHdop()

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

Get HDOP value.

Definition at line 226 of file gsa.cpp.

◆ getMode()

unsigned int nmealib::nmea0183::GSA::getMode ( ) const
noexcept

Get fix dimension mode.

Definition at line 210 of file gsa.cpp.

◆ getPdop()

double nmealib::nmea0183::GSA::getPdop ( ) const
noexcept

Get PDOP value.

Definition at line 222 of file gsa.cpp.

◆ getSatelliteId()

unsigned int nmealib::nmea0183::GSA::getSatelliteId ( size_t  index) const
noexcept

Get one satellite ID by slot index.

Parameters
indexZero-based index in [0, 11].
Returns
unsigned int Satellite ID, or 0 when index is out of range.

Definition at line 218 of file gsa.cpp.

◆ getSatelliteIds()

std::array< unsigned int, 12 > nmealib::nmea0183::GSA::getSatelliteIds ( ) const
noexcept

Get all 12 satellite ID slots (0 for empty).

Definition at line 214 of file gsa.cpp.

◆ getSelectionMode()

char nmealib::nmea0183::GSA::getSelectionMode ( ) const
noexcept

Get selection mode indicator.

Definition at line 206 of file gsa.cpp.

◆ getStringContent()

std::string nmealib::nmea0183::GSA::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 126 of file gsa.cpp.

◆ getSystemId()

std::optional< unsigned int > nmealib::nmea0183::GSA::getSystemId ( ) const
noexcept

Get optional GNSS system ID.

Definition at line 238 of file gsa.cpp.

◆ getVdop()

double nmealib::nmea0183::GSA::getVdop ( ) const
noexcept

Get VDOP value.

Definition at line 230 of file gsa.cpp.

◆ hasSystemId()

bool nmealib::nmea0183::GSA::hasSystemId ( ) const
noexcept

Return whether an optional system ID is present.

Definition at line 234 of file gsa.cpp.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ operator==()

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

Compare two GSA messages for equality.

Equality delegates to Message0183::operator==.

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

Definition at line 242 of file gsa.cpp.

Friends And Related Symbol Documentation

◆ MessageRegistry

friend class MessageRegistry
friend

Definition at line 152 of file gsa.h.

◆ Nmea0183Factory

friend class Nmea0183Factory
friend

Definition at line 151 of file gsa.h.


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