File indexing completed on 2024-06-09 04:00:39

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 #ifndef UDEVQTDEVICE_H
0008 #define UDEVQTDEVICE_H
0009 
0010 #include <QList>
0011 #include <QString>
0012 #include <QStringList>
0013 #include <QVariant>
0014 
0015 namespace UdevQt
0016 {
0017 class DevicePrivate;
0018 class Device
0019 {
0020 public:
0021     Device();
0022     Device(const Device &other);
0023     ~Device();
0024     Device &operator=(const Device &other);
0025 
0026     bool isValid() const;
0027     QString subsystem() const;
0028     QString devType() const;
0029     QString name() const;
0030     QString sysfsPath() const;
0031     int sysfsNumber() const;
0032     QString driver() const;
0033     QString primaryDeviceFile() const;
0034     QStringList alternateDeviceSymlinks() const;
0035     QStringList deviceProperties() const;
0036 #ifdef UDEV_HAVE_GET_SYSATTR_LIST_ENTRY
0037     QStringList sysfsProperties() const;
0038 #endif
0039     Device parent() const;
0040 
0041     // ### should this really be a QVariant? as far as udev knows, everything is a string...
0042     // see also Client::devicesByProperty
0043     QVariant deviceProperty(const QString &name) const;
0044     QString decodedDeviceProperty(const QString &name) const;
0045     QVariant sysfsProperty(const QString &name) const;
0046     Device ancestorOfType(const QString &subsys, const QString &devtype) const;
0047 
0048 private:
0049     Device(DevicePrivate *devPrivate);
0050     friend class Client;
0051     friend class ClientPrivate;
0052 
0053     DevicePrivate *d;
0054 };
0055 
0056 typedef QList<Device> DeviceList;
0057 
0058 }
0059 
0060 #endif