• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

Solid

  • Solid
  • Device
Public Member Functions | Static Public Member Functions | List of all members
Solid::Device Class Reference

#include <device.h>

Public Member Functions

 Device (const QString &udi=QString())
 
 Device (const Device &device)
 
 ~Device ()
 
template<class DevIface >
DevIface * as ()
 
template<class DevIface >
const DevIface * as () const
 
DeviceInterface * asDeviceInterface (const DeviceInterface::Type &type)
 
const DeviceInterface * asDeviceInterface (const DeviceInterface::Type &type) const
 
QString description () const
 
QStringList emblems () const
 
QString icon () const
 
template<class DevIface >
bool is () const
 
bool isDeviceInterface (const DeviceInterface::Type &type) const
 
bool isValid () const
 
Device & operator= (const Device &device)
 
Device parent () const
 
QString parentUdi () const
 
QString product () const
 
QString udi () const
 
QString vendor () const
 

Static Public Member Functions

static QList< Device > allDevices ()
 
static QList< Device > listFromQuery (const Predicate &predicate, const QString &parentUdi=QString())
 
static QList< Device > listFromQuery (const QString &predicate, const QString &parentUdi=QString())
 
static QList< Device > listFromType (const DeviceInterface::Type &type, const QString &parentUdi=QString())
 

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.

Author
Kevin Ottens ervin.nosp@m.@kde.nosp@m..org

Definition at line 48 of file device.h.

Constructor & Destructor Documentation

Solid::Device::Device ( const QString &  udi = QString())
explicit

Constructs a device for a given Universal Device Identifier (UDI).

Parameters
udithe udi of the device to create

Definition at line 75 of file device.cpp.

Solid::Device::Device ( const Device &  device)

Constructs a copy of a device.

Parameters
devicethe device to copy

Definition at line 82 of file device.cpp.

Solid::Device::~Device ( )

Destroys the device.

Definition at line 87 of file device.cpp.

Member Function Documentation

QList< Solid::Device > Solid::Device::allDevices ( )
static

Retrieves all the devices available in the underlying system.

Returns
the list of the devices available

Definition at line 65 of file devicemanager.cpp.

template<class DevIface >
DevIface* Solid::Device::as ( )
inline

Retrieves a specialized interface to interact with the device corresponding to a given device interface.

Returns
a pointer to the device interface if it exists, 0 otherwise

Definition at line 238 of file device.h.

template<class DevIface >
const DevIface* Solid::Device::as ( ) const
inline

Retrieves a specialized interface to interact with the device corresponding to a given device interface.

Returns
a pointer to the device interface if it exists, 0 otherwise

Definition at line 251 of file device.h.

Solid::DeviceInterface * Solid::Device::asDeviceInterface ( const DeviceInterface::Type &  type)

Retrieves a specialized interface to interact with the device corresponding to a particular device interface.

Parameters
typethe device interface type
Returns
a pointer to the device interface interface if it exists, 0 otherwise

Definition at line 159 of file device.cpp.

const Solid::DeviceInterface * Solid::Device::asDeviceInterface ( const DeviceInterface::Type &  type) const

Retrieves a specialized interface to interact with the device corresponding to a particular device interface.

Parameters
typethe device interface type
Returns
a pointer to the device interface interface if it exists, 0 otherwise

Definition at line 165 of file device.cpp.

QString Solid::Device::description ( ) const

Retrieves the description of device.

Returns
the description
Since
4.4

Definition at line 146 of file device.cpp.

QStringList Solid::Device::emblems ( ) const

Retrieves the names of the emblems representing the state of this device.

The naming follows the freedesktop.org specification.

Returns
the emblem names
Since
4.4

Definition at line 141 of file device.cpp.

QString Solid::Device::icon ( ) const

Retrieves the name of the icon representing this device.

The naming follows the freedesktop.org specification.

Returns
the icon name

Definition at line 136 of file device.cpp.

template<class DevIface >
bool Solid::Device::is ( ) const
inline

Tests if a device provides a given device interface.

Returns
true if the interface is available, false otherwise

Definition at line 263 of file device.h.

bool Solid::Device::isDeviceInterface ( const DeviceInterface::Type &  type) const

Tests if a device interface is available from the device.

Parameters
typethe device interface type to query
Returns
true if the device interface is available, false otherwise

Definition at line 151 of file device.cpp.

bool Solid::Device::isValid ( ) const

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

Definition at line 97 of file device.cpp.

QList< Solid::Device > Solid::Device::listFromQuery ( const Predicate &  predicate,
const QString &  parentUdi = QString() 
)
static

Retrieves a list of devices of the system given matching the given constraints (parent and predicate)

Parameters
predicatePredicate that the devices we're searching for must verify
parentUdiUDI 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

Definition at line 122 of file devicemanager.cpp.

QList< Solid::Device > Solid::Device::listFromQuery ( const QString &  predicate,
const QString &  parentUdi = QString() 
)
static

Convenience function see above.

Parameters
predicate
parentUdi
Returns
the list of devices

Definition at line 85 of file devicemanager.cpp.

QList< Solid::Device > Solid::Device::listFromType ( const DeviceInterface::Type &  type,
const QString &  parentUdi = QString() 
)
static

Retrieves a list of devices of the system given matching the given constraints (parent and device interface type)

Parameters
typedevice interface type available on the devices we're looking for, or DeviceInterface::Unknown if there's no constraint on the device interfaces
parentUdiUDI 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

Definition at line 100 of file devicemanager.cpp.

Solid::Device & Solid::Device::operator= ( const Device &  device)

Assigns a device to this device and returns a reference to it.

Parameters
devicethe device to assign
Returns
a reference to the device

Definition at line 91 of file device.cpp.

Solid::Device Solid::Device::parent ( ) const

Retrieves the parent of the Device.

Returns
the device's parent
See also
parentUdi()

Definition at line 112 of file device.cpp.

QString Solid::Device::parentUdi ( ) const

Retrieves the Universal Device Identifier (UDI) of the Device's parent.

Returns
the udi of the device's parent

Definition at line 107 of file device.cpp.

QString Solid::Device::product ( ) const

Retrieves the name of the product corresponding to this device.

Returns
the product name

Definition at line 131 of file device.cpp.

QString Solid::Device::udi ( ) const

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

Definition at line 102 of file device.cpp.

QString Solid::Device::vendor ( ) const

Retrieves the name of the device vendor.

Returns
the vendor name

Definition at line 126 of file device.cpp.


The documentation for this class was generated from the following files:
  • device.h
  • device.cpp
  • devicemanager.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:48 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Solid

Skip menu "Solid"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal