Advanced Programming Using C++ is a course that is taught at Virginia Commonwealth university as part of the Computer Engineering curriculum. In this course one of the course assignments was to successfully create a C++ program that is able to parse NMEA Messages and properly display them the console in an specified order.
The data in the NMEA GPS sentences is contained in comma-separated fields. While the number of fields in each message type and their meanings are fixed, depending on the state of the GPS receiver, whether or not they actually contain data is variable.
For example, with a valid GPS fix, a GPGGA message may look like this one:
But without a GPS fix, a GPGGA message may look like this one:
UTC time: 155006.000
Date: 14/10/2014
Latitude: 37d 32.7239'
Longitude: -77d 26.9956'
Altitude: 89.1M
Speed:0.00 knots, Course:80.30 degrees, true
3D fix Satellite count: 5
PDOP: 3.2
HDOP: 1.7
VDOP: 2.7
$GPGGA,190326.054,,,,,0,00,50.0,,M,0.0,M,,0000*43
$GPRMC,155006.000,A,3732.7239,N,07726.9956,W,0.00,80.30,141014,,,A*4C
$GPGGA,155002.000,3732.7239,N,07726.9956,W,1,05,1.7,89.1,M,-33.6,M,,0000*58
$GPRMC,155006.000,A,3732.7239,N,07726.9956,W,0.00,80.30,141014,,,A*4C
NMEA is an acronym for the National Marine Electronic Association. It existed well before Global Positioning Systems(GPS) was invented. Today In the world of GPS, NMEA is a standard data format supported by al GPS manufacturers, much like ASCII is the standard for digital computer characters in the computer world. (2)
NMEA GPS sentences consist of data in ASCII form – that is, each byte of information that is output corresponds to an ASCII character. Thus NMEA sentences are typically transmitted over an RS-232 serial link and thus are received one byte at a time. For the purposes of the assignment, we read the NMEA GPS sentences from a file, one byte at a time. But was tested with an actual NMEA GPS at the end equating to the same idea. Its simply a matter of adding another file that allows the program to take the data input from a serial link.
A valid sentence starts with a ‘$’ character. After the ‘$’, there is a 5- character sequence starting with “GP” and ending with three characters that specify the “type” of the message. After the ‘$’ character and message type, the sentence includes a variable number of characters that contain the actual message data. After the message data, the sentence will contain a ‘*’ character signifying the end of the data. Following the ‘*’ character, there will be two ASCII characters which specify the checksum of the message in hexadecimal format. After the two checksum characters, the next character should be a ‘$’ character signifying the start of the next message.(1)
More information and examples of the NMEA GPS sentences can be found at these websites
Sources
(1) About NMEA Sentences: http://aprs.gids.nl/nmea/
(2) What is NMEA GPS Data:
http://gpsworld.com/what-exactly-is-gps-nmea-data/t