NDEVR
API Documentation
NMEAParserPacket.h
1
2#pragma once
3#include "NMEAParserData.h"
4#include <NDEVR/StringView.h>
5#include <NDEVR/String.h>
6#include <NDEVR/Dictionary.h>
7namespace NDEVR
8{
12 {
13 public:
19 virtual NMEAUpdateInfo processRxCommand(const StringView& command, const StringView& data, NMEAInfo& info) = 0;
25 virtual StringView name() const = 0;
26 protected:
29 public:
30 TimeSpan average_rx_rate = Constant<TimeSpan>::Invalid;
31 Time last_rx_time = Constant<Time>::Invalid;
33 protected:
35 };
36
39 {
40 public:
53 virtual NMEAUpdateInfo processRxCommand(const StringView& command, const StringView& data);
55 void reset();
62 void addSentenceReader(const StringView& string, NMEASentenceReader* reader) { m_sentence_readers.add(string, reader); };
68 const Buffer<NMEASentenceReader*>& readers() const { return m_readers; };
71 const NMEAInfo& info() const { return m_info; }
72 private:
73 enum PARSE_STATE
74 {
75 PARSE_STATE_SOM = 0,
76 PARSE_STATE_CMD,
77 PARSE_STATE_DATA,
78 PARSE_STATE_CHECKSUM_1,
79 PARSE_STATE_CHECKSUM_2,
80 };
81 protected:
83 private:
86 PARSE_STATE m_nState;
87 uint01 m_u8Checksum;
88 uint01 m_u8ReceivedChecksum;
89 String m_pCommand;
90 String m_pData;
91 };
92}
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
A hash-based key-value store, useful for quick associative lookups.
Definition Dictionary.h:64
NMEAUpdateInfo processNMEABuffer(const StringView &data)
Processes a buffer of raw NMEA data, extracting and processing complete sentences.
~NMEAReader()
Destructor.
void addSentenceReader(const StringView &string, NMEASentenceReader *reader)
Registers a sentence reader for a specific sentence type.
NMEAInfo m_info
Accumulated NMEA data.
const NMEAInfo & info() const
Returns the current accumulated NMEA info.
const Buffer< NMEASentenceReader * > & readers() const
Returns the registered sentence readers.
void reset()
Resets the parser state machine to its initial state.
void addSentenceReader(NMEASentenceReader *reader)
Registers a sentence reader and auto-maps its supported sentence types.
Buffer< StringView > activeSentenceTypes() const
Returns the list of sentence types that have active readers.
NMEAReader()
Constructs the NMEA reader.
virtual NMEAUpdateInfo processRxCommand(const StringView &command, const StringView &data)
Processes a single extracted NMEA command and data pair.
Abstract base class for parsing specific NMEA sentence types (e.g.
virtual Buffer< StringView > supportedTypes() const =0
Returns the NMEA sentence types this reader can handle.
void onMessageReceived()
Updates receive timing statistics after processing a message.
virtual StringView name() const =0
Returns the display name of this sentence reader.
virtual NMEAUpdateInfo processRxCommand(const StringView &command, const StringView &data, NMEAInfo &info)=0
Processes a received NMEA command and its data payload.
Time last_rx_time
Time of the last received message.
Buffer< StringView > m_sentence_parts
Temporary storage for parsed sentence fields.
TimeSpan average_rx_rate
Average time between received messages.
uint04 count
Total number of messages processed.
The core String View class for the NDEVR API.
Definition StringView.h:58
The core String class for the NDEVR API.
Definition String.h:95
Stores a time span, or difference between two times, with an optional start time.
Definition TimeSpan.h:46
Represents a timestamp with utilities for manipulation and conversion.
Definition Time.h:62
The primary namespace for the NDEVR SDK.
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
The complete accumulated NMEA data state including satellite info, error data, INS data,...
Describes what was updated after processing an NMEA sentence, including which data categories changed...