sensorfw
orientation.h
Go to the documentation of this file.
1 
27 #ifndef ORIENTATION_H
28 #define ORIENTATION_H
29 
30 #include <QDBusArgument>
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)
44 
45 public:
52  {
60  };
61 
66 
73 
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 
117 
118 private:
119  OrientationData data_;
121  friend const QDBusArgument &operator>>(const QDBusArgument &argument, Orientation& orientation);
122 };
123 
125 
126 
133 inline 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
QObject facade for OrientationData.
Definition: orientation.h:37
Orientation(const OrientationData &orientationData)
Constructor.
DisplayOrientation
Display orientation.
Definition: orientation.h:52
@ OrientationUndefined
Definition: orientation.h:53
@ OrientationDisplayDown
Definition: orientation.h:55
@ OrientationDisplayLeftUp
Definition: orientation.h:56
@ OrientationDisplayDownwards
Definition: orientation.h:59
@ OrientationDisplayRightUp
Definition: orientation.h:57
@ OrientationDisplayUpwards
Definition: orientation.h:58
@ OrientationDisplayUp
Definition: orientation.h:54
int y() const
Accessor for Y coordinate.
Definition: orientation.h:100
friend const QDBusArgument & operator>>(const QDBusArgument &argument, Orientation &orientation)
Unmarshall Orientation data from the D-Bus argument.
Definition: orientation.h:148
const OrientationData & orientationData() const
Accessor for contained OrientationData.
Definition: orientation.h:86
int x() const
Accessor for X coordinate.
Definition: orientation.h:93
int z() const
Accessor for Z coordinate.
Definition: orientation.h:107
Orientation(const Orientation &orientation)
Copy constructor.
DisplayOrientation orientation
Definition: orientation.h:43
DisplayOrientation orientation() const
Accessor for display orientation.
Definition: orientation.h:116
Orientation()
Default constructor.
Definition: orientation.h:65
quint64 timestamp_
monotonic time (microsec)
Definition: genericdata.h:46
Class for vector type measurement data (timestamp, x, y, z).
Definition: genericdata.h:53
int x_
X value.
Definition: genericdata.h:70
int y_
Y value.
Definition: genericdata.h:71
int z_
Z value.
Definition: genericdata.h:72
Q_DECLARE_METATYPE(TMatrix)
const QDBusArgument & operator>>(const QDBusArgument &argument, Orientation &orientation)
Unmarshall Orientation data from the D-Bus argument.
Definition: orientation.h:148
Datatypes for different filters.