sensorfw
tap.h
Go to the documentation of this file.
1
26#ifndef TAP_H
27#define TAP_H
28
29#include <QDBusArgument>
30
31#include <datatypes/tapdata.h>
32
36class Tap : public QObject
37{
38 Q_OBJECT
39
40 Q_PROPERTY(int direction READ direction)
41 Q_PROPERTY(int type READ type)
42
43public:
47 Tap() {}
48
55
61 Tap(const Tap& tap);
62
67 const TapData& tapData() const { return data_; }
68
73 TapData::Direction direction() const { return data_.direction_; }
74
79 TapData::Type type() const { return data_.type_; }
80
81private:
82 TapData data_;
84 friend const QDBusArgument &operator>>(const QDBusArgument &argument, Tap& tap);
85};
86
88
89
96inline QDBusArgument &operator<<(QDBusArgument &argument, const Tap &tap)
97{
98 argument.beginStructure();
99 argument << tap.tapData().timestamp_ << (int)(tap.tapData().direction_) << (int)(tap.tapData().type_);
100 argument.endStructure();
101 return argument;
102}
103
111inline const QDBusArgument &operator>>(const QDBusArgument &argument, Tap &tap)
112{
113 int tmp;
114 argument.beginStructure();
115 argument >> tap.data_.timestamp_;
116 argument >> tmp;
117 tap.data_.direction_ = (TapData::Direction)tmp;
118 argument >> tmp;
119 tap.data_.type_ = (TapData::Type)tmp;
120 argument.endStructure();
121 return argument;
122}
123
124#endif // TAP_H
Datatype for device tap events.
Definition: tapdata.h:36
Type
Type of tap.
Definition: tapdata.h:59
TapData::Direction direction_
Direction of tap.
Definition: tapdata.h:64
Direction
Direction of tap.
Definition: tapdata.h:43
TapData::Type type_
Type of tap.
Definition: tapdata.h:65
QObject facade for TapData.
Definition: tap.h:37
int direction
Definition: tap.h:40
int type
Definition: tap.h:41
friend const QDBusArgument & operator>>(const QDBusArgument &argument, Tap &tap)
Unmarshall Tap data from the D-Bus argument.
Definition: tap.h:111
Tap(const TapData &tapData)
Constructor.
Tap(const Tap &tap)
Copy constructor.
TapData::Type type() const
Returns tap type.
Definition: tap.h:79
const TapData & tapData() const
Returns the contained TapData.
Definition: tap.h:67
Tap()
Default constructor.
Definition: tap.h:47
TapData::Direction direction() const
Returns tap direction.
Definition: tap.h:73
quint64 timestamp_
monotonic time (microsec)
Definition: genericdata.h:46
Q_DECLARE_METATYPE(TMatrix)
const QDBusArgument & operator>>(const QDBusArgument &argument, Tap &tap)
Unmarshall Tap data from the D-Bus argument.
Definition: tap.h:111
Datatype for device tap events.