Debian Codegraph @

src/rfkill_p.h

raw
1 /*
2 * BluezQt - Asynchronous Bluez wrapper library
3 *
4 * SPDX-FileCopyrightText: 2015 David Rosca <[email protected]>
5 *
6 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7 */
8
9 #ifndef BLUEZQT_RFKILL_P_H
10 #define BLUEZQT_RFKILL_P_H
11
12 #include <QHash>
13 #include <QMutex>
14 #include <QObject>
15 #include <QThread>
16 #include <QWaitCondition>
17
18 #include "bluezqt_export.h"
19 #include "rfkill.h"
20
21 namespace BluezQt
22 {
23
24 class RfkillThread : public QThread
25 {
26 Q_OBJECT
27
28 public:
29 explicit RfkillThread(QObject *parent);
30
31 void interrupt();
32 void setSoftBlocked(quint8 blocked);
33
34 protected:
35 void run() override;
36
37 private:
38 void doSetSoftBlocked(quint8 blocked);
39
40 QWaitCondition m_waitCondition;
41 QMutex m_mutex;
42 quint8 m_pendingBlocked;
43 };
44
45 struct RfkillPrivate {
46 int m_readFd = -1;
47 Rfkill::State m_state = Rfkill::State::Unknown;
48 QHash<quint32, Rfkill::State> m_devices;
49 RfkillThread *m_thread = nullptr;
50 };
51
52 } // namespace BluezQt
53
54 #endif // BLUEZQT_RFKILL_P_H