1 | /* |
2 | * BluezQt - Asynchronous Bluez wrapper library |
3 | * |
4 | * SPDX-FileCopyrightText: 2015 David Rosca <nowrep@gmail.com> |
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_H |
10 | #define BLUEZQT_RFKILL_H |
11 | |
12 | #include <QHash> |
13 | #include <QObject> |
14 | |
15 | #include "bluezqt_export.h" |
16 | |
17 | #include <memory> |
18 | |
19 | namespace BluezQt |
20 | { |
21 | struct RfkillPrivate; |
22 | |
23 | class BLUEZQT_EXPORT Rfkill : public QObject |
24 | { |
25 | Q_OBJECT |
26 | Q_PROPERTY(State state READ state NOTIFY stateChanged) |
27 | |
28 | public: |
29 | enum State { |
30 | Unblocked = 0, |
31 | SoftBlocked = 1, |
32 | HardBlocked = 2, |
33 | Unknown = 3, |
34 | }; |
35 | Q_ENUM(State) |
36 | |
37 | explicit Rfkill(QObject *parent = nullptr); |
38 | ~Rfkill() override; |
39 | |
40 | State state() const; |
41 | void block(); |
42 | void unblock(); |
43 | |
44 | Q_SIGNALS: |
45 | void stateChanged(State state); |
46 | |
47 | private Q_SLOTS: |
48 | BLUEZQT_NO_EXPORT void devReadyRead(); |
49 | |
50 | private: |
51 | BLUEZQT_NO_EXPORT void init(); |
52 | BLUEZQT_NO_EXPORT bool openForWriting(); |
53 | BLUEZQT_NO_EXPORT void updateRfkillDevices(); |
54 | BLUEZQT_NO_EXPORT bool setSoftBlock(quint8 soft); |
55 | |
56 | std::unique_ptr<RfkillPrivate> d; |
57 | }; |
58 | |
59 | } // namespace BluezQt |
60 | |
61 | #endif // BLUEZQT_RFKILL_H |
62 | |