Detailed Description
The QHardwareInterface class is the base class of all hardware abstraction classes.
QHardwareInterface and the abstraction classes are part of the Qt Extended Hardware Abstraction, which provides information on the availability of physical device and an API for controlling those devices. The device API is split into two sets of classes: iabstraction provider classes and abstraction client classes. Both sets are subclasses of QHardwareInterface.
The provider classes implement device-specific code for controlling the hardware feature and manage the state that is reported to the rest of Qt Extended through the client API. Provider classes are created by passing QAbstractIpcInterface::Server as the mode parameter when constructing QHardwareInterface derived classes.
The client classes provide an API for querying the state of and controlling devices. Client classes communicate with provider classes through an Inter Process Communication (IPC) mechanism. Multiple client instances can connect to a single provider. Client classes are created by passing QAbstractIpcInterface::Client as the mode parameter when constructing QHardwareInterface derived classes.
Qt Extended automatically recognizes any subclass of QHardwareInterface as a Qt Extended hardware abstraction. Each abstraction follows the principal of client and provider split whereby the provider is a subclass of the client class. See the documentation for QAbstractIpcInterface for more information on writing and using interface classes.
The system supports multiple providers of the same interface type. For example, a device could have a primary and secondary battery. Each battery would be exposed as a separate instance of a QPowerSourceProvider derived class. Default devices can be defined in the Trolltech/HardwareAccessories.conf configuration file. The file contains a list of interface names and the identity of the default device, for example:
[Defaults]
QPowerSource = DefaultBattery
QSignalSource = DefaultSignal
QVibrateAccessory = Modem
See also QHardwareManager and QAbstractIpcInterface.
Member Function Documentation
QHardwareInterface::QHardwareInterface ( const QString & name, const QString & id = QString(), QObject * parent = 0, QAbstractIpcInterface::Mode mode = Client )
Constructs a new QHardwareInterface object with interface type name, identity id and operates in mode. The object is attached to parent.
If id is empty the default device for name will be automatically selected.
QHardwareInterface::~QHardwareInterface ()
Destroys the hardware interface object.