Solid::Ifaces::Device Class
class Solid::Ifaces::DeviceHeader: | #include <Device> |
CMake: | find_package(KF6 REQUIRED COMPONENTS Solid) target_link_libraries(mytarget PRIVATE KF6::Solid) |
Inherits: | QObject |
Public Functions
Device(QObject *parent = nullptr) | |
virtual | ~Device() override |
void | broadcastActionDone(const QString &actionName, int error = Solid::NoError, const QString &errorString = QString()) const |
void | broadcastActionRequested(const QString &actionName) const |
virtual QObject * | createDeviceInterface(const Solid::DeviceInterface::Type &type) = 0 |
virtual QString | description() const = 0 |
virtual QString | displayName() const |
virtual QStringList | emblems() const = 0 |
virtual QString | icon() const = 0 |
virtual QString | parentUdi() const |
virtual QString | product() const = 0 |
virtual bool | queryDeviceInterface(const Solid::DeviceInterface::Type &type) const = 0 |
void | registerAction(const QString &actionName, QObject *dest, const char *requestSlot, const char *doneSlot) const |
virtual QString | udi() const = 0 |
virtual QString | vendor() const = 0 |
Detailed Description
This class specifies the interface a device will have to comply to in order to be used in the system.
Backends will have to implement it to gather and modify data in the underlying system. Each device has a set of key/values pair describing its properties. It has also a list of interfaces describing what the device actually is (a cdrom drive, a portable media player, etc.)
@author Kevin Ottens <ervin@kde.org>
Member Function Documentation
Device::Device(QObject *parent = nullptr)
Constructs a Device
[override virtual noexcept]
Device::~Device()
Destruct the Device object
void Device::broadcastActionDone(const QString &actionName, int error = Solid::NoError, const QString &errorString = QString()) const
Allows to broadcast that an action just completed in a device to all the corresponding devices in other processes.
@param actionName name of the action which just completed @param error error code if the action failed @param errorString message describing a potential error
void Device::broadcastActionRequested(const QString &actionName) const
Allows to broadcast that an action just got requested on a device to all the corresponding devices in other processes.
@param actionName name of the action which just completed
[pure virtual]
QObject *Device::createDeviceInterface(const Solid::DeviceInterface::Type &type)
Create a specialized interface to interact with the device corresponding to a particular device interface.
@param type the device interface type @returns a pointer to the device interface if supported by the device, 0 otherwise
[pure virtual]
QString Device::description() const
Retrieves the description of device.
@return the description
[virtual]
QString Device::displayName() const
Retrieves the display name to use for this device. Same as description when not defined.
@return the display name @since 5.71
[pure virtual]
QStringList Device::emblems() const
Retrieves the name of the emblems representing the state of this device. The naming follows the freedesktop.org specification.
@return the emblem names
[pure virtual]
QString Device::icon() const
Retrieves the name of the icon representing this device. The naming follows the freedesktop.org specification.
@return the icon name
[virtual]
QString Device::parentUdi() const
Retrieves the Universal Device Identifier (UDI) of the Device's parent.
@returns the Universal Device Identifier of the parent device
[pure virtual]
QString Device::product() const
Retrieves the name of the product corresponding to this device.
@return the product name
[pure virtual]
bool Device::queryDeviceInterface(const Solid::DeviceInterface::Type &type) const
Tests if a property exist.
@param type the device interface type @returns true if the device interface is provided by this device, false otherwise
void Device::registerAction(const QString &actionName, QObject *dest, const char *requestSlot, const char *doneSlot) const
Register an action for the given device. Each time the same device in another process broadcast the begin or the end of such action, the corresponding slots will be called in the current process.
@param actionName name of the action to register @param dest the object receiving the messages when the action begins and ends @param requestSlot the slot processing the message when the action begins @param doneSlot the slot processing the message when the action ends
[pure virtual]
QString Device::udi() const
Retrieves the Universal Device Identifier (UDI) of the Device. This identifier is unique for each device in the system.
@returns the Universal Device Identifier of the current device
[pure virtual]
QString Device::vendor() const
Retrieves the name of the device vendor.
@return the vendor name