1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-30 22:51:16 +01:00
GPXSee/src/data/fitparser.h

66 lines
1.3 KiB
C
Raw Normal View History

#ifndef FITPARSER_H
#define FITPARSER_H
#include "parser.h"
class FITParser : public Parser
{
public:
2017-07-27 19:47:46 +02:00
FITParser();
2017-07-27 19:47:46 +02:00
bool parse(QFile *file, QList<TrackData> &tracks, QList<RouteData> &routes,
QList<Waypoint> &waypoints);
QString errorString() const {return _errorString;}
int errorLine() const {return 0;}
private:
2017-08-10 08:58:21 +02:00
struct FileHeader {
2016-11-03 07:37:17 +01:00
quint8 headerSize;
quint8 protocolVersion;
quint16 profileVersion;
quint32 dataSize;
quint32 magic;
2017-08-10 08:58:21 +02:00
};
2017-08-10 08:58:21 +02:00
struct Field {
quint8 id;
quint8 size;
quint8 type;
2017-08-10 08:58:21 +02:00
};
2017-08-10 08:58:21 +02:00
struct MessageDefinition {
quint8 endian;
2016-11-03 07:37:17 +01:00
quint16 globalId;
quint8 numFields;
Field *fields;
quint8 numDevFields;
Field *devFields;
2017-08-10 08:58:21 +02:00
};
2016-11-02 17:33:54 +01:00
void warning(const char *text) const;
void clearDefinitions();
bool readData(char *data, size_t size);
template<class T> bool readValue(T &val);
bool skipValue(size_t size);
bool parseHeader();
2017-07-27 19:47:46 +02:00
bool parseRecord(TrackData &track);
bool parseDefinitionMessage(quint8 header);
2017-07-27 19:47:46 +02:00
bool parseCompressedMessage(TrackData &track, quint8 header);
bool parseDataMessage(TrackData &track, quint8 header);
bool parseData(TrackData &track, MessageDefinition *def, quint8 offset);
bool readField(Field *f, quint32 &val);
QIODevice *_device;
QString _errorString;
quint32 _len;
quint8 _endian;
quint32 _timestamp;
MessageDefinition _defs[16];
};
#endif // FITPARSER_H