v2.0.0
Loading...
Searching...
No Matches
fastrak_parser.h
Go to the documentation of this file.
1//=============================================================================================================
27
28#ifndef UTILS_FASTRAK_PARSER_H
29#define UTILS_FASTRAK_PARSER_H
30
31//=============================================================================================================
32// INCLUDES
33//=============================================================================================================
34
35#include "../utils_global.h"
36
37//=============================================================================================================
38// QT INCLUDES
39//=============================================================================================================
40
41#include <QByteArray>
42#include <QQuaternion>
43#include <QVector3D>
44
45//=============================================================================================================
46// DEFINE NAMESPACE UTILSLIB
47//=============================================================================================================
48
49namespace UTILSLIB
50{
51
52//=============================================================================================================
57{
58 int station = 0;
59 QVector3D position;
60 QQuaternion orientation;
61 bool hasOrientation = false;
62};
63
64//=============================================================================================================
72{
73public:
74 enum class Units {
75 Inches,
76 Centimetres
77 };
78
79 FastrakParser() = default;
80
82 void setUnits(Units units) { m_units = units; }
83
84 Units units() const { return m_units; }
85
87 void append(const QByteArray& chunk) { m_buffer.append(chunk); }
88
95 bool nextSample(FastrakSample& out);
96
98 void reset() { m_buffer.clear(); }
99
106 static bool parseRecord(const QByteArray& record, Units units, FastrakSample& out);
107
108private:
109 QByteArray m_buffer;
110 Units m_units = Units::Centimetres;
111};
112
113} // namespace UTILSLIB
114
115#endif // UTILS_FASTRAK_PARSER_H
Public umbrella header for UTILSLIB exposing the UTILSSHARED_EXPORT macro and build-info accessors.
#define UTILSSHARED_EXPORT
Shared utilities (I/O helpers, spectral analysis, layout management, warp algorithms).
One decoded sample from a Fastrak ASCII stream.
QVector3D position
Position in metres (always normalised to SI).
QQuaternion orientation
Sensor orientation; identity if not provided.
int station
1-based station id reported by the device.
void setUnits(Units units)
void append(const QByteArray &chunk)