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 
36 class Tap : public QObject
37 {
38  Q_OBJECT
39 
40  Q_PROPERTY(int direction READ direction)
41  Q_PROPERTY(int type READ type)
42 
43 public:
47  Tap() {}
48 
54  Tap(const TapData& tapData);
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 
81 private:
82  TapData data_;
84  friend const QDBusArgument &operator>>(const QDBusArgument &argument, Tap& tap);
85 };
86 
88 
89 
96 inline 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 
111 inline 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
TapData::Type type_
Type of tap.
Definition: tapdata.h:65
TapData::Type type() const
Returns tap type.
Definition: tap.h:79
const TapData & tapData() const
Returns the contained TapData.
Definition: tap.h:67
TapData::Direction direction_
Direction of tap.
Definition: tapdata.h:64
const QDBusArgument & operator>>(const QDBusArgument &argument, Tap &tap)
Unmarshall Tap data from the D-Bus argument.
Definition: tap.h:111
Direction
Direction of tap.
Definition: tapdata.h:42
TapData::Direction direction() const
Returns tap direction.
Definition: tap.h:73
quint64 timestamp_
monotonic time (microsec)
Definition: genericdata.h:46
Q_DECLARE_METATYPE(TMatrix)
Datatype for device tap events.
Definition: tapdata.h:36
QObject facade for TapData.
Definition: tap.h:36
friend 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.
Tap()
Default constructor.
Definition: tap.h:47
Type
Type of tap.
Definition: tapdata.h:58