Home · All Classes · Grouped Classes · Annotated · Functions

QHardwareManager Class Reference

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

    #include <QHardwareManager>

Inherits QAbstractIpcInterfaceGroupManager.

Public Functions

Signals

Static Public Members

Additional Inherited Members


Detailed Description

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

QHardwareManager is part of the Qtopia Accessory System, which provides information about the available hardware accessories.

A QHardwareMonitor can be used to monitor the availability of a given type of hardware accessory, providing a list of providers through providers() and emitting signals providerAdded() and providerRemoved() when that list changes. The type of hardware accessory 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 hardware accessories are the names of the accessory classes which implement the accessories. Any class that is subclassing QHardwareInterface is considered to be a Qtopia accessory.

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 accessory interface that this object is monitoring.

The following code assumes that Qtopia 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();

    //Qtopia 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 © 2008 Nokia Trademarks
Qtopia 4.3.3