| 1 | /* |
| 2 | SPDX-FileCopyrightText: 2009 Benjamin K. Stuhl <bks24@cornell.edu> |
| 3 | |
| 4 | SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
| 5 | */ |
| 6 | |
| 7 | #ifndef UDEVQTDEVICE_H |
| 8 | #define UDEVQTDEVICE_H |
| 9 | |
| 10 | #include <QList> |
| 11 | #include <QString> |
| 12 | #include <QStringList> |
| 13 | #include <QVariant> |
| 14 | |
| 15 | namespace UdevQt |
| 16 | { |
| 17 | class DevicePrivate; |
| 18 | class Device |
| 19 | { |
| 20 | public: |
| 21 | Device(); |
| 22 | Device(const Device &other); |
| 23 | ~Device(); |
| 24 | Device &operator=(const Device &other); |
| 25 | |
| 26 | bool isValid() const; |
| 27 | QString subsystem() const; |
| 28 | QString devType() const; |
| 29 | QString name() const; |
| 30 | QString sysfsPath() const; |
| 31 | int sysfsNumber() const; |
| 32 | QString driver() const; |
| 33 | QString primaryDeviceFile() const; |
| 34 | QStringList alternateDeviceSymlinks() const; |
| 35 | QStringList deviceProperties() const; |
| 36 | #ifdef UDEV_HAVE_GET_SYSATTR_LIST_ENTRY |
| 37 | QStringList sysfsProperties() const; |
| 38 | #endif |
| 39 | Device parent() const; |
| 40 | |
| 41 | // ### should this really be a QVariant? as far as udev knows, everything is a string... |
| 42 | // see also Client::devicesByProperty |
| 43 | QVariant deviceProperty(const QString &name) const; |
| 44 | QString decodedDeviceProperty(const QString &name) const; |
| 45 | QVariant sysfsProperty(const QString &name) const; |
| 46 | Device ancestorOfType(const QString &subsys, const QString &devtype) const; |
| 47 | |
| 48 | private: |
| 49 | Device(DevicePrivate *devPrivate); |
| 50 | friend class Client; |
| 51 | friend class ClientPrivate; |
| 52 | |
| 53 | DevicePrivate *d; |
| 54 | }; |
| 55 | |
| 56 | typedef QList<Device> DeviceList; |
| 57 | |
| 58 | } |
| 59 | |
| 60 | #endif |
| 61 | |