File indexing completed on 2024-05-26 04:05:33

0001 /*
0002     SPDX-FileCopyrightText: 2009 Harald Fernengel <harry@kdevelop.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #ifndef SOLID_BACKENDS_IOKIT_IOKITDEVICE_H
0008 #define SOLID_BACKENDS_IOKIT_IOKITDEVICE_H
0009 
0010 #include <IOKit/IOKitLib.h>
0011 #include <solid/devices/ifaces/device.h>
0012 
0013 namespace Solid
0014 {
0015 namespace Backends
0016 {
0017 namespace IOKit
0018 {
0019 class IOKitDevicePrivate;
0020 class IOKitManager;
0021 
0022 class IOKitDevice : public Solid::Ifaces::Device
0023 {
0024     Q_OBJECT
0025 
0026 public:
0027     IOKitDevice(const QString &udi);
0028     IOKitDevice(const IOKitDevice &device);
0029     virtual ~IOKitDevice();
0030 
0031     QString udi() const override;
0032     QString parentUdi() const override;
0033 
0034     QString vendor() const override;
0035     QString product() const override;
0036     QString icon() const override;
0037     QStringList emblems() const override;
0038     QString description() const override;
0039 
0040     virtual QVariant property(const QString &key) const;
0041 
0042     virtual QMap<QString, QVariant> allProperties() const;
0043 
0044     virtual bool iOKitPropertyExists(const QString &key) const;
0045 
0046     bool queryDeviceInterface(const Solid::DeviceInterface::Type &type) const override;
0047     QObject *createDeviceInterface(const Solid::DeviceInterface::Type &type) override;
0048 
0049     bool conformsToIOKitClass(const QString &className) const;
0050 
0051 Q_SIGNALS:
0052     void propertyChanged(const QMap<QString, int> &changes);
0053     void conditionRaised(const QString &condition, const QString &reason);
0054 
0055 private:
0056     friend class IOKitManager;
0057     IOKitDevice(const QString &udi, const io_registry_entry_t &entry);
0058     IOKitDevicePrivate *const d;
0059 };
0060 }
0061 }
0062 }
0063 
0064 #endif // SOLID_BACKENDS_IOKIT_IOKITDEVICE_H