NemaTode icon indicating copy to clipboard operation
NemaTode copied to clipboard

Plus sign in NMEA sentences not supported.

Open rgirardin opened this issue 6 years ago • 2 comments

I am using a modem Cypress CTM-200 and processing the GPS coordinates with Nematode.

I am getting the following sentences from the modem. Unfortunately a plus sign is included before the altitude field in the GPGGA sentence. Plus sign is not supported and the sentence cannot be processed.

$PMID,353968095226388,35396809522638810 $GPGGA,194045.00,4531.6094,N,07331.1947,W,1,11,01.1,+00053,M,,M,,00006B $GPRMC,194045.00,A,4531.6094,N,07331.1947,W,000.2,000.0,160519,,*21

rgirardin avatar May 21 '19 18:05 rgirardin

I'll patch this weekend. Thanks for reporting.

ckgt avatar Jun 14 '19 14:06 ckgt

The problem sentence should be:

$GPGGA,194045.00,4531.6094,N,07331.1947,W,1,11,01.1,+00053,M,,M,,0000*6B

The fix is fairly straight forward in NMEAParser.cpp:

// true if alphanumeric or '-' or '+'
bool validParamChars(string txt)
{
  for (size_t i = 0; i < txt.size(); i++)
  {
    if (!isalnum(txt[i]))
    {
      if (txt[i] != '-' && txt[i] != '.' && txt[i] != '+')
      {
        return false;
      }
    }
  }
  return true;
}

damiandixon avatar Aug 18 '20 10:08 damiandixon