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

QNetworkState Class Reference
[QtBaseModule]

The QNetworkState class provides very generic information about the connectivity state of the Qt Extended device. More...

    #include <QNetworkState>

Inherits QObject.

Public Functions

Signals

Static Public Members

Additional Inherited Members


Detailed Description

The QNetworkState class provides very generic information about the connectivity state of the Qt Extended device.

In addition to QtopiaNetwork::online() which returns the current connectivity state QNetworkState provides the connected() and disconnected() signals which are emitted when the connectivity changes. If more specific information about a particular device is required QNetworkDevice should be used.

interfacesOnline() returns the list of interfaces which are online. An network interface is identified via its device handle which is the configuration file that specifies the device parameter. If it is required to enumerate all or a particular type of network devices (regardless of their state) availableNetworkDevices() can be used. The reverse operation is provided by deviceType().

QNetworkState also provides gateway/routing information. The gateway() function returns the devHandle belonging to the network device that currently provides the default route. The defaultGatewayChanged() signal is emitted when the default route changes. The default WAP configuration is returned via defaultWapAccount().

See also QtopiaNetwork, QNetworkDevice, and QNetworkConnection.


Member Function Documentation

QNetworkState::QNetworkState ( QObject * parent = 0 )

Constructs a QNetworkState object with the specified parent.

QNetworkState::~QNetworkState ()   [virtual]

Destructs the QNetworkState object.

QList<QString> QNetworkState::availableNetworkDevices ( QtopiaNetwork::Type type = QtopiaNetwork::Any )   [static]

Returns the list of known network devices of type. If type is QtopiaNetwork::Any it returns all known devices. A device is considered to be known if a configuration file exists for it. The returned Qt Extended network interface handles are equivalent to the full qualified path to the configuration file.

See also QtopiaNetwork::availableNetworkConfigs().

void QNetworkState::connected ()   [signal]

This signal is emitted when Qt Extended changes from offline to online. If the connectivity state of a particular device is required QNetworkDevice::state() should be used.

See also QtopiaNetwork::online().

void QNetworkState::defaultGatewayChanged ( QString handle, const QNetworkInterface & local )   [signal]

This signal is emitted when the default gateway for network packages changes. Such a change usually implies that a new route and new DNS information have been set. handle is the new default interface and local contains the IP details for handle. An empty handle implies that no new default gateway is available. This may happen when the last online interface changes its state to offline.

See also gateway().

QString QNetworkState::defaultWapAccount () const

Returns the default WAP account. If no default account has been set this function returns an empty string. The returned account can be accessed via QWapAccount.

    QNetworkState state;
    QString wapConf = state.defaultWapAccount();
    if ( !wapConf.isEmpty() ) {
        QWapAccount acc( state.defaultWapAccount() );
        QString name = acc.name();  //returns user visibile name
    }

See also QWapAccount.

QtopiaNetwork::Type QNetworkState::deviceType ( const QString & devHandle )   [static]

Returns the type of devHandle.

void QNetworkState::disconnected ()   [signal]

This signal is emitted when Qt Extended changes from online to offline. If the connectivity state of a particular device is required QNetworkDevice::state() should be used.

See also QtopiaNetwork::online().

QString QNetworkState::gateway () const

Returns the handle to the network interface that is currently used as default gateway for network packages. If QtopiaNetwork::online() returns false this function returns an empty string.

QList<QString> QNetworkState::interfacesOnline () const

This function returns the list of all interface which are online at the time of the function call. The returned list contains the device handles for these interfaces.


Copyright © 2009 Trolltech Trademarks
Qt Extended 4.4.3