sensorfw: datatypes/orientation.h Source File

sensorfw

orientation.h
Go to the documentation of this file.
1
27#ifndef ORIENTATION_H
28#define ORIENTATION_H
29
30#include <QDBusArgument>
31#include <datatypes/orientationdata.h>
32
36 class Orientation : public QObject
37{
38 Q_OBJECT
39
40 Q_PROPERTY(int x READ x)
41 Q_PROPERTY(int y READ y)
42 Q_PROPERTY(int z READ z)
43 Q_PROPERTY(DisplayOrientation orientation READ orientation)
44
45public:
51 enum DisplayOrientation
52 {
53 OrientationUndefined = 0,
54 OrientationDisplayUp,
55 OrientationDisplayDown,
56 OrientationDisplayLeftUp,
57 OrientationDisplayRightUp,
58 OrientationDisplayUpwards,
59 OrientationDisplayDownwards
60 };
61
65 Orientation() {}
66
72 Orientation(const OrientationData& orientationData);
73
79 Orientation(const Orientation& orientation);
80
86 const OrientationData& orientationData() const { return data_; }
87
93 int x() const { return data_.x_; }
94
100 int y() const { return data_.y_; }
101
107 int z() const { return data_.z_; }
108
116 DisplayOrientation orientation() const { return OrientationUndefined; }
117
118private:
119 OrientationData data_;
121 friend const QDBusArgument &operator>>(const QDBusArgument &argument, Orientation& orientation);
122};
123
124 Q_DECLARE_METATYPE( Orientation )
125
126
133inline QDBusArgument &operator<<(QDBusArgument &argument, const Orientation &orientation)
134{
135 argument.beginStructure();
136 argument << orientation.orientationData().timestamp_ << orientation.orientationData().x_ << orientation.orientationData().y_ << orientation.orientationData().z_;
137 argument.endStructure();
138 return argument;
139}
140
148 inline const QDBusArgument &operator>>(const QDBusArgument &argument, Orientation &orientation)
149{
150 argument.beginStructure();
151 argument >> orientation.data_.timestamp_ >> orientation.data_.x_ >> orientation.data_.y_ >> orientation.data_.z_;
152 argument.endStructure();
153 return argument;
154}
155
156#endif // ORIENTATION_H
Orientation
QObject facade for OrientationData.
Definition: orientation.h:37
Orientation::orientationData
const OrientationData & orientationData() const
Accessor for contained OrientationData.
Definition: orientation.h:86
Orientation::Orientation
Orientation(const OrientationData &orientationData)
Constructor.
Orientation::DisplayOrientation
DisplayOrientation
Display orientation.
Definition: orientation.h:52
Orientation::OrientationUndefined
@ OrientationUndefined
Definition: orientation.h:53
Orientation::OrientationDisplayDown
@ OrientationDisplayDown
Definition: orientation.h:55
Orientation::OrientationDisplayLeftUp
@ OrientationDisplayLeftUp
Definition: orientation.h:56
Orientation::OrientationDisplayDownwards
@ OrientationDisplayDownwards
Definition: orientation.h:59
Orientation::OrientationDisplayRightUp
@ OrientationDisplayRightUp
Definition: orientation.h:57
Orientation::OrientationDisplayUpwards
@ OrientationDisplayUpwards
Definition: orientation.h:58
Orientation::OrientationDisplayUp
@ OrientationDisplayUp
Definition: orientation.h:54
Orientation::operator>>
friend const QDBusArgument & operator>>(const QDBusArgument &argument, Orientation &orientation)
Unmarshall Orientation data from the D-Bus argument.
Definition: orientation.h:148
Orientation::y
int y() const
Accessor for Y coordinate.
Definition: orientation.h:100
Orientation::x
int x() const
Accessor for X coordinate.
Definition: orientation.h:93
Orientation::z
int z() const
Accessor for Z coordinate.
Definition: orientation.h:107
Orientation::Orientation
Orientation(const Orientation &orientation)
Copy constructor.
Orientation::x
int x
Definition: orientation.h:40
Orientation::y
int y
Definition: orientation.h:41
Orientation::orientation
DisplayOrientation orientation
Definition: orientation.h:43
Orientation::orientation
DisplayOrientation orientation() const
Accessor for display orientation.
Definition: orientation.h:116
Orientation::Orientation
Orientation()
Default constructor.
Definition: orientation.h:65
Orientation::z
int z
Definition: orientation.h:42
TimedData::timestamp_
quint64 timestamp_
monotonic time (microsec)
Definition: genericdata.h:46
TimedXyzData
Class for vector type measurement data (timestamp, x, y, z).
Definition: genericdata.h:53
TimedXyzData::x_
int x_
X value.
Definition: genericdata.h:70
TimedXyzData::y_
int y_
Y value.
Definition: genericdata.h:71
TimedXyzData::z_
int z_
Z value.
Definition: genericdata.h:72
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(TMatrix)
operator>>
const QDBusArgument & operator>>(const QDBusArgument &argument, Orientation &orientation)
Unmarshall Orientation data from the D-Bus argument.
Definition: orientation.h:148
orientationdata.h
Datatypes for different filters.