Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions codeless banner

QHardwareManager Class Reference
[QtBaseModule]

The QHardwareManager class finds available hardware abstraction providers for a given interface. More...

    #include <QHardwareManager>

Inherits QAbstractIpcInterfaceGroupManager.

Public Functions

Signals

Static Public Members

Additional Inherited Members


Detailed Description

The QHardwareManager class finds available hardware abstraction providers for a given interface.

QHardwareManager is part of the Qt Extended Hardware Abstraction, which provides information about the available hardware devices.

A QHardwareMonitor can be used to monitor the availability of a given type of hardware, providing a list of providers through providers() and emitting signals providerAdded() and providerRemoved() when that list changes. The type of hardware monitored is given as a parameter to constructing the QHardwareMonitor.

The following example responds whenever a new QSignalSource becomes available:

    QHardwareManager* manager = new QHardwareManager( "QSignalSource" );
    connect( manager, SIGNAL(providerAdded(QString)),
        this, SLOT(newBatteryAdded(QString)));

The types of a hardware abstraction is the name of the abstraction classes which implement the interface to the device. Any class that is subclassing QHardwareInterface is considered to be a Qt Extended hardware abstraction.

See also QHardwareInterface, QPowerSource, QSignalSource, and QVibrateAccessory.


Member Function Documentation

QHardwareManager::QHardwareManager ( const QString & interface, QObject * parent = 0 )

Creates a QHardwareManager object and attaches it to parent. interface is the name of the hardware interface that this object is monitoring.

The following code assumes that Qt Extended is running on a device that has a modem as power source (for more details see QPowerStatus and QPowerSource).

    QHardwareManager manager( "QPowerSource" );
    QStringList providers = manager.providers();

    //Qt Extended always has a virtual power source with id DefaultBattery
    providers.contains( "DefaultBattery" ); //always true
    providers.contains( "modem" ); //true

Another way to achieve the same as the above example would be:

    QStringList providers = QHardwareManager::providers<QPowerSource>();
    providers.contains( "DefaultBattery" ); //always true
    providers.contains( "modem" ); //true

QHardwareManager::~QHardwareManager ()   [virtual]

Destroys the QHardwareManager object.

QString QHardwareManager::interface () const

Returns the interface that this object is monitoring.

void QHardwareManager::providerAdded ( const QString & id )   [signal]

This signal is emitted when provider id is added.

void QHardwareManager::providerRemoved ( const QString & id )   [signal]

This signal is emitted when provider id is removed.

QStringList QHardwareManager::providers () const

Returns a list of providers that support the interface that this object was initialized with.

QStringList QHardwareManager::providers ()   [static]

This is an overloaded member function, provided for convenience.

Returns a list of providers which support the given interface of type T. The following example demonstrates how to get the list of providers that supports the QPowerSource interface.

    QStringList providers = QHardwareManager::providers<QPowerSource>();


Copyright © 2009 Nokia Trademarks
Qt Extended 4.4.3