sensorfw: datatypes/lid.h Source File

sensorfw

lid.h
Go to the documentation of this file.
1
26 #ifndef LID_H
27 #define LID_H
28
29 #include <QDBusArgument>
30
31 #include <datatypes/liddata.h>
32
36 class Lid : public QObject
37 {
38 Q_OBJECT
39
40 // Q_PROPERTY(uint value READ value)
41 Q_PROPERTY(int type READ type)
42
43 public:
47 Lid() {}
48
54 Lid(const LidData& lidData);
55
61 Lid(const Lid& lid);
62
67 const LidData& lidData() const { return data_; }
68
73 LidData::Type type() const { return data_.type_; }
74
75 unsigned value_;
76
77 private:
78 LidData data_;
80 friend const QDBusArgument &operator>>(const QDBusArgument &argument, Lid& lid);
81 };
82
83 Q_DECLARE_METATYPE( Lid )
84
85
92 inline QDBusArgument &operator<<(QDBusArgument &argument, const Lid &lid)
93 {
94 argument.beginStructure();
95 argument << lid.lidData().timestamp_ << (int)(lid.lidData().value_) << (int)(lid.lidData().type_);
96 argument.endStructure();
97 return argument;
98 }
99
107 inline const QDBusArgument &operator>>(const QDBusArgument &argument, Lid &lid)
108 {
109 int tmp;
110 argument.beginStructure();
111 argument >> lid.data_.timestamp_;
112 argument >> tmp;
113 lid.data_.value_ = (unsigned)tmp;
114 argument >> tmp;
115 lid.data_.type_ = (LidData::Type)tmp;
116 argument.endStructure();
117 return argument;
118 }
119
120 #endif // LID_H
LidData
Datatype for device lid events.
Definition: liddata.h:36
LidData::Type
Type
Type of lid.
Definition: liddata.h:42
LidData::type_
LidData::Type type_
Type of lid.
Definition: liddata.h:48
LidData::value_
unsigned value_
Measurement value.
Definition: liddata.h:49
Lid
QObject facade for LidData.
Definition: lid.h:37
Lid::Lid
Lid(const LidData &lidData)
Constructor.
Lid::operator>>
friend const QDBusArgument & operator>>(const QDBusArgument &argument, Lid &lid)
Unmarshall Lid data from the D-Bus argument.
Definition: lid.h:107
Lid::Lid
Lid()
Default constructor.
Definition: lid.h:47
Lid::Lid
Lid(const Lid &lid)
Copy constructor.
Lid::type
LidData::Type type() const
Returns Lid type.
Definition: lid.h:73
Lid::lidData
const LidData & lidData() const
Returns the contained LidData.
Definition: lid.h:67
Lid::value_
unsigned value_
Definition: lid.h:75
Lid::type
int type
Definition: lid.h:41
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, Lid &lid)
Unmarshall Lid data from the D-Bus argument.
Definition: lid.h:107
liddata.h
Datatype for device tap events.