Nmea0183Parser/Inc/Nmea0183Parser_Private.h

43 lines
1.7 KiB
C

//
// Created by villuton on 20.03.25.
//
#ifndef NMEA0183PARSER_PRIVATE_H
#define NMEA0183PARSER_PRIVATE_H
#include "AsciiStringParsingUtils.h"
#define Nmea0183StartEncapsulateSentenceDelimiter '!'
#define Nmea0183StartDelimiter '$'
#define Nmea0183CheckSumDelimiter '*'
#define Nmea0183FieldDelimiter ','
#define Nmea0183ParseShortCharsDecimalNumber(STR, LEN) (uint16_t) iAsciiStringParseUnsignedLongDecimalNumber(STR,((STR)+(LEN)))
#define Nmea0183ParseDouble(STR, LEN) dAsciiStringParseDouble(STR,((STR)+(LEN)))
#define Nmea0183SkipSpace(STR, STR_END) xAsciiStringSkipSpace(STR,STR_END)
#define Nmea0183SkipToChar(STR, STR_END, SYMBOL) xAsciiStringSeekChar(STR,STR_END,SYMBOL)
#define Nmea0183ParseNextPortion(BEGIN, DIV, STR_END) iAsciiStringMoveToNextParsingBlock(BEGIN,DIV,STR_END,Nmea0183FieldDelimiter)
#define Nmea0183ParseStartPosition(BEGIN, DIV, STR_END) iAsciiStringMoveToNextParsingBlock(BEGIN,DIV,STR_END,Nmea0183StartDelimiter)
#define Nmea0183ParseCheckSumPosition(BEGIN, DIV, STR_END) iAsciiStringMoveToNextParsingBlock(BEGIN,DIV,STR_END,Nmea0183CheckSumDelimiter)
#define Nmea0183SkipToStartDelimiter(STR, STR_END) Nmea0183SkipToChar(STR,STR_END,Nmea0183StartDelimiter)
#define Nmea0183SkipToCheckSumDelimiter(STR, STR_END) Nmea0183SkipToChar(STR,STR_END,Nmea0183CheckSumDelimiter)
#define NmeaParsePrepare char *end = Nmea0183SkipToCheckSumDelimiter(str, str + len);\
char *front = str;\
char *nextDivider = front - 1;
#define NmeaSkipToNextPortion Nmea0183ParseNextPortion(&front, &nextDivider, end);
#define NMEA_ASSERT(x) if(!(x)){return 0;};
#define Nmea0183ParseHexByte(STR) iAsciiStringParseHexByte(STR)
#endif //NMEA0183PARSER_PRIVATE_H