mikalhart/TinyGPSPlus

Support for Beidou & GLONASS

JasonPittenger opened this issue · 0 comments

Can you add support for Beidou & GLONASS?
Instead of a string compare for an exact match, I suggest a string search for the sentence type.
This then is agnostic to the system being used.

Global Positioning System (GPS, SBAS, QZSS) = GP
Global Navigation Satellite System (GNSS) = GN
Global Navigation Satellite System (GLONASS) = GL
Beidou Navigation Satellite System (BDS) = BD

This

#define _GPRMCterm   "GPRMC"
#define _GPGGAterm   "GPGGA"
#define _GNRMCterm   "GNRMC"
#define _GNGGAterm   "GNGGA"

becomes

#define __RMCterm   "RMC"
#define __GGAterm   "GGA"

and

if (!strcmp(term, _GPRMCterm) || !strcmp(term, _GNRMCterm))
      curSentenceType = GPS_SENTENCE_GPRMC;
    else if (!strcmp(term, _GPGGAterm) || !strcmp(term, _GNGGAterm))
      curSentenceType = GPS_SENTENCE_GPGGA;
    else
      curSentenceType = GPS_SENTENCE_OTHER;

Becomes

if (strstr(term, __RMCterm)
      curSentenceType = GPS_SENTENCE_GPRMC;
    else if (strstr(term, __GGAterm))
      curSentenceType = GPS_SENTENCE_GPGGA;
    else
      curSentenceType = GPS_SENTENCE_OTHER;