QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
NMEASentence.h File Reference
#include <array>
#include <charconv>
#include <cmath>
#include <cstdint>
#include <optional>
#include <span>
#include <string_view>
#include <type_traits>
#include <QtCore/QByteArray>
#include <QtCore/QByteArrayView>
#include <QtCore/QTime>
#include "GPSReceiverReports.h"
+ Include dependency graph for NMEASentence.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  NMEA::Sentence
 
struct  NMEA::Frame
 Views into a single wire frame; the caller owns the backing bytes. More...
 
struct  NMEA::GGA
 
struct  NMEA::UtcDate
 
struct  NMEA::RMC
 
struct  NMEA::GLL
 
struct  NMEA::VTG
 
struct  NMEA::ZDA
 
struct  NMEA::NavigationStatus
 
struct  NMEA::GST
 

Namespaces

namespace  NMEA
 
namespace  NMEA::Field
 
namespace  NMEA::GgaQuality
 
namespace  NMEA::FixDimension
 
namespace  NMEAUtils
 

Functions

GPSFixQuality NMEA::fixQuality (unsigned quality, GPSFixQuality autonomous)
 Autonomous GGA does not distinguish 2D/3D; the caller supplies its independently resolved quality.
 
template<class T >
std::optional< T > NMEA::number (std::string_view field, int base=DECIMAL_BASE)
 
unsigned char NMEA::checksum (std::string_view body)
 
constexpr bool NMEA::isAsciiDigit (char ch)
 Locale-independent ASCII character classes for receiver text.
 
constexpr bool NMEA::isAsciiUpper (char ch)
 
std::optional< uint32_t > NMEA::hexNumber (std::string_view digits)
 The value of digits when every one is a hexadecimal digit, with no sign or prefix; nullopt otherwise.
 
size_t NMEA::splitFields (std::string_view text, std::span< std::string_view > fields)
 Preserve empty fields, including the final field. Return zero on storage overflow.
 
std::optional< Frame > NMEA::frame (std::string_view text)
 
std::optional< Sentence > NMEA::sentence (std::string_view text)
 
bool NMEA::isStandardSentence (std::string_view text)
 A checked sentence from a standard talker, not a proprietary $P... sentence.
 
double NMEA::degreesFromDegreesMinutes (double ddmm)
 Convert a signed ddmm.mmmm (or dddmm.mmmm) value; invalid values return NaN.
 
std::optional< double > NMEA::coordinate (std::string_view field, std::string_view hemisphere, bool latitude)
 
std::optional< GGA > NMEA::gga (const Sentence &input)
 Quality zero is a valid fix-loss observation with empty coordinates and optional hemisphere fields.
 
std::optional< int > NMEA::utcMilliseconds (std::string_view field)
 
std::optional< UtcDate > NMEA::rmcDate (std::string_view field)
 
std::optional< RMC > NMEA::rmc (const Sentence &input)
 
std::optional< GLL > NMEA::gll (const Sentence &input)
 
std::optional< VTG > NMEA::vtg (const Sentence &input)
 
std::optional< ZDA > NMEA::zda (const Sentence &input)
 
std::optional< NavigationStatus > NMEA::navigationStatus (const Sentence &input)
 
std::optional< GST > NMEA::gst (const Sentence &input)
 
QByteArray NMEAUtils::frame (QByteArrayView body)
 body as one "$<body>*hh\r\n" sentence, with uppercase checksum digits.
 
QByteArray NMEAUtils::repairChecksum (const QByteArray &sentence)
 Rebuild a valid frame with its checksum and CRLF; short or malformed bodies are only terminated.
 
QByteArray NMEAUtils::makeGGA (const NMEA::GGA &fix, const QTime &utc)
 

Variables

constexpr int NMEA::DECIMAL_BASE = 10
 
constexpr int NMEA::HEX_BASE = 16
 
constexpr int NMEA::CHECKSUM_DIGITS = 2
 
constexpr double NMEA::MINUTES_PER_DEGREE = 60.0
 
constexpr size_t NMEA::Field::UTC_TIME = 1
 
constexpr size_t NMEA::Field::GGA_LATITUDE = 2
 
constexpr size_t NMEA::Field::GGA_LATITUDE_HEMISPHERE = 3
 
constexpr size_t NMEA::Field::GGA_LONGITUDE = 4
 
constexpr size_t NMEA::Field::GGA_LONGITUDE_HEMISPHERE = 5
 
constexpr size_t NMEA::Field::GGA_QUALITY = 6
 
constexpr size_t NMEA::Field::GGA_SATELLITES_USED = 7
 
constexpr size_t NMEA::Field::GGA_HDOP = 8
 
constexpr size_t NMEA::Field::GGA_ALTITUDE = 9
 
constexpr size_t NMEA::Field::GGA_ALTITUDE_UNITS = 10
 
constexpr size_t NMEA::Field::GGA_GEOID_SEPARATION = 11
 
constexpr size_t NMEA::Field::GGA_GEOID_UNITS = 12
 
constexpr size_t NMEA::Field::GGA_MIN_FIELDS = GGA_GEOID_UNITS + 1
 
constexpr size_t NMEA::Field::RMC_STATUS = 2
 
constexpr size_t NMEA::Field::RMC_LATITUDE = 3
 
constexpr size_t NMEA::Field::RMC_LATITUDE_HEMISPHERE = 4
 
constexpr size_t NMEA::Field::RMC_LONGITUDE = 5
 
constexpr size_t NMEA::Field::RMC_LONGITUDE_HEMISPHERE = 6
 
constexpr size_t NMEA::Field::RMC_SPEED_KNOTS = 7
 
constexpr size_t NMEA::Field::RMC_COURSE = 8
 
constexpr size_t NMEA::Field::RMC_DATE = 9
 
constexpr size_t NMEA::Field::RMC_MIN_FIELDS = RMC_DATE + 1
 
constexpr size_t NMEA::Field::GLL_LATITUDE = 1
 
constexpr size_t NMEA::Field::GLL_LATITUDE_HEMISPHERE = 2
 
constexpr size_t NMEA::Field::GLL_LONGITUDE = 3
 
constexpr size_t NMEA::Field::GLL_LONGITUDE_HEMISPHERE = 4
 
constexpr size_t NMEA::Field::GLL_TIME = 5
 
constexpr size_t NMEA::Field::GLL_STATUS = 6
 
constexpr size_t NMEA::Field::GLL_MIN_FIELDS = GLL_STATUS + 1
 
constexpr size_t NMEA::Field::GSA_DIMENSION = 2
 
constexpr size_t NMEA::Field::GSA_FIRST_SATELLITE = 3
 
constexpr size_t NMEA::Field::GSA_SATELLITE_SLOTS = 12
 
constexpr size_t NMEA::Field::GSA_HDOP = GSA_FIRST_SATELLITE + GSA_SATELLITE_SLOTS + 1
 
constexpr size_t NMEA::Field::GSA_VDOP = GSA_HDOP + 1
 
constexpr size_t NMEA::Field::GSA_MIN_FIELDS = GSA_VDOP + 1
 
constexpr size_t NMEA::Field::GSA_SYSTEM_ID = GSA_MIN_FIELDS
 
constexpr size_t NMEA::Field::VTG_TRUE_COURSE = 1
 
constexpr size_t NMEA::Field::VTG_SPEED_KNOTS = 5
 
constexpr size_t NMEA::Field::VTG_SPEED_KMH = 7
 
constexpr size_t NMEA::Field::VTG_MIN_FIELDS = VTG_SPEED_KMH + 1
 
constexpr size_t NMEA::Field::ZDA_DAY = 2
 
constexpr size_t NMEA::Field::ZDA_MONTH = 3
 
constexpr size_t NMEA::Field::ZDA_YEAR = 4
 
constexpr size_t NMEA::Field::ZDA_MIN_FIELDS = ZDA_YEAR + 1
 
constexpr size_t NMEA::Field::GST_LATITUDE_ERROR = 6
 
constexpr size_t NMEA::Field::GST_LONGITUDE_ERROR = 7
 
constexpr size_t NMEA::Field::GST_ALTITUDE_ERROR = 8
 
constexpr unsigned NMEA::GgaQuality::INVALID = 0
 
constexpr unsigned NMEA::GgaQuality::GPS = 1
 
constexpr unsigned NMEA::GgaQuality::DIFFERENTIAL = 2
 
constexpr unsigned NMEA::GgaQuality::RTK_FIXED = 4
 
constexpr unsigned NMEA::GgaQuality::RTK_FLOAT = 5
 
constexpr unsigned NMEA::GgaQuality::ESTIMATED = 6
 
constexpr unsigned NMEA::GgaQuality::MANUAL = 7
 Manual input: the position a base station was fixed at.
 
constexpr unsigned NMEA::GgaQuality::MAX_VALUE = 8
 
constexpr unsigned NMEA::FixDimension::NO_FIX = 1
 
constexpr unsigned NMEA::FixDimension::THREE_D = 3