ckgt / nematode Goto Github PK
View Code? Open in Web Editor NEWC++ 11 NMEA Parser and GPS Interface
License: Other
C++ 11 NMEA Parser and GPS Interface
License: Other
For the parser a unit test framework would be useful. There are some open source solutions like Google Test, CppUnit or Boost.Test.
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
First off, thank you for this great tool, it works really well.
The only problem I have occurs when I use a gps that sends checksums. Sometimes I receive a valid NMEA checksum of 0, and the parser treats that as an invalid checksum and throws an error. An example sentence from my GPS:
$GPRMC,173138.000,V,3145.5214,N,09704.5057,W,000.0,000.0,170318,000.0,E,N*00
I get the error:
GPS Data Bad Format [$GPRMC] :: Checksum is invalid
The month of year field in $GPRMC sentences is indexed 1-12. This is also how it it is stored in the month
class member of GPSTimestamp
. In getTime()
, however mktime()
is called, which expects months be 0-11.
This results in the timestamp returned by getTime
being off by one month.
The mktime function used to convert the tm struct to time_t (seconds since Jan 1, 1970) assumes that the tm struct time is in local time. Hence, in the instance that the system time is not equal to UTC, the GPS time returned is shifted by the timezone in the opposite direction.
Hey, would you mind putting the actual text of the zlib license in your License file, along with your copyright? I'd like to use the library but don't want to violate zlib by not properly attributing you.
When not including this header ::strtoll and friends are missing (see http://www.cplusplus.com/reference/cstdlib/strtoll/). Tested with arm-none-eabi-g++. Thanks in advance
Hello,
Even though this is not really a big issue, I would like to point out that the code is not suitable for GN*** or GL*** sentences.
I tried to adapt it, and make it work for all prefixes of NMEA sentences but I did not succeed.
Has anyone made an attempt at this before ?
Thank you.
According to https://anavs.com/knowledgebase/nmea-format/ there are additional message formats:
The GPS messages are supported, while the others are not, limiting the usability of the library.
I'll do a fork and add the other formats (as long as I have test data for them) as described in #4 .
And do a pull request later.
otherwise NMEACommand::addChecksum() will add wrong checksum string if checksum>=0x80
#include <string>
#include <iostream>
#include <iomanip>
#include <sstream>
int main()
{
char checksum = 0x80;
unsigned char uchecksum = 0x80;
std::stringstream ss1, ss2;
ss1 << std::hex << std::uppercase << std::internal << std::setfill('0') << std::setw(2) << (int)checksum;
ss2 << std::hex << std::uppercase << std::internal << std::setfill('0') << std::setw(2) << (int)uchecksum;
std::cout<< ss1.str() << ", "<< ss2.str()<<std::endl;
}
result in
FFFFFF80, 80
NMEASentence and NMEAParser constructors cause warnings on member variable initialisation order; I suggest changing from:
NMEASentence::NMEASentence()
: isvalid(false)
, checksumIsCalculated(false)
, calculatedChecksum(0)
, parsedChecksum(0)
{ }
to
NMEASentence::NMEASentence()
: isvalid(false)
, checksumIsCalculated(false)
, parsedChecksum(0)
, calculatedChecksum(0)
{ }
and from
NMEAParser::NMEAParser()
: log(false)
, maxbuffersize(NMEA_PARSER_MAX_BUFFER_SIZE)
, fillingbuffer(false)
{ }
to
NMEAParser::NMEAParser()
: fillingbuffer(false)
, maxbuffersize(NMEA_PARSER_MAX_BUFFER_SIZE)
, log(false)
{ }
or use non-static member initialisation where they're declared.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.