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  · 

QtopiaNetwork Class Reference
[QtBaseModule]

The QtopiaNetwork class provides functions for starting/stopping of network devices/interfaces. More...

    #include <QtopiaNetwork>

Public Types

  • flags Type
  • enum TypeFlag { LAN, WirelessLAN, Dialup, GPRS, ..., BluetoothPAN }

Static Public Members


Detailed Description

The QtopiaNetwork class provides functions for starting/stopping of network devices/interfaces.

In general it allows the managing of existing network configurations. The management functions include the starting and stopping of interfaces and other functions which may be useful for applications which want to influence the connectivity state of Qtopia.

The QtopiaNetworkServer synchronizes network interface operations across all Qt Extended applications. Client applications can request network operations via the static methods provided by this class. The following functions are thin wrapper functions encapsulating IPC calls to the QtopiaNetworkServer which then acts on behalf of the caller:

The second set of static functions relates to the management of network configuration files. By default Qt Extended saves network configurations in the directory returned by settingsDir(). Network interfaces are identified via a handle which is the absolute path and name of the network configuration file containing the parameters for that interface. The network server will choose and load the appropriate network plug-in based on the configuration handle. QNetworkState::deviceType() can be used to determine the type of a network handle. In order to obtain a list of network handles of a particular type availableNetworkConfigs() should be used.

loadPlugin() finds and loads the Qt Extended network plug-in that is suitable for a given network handle. However to avoid multiple access to the same network interface the returned QtopiaNetworkInterface instance should be carefully managed. The most common reason for instanciating a QtopiaNetworkInterface from outside of the network server would be the need to allow the user to configure the interface via QtopiaNetworkInterface::configuration(). The internet application would be an example for such a use case.

QtopiaNetwork only provides a minimum level of monitoring functionality via online(). If more detailed monitoring is required one of the following classes should be used:

  • QNetworkState - very generic connectivity information related to Qtopia
  • QNetworkDevice - specific information about the state of a particular hardware device
  • QNetworkConnection - information beyond the device level such as the remote partner

See also QtopiaNetworkServer.


Member Type Documentation

enum QtopiaNetwork::TypeFlag
flags QtopiaNetwork::Type

This enum is used to describe the type of a network connection.

ConstantValueDescription
QtopiaNetwork::LAN0x00000001Ethernet based network.
QtopiaNetwork::WirelessLAN0x00000002Wireless network.
QtopiaNetwork::Dialup0x00000004The connection is established via a dial-up connection.
QtopiaNetwork::GPRS0x00000008The connection is established via GPRS/UMTS/EDGE.
QtopiaNetwork::Bluetooth0x00001000The network is based on Bluetooth.
QtopiaNetwork::Hidden0x10000000This interface is hidden from the user.
QtopiaNetwork::Custom0x20000000This network plugin must exactly match the network configuration. For more details see QtopiaNetworkFactoryIface::customID().
QtopiaNetwork::Any0x00000000A place holder for any arbitrary network type.

These sub types are used in conjunction with QtopiaNetwork::GPRS and QtopiaNetwork::Dialup only:

ConstantValueDescription
QtopiaNetwork::PhoneModem0x00000010The network connection is established via the internal phone modem (this flag is defined for Cell module only).
QtopiaNetwork::NamedModem0x00000020A serial network connection using a specific device such as /dev/ttyS0 is established. The device name is given in the configuration file.

These sub types specify the type of the external device which is used to establish the connection.

ConstantValueDescription
QtopiaNetwork::PCMCIA0x00000040The network device is an attached PCMCIA card.

These sub types are used in conjunction with QtopiaNetwork::Bluetooth only.

ConstantValueDescription
QtopiaNetwork::BluetoothDUN0X00002000The network connection is established via a local bluetooth device. The remote Bluetooth device acts as Internet gateway as specified by the Dial-up Networking Profile (DNP).
QtopiaNetwork::BluetoothPAN0x00004000This value is reserved for future use in Qtopia.

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


Member Function Documentation

QStringList QtopiaNetwork::availableNetworkConfigs ( QtopiaNetwork::Type type = QtopiaNetwork::Any, const QString & path = QString() )   [static]

Returns a list of all known Qt Extended network interface handles which match type. A handle uniquely identifies a Qt Extended network interfaces and is the absolute path to the configuration file that contains the settings for a particular QtopiaNetworkInterface. path specifies the directory where the lookup takes place.

Note that the lookup is independent of the state of an interface. It always returns all Qt Extended network interfaces which are online and offline.

If type is set to QtopiaNetwork::Any it returns all known NetworkInterfaces. If path is empty the lookup will take place in settingsDir().

QPointer<QtopiaNetworkInterface> QtopiaNetwork::loadPlugin ( const QString & handle )   [static]

Loads the appropriate network plug-in for the interface with handle; or 0 if no suitable plug-in can be found.

Only use this function if you intend to configure the returned QtopiaNetworkInterface via QtopiaNetworkInterface::configuration(). Any other use may trigger undesired behaviour whereby the loaded network interface instance may overshadow the instance created by the QtopiaNetworkServer. For more details see the QtopiaNetworkInterface general class documentation.

bool QtopiaNetwork::online ()   [static]

Returns true if any known network interface is online/connected. This can be used to check the general connectivity status of the Qt Extended environment. A device is considered to be online if it is in the state QtopiaNetwork::Up, QtopiaNetwork::Demand or QtopiaNetwork::Pending.

More detailed state updates on a per device base can be obtained by using QNetworkDevice and overal state change notifications across all network devices are provided by QNetworkState.

void QtopiaNetwork::setDefaultGateway ( const QString & handle )   [static]

The network interface identified by handle becomes the new default gateway. If the device is connected to more than one network at a time this can be used to choose a preferred network for data transfers.

QString QtopiaNetwork::settingsDir ()   [static]

Returns the default directory for network interface configurations; $HOME/Applications/Network/config.

void QtopiaNetwork::shutdown ()   [static]

Stops all active network interfaces.

void QtopiaNetwork::startInterface ( const QString & handle, const QVariant & options = QVariant() )   [static]

Starts that the network interface identified by handle. If the interface is running already this function does nothing.

options is used internally by some network plug-ins. It allows to specify additional parameters which are specific to particular network plug-ins. Otherwise this parameter can safely be ignored.

void QtopiaNetwork::stopInterface ( const QString & handle, bool deleteIface = false )   [static]

Stops the network interface identified by handle. If deleteIface is true the server will delete all configuration information associated to this interface.

void QtopiaNetwork::unsetDefaultGateway ( const QString & handle )   [static]

Qt Extended will set the default gateway to an interface that is not equal to handle. This is useful if handle goes offline and the caller doesn't care what interface should become the new default gateway.

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 64
  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. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. La rubrique Qt a besoin de vous ! 1
Page suivante

Le blog Digia au hasard

Logo

Créer des applications avec un style Metro avec Qt, exemples en QML et C++, un article de Digia Qt traduit par Thibaut Cuvelier

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 qtextended4.4
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