I don't see a huge problem here. Why not just parse whatever message with interesting info we get? if (!strcmp("$GPGLL") { // extract coordinates and update buffer } else if(!strcmp("$GPGGA)) { // extract coordinates and update buffer } else if(!strcmp("$GPRMC)) { // extract coordinates and update buffer } else if(!strcmp("$GPSuperProprietaryMessageWithAwesomePrecisionData")) { // extract coordinates and update buffer } else { // no luck with this message return; } Sebastien On Mon, Jan 31, 2011 at 4:28 PM, <mad@auth.se> wrote:
On Mon, 31 Jan 2011 13:34:16 +0100, Dario Lombardo wrote:
Good, but why did you change the old code? Why don't you put something like
if (strcmp("$GPGLL") { // run the old code } else if(strcmp("$GPGGA)) { // run your new code } else { return; }
That could support both the devices.
BTW, best practice would be to implement parsing of the "GPRMC"-sentence as it is the "Recommended Minimal Sentence" for every NMEA-capable gps receiver. It contains time, date, latitude, longitude, validity, speed and heading, so everything needed is delivered and should work with all receivers out there.
Regards, Mad