DtkSystemSettings
dtk library for systemsettings.
载入中...
搜索中...
未找到
drfmanager.h
浏览该文件的文档.
1// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4#ifndef DRFMANAGER_H
5#define DRFMANAGER_H
6
7#include "dtkrfmanager_global.h"
8#include "dtksystemsettings_global.h"
9
10#include <dexpected.h>
11
12#include <QObject>
13
14DRFMGR_BEGIN_NAMESPACE
15using DCORE_NAMESPACE::DExpected;
16class DRfmanagerPrivate;
17
18class LIBDTKSYSTEMSETTINGSSHARED_EXPORT DRfmanager : public QObject
19{
20 Q_OBJECT
21 Q_PROPERTY(bool bluetoothBlocked READ isBluetoothBlocked WRITE blockBluetooth NOTIFY
22 bluetoothBlockedChanged)
23 Q_PROPERTY(bool wifiBlocked READ isWifiBlocked WRITE blockWifi NOTIFY wifiBlockedChanged)
24 Q_PROPERTY(int count READ count NOTIFY countChanged)
25 Q_PROPERTY(bool allBlocked READ isAllBlocked WRITE blockAll NOTIFY allBlockedChanged)
26
27public:
30 ADD = 0,
31 DEL,
32 CHANGE,
33 CHANGE_ALL,
36 };
37 Q_ENUM(RfOperation)
38
39
40 enum RfType {
41 ALL = 0,
42 WLAN,
43 WIFI = WLAN,
44 BLUETOOTH,
45 UWB,
46 WIMAX,
47 WWAN,
48 GPS,
49 FM,
50 NFC,
52 NUM_TYPES,
53 };
54 Q_ENUM(RfType)
55
56
57 struct RfDevice
58 {
59 quint32 idx;
60 RfType type;
61 QString name;
62 bool softBlocked;
63 bool hardBlocked;
64 };
65
66 explicit DRfmanager(QObject *parent = nullptr);
67 virtual ~DRfmanager() override;
68
69 bool block(RfType type, bool blocked = true);
70 bool block(quint32 id, bool blocked = true);
71
72 bool isBluetoothBlocked() const;
73 bool isWifiBlocked() const;
74 bool isAllBlocked() const;
75 int count() const;
76 QList<RfDevice> deviceList() const;
77
78public slots:
79 DExpected<bool> blockBluetooth(bool bluetoothBlocked = true);
80 DExpected<bool> blockWifi(bool wifiBlocked = true);
81 DExpected<bool> blockAll(bool blockAll = true);
82
83signals:
84 void bluetoothBlockedChanged(bool bluetoothBlocked);
85 void wifiBlockedChanged(bool wifiBlocked);
86 void countChanged(int count);
87 void allBlockedChanged(bool blockAll);
88 void blockedChanged(quint32 idx);
89
90private:
91 QScopedPointer<DRfmanagerPrivate> d_dptr;
92 Q_DECLARE_PRIVATE_D(d_dptr, DRfmanager)
93};
94
95#if !defined(QT_NO_DEBUG_STREAM)
96Q_CORE_EXPORT QDebug operator<<(QDebug, const DRfmanager::RfDevice &);
97#endif
98
99DRFMGR_END_NAMESPACE
100#endif // DRFMANAGER_H
无线设备管理类
Definition drfmanager.h:19
bool isWifiBlocked() const
无线网络设备是否禁用
bool isAllBlocked() const
支持的设备是否都被禁用
bool isBluetoothBlocked() const
蓝牙设备是否禁用
DExpected< bool > blockBluetooth(bool bluetoothBlocked=true)
禁用或者启用蓝牙设备
bool block(RfType type, bool blocked=true)
禁用或者启用类型为 type 的无线设备
void bluetoothBlockedChanged(bool bluetoothBlocked)
蓝牙设备禁用或者启用状态发生变化信号
DExpected< bool > blockAll(bool blockAll=true)
禁用或者启用所有无线设备
QList< RfDevice > deviceList() const
获取支持的设备列表
void blockedChanged(quint32 idx)
设备禁用或者启用状态发生变化信号
RfOperation
<
Definition drfmanager.h:29
void countChanged(int count)
无线设备拔插时即设备数量变化的信号
bool block(quint32 id, bool blocked=true)
禁用或者启用设备编号为 id 的无线设备
void allBlockedChanged(bool blockAll)
支持的所有社别设备全部禁用或者非全部状态发生变化信号
DExpected< bool > blockWifi(bool wifiBlocked=true)
禁用或者启用无线网络设备
void wifiBlockedChanged(bool wifiBlocked)
无线网络设备禁用或者启用状态发生变化信号
virtual ~DRfmanager() override
析构函数
int count() const
获取支持的设备数量
DRfmanager(QObject *parent=nullptr)
构造函数
Definition drfmanager.h:58