sensorfw: datatypes/tap.h Source File

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