Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

QNetworkConfiguration Class Reference

The QNetworkConfiguration class provides an abstraction of one or more access point configurations. More...

 #include <QNetworkConfiguration>

Public Types

enum Purpose { UnknownPurpose, PublicPurpose, PrivatePurpose, ServiceSpecificPurpose }
enum StateFlag { Undefined, Defined, Discovered, Active }
flags StateFlags
enum Type { InternetAccessPoint, ServiceNetwork, UserChoice, Invalid }

Public Functions

QNetworkConfiguration ()
QNetworkConfiguration ( const QNetworkConfiguration & other )
~QNetworkConfiguration ()
QString bearerName () const
QList<QNetworkConfiguration> children () const
QString identifier () const
bool isRoamingAvailable () const
bool isValid () const
QString name () const
Purpose purpose () const
StateFlags state () const
Type type () const
bool operator!= ( const QNetworkConfiguration & other ) const
QNetworkConfiguration & operator= ( const QNetworkConfiguration & other )
bool operator== ( const QNetworkConfiguration & other ) const

Detailed Description

The QNetworkConfiguration class provides an abstraction of one or more access point configurations.

QNetworkConfiguration encapsulates a single access point or service network. In most cases a single access point configuration can be mapped to one network interface. However a single network interface may not always map to only one access point configuration. Multiple configurations for the same network device may enable multiple access points. An example device that could exhibit such a configuration might be a Smartphone which allows the user to manage multiple WLAN configurations while the device itself has only one WLAN network device.

The QNetworkConfiguration also supports the concept of service networks. This concept allows the grouping of multiple access point configurations into one entity. Such a group is called service network and can be beneficial in cases whereby a network session to a particular destination network is required (e.g. a company network). When using a service network the user doesn't usually care which one of the connectivity options is chosen (e.g. corporate WLAN or VPN via GPRS) as long as he can reach the company's target server. Depending on the current position and time some of the access points that make up the service network may not even be available. Furthermore automated access point roaming can be enabled which enables the device to change the network interface configuration dynamically while maintaining the applications connection to the target network. It allows adaption to the changing environment and may enable optimization with regards to cost, speed or other network parameters.

Special configurations of type UserChoice provide a placeholder configuration which is resolved to an actual network configuration by the platform when a session is opened. Not all platforms support the concept of a user choice configuration.

Configuration states

The list of available configurations can be obtained via QNetworkConfigurationManager::allConfigurations(). A configuration can have multiple states. The Defined configuration state indicates that the configuration is stored on the device. However the configuration is not yet ready to be activated as e.g. a WLAN may not be available at the current time.

The Discovered state implies that the configuration is Defined and the outside conditions are such that the configuration can be used immediately to open a new network session. An example of such an outside condition may be that the Ethernet cable is actually connected to the device or that the WLAN with the specified SSID is in range.

The Active state implies that the configuration is Discovered. A configuration in this state is currently being used by an application. The underlying network interface has a valid IP configuration and can transfer IP packets between the device and the target network.

The Undefined state indicates that the system has knowledge of possible target networks but cannot actually use that knowledge to connect to it. An example for such a state could be an encrypted WLAN that has been discovered but the user hasn't actually saved a configuration including the required password which would allow the device to connect to it.

Depending on the type of configuration some states are transient in nature. A GPRS/UMTS connection may almost always be Discovered if the GSM/UMTS network is available. However if the GSM/UMTS network looses the connection the associated configuration may change its state from Discovered to Defined as well. A similar use case might be triggered by WLAN availability. QNetworkConfigurationManager::updateConfigurations() can be used to manually trigger updates of states. Note that some platforms do not require such updates as they implicitly change the state once it has been discovered. If the state of a configuration changes all related QNetworkConfiguration instances change their state automatically.

See also QNetworkSession and QNetworkConfigurationManager.

Member Type Documentation

enum QNetworkConfiguration::Purpose

Specifies the purpose of the configuration.

ConstantValueDescription
QNetworkConfiguration::UnknownPurpose0The configuration doesn't specify any purpose. This is the default value.
QNetworkConfiguration::PublicPurpose1The configuration can be used for general purpose internet access.
QNetworkConfiguration::PrivatePurpose2The configuration is suitable to access a private network such as an office Intranet.
QNetworkConfiguration::ServiceSpecificPurpose3The configuration can be used for operator specific services (e.g. receiving MMS messages or content streaming).

enum QNetworkConfiguration::StateFlag
flags QNetworkConfiguration::StateFlags

Specifies the configuration states.

ConstantValueDescription
QNetworkConfiguration::Undefined0x0000001This state is used for transient configurations such as newly discovered WLANs for which the user has not actually created a configuration yet.
QNetworkConfiguration::Defined0x0000002Defined configurations are known to the system but are not immediately usable (e.g. a configured WLAN is not within range or the Ethernet cable is currently not plugged into the machine).
QNetworkConfiguration::Discovered0x0000006A discovered configuration can be immediately used to create a new QNetworkSession. An example of a discovered configuration could be a WLAN which is within in range. If the device moves out of range the discovered flag is dropped. A second example is a GPRS configuration which generally remains discovered for as long as the phone has network coverage. A configuration that has this state is also in state QNetworkConfiguration::Defined. If the configuration is a service network this flag is set if at least one of the underlying access points configurations has the Discovered state.
QNetworkConfiguration::Active0x000000eThe configuration is currently used by an open network session (see QNetworkSession::isOpen()). However this does not mean that the current process is the entity that created the open session. It merely indicates that if a new QNetworkSession were to be constructed based on this configuration QNetworkSession::state() would return QNetworkSession::Connected. This state implies the QNetworkConfiguration::Discovered state.

The StateFlags type is a typedef for QFlags<StateFlag>. It stores an OR combination of StateFlag values.

enum QNetworkConfiguration::Type

This enum describes the type of configuration.

ConstantValueDescription
QNetworkConfiguration::InternetAccessPoint0The configuration specifies the details for a single access point. Note that configurations of type InternetAccessPoint may be part of other QNetworkConfigurations of type ServiceNetwork.
QNetworkConfiguration::ServiceNetwork1The configuration is based on a group of QNetworkConfigurations of type InternetAccessPoint. All group members can reach the same target network. This type of configuration is a mandatory requirement for roaming enabled network sessions. On some platforms this form of configuration may also be called Service Network Access Point (SNAP).
QNetworkConfiguration::UserChoice2The configuration is a placeholder which will be resolved to an actual configuration by the platform when a session is opened. Depending on the platform the selection may generate a popup dialog asking the user for his preferred choice.
QNetworkConfiguration::Invalid3The configuration is invalid.

Member Function Documentation

QNetworkConfiguration::QNetworkConfiguration ()

Constructs an invalid configuration object.

See also isValid().

QNetworkConfiguration::QNetworkConfiguration ( const QNetworkConfiguration & other )

Creates a copy of the QNetworkConfiguration object contained in other.

QNetworkConfiguration::~QNetworkConfiguration ()

Frees the resources associated with the QNetworkConfiguration object.

QString QNetworkConfiguration::bearerName () const

Returns the type of bearer. The string is not translated and therefore can not be shown to the user. The subsequent table presents the currently known bearer types:

ValueDescription

Unknown

The session is based on an unknown or unspecified bearer type.

Ethernet

The session is based on Ethernet.

WLAN

The session is based on Wireless LAN.

2G

The session uses CSD, GPRS, HSCSD, EDGE or cdmaOne.

CDMA2000

The session uses CDMA.

WCDMA

The session uses W-CDMA/UMTS.

HSPA

The session uses High Speed Packet Access.

Bluetooth

The session uses Bluetooth.

WiMAX

The session uses WiMAX.

This function returns an empty string if this is an invalid configuration, a network configuration of type QNetworkConfiguration::ServiceNetwork or QNetworkConfiguration::UserChoice.

QList<QNetworkConfiguration> QNetworkConfiguration::children () const

Returns all sub configurations of this network configuration. Only network configurations of type ServiceNetwork can have children. Otherwise this function returns an empty list.

QString QNetworkConfiguration::identifier () const

Returns the unique and platform specific identifier for this network configuration; otherwise an empty string.

bool QNetworkConfiguration::isRoamingAvailable () const

Returns true if this configuration supports roaming; otherwise false.

bool QNetworkConfiguration::isValid () const

Returns true if this QNetworkConfiguration object is valid. A configuration may become invalid if the user deletes the configuration or the configuration was default-constructed.

The addition and removal of configurations can be monitored via the QNetworkConfigurationManager.

See also QNetworkConfigurationManager.

QString QNetworkConfiguration::name () const

Returns the user visible name of this configuration.

The name may either be the name of the underlying access point or the name for service network that this configuration represents.

Purpose QNetworkConfiguration::purpose () const

Returns the purpose of this configuration.

The purpose field may be used to programmatically determine the purpose of a configuration. Such information is usually part of the access point or service network meta data.

StateFlags QNetworkConfiguration::state () const

Returns the current state of the configuration.

Type QNetworkConfiguration::type () const

Returns the type of the configuration.

A configuration can represent a single access point configuration or a set of access point configurations. Such a set is called service network. A configuration that is based on a service network can potentially support roaming of network sessions.

bool QNetworkConfiguration::operator!= ( const QNetworkConfiguration & other ) const

Returns true if this configuration is not the same as the other configuration given; otherwise returns false.

QNetworkConfiguration & QNetworkConfiguration::operator= ( const QNetworkConfiguration & other )

Copies the content of the QNetworkConfiguration object contained in other into this one.

bool QNetworkConfiguration::operator== ( const QNetworkConfiguration & other ) const

Returns true, if this configuration is the same as the other configuration given; otherwise returns false.

X

Thank you for giving your feedback.

Make sure it is related to this specific page. For more general bugs and requests, please use the Qt Bug Tracker.

[0]; s.parentNode.insertBefore(ga, s); })();
Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 94
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. Pourquoi les programmeurs sont-ils moins payés que les gestionnaires de programmes ? Manquent-ils de pouvoir de négociation ? 42
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. 2017 : un quinquennat pour une nouvelle version du C++ ? Possible, selon Herb Sutter 9
  7. Qt Commercial : Digia organise un webinar gratuit le 27 mars sur la conception d'interfaces utilisateur et d'applications avec le framework 0
Page suivante

Le blog Digia au hasard

Logo

Déploiement d'applications Qt Commercial sur les tablettes Windows 8

Le blog Digia est l'endroit privilégié pour la communication sur l'édition commerciale de Qt, où des réponses publiques sont apportées aux questions les plus posées au support. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt qtmobility-1.1
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web