2016-10-31 22:59:08 +01:00
|
|
|
#ifndef FITPARSER_H
|
|
|
|
#define FITPARSER_H
|
|
|
|
|
|
|
|
#include "parser.h"
|
|
|
|
|
2018-07-03 19:08:46 +02:00
|
|
|
class QFile;
|
|
|
|
|
2016-10-31 22:59:08 +01:00
|
|
|
class FITParser : public Parser
|
|
|
|
{
|
|
|
|
public:
|
2017-07-27 19:47:46 +02:00
|
|
|
bool parse(QFile *file, QList<TrackData> &tracks, QList<RouteData> &routes,
|
2019-01-31 01:46:53 +01:00
|
|
|
QList<Area> &polygons, QVector<Waypoint> &waypoints);
|
2016-10-31 22:59:08 +01:00
|
|
|
QString errorString() const {return _errorString;}
|
|
|
|
int errorLine() const {return 0;}
|
|
|
|
|
|
|
|
private:
|
2018-07-03 19:08:46 +02:00
|
|
|
struct Field;
|
|
|
|
class MessageDefinition;
|
|
|
|
class CTX;
|
|
|
|
|
|
|
|
bool readData(QFile *file, char *data, size_t size);
|
|
|
|
template<class T> bool readValue(CTX &ctx, T &val);
|
2018-08-19 10:44:12 +02:00
|
|
|
bool skipValue(CTX &ctx, quint8 size);
|
2020-04-08 22:28:35 +02:00
|
|
|
bool readField(CTX &ctx, Field *field, QVariant &val, bool &valid);
|
2018-07-03 19:08:46 +02:00
|
|
|
|
|
|
|
bool parseHeader(CTX &ctx);
|
|
|
|
bool parseRecord(CTX &ctx);
|
|
|
|
bool parseDefinitionMessage(CTX &ctx, quint8 header);
|
|
|
|
bool parseCompressedMessage(CTX &ctx, quint8 header);
|
|
|
|
bool parseDataMessage(CTX &ctx, quint8 header);
|
|
|
|
bool parseData(CTX &ctx, const MessageDefinition *def);
|
2016-10-31 22:59:08 +01:00
|
|
|
|
|
|
|
QString _errorString;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // FITPARSER_H
|