1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: http://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the QtFeedback module of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL3$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see http://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at http://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 3 requirements |
23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. |
24 | ** |
25 | ** GNU General Public License Usage |
26 | ** Alternatively, this file may be used under the terms of the GNU |
27 | ** General Public License version 2.0 or later as published by the Free |
28 | ** Software Foundation and appearing in the file LICENSE.GPL included in |
29 | ** the packaging of this file. Please review the following information to |
30 | ** ensure the GNU General Public License version 2.0 requirements will be |
31 | ** met: http://www.gnu.org/licenses/gpl-2.0.html. |
32 | ** |
33 | ** $QT_END_LICENSE$ |
34 | ** |
35 | ****************************************************************************/ |
36 | |
37 | #ifndef QFEEDBACKACTUATOR_H |
38 | #define QFEEDBACKACTUATOR_H |
39 | |
40 | #include "qfeedbackglobal.h" |
41 | #include <QtCore/QObject> |
42 | |
43 | QT_BEGIN_HEADER |
44 | QT_BEGIN_NAMESPACE |
45 | |
46 | class QFeedbackEffect; |
47 | |
48 | class Q_FEEDBACK_EXPORT QFeedbackActuator : public QObject |
49 | { |
50 | Q_OBJECT |
51 | |
52 | Q_ENUMS(Capability) |
53 | Q_ENUMS(State) |
54 | |
55 | Q_PROPERTY(int id READ id) |
56 | Q_PROPERTY(QString name READ name) |
57 | Q_PROPERTY(QFeedbackActuator::State state READ state) |
58 | Q_PROPERTY(bool valid READ isValid) |
59 | Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged) |
60 | |
61 | public: |
62 | enum Capability { |
63 | Envelope, |
64 | Period |
65 | }; |
66 | |
67 | enum State { |
68 | Busy, |
69 | Ready, |
70 | Unknown |
71 | }; |
72 | |
73 | explicit QFeedbackActuator(QObject *parent = Q_NULLPTR); |
74 | |
75 | int id() const; |
76 | bool isValid() const; |
77 | |
78 | QString name() const; |
79 | State state() const; |
80 | |
81 | Q_INVOKABLE bool isCapabilitySupported(Capability) const; |
82 | |
83 | bool isEnabled() const; |
84 | void setEnabled(bool); |
85 | |
86 | static QList<QFeedbackActuator*> actuators(); |
87 | bool operator==(const QFeedbackActuator&) const; |
88 | |
89 | Q_SIGNALS: |
90 | void enabledChanged(); |
91 | |
92 | private: |
93 | QFeedbackActuator(QObject *parent, int id); |
94 | friend class QFeedbackHapticsInterface; |
95 | int m_id; |
96 | }; |
97 | |
98 | QT_END_NAMESPACE |
99 | QT_END_HEADER |
100 | |
101 | #endif // QFEEDBACKACTUATOR_H |
102 | |