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

QDeviceIndicatorsProvider Class Reference
[QtBaseModule]

The QDeviceIndicatorsProvider class provides the backend for the QDeviceIndicator API. More...

    #include <QDeviceIndicatorsProvider>

Inherits QObject.

Public Functions

Protected Functions

Additional Inherited Members


Detailed Description

The QDeviceIndicatorsProvider class provides the backend for the QDeviceIndicator API.

QDeviceIndicatorsProvider derived types control the status of device indicators. During construction, derived types usually call addSupportedIndicator() followed by setIndicatorSupportedStates() to set up the indicators they provide. Derived classes must implement the changeIndicatorState() and changeIndicatorAttribute() functions which perform the actual hardware operations involved.

Communication between the frontend QDeviceIndicators and backend QDeviceIndicatorsProvider is facilitated through the Qt Extended Value Space. Whenever the state or attributes of an indicator are modified, the status of the indicators should be reflected in the Value Space via setIndicatorState() and setIndicatorAttribute().

The following table shows a few common attributes and how they could be represented.

Attributetype(units)
Period (Flash state)int (ms)
Duty Cycle(Flash state)int (%)
TransitionTime (Throb state)int (ms)
ColorQColor

Because the indicator names and supported states and attributes are device specific, it is expected that the implementer of the QDeviceIndicatorsProvider derived class will provide these to the user of QDeviceIndicators. If the possible values a particular attribute need to be queryable, then another attribute can be made specifically for this eg a SupportedColors attribute whose type is QList<QColor>. Generally this would not be necessary since the possible supported values should be provided to the user of QDeviceIndicators.

This class is part of the Qt Extended server and a specific implementation should be provided as part of a server task.

See also QDeviceIndicators.


Member Function Documentation

QDeviceIndicatorsProvider::QDeviceIndicatorsProvider ( QObject * parent = 0 )

Create a new QDeviceIndicatorsProvider instance with the specified parent.

void QDeviceIndicatorsProvider::addSupportedIndicator ( const QString & indicator )   [protected]

Add an indicator that this QDeviceIndicatorsProvider instance will provide. changeIndicatorState() callbacks will only occur for indicators added in this way or with setSupportedIndicators(). This function will have no effect and produce a warning if an indicator already exists that is already being provided by this or another provider.

The initial state of the indicator is QDeviceIndicators::Off.

See also setSupportedIndicators().

void QDeviceIndicatorsProvider::changeIndicatorAttribute ( const QString & indicator, const QString & attribute, const QVariant & value )   [pure virtual protected]

Called when the attribute of indicator should be set to a new value. This is usually in response to a QDeviceIndicators::setIndicatorAttribute() call. Subclasses should implement the hardware specific operations from this function.

See also changeIndicatorState().

void QDeviceIndicatorsProvider::changeIndicatorState ( const QString & indicator, QDeviceIndicators::IndicatorState state )   [pure virtual protected]

Called when the indicator should be set to state. This is usually in response to a QDeviceIndicators::setIndicatorState() call. Subclasses should implement the hardware specific operations from this function.

See also changeIndicatorAttribute().

void QDeviceIndicatorsProvider::setIndicatorAttribute ( const QString & indicator, const QString & attribute, const QVariant & value )   [protected]

Sets the published attribute of indicator to value. This is generally called during the changeIndicatorAttribute() callback to reflect the successful change in attribute or at startup to publish the attribute's initial value, but it can be called at any time.

This function has no effect if indicator has not previously been added or set.

See also setIndicatorState().

void QDeviceIndicatorsProvider::setIndicatorState ( const QString & indicator, QDeviceIndicators::IndicatorState state )   [protected]

Set the published indicator state to state. This is generally called during the changeIndicatorState() callback to indicate that the state was successfully changed or at startup to set the initial state, but it can be called at any time.

This function has no effect if indicator has not previously been set up.

See also setIndicatorAttribute().

void QDeviceIndicatorsProvider::setIndicatorSupportedStates ( const QString & indicator, QList<QDeviceIndicators::IndicatorState> states )   [protected]

Sets the published list of the supported states of indicator to states.

This function has no effect if indicator has not previously been set up.

See also setIndicatorState().

void QDeviceIndicatorsProvider::setSupportedIndicators ( const QStringList & indicators )   [protected]

Set the indicators that this QDeviceIndicatorsProvider instance will provide. changeIndicatorState() callbacks will only occur for indicators set in this way or added with addSupportedIndicator(). If an indicator in the in the indicators list is already provided by another QDeviceIndicators instance, then that indicator is not set and a warning is produced.

The initial state of the indicators is QDeviceIndicators::Off.

See also addSupportedIndicator().


Copyright © 2009 Trolltech Trademarks
Qt Extended 4.4.3