File indexing completed on 2024-05-12 05:38:44
0001 /* 0002 SPDX-FileCopyrightText: 2009 Benjamin K. Stuhl <bks24@cornell.edu> 0003 0004 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #pragma once 0008 0009 #include <QList> 0010 #include <QObject> 0011 #include <QString> 0012 #include <QStringList> 0013 #include <QVariant> 0014 0015 #include "udevqtdevice.h" 0016 0017 namespace UdevQt 0018 { 0019 class ClientPrivate; 0020 class Client : public QObject 0021 { 0022 Q_OBJECT 0023 0024 Q_PROPERTY(QStringList watchedSubsystems READ watchedSubsystems WRITE setWatchedSubsystems) 0025 0026 public: 0027 explicit Client(QObject *parent = nullptr); 0028 explicit Client(const QStringList &subsystemList, QObject *parent = nullptr); 0029 ~Client() override; 0030 0031 QStringList watchedSubsystems() const; 0032 void setWatchedSubsystems(const QStringList &subsystemList); 0033 0034 DeviceList allDevices(); 0035 DeviceList devicesByProperty(const QString &property, const QVariant &value); 0036 DeviceList devicesBySubsystem(const QString &subsystem); 0037 Device deviceByDeviceFile(const QString &deviceFile); 0038 Device deviceBySysfsPath(const QString &sysfsPath); 0039 Device deviceBySubsystemAndName(const QString &subsystem, const QString &name); 0040 0041 Q_SIGNALS: 0042 void deviceAdded(const UdevQt::Device &dev); 0043 void deviceRemoved(const UdevQt::Device &dev); 0044 void deviceChanged(const UdevQt::Device &dev); 0045 void deviceOnlined(const UdevQt::Device &dev); 0046 void deviceOfflined(const UdevQt::Device &dev); 0047 0048 private: 0049 friend class ClientPrivate; 0050 Q_PRIVATE_SLOT(d, void _uq_monitorReadyRead(int fd)) 0051 ClientPrivate *d; 0052 }; 0053 0054 }