A light library for parsing the parameters inside a NMEA sentence and detecting the parameter type.
- Prepare a NMEA sentence. Like:
char GGA_testSentence[] = "$GPGGA,002153.000,3342.6618,N,11751.3858,W,1,10,1.2,27.0,M,-34.2,M,,0000,*5E";
- Add nmea, Param and Str lib to your project
- Include nmea.h
#include "nmea.h"
- Create an instance of "NMEA_sentence" struct to hold the parser result
NMEA_sentence nmea;
- Create an array of "NMEA_Field" to hold the parameters
NMEA_Field fields[GGA_fieldNum];
- Use "NMEA_parseSentence" function to parse GGA_testSentence like this:
NMEA_LenType ret = NMEA_parseSentence(&nmea, &fields, GGA_fieldNum, GGA_testSentence);
- If the output is smaller than 0, there is a problem in the parsing process, otherwise the result is the number of fields that have been parsed and saved.
- You can find the details of the parsing operation through nmea