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//=============================================================================================================
59{
60 int station = 0;
61 QVector3D position;
62 QQuaternion orientation;
63 bool hasOrientation = false;
64};
65
66//=============================================================================================================
76{
77public:
79 enum class Units
80 {
81 Inches,
82 Centimetres
83 };
84
85 FastrakParser() = default;
86
93 {
94 m_units = units;
95 }
96
97 Units units() const
98 {
99 return m_units;
100 }
101
107 void append(const QByteArray& chunk)
108 {
109 m_buffer.append(chunk);
110 }
111
120 bool nextSample(FastrakSample& out);
121
123 void reset()
124 {
125 m_buffer.clear();
126 }
127
138 static bool parseRecord(const QByteArray& record, Units units, FastrakSample& out);
139
140private:
141 QByteArray m_buffer;
142 Units m_units = Units::Centimetres;
143};
144
145} // namespace UTILSLIB
146
147#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)