2016-11-16 23:54:15 +01:00
|
|
|
#ifndef NMEAPARSER_H
|
|
|
|
#define NMEAPARSER_H
|
|
|
|
|
|
|
|
#include <QDate>
|
|
|
|
#include "parser.h"
|
|
|
|
|
|
|
|
|
|
|
|
class NMEAParser : public Parser
|
|
|
|
{
|
|
|
|
public:
|
2020-01-23 23:19:32 +01:00
|
|
|
NMEAParser() : _errorLine(0) {}
|
2016-11-16 23:54:15 +01:00
|
|
|
|
2019-01-31 01:46:53 +01:00
|
|
|
bool parse(QFile *file, QList<TrackData> &tracks, QList<RouteData> &routes,
|
|
|
|
QList<Area> &polygons, QVector<Waypoint> &waypoints);
|
2016-11-16 23:54:15 +01:00
|
|
|
QString errorString() const {return _errorString;}
|
|
|
|
int errorLine() const {return _errorLine;}
|
|
|
|
|
|
|
|
private:
|
2020-01-23 23:19:32 +01:00
|
|
|
struct CTX {
|
|
|
|
CTX() : GGA(false) {}
|
|
|
|
|
|
|
|
QDate date;
|
|
|
|
QTime time;
|
|
|
|
bool GGA;
|
|
|
|
};
|
|
|
|
|
2016-11-22 00:13:41 +01:00
|
|
|
bool readEW(const char *data, int len, qreal &lon);
|
|
|
|
bool readLon(const char *data, int len, qreal &lon);
|
|
|
|
bool readNS(const char *data, int len, qreal &lat);
|
|
|
|
bool readLat(const char *data, int len, qreal &lat);
|
|
|
|
bool readDate(const char *data, int len, QDate &date);
|
|
|
|
bool readTime(const char *data, int len, QTime &time);
|
|
|
|
bool readAltitude(const char *data, int len, qreal &ele);
|
|
|
|
bool readGeoidHeight(const char *data, int len, qreal &gh);
|
|
|
|
|
2020-01-23 23:19:32 +01:00
|
|
|
bool readRMC(CTX &ctx, const char *line, int len, SegmentData &segment);
|
|
|
|
bool readGGA(CTX &ctx, const char *line, int len, SegmentData &segment);
|
|
|
|
bool readWPL(const char *line, int len, QVector<Waypoint> &waypoints);
|
|
|
|
bool readZDA(CTX &ctx, const char *line, int len);
|
2016-11-16 23:54:15 +01:00
|
|
|
|
|
|
|
int _errorLine;
|
|
|
|
QString _errorString;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // NMEAPARSER_H
|