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  · 

QIrServer Class Reference

The QIrServer class represents an Infrared TinyTP server socket. More...

    #include <QIrServer>

Inherits QObject.

Public Functions

  • 29 public functions inherited from QObject

Signals

Additional Inherited Members

  • 1 property inherited from QObject
  • 1 public slot 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 QIrServer class represents an Infrared TinyTP server socket.

This class makes it possible to accept incoming Infrared connections. You can specify the service identifier that this socket represents to be automatically advertised in the IAS database.

Call listen() to make the server listen for new connections. The newConnection() signal will be emmited each time a client connects to the server.

Call nextPendingConnection() to accept the pending client connection.

When listening for connections, server service descriptor is available by calling serverService().

Calling close() will make the QIrServer stop listening for connections and delete all pending connections.

See also QIrSocket.


Member Function Documentation

QIrServer::QIrServer ( QObject * parent = 0 )

Constructs a new QIrServer with parent parent. The server is in the UnconnectedState.

QIrServer::~QIrServer ()

Destroys the server.

void QIrServer::close ()

Closes the server. The server will no longer listen for incoming connections and all pending connections will be closed.

See also isListening() and socketDescriptor().

QString QIrServer::errorString () const

Returns a human-readable description of the last device error that occurred.

See also serverError().

bool QIrServer::hasPendingConnections () const

Returns true if the server has a pending connection(s); otherwise returns false.

See also nextPendingConnection() and setMaxPendingConnections().

bool QIrServer::isListening () const

Returns true if the server is currently listening for remote connections, and false otherwise.

See also close() and socketDescriptor().

bool QIrServer::listen ( const QByteArray & service, QIr::DeviceClasses classes = QIr::OBEX )

Tells the server to listen for incoming connections. The service will be automatically added to the IAS database and an Ir LSAP selector will be automatically chosen.

The classes contains the service hints for this service. If the system supports setting of the service hints they will be set into the IAS database automatically, otherwise passing this parameter will have no effect.

Returns true on success; otherwise returns false.

See also isListening().

int QIrServer::maxPendingConnections () const

Returns the maximum number of pending accepted connections. The default is 1.

See also setMaxPendingConnections() and hasPendingConnections().

void QIrServer::newConnection ()   [signal]

This signal is emitted every time a new connection is available. Call nextPendingConnection() in order to accept the connection.

See also hasPendingConnections() and nextPendingConnection().

QIrSocket * QIrServer::nextPendingConnection ()

Returns the next pending connection as a connected QIrSocket object. The function returns a pointer to a QIrSocket in QIrSocket::ConnectedState that you can use for communicating with the client.

The socket is created as a child of the server, which means that it is automatically deleted when the QIrServer object is destroyed. It is still a good idea to delete the object explicitly when you are done with it, to avoid wasting memory.

A NULL pointer is returned if this function is called when there are no pending connections.

See also hasPendingConnections().

QIr::DeviceClasses QIrServer::serverDeviceClasses () const

Returns the service hint set that this socket has been created with. The service hints are added to the IAS database automatically.

Note that this functionality might not be supported on some systems in which case this function will always return an empty set.

See also listen() and serverService().

QIrSocket::SocketError QIrServer::serverError () const

Returns the last error that has occurred.

See also errorString().

QByteArray QIrServer::serverService () const

Returns the service descriptor this socket has been created with. The service descriptor is added to the IAS database automatically.

See also listen() and serverDeviceClasses().

void QIrServer::setMaxPendingConnections ( int numConnections )

Sets the maximum number of pending accepted connections to numConnections. QIrServer will accept no more than numConnections incoming connections before nextPendingConnection() is called. By default, the limit is 1 pending connection.

See also maxPendingConnections() and hasPendingConnections().

int QIrServer::socketDescriptor () const

Returns the socket descriptor the server is currently listening on. If the server is not listening, then -1 is returned.

See also isListening().

bool QIrServer::waitForNewConnection ( int msecs = 0, bool * timedOut = 0 )

Waits for at most msecs milliseconds or until an incoming connection is available. Returns true if a connection is available; otherwise returns false. If the operation timed out and timedOut is not 0, *timedOut will be set to true.

This is a blocking function call. Its use is not advised in a single-threaded GUI application, since the whole application will stop responding until the function returns. waitForNewConnection() is mostly useful when there is no event loop available.

The non-blocking alternative is to connect to the newConnection() signal.

See also hasPendingConnections() and nextPendingConnection().

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 82
  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. 2017 : un quinquennat pour une nouvelle version du C++ ? Possible, selon Herb Sutter 6
Page suivante

Le Qt Developer Network au hasard

Logo

La création de colonnes dans une ListView en QML

Le Qt Developer Network est un réseau de développeurs Qt anglophone, où ils peuvent partager leur expérience sur le framework. 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


Warning: mysql_connect() [function.mysql-connect]: [2002] Connection refused (trying to connect via tcp://developpez.net:3306) in /home/developpez/www/developpez-com/template/connexion.php on line 7

Warning: mysql_connect() [function.mysql-connect]: Connection refused in /home/developpez/www/developpez-com/template/connexion.php on line 7

Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /home/developpez/www/developpez-com/template/pied.php on line 12