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  · 

QtopiaNetworkInterface Class Reference
[QtBaseModule]

The QtopiaNetworkInterface class describes the minimum interface that a network plug-in must provide. More...

    #include <QtopiaNetworkInterface>

Inherits QObject.

Public Types

  • enum Error { NoError, NotConnected, NotInitialized, NotAvailable, UnknownError }
  • enum Status { Unknown, Down, Up, Pending, Demand, Unavailable }

Public Functions

  • 29 public functions inherited from QObject

Additional Inherited Members

  • 1 property inherited from QObject
  • 1 public slot inherited from QObject
  • 1 signal inherited from QObject
  • 1 public type inherited from QObject
  • 4 static public members inherited from QObject
  • 7 protected functions inherited from QObject
  • 2 protected variables inherited from QObject

Detailed Description

The QtopiaNetworkInterface class describes the minimum interface that a network plug-in must provide.

The QtopiaNetworkServer interacts with Linux network devices via network plug-ins. Each plug-in implements this interface. It allows to start() and stop() network devices, changes to the routing table via setDefaultGateway() and provides access to the status() and Linux device() name.

Note that applications should usually not handle QtopiaNetworkInterface instances directly. This interface is only of interest to device integrators intending to implement their own network plug-ins. Most functions of this interface have a public equivalent which can be used by application developer wanting to utilise network facilities:

QtopiaNetworkInterface callPublic replacement call
cleanup()none (internally used by network server only)
configuration()can be savely called from any Qt Extended application that intends to configure the interface.
device()use QNetworkDevice::interfaceName()
initialize()none (internally used by network server only)
setDefaultGateway()use QtopiaNetwork::setDefaultGateway() and QtopiaNetwork::unsetDefaultGateway()
setProperties()no equivalent available (use configuration())
start()use QtopiaNetwork::startInterface()
status()use QNetworkDevice::state() and QNetworkDevice::stateChanged()
stop()use QtopiaNetwork::stopInterface()
type()use QNetworkState::deviceType()

Each instance publishes various internal states to the network value space. The network value space can be found under /Network/Interfaces/<config hash>. The hash value uniquely identifies each interface and is generated via:

    QtopiaNetworkInterface* iface = ...
    QString hash = qHash( iface->configuration()->configFile() );

Each QtopiaNetworkInterface instance must publish the following values:

  • Config - the configuration file associated to this interface
  • Error - the last QtopiaNetworkInterface::Error value converted to an integer
  • ErrorString - the human-readable string describing the last error
  • NetDevice - the Linux network interface that this interface is managing e.g., eth0
  • State - the current state (QtopiaNetworkInterface::Status enum converted to integer)

There is no default implementation available for this interface.

See also QtopiaNetworkServer and QtopiaNetworkConfiguration.


Member Type Documentation

enum QtopiaNetworkInterface::Error

This enum identifies the error that occurred.

ConstantValueDescription
QtopiaNetworkInterface::NoError0No error occurred.
QtopiaNetworkInterface::NotConnected1The device could not connect to the network or in case of of a PPP connection to the peer server.
QtopiaNetworkInterface::NotInitialized2The network plug-in has not been initialized yet. The interface can be initialized by calling QtopiaNetworkInterface::initialize().
QtopiaNetworkInterface::NotAvailable3The device is not available (e.g. the PCMCIA card is not plugged in).
QtopiaNetworkInterface::UnknownError100An error other than those specified above occurred.

enum QtopiaNetworkInterface::Status

The status provides information about the state of the network interface.

ConstantValueDescription
QtopiaNetworkInterface::Unknown0this is the initial state of a network interface that has not been initialized yet (initialize()). The interface must never return to this state after initialization.
QtopiaNetworkInterface::Down1the interface is ready to be started
QtopiaNetworkInterface::Up2the interface is up and running
QtopiaNetworkInterface::Pending3temporary state of the interface
QtopiaNetworkInterface::Demand4Initiate the link only on demand when data traffic is present
QtopiaNetworkInterface::Unavailable100the interface cannot be started because the network device does not exist and/or cannot be recognised


Member Function Documentation

QtopiaNetworkInterface::~QtopiaNetworkInterface ()   [virtual]

Destroys the QtopiaNetworkInterface instance.

void QtopiaNetworkInterface::cleanup ()   [pure virtual]

Removes all system and config files (e.g., the dialup plug-in deletes the peer and connect/disconnect chat file) created for this interface. However this function must not remove the network configuration file associated with this plug-in instance as this will be done by the network server.

QtopiaNetworkConfiguration * QtopiaNetworkInterface::configuration ()   [pure virtual]

Returns a pointer to allow access to the configuration for this interface. This function must not change the internal state of the current network interface instance. Its sole purpose is to allow applications to change the underlying configuration.

QString QtopiaNetworkInterface::device () const   [pure virtual]

Returns the name of the network device that is used for connections. (e.g., eth0, wlan1, ppp0). This name is only valid if the interface status is not QtopiaNetworkInterface::Unknown or QtopiaNetworkInterface::Unavailable

void QtopiaNetworkInterface::initialize ()   [pure virtual]

Initializes the network interface configuration. The implementation must change the interface state to a value that is not equal to QtopiaNetworkInterface::Unknown.

bool QtopiaNetworkInterface::setDefaultGateway ()   [pure virtual]

This interface becomes the default gateway for the device. This function returns false if the default gateway could not be set.

void QtopiaNetworkInterface::setProperties ( const QtopiaNetworkProperties & properties )   [pure virtual]

The content of properties is written to the network configuration for this interface.

bool QtopiaNetworkInterface::start ( const QVariant options = QVariant() )   [pure virtual]

Starts the network service, returning true on success. options is used to pass optional parameter to the interface. The actual value of options is plug-in specific and plug-in developer may use it for any arbitrary value that might be of importance to the startup code.

Note: This function may only be called by the qpe server. Qt Extended applications should start an interface via QtopiaNetwork::startInterface().

Status QtopiaNetworkInterface::status ()   [pure virtual]

Updates and returns the current status of the interface. At any given time a call to this function should always perform a status check before returning the results.

See also QtopiaNetworkInterface::Status.

bool QtopiaNetworkInterface::stop ()   [pure virtual]

Stops the network service, returning true on success.

Note: This function may only be called by the qpe server. Qt Extended applications should stop a specific interface via QtopiaNetwork::stopInterface() or QtopiaNetwork::shutdown()

QtopiaNetwork::Type QtopiaNetworkInterface::type () const   [pure virtual]

Returns the type of network interface that this particular interface can handle.

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 Qt Labs au hasard

Logo

Le moteur de rendu OpenVG

Les Qt Labs sont les laboratoires des développeurs de Qt, où ils peuvent partager des impressions sur le framework, son utilisation, ce que pourrait être son futur. 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