/
orientationdata.h
171 lines (147 loc) · 5.26 KB
/
orientationdata.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/**
@file orientationdata.h
@brief Datatypes for different filters
<p>
Copyright (C) 2009-2010 Nokia Corporation
@author Joep van Gassel <joep.van.gassel@nokia.com>
@author Timo Rongas <ext-timo.2.rongas@nokia.com>
@author Ustun Ergenoglu <ext-ustun.ergenoglu@nokia.com>
@author Antti Virtanen <antti.i.virtanen@nokia.com>
This file is part of Sensord.
Sensord is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License
version 2.1 as published by the Free Software Foundation.
Sensord is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with Sensord. If not, see <http://www.gnu.org/licenses/>.
</p>
*/
#ifndef ORIENTATIONDATA_H
#define ORIENTATIONDATA_H
#include <datatypes/genericdata.h>
#include <datatypes/unsigned.h>
/**
* Accelerometer mesurement data.
*/
typedef TimedXyzData AccelerationData;
/**
* Magnetometer measurement data.
*/
typedef TimedXyzData MagneticFieldData;
/**
* Device orientation measurement data.
*/
typedef TimedXyzData OrientationData;
/**
* Magnetometer measurement data.
*/
typedef TimedXyzData MagnetometerData;
/**
* Datatype for calibrated magnetometer measurements.
*/
class CalibratedMagneticFieldData : public TimedData
{
public:
/**
* Default constructor.
*/
CalibratedMagneticFieldData() : TimedData(0),
x_(0), y_(0), z_(0),
rx_(0), ry_(0), rz_(0),
level_(0) {}
/**
* Constructor.
*
* @param timestamp timestamp as monotonic time (microsec).
* @param x X coordinate value.
* @param y Y coordinate value.
* @param z Z coordinate value.
* @param rx raw X coordinate value.
* @param ry raw Y coordinate value.
* @param rz raw Z coordinate value.
* @param level Calibration level.
*/
CalibratedMagneticFieldData(const quint64& timestamp, int x, int y, int z, int rx, int ry, int rz, int level) :
TimedData(timestamp),
x_(x), y_(y), z_(z),
rx_(rx), ry_(ry), rz_(rz),
level_(level) {}
/**
* Constructor.
*
* @param magData Magnetometer data.
* @param level Calibration level.
*/
CalibratedMagneticFieldData(TimedXyzData magData, int level) :
TimedData(magData.timestamp_),
x_(0), y_(0), z_(0),
rx_(magData.x_), ry_(magData.y_), rz_(magData.z_),
level_(level) {}
int x_; /**< X coordinate value */
int y_; /**< Y coordinate value */
int z_; /**< Z coordinate value */
int rx_; /**< raw X coordinate value */
int ry_; /**< raw Y coordinate value */
int rz_; /**< raw Z coordinate value */
int level_; /**< Magnetometer calibration level. Higher value means better calibration. */
};
/**
* Datatype for compass measurements.
*/
class CompassData : public TimedData
{
public:
/**
* Default constructor.
*/
CompassData() : TimedData(0), degrees_(0), rawDegrees_(0), correctedDegrees_(0), level_(0) {}
/**
* Constructor.
*
* @param timestamp timestamp as monotonic time (microsec).
* @param degrees Angle to north.
* @param level Magnetometer calibration level.
*/
CompassData(const quint64& timestamp, int degrees, int level) :
TimedData(timestamp), degrees_(degrees), rawDegrees_(degrees), correctedDegrees_(0), level_(level) {}
/**
* Constructor.
*
* @param timestamp timestamp as monotonic time (microsec).
* @param degrees Angle to north.
* @param level Magnetometer calibration level.
* @param correctedDegrees Declination corrected angle to north.
* @param rawDegrees Not declination corrected angle to north.
*/
CompassData(const quint64& timestamp, int degrees, int level, int correctedDegrees, int rawDegrees) :
TimedData(timestamp), degrees_(degrees), rawDegrees_(rawDegrees), correctedDegrees_(correctedDegrees), level_(level) {}
int degrees_; /**< Angle to north which may be declination corrected or not. This is the value apps should use */
int rawDegrees_; /**< Angle to north without declination correction */
int correctedDegrees_; /**< Declination corrected angle to north */
int level_; /**< Magnetometer calibration level. Higher value means better calibration. */
};
/**
* Datatype for proximity measurements
*/
class ProximityData : public TimedUnsigned
{
public:
/**
* Default constructor.
*/
ProximityData() : TimedUnsigned(), withinProximity_(false) {}
/**
* Constructor
*
* @param timestamp timestamp as monotonic time (microsec).
* @param value raw proximity value.
* @param withinProximity is there an object within proximity.
*/
ProximityData(const quint64& timestamp, unsigned int value, bool withinProximity) :
TimedUnsigned(timestamp, value), withinProximity_(withinProximity) {}
bool withinProximity_; /**< is an object within proximity or not */
};
#endif // ORIENTATIONDATA_H