C NMEA Parser
The GPS emits coordinate information in the form of NMEA sentences. In the previous post, I showed how to we could connect to GPS to get these strings and simply print them out to the console. But in order to really work with the GPS coordinates, the data stream needs to be processed and each NMEA sentence parsed for this.
The NMEA Sentence
Each NMEA sentence begins with the data type field and ends with checksum. For example:
$GPGGA is the location fix data, with the coordinates including: latitude, longitude and altitude. This is the most commonly used NMEA sentence which also includes accuracy information.
$GPGSV is the visible satellite data. The sentences include an id and information about the location of the satellite with respect to the GPS in degrees.
Although the parser is not threaded at this time, here is a first cut of the source code, printing individual NMEA sentences.