Device Class Reference
from PyKDE4.solid import *
Namespace: Solid
Detailed Description
This class allows applications to deal with devices available in the underlying system.
Device stores a reference to device data provided by the backend. Device objects are designed to be used by value. Copying these objects is quite cheap, so using pointers to the me is generally not needed.
Methods | |
__init__ (self, QString udi=QString()) | |
__init__ (self, Solid.Device device) | |
Solid.DeviceInterface | asDeviceInterface (self, Solid.DeviceInterface.Type type) |
Solid.DeviceInterface | asDeviceInterface (self, Solid.DeviceInterface.Type type) |
QString | icon (self) |
bool | isDeviceInterface (self, Solid.DeviceInterface.Type type) |
bool | isValid (self) |
Solid.Device | parent (self) |
QString | parentUdi (self) |
QString | product (self) |
QString | udi (self) |
QString | vendor (self) |
Static Methods | |
[Solid.Device] | allDevices () |
[Solid.Device] | listFromQuery (Solid.Predicate predicate, QString parentUdi=QString()) |
[Solid.Device] | listFromQuery (QString predicate, QString parentUdi=QString()) |
[Solid.Device] | listFromType (Solid.DeviceInterface.Type type, QString parentUdi=QString()) |
Method Documentation
__init__ | ( | self, | ||
QString | udi=QString() | |||
) |
Constructs a device for a given Universal Device Identifier (UDI).
- Parameters:
-
udi the udi of the device to create
__init__ | ( | self, | ||
Solid.Device | device | |||
) |
Constructs a copy of a device.
- Parameters:
-
device the device to copy
[Solid.Device] allDevices | ( | ) |
Retrieves all the devices available in the underlying system.
- Returns:
- the list of the devices available
Solid.DeviceInterface asDeviceInterface | ( | self, | ||
Solid.DeviceInterface.Type | type | |||
) |
Retrieves a specialized interface to interact with the device corresponding to a particular device interface.
- Parameters:
-
type the device interface type
- Returns:
- a pointer to the device interface interface if it exists, 0 otherwise
Solid.DeviceInterface asDeviceInterface | ( | self, | ||
Solid.DeviceInterface.Type | type | |||
) |
Retrieves a specialized interface to interact with the device corresponding to a particular device interface.
- Parameters:
-
type the device interface type
- Returns:
- a pointer to the device interface interface if it exists, 0 otherwise
QString icon | ( | self ) |
Retrieves the name of the icon representing this device. The naming follows the freedesktop.org specification.
- Returns:
- the icon name
bool isDeviceInterface | ( | self, | ||
Solid.DeviceInterface.Type | type | |||
) |
Tests if a device interface is available from the device.
- Parameters:
-
type the device interface type to query
- Returns:
- true if the device interface is available, false otherwise
bool isValid | ( | self ) |
Indicates if this device is valid. A device is considered valid if it's available in the system.
- Returns:
- true if this device is available, false otherwise
[Solid.Device] listFromQuery | ( | Solid.Predicate | predicate, | |
QString | parentUdi=QString() | |||
) |
Retrieves a list of devices of the system given matching the given constraints (parent and predicate)
- Parameters:
-
predicate Predicate that the devices we're searching for must verify parentUdi UDI of the parent of the devices we're searching for, or QString() if there's no constraint on the parent
- Returns:
- the list of devices corresponding to the given constraints
- See also:
- Solid.Predicate
[Solid.Device] listFromQuery | ( | QString | predicate, | |
QString | parentUdi=QString() | |||
) |
Convenience function see above.
- Parameters:
-
predicate parentUdi
- Returns:
- the list of devices
[Solid.Device] listFromType | ( | Solid.DeviceInterface.Type | type, | |
QString | parentUdi=QString() | |||
) |
Retrieves a list of devices of the system given matching the given constraints (parent and device interface type)
- Parameters:
-
type device interface type available on the devices we're looking for, or DeviceInterface.Unknown if there's no constraint on the device interfaces parentUdi UDI of the parent of the devices we're searching for, or QString() if there's no constraint on the parent
- Returns:
- the list of devices corresponding to the given constraints
- See also:
- Solid.Predicate
Solid.Device parent | ( | self ) |
Retrieves the parent of the Device.
- Returns:
- the device's parent
- See also:
- parentUdi()
QString parentUdi | ( | self ) |
Retrieves the Universal Device Identifier (UDI) of the Device's parent.
- Returns:
- the udi of the device's parent
QString product | ( | self ) |
Retrieves the name of the product corresponding to this device.
- Returns:
- the product name
QString udi | ( | self ) |
Retrieves the Universal Device Identifier (UDI).
- Warning:
- Don't use the UDI for anything except communication with Solid. Also don't store UDIs as there's no guarantee that the UDI stays the same when the hardware setup changed. The UDI is a unique identifier that is local to the computer in question and for the current boot session. The UDIs may change after a reboot. Similar hardware in other computers may have different values; different hardware could have the same UDI.
- Returns:
- the udi of the device
QString vendor | ( | self ) |
Retrieves the name of the device vendor.
- Returns:
- the vendor name