Solid::Ifaces::DeviceManager Class

class Solid::Ifaces::DeviceManager
Header: #include <DeviceManager>
CMake: find_package(KF6 REQUIRED COMPONENTS Solid)
target_link_libraries(mytarget PRIVATE KF6::Solid)
Inherits: QObject

Public Functions

DeviceManager(QObject *parent = nullptr)
virtual ~DeviceManager() override
virtual QStringList allDevices() = 0
virtual QObject *createDevice(const QString &udi) = 0
virtual QStringList devicesFromQuery(const QString &parentUdi, Solid::DeviceInterface::Type type = Solid::DeviceInterface::Unknown) = 0
virtual QSet<Solid::DeviceInterface::Type> supportedInterfaces() const = 0
virtual QString udiPrefix() const = 0

Signals

void deviceAdded(const QString &udi)
void deviceRemoved(const QString &udi)

Detailed Description

This class specifies the interface a backend will have to implement in order to be used in the system.

A device manager allows to query the underlying platform to discover the available devices. It has also the responsibility to notify when a device appears or disappears.

Member Function Documentation

DeviceManager::DeviceManager(QObject *parent = nullptr)

Constructs a DeviceManager

[override virtual noexcept] DeviceManager::~DeviceManager()

Destructs a DeviceManager object

[pure virtual] QStringList DeviceManager::allDevices()

Retrieves the Universal Device Identifier (UDI) of all the devices available in the system. This identifier is unique for each device in the system.

@returns the UDIs of all the devices in the system

[pure virtual] QObject *DeviceManager::createDevice(const QString &udi)

Instantiates a new Device object from this backend given its UDI.

@param udi the identifier of the device instantiated @returns a new Device object if there's a device having the given UDI, nullptr otherwise

[signal] void DeviceManager::deviceAdded(const QString &udi)

This signal is emitted when a new device appears in the system.

@param udi the new device identifier

[signal] void DeviceManager::deviceRemoved(const QString &udi)

This signal is emitted when a device disappears from the system.

@param udi the old device identifier

[pure virtual] QStringList DeviceManager::devicesFromQuery(const QString &parentUdi, Solid::DeviceInterface::Type type = Solid::DeviceInterface::Unknown)

Retrieves the Universal Device Identifier (UDI) of all the devices matching the given constraints (parent and device interface)

@param parentUdi UDI of the parent of the devices we're searching for, or QString() if there's no constraint on the parent @param type DeviceInterface type available on the devices we're looking for, or DeviceInterface::Unknown if there's no constraint on the device interfaces @returns the UDIs of all the devices having the given parent and device interface

[pure virtual] QSet<Solid::DeviceInterface::Type> DeviceManager::supportedInterfaces() const

Retrieves a set of interfaces the backend supports

[pure virtual] QString DeviceManager::udiPrefix() const

Retrieves the prefix used for the UDIs off all the devices reported by the device manager