2020-01-14 23:21:05 +01:00
|
|
|
#ifndef SMLPARSER_H
|
|
|
|
#define SMLPARSER_H
|
|
|
|
|
|
|
|
#include <QXmlStreamReader>
|
2020-01-15 21:56:04 +01:00
|
|
|
#include <QMap>
|
|
|
|
#include <QDebug>
|
2020-01-14 23:21:05 +01:00
|
|
|
#include "parser.h"
|
|
|
|
|
|
|
|
class SMLParser : public Parser
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
bool parse(QFile *file, QList<TrackData> &tracks, QList<RouteData> &routes,
|
|
|
|
QList<Area> &polygons, QVector<Waypoint> &waypoints);
|
|
|
|
QString errorString() const {return _reader.errorString();}
|
|
|
|
int errorLine() const {return _reader.lineNumber();}
|
|
|
|
|
|
|
|
private:
|
2020-01-15 21:56:04 +01:00
|
|
|
struct Sensors
|
|
|
|
{
|
|
|
|
Sensors()
|
|
|
|
: cadence(NAN), temperature(NAN), hr(NAN), power(NAN), speed(NAN) {}
|
|
|
|
|
|
|
|
qreal cadence, temperature, hr, power, speed;
|
|
|
|
};
|
|
|
|
|
2023-12-26 20:05:38 +01:00
|
|
|
typedef QMap<QDateTime, Sensors> SensorsMap;
|
|
|
|
|
2020-01-14 23:21:05 +01:00
|
|
|
void sml(QList<TrackData> &tracks);
|
|
|
|
void deviceLog(TrackData &track);
|
|
|
|
void samples(SegmentData &segment);
|
2023-12-26 20:05:38 +01:00
|
|
|
void sample(SegmentData &segment, SensorsMap &map);
|
2020-01-15 21:56:04 +01:00
|
|
|
|
|
|
|
#ifndef QT_NO_DEBUG
|
|
|
|
friend QDebug operator<<(QDebug dbg, const Sensors &sensors);
|
|
|
|
#endif // QT_NO_DEBUG
|
2020-01-14 23:21:05 +01:00
|
|
|
|
|
|
|
QXmlStreamReader _reader;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SMLPARSER_H
|