Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Most GPS receivers output the position information using the NMEA protocol, you need a NMEA parser written in C, take a look at <a href="http://nmea.sourceforge.net/" rel="nofollow">NMEA Library</a> as an example.</p> <p>The library contains a number of sample applications, probably the simplest to understand/implement is in the <code>nmealib\samples\parse</code> directory.</p> <pre><code>#include &lt;nmea/nmea.h&gt; #include &lt;string.h&gt; int main() { const char *buff[] = { "$GPRMC,173843,A,3349.896,N,11808.521,W,000.0,360.0,230108,013.4,E*69\r\n", "$GPGGA,111609.14,5001.27,N,3613.06,E,3,08,0.0,10.2,M,0.0,M,0.0,0000*70\r\n", "$GPGSV,2,1,08,01,05,005,80,02,05,050,80,03,05,095,80,04,05,140,80*7f\r\n", "$GPGSV,2,2,08,05,05,185,80,06,05,230,80,07,05,275,80,08,05,320,80*71\r\n", "$GPGSA,A,3,01,02,03,04,05,06,07,08,00,00,00,00,0.0,0.0,0.0*3a\r\n", "$GPRMC,111609.14,A,5001.27,N,3613.06,E,11.2,0.0,261206,0.0,E*50\r\n", "$GPVTG,217.5,T,208.8,M,000.00,N,000.01,K*4C\r\n" }; int it; nmeaINFO info; nmeaPARSER parser; nmea_zero_INFO(&amp;info); nmea_parser_init(&amp;parser); for(it = 0; it &lt; 6; ++it) nmea_parse(&amp;parser, buff[it], (int)strlen(buff[it]), &amp;info); nmea_parser_destroy(&amp;parser); return 0; } </code></pre> <p>When implementing with a GPS receiver, instead of passing the fixed strings (in <code>buff</code>) to the parser you just need to pass the received NMEA strings from the receiver to the parser. The data gathered will be available in the <code>info</code> structure.</p> <p>If you wish to develop your own parser, take a look <a href="http://gpsd.berlios.de/NMEA.txt" rel="nofollow">here</a> for a detailed breakdown of the various messages that may be output from a GPS receiver. Most GPS receivers output only RMC, GGA, GSA, GSV, GLL, VTG, and (rarely) ZDA.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload