| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QEVDEVTABLETHANDLER_P_H |
| 5 | #define QEVDEVTABLETHANDLER_P_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists purely as an |
| 12 | // implementation detail. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include <QObject> |
| 19 | #include <QString> |
| 20 | #include <QThread> |
| 21 | #include <QLoggingCategory> |
| 22 | #include <QtCore/private/qthread_p.h> |
| 23 | |
| 24 | QT_BEGIN_NAMESPACE |
| 25 | |
| 26 | Q_DECLARE_LOGGING_CATEGORY(qLcEvdevTablet) |
| 27 | |
| 28 | class QSocketNotifier; |
| 29 | class QEvdevTabletData; |
| 30 | |
| 31 | class QEvdevTabletHandler : public QObject |
| 32 | { |
| 33 | public: |
| 34 | explicit QEvdevTabletHandler(const QString &device, const QString &spec = QString(), QObject *parent = nullptr); |
| 35 | ~QEvdevTabletHandler(); |
| 36 | |
| 37 | qint64 deviceId() const; |
| 38 | |
| 39 | void readData(); |
| 40 | |
| 41 | private: |
| 42 | bool queryLimits(); |
| 43 | |
| 44 | int m_fd; |
| 45 | QString m_device; |
| 46 | QSocketNotifier *m_notifier; |
| 47 | QEvdevTabletData *d; |
| 48 | }; |
| 49 | |
| 50 | class QEvdevTabletHandlerThread : public QDaemonThread |
| 51 | { |
| 52 | public: |
| 53 | explicit QEvdevTabletHandlerThread(const QString &device, const QString &spec, QObject *parent = nullptr); |
| 54 | ~QEvdevTabletHandlerThread(); |
| 55 | void run() override; |
| 56 | QEvdevTabletHandler *handler() { return m_handler; } |
| 57 | |
| 58 | private: |
| 59 | QString m_device; |
| 60 | QString m_spec; |
| 61 | QEvdevTabletHandler *m_handler; |
| 62 | }; |
| 63 | |
| 64 | QT_END_NAMESPACE |
| 65 | |
| 66 | #endif // QEVDEVTABLETHANDLER_P_H |
| 67 |
