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

QSignalSource Class Reference
[QtBaseModule]

The QSignalSource class provides access to information about signal sources on devices. More...

    #include <QSignalSource>

Inherits QHardwareInterface.

Inherited by QSignalSourceProvider.

Public Types

Public Functions

Signals

Additional Inherited Members


Detailed Description

The QSignalSource class provides access to information about signal sources on devices.

Signal sources are accessories that provide radio signal details to Qtopia. A signal source could be an internal modem monitoring the GSM/3G network signal or a wireless LAN interface on VoIP devices as indicated by type(). QSignalSource allows applications to query the availability through availability(), the signal level through signalStrength() and emits signals availabilityChanged() and signalStrengthChanged() when those values change.

In addition to the above hardware related signal sources Qt Extended provides a virtual default signal source. This default source is selected from the list of available QSignalSource providers. The selection may be configured in the Trolltech/HardwareAccessories configuration file. The following keys apply:

keyDecription
SignalSources/DefaultSignalSourceName (ID) of the QSignalSource to use as the default signal source.

If the default signal source is not explicitly configured via the configuration file above a modem signal source is preferred over a WLAN signal source. If there are several signal sources of the same type the first signal source that is created will be used. If the default signal source is configured, but the specified provider does not exist, then QSignalSource becomes invalid. The default signal is provided by the DefaultSignal server task.

A specific QSignalSource can be selected as shown in the following example:

    QSignalSource* src = 0;
    QHardwareManager* manager = new QHardwareManager("QSignalSource", this);
    QStringList providers = man->providers();

    //find a WLAN signal source
    foreach( QString signalSourceId, providers )
    {
        src = new QSignalSource( signalSourceId, this );
        if ( src->type() == "wlan" ) {
            break;
        } else {
            delete src;
            src = 0;
        }
    }

    if ( !src ) {
        //could not find signal source for WLAN
        //fall back to virtual default signal source
        src = new QSignalSource( "DefaultSignal", this );
        if ( src->availability() == QSignalSource::Invalid ) {
            //no signal source available at all
        }
    }

New signal sources can be added to Qt Extended via the QSignalSourceProvider class.

See also QSignalSourceProvider, QHardwareManager, and DefaultSignal.


Member Type Documentation

enum QSignalSource::Availability

Represents whether the signal source is available.

ConstantValueDescription
QSignalSource::Available0The signal source is available.
QSignalSource::NotAvailable1The Signal source is not available. If the signal source is of type "wlan" the signal strength is temporarily not available while the WLAN interface is not connected.
QSignalSource::Invalid2The signal source is not valid. This is distinct from the not available case. A reason for this state could be that QSignalSource was initialised with an invalid/not existing ID or in the case of the default signal source there simply is no signal source available that the default signal source could map to.


Member Function Documentation

QSignalSource::QSignalSource ( const QString & id = QString(), QObject * parent = 0 )

Constructs a new signal source for provider id with the specified parent.

If id is empty, this class will use the default signal source.

QSignalSource::~QSignalSource ()   [virtual]

Destroys the QSignalSource.

Availability QSignalSource::availability () const

Returns the signal source availability.

void QSignalSource::availabilityChanged ( QSignalSource::Availability availability )   [signal]

This signal is emitted whenever the availability of the signal source changes; availability is the new value.

int QSignalSource::signalStrength () const

Returns the signal source strength as a percentage of the maximum strength, or -1 if the strength is unavailable or invalid.

void QSignalSource::signalStrengthChanged ( int signalStrength )   [signal]

This signal is emitted whenever the strength of the signal changes; signalStrength is the new value.

QString QSignalSource::type () const

Returns the type of the signal source, e.g. "wlan", "modem", or an empty string if this signal source is invalid.


Copyright © 2009 Trolltech Trademarks
Qt Extended 4.4.3