DtkDevice
DTK library for device.
dlsdevice.h
1// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4#ifndef DLSDEVICE_H
5#define DLSDEVICE_H
6
7#include "dtkdevice_global.h"
8
9#include <QMap>
10#include <QObject>
11
12DDEVICE_BEGIN_NAMESPACE
13
14class DlsDevicePrivate;
15class LIBDTKDEVICESHARED_EXPORT DlsDevice : public QObject
16{
17public:
18 enum DevClass {
19 DtkUnkown = 0,
20 DtkBridge, DtkController, DtkHub,
21 DtkBios, DtkBus, DtkAddress, DtkVolume,
22 DtkVirtual,
23 DtkGeneric,
24 DtkProductSystem,
25 DtkMainboard,
26 DtkCpu,
27 DtkMemory,
28 DtkStorage, DtkDisk,
29 DtkDvd, DtkTape,
30 DtkNetwork, Dtkwlan, DtkCommunication,
31 DtkDisplayGPU, DtkMonitor,
32 DtkInput,
33 DtkMouse,
34 DtkKeyboard,
35 DtkFingerprint,
36 DtkCamera,
37 DtkSoundAudio,
38 DtkTouchscreen,
39 DtkTouchpad,
40 DtkBluetooth,
41 DtkPrinter,
42 DtkPower, DtkBattery,
43 DtkSensor,
44 DtkLed,
45 DtkSwitchbuttion,
46 DtkScanner,
47 DtkChipcard,
48
49 DtkOther,
50 DtkRevers1,
51 DtkRevers2,
52
53 DtkMax = 100
54 };
55
56 struct DDeviceInfo {
57 QMap<QString, QString> deviceInfoLstMap;
58 QString vendorName;
59 QString productName;
60 QString modalias;
61 QString vendorID;
62 QString productID;
63 QString sysFsPath;
65 QString subClassName;
66 QString description;
69 DevClass devClass;
70 };
71
72 explicit DlsDevice(QObject *parent = nullptr);
73 ~DlsDevice();
74
75 QList< DDeviceInfo > devicesInfosAll();
76 QStringList deviceAttris(DevClass etype);
77 QList< DDeviceInfo > deviceInfo(DevClass etype);
78 QList< DDeviceInfo > deviceInfo(DevClass etype, const int idex);
80 int devicesCount(DevClass devclass);
82 QMap<QString, int> CpuStat();
83 double getCpuUsage();
84 QList< DDeviceInfo > deviceCPU();
85 QList< DDeviceInfo > deviceStorage();
86 QList< DDeviceInfo > deviceGPU();
87 QList< DDeviceInfo > deviceMemory();
88 QList< DDeviceInfo > deviceMonitor(); //todo
89 QList< DDeviceInfo > deviceAudio();
90 QList< DDeviceInfo > deviceNetwork();
91 QList< DDeviceInfo > deviceCamera();
92 QList< DDeviceInfo > deviceKeyboard();
93 QList< DDeviceInfo > deviceMouse();
94 QList< DDeviceInfo > deviceComputer();
95
96private:
97 QScopedPointer<DlsDevicePrivate> d_ptr;
98 Q_DECLARE_PRIVATE(DlsDevice)
99};
100
101DDEVICE_END_NAMESPACE
102
103#endif
104
105
解析获取硬件信息.
Definition: dlsdevice.h:16
double updateSystemCpuUsage()
更新CPU信息
QList< DDeviceInfo > deviceMemory()
获取内存设备信息
int devicesCount(DevClass devclass)
获取的相关类别设备个数
QList< DDeviceInfo > deviceCamera()
获取相机设备信息
QList< DDeviceInfo > deviceMonitor()
获取显示器设备信息
QList< DDeviceInfo > deviceCPU()
获取CPU设备信息
QList< DDeviceInfo > deviceStorage()
获取存储设备信息
QList< DDeviceInfo > deviceGPU()
获取GPU设备信息
QList< DDeviceInfo > devicesInfosAll()
获取的所有设备信息
QList< DDeviceInfo > deviceAudio()
获取声音设备信息
QList< DDeviceInfo > deviceMouse()
获取鼠标设备信息
double getCpuUsage()
获取CPU利用率
QList< DDeviceInfo > deviceKeyboard()
获取键盘设备信息
QList< DDeviceInfo > deviceNetwork()
获取网络设备信息
int devicesCount()
获取的所有设备个数
QStringList deviceAttris(DevClass etype)
获取的相关类别设备属性名称
DevClass
设备类型分类
Definition: dlsdevice.h:18
QList< DDeviceInfo > deviceInfo(DevClass etype)
获取的相关类别设备信息
QList< DDeviceInfo > deviceComputer()
获取系统设备信息
QList< DDeviceInfo > deviceInfo(DevClass etype, const int idex)
获取的相关类别设备信息
存储设备相关信息
Definition: dlsdevice.h:56
QMap< QString, QString > deviceInfoLstMap
Definition: dlsdevice.h:57
QString productName
Definition: dlsdevice.h:59
QStringList deviceBaseAttrisLst
Definition: dlsdevice.h:67
QStringList deviceOtherAttrisLst
Definition: dlsdevice.h:68
QString subClassName
Definition: dlsdevice.h:65
QString vendorName
Definition: dlsdevice.h:58
QString vendorID
Definition: dlsdevice.h:61
QString productID
Definition: dlsdevice.h:62
QString sysFsPath
Definition: dlsdevice.h:63
QString modalias
Definition: dlsdevice.h:60
QString baseClassName
Definition: dlsdevice.h:64