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  · 

QBluetoothL2CapSocket Class Reference
[QtBluetoothModule]

The QBluetoothL2CapSocket class represents an L2CAP client socket. More...

    #include <QBluetoothL2CapSocket>

Inherits QBluetoothAbstractSocket.

Public Functions

Additional Inherited Members


Detailed Description

The QBluetoothL2CapSocket class represents an L2CAP client socket.

The Bluetooth L2CAP protocol provides reliable connection-oriented and unreliable connectionless data services. It is a lower layer protocol than RFCOMM. The implementation of L2CAP protocol under Linux uses sockets, and is in general very similar to TCP socket programming.

PSM stands for Port and Service Multiplexer. The PSM value can be any odd value the range of 1-32765. For more information please see Bluetooth Specification Version 2.0 + EDR [vol 4] page 45.

The PSM and address of the connected peer are fetched by calling remotePsm() and remoteAddress() respectively. The localAddress() returns the address of the local device being used by the socket.

Note that special attention should be paid to the incoming and outgoing MTU sizes. These determine in what size chunks the data should be read / written. If preserving the record boundaries when reading is important, then the read buffer size should be set to the value of incomingMtu() using setReadBufferSize() when the socket is connected. If record boundaries are important when writing, the data should only be fed one packet of size <= outgoingMtu() at a time by using write and then waiting for the bytesWritten() signal before sending more data.

See also QBluetoothL2CapServer.


Member Function Documentation

QBluetoothL2CapSocket::QBluetoothL2CapSocket ( QObject * parent = 0 )

Constructs a new QBluetoothL2CapSocket object. The parent parameter is passed to the QObject constructor.

QBluetoothL2CapSocket::~QBluetoothL2CapSocket ()

Destroys the socket.

bool QBluetoothL2CapSocket::connect ( const QBluetoothAddress & local, const QBluetoothAddress & remote, int psm, int incomingMtu = 672, int outgoingMtu = 672, QBluetooth::SecurityOptions options = 0 )

Attempts to open a L2CAP connection between the local device with address local and the remote device with address remote. The L2CAP PSM to use is given by psm. This function should generally return immediately, and the socket will enter into the ConnectingState.

The incomingMtu and outgoingMtu represent the MTU sizes to use for incoming and outgoing data respectively. These parameters should only be considered hints and are subject to negotiation by the underlying stack implementation. If the connection succeeds the actual MTUs should be queried by using incomingMtu() and outgoingMtu() methods.

Optionally, the client can request that that the connection be secured by specifying the options parameter. NOTE: This feature might not work under some systems.

The function returns true if the connection could be started, and false otherwise.

Note that the connection could still fail, the state of the socket will be sent in the stateChanged() signal.

See also state(), connected(), and waitForConnected().

int QBluetoothL2CapSocket::incomingMtu () const

Returns the MTU for incoming data. The underlying implementation will accept data packets of size no bigger than the incoming MTU. The MTU information is provided so that the read buffer size can be set appropriately.

See also outgoingMtu().

bool QBluetoothL2CapSocket::isAuthenticated () const

Returns true if the socket is authenticated.

See also securityOptions() and isEncrypted().

bool QBluetoothL2CapSocket::isEncrypted () const

Returns true if the socket is encrypted.

See also securityOptions() and isAuthenticated().

QBluetoothAddress QBluetoothL2CapSocket::localAddress () const

Returns the address of the local device. If the socket is not currently connected, returns QBluetoothAddress::invalid.

See also remotePsm() and remoteAddress().

int QBluetoothL2CapSocket::outgoingMtu () const

Returns the MTU for outgoing data. The underlying implementation will accept outgoing data packets of size no bigger than the outgoing MTU.

See also incomingMtu().

QBluetoothAddress QBluetoothL2CapSocket::remoteAddress () const

Returns the address of the remote device. If the socket is not currently connected, returns QBluetoothAddress::invalid.

See also remotePsm() and localAddress().

int QBluetoothL2CapSocket::remotePsm () const

Returns the PSM of the remote device. If the socket is not currently connected, returns -1.

See also remoteAddress() and localAddress().

QBluetooth::SecurityOptions QBluetoothL2CapSocket::securityOptions () const

Returns the security options currently active for the socket.

See also isAuthenticated() and isEncrypted().

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 Quarterly au hasard

Logo

Abusons de QMap

Qt Quarterly est la revue trimestrielle proposée par Nokia et à destination des développeurs Qt. Ces articles d'une grande qualité technique sont rédigés par des experts Qt. 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