Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions |
The QBluetoothL2CapDatagramSocket class represents an L2CAP Datagram Socket. More...
#include <QBluetoothL2CapDatagramSocket>
Inherits QBluetoothAbstractSocket.
The QBluetoothL2CapDatagramSocket class represents an L2CAP Datagram Socket.
The Bluetooth L2CAP protocol provides reliable connection-oriented and unreliable connectionless data services. It is a lower layer protocol than RFCOMM.
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 implementation of L2CAP Datagram protocol under Linux uses sockets, and is in general very similar to UDP socket programming.
The most common way to use this class is to call connect() and then write() and read() to write and read the data. If you only wish to receive data, call bind() and use the readDatagram() function.
Note that unlike UDP, the L2Cap Datagram socket must be connected first by using connect().
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.
NOTE: The socket is not buffered. All reads and writes happen immediately. The user must be prepared to deal with conditions where no more data could be read/written to the socket.
See also QBluetoothAbstractSocket.
Constructs a new QBluetoothL2CapDatagramSocket object. The parent parameter is passed to the QObject constructor.
Destroys the socket.
Binds an L2CAP socket to a specific local address and psm, returning true if successful; otherwise returns false. The mtu specifies the MTU to use.
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.
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 connected(), stateChanged(), and waitForConnected().
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().
Returns true if the socket is authenticated.
See also securityOptions() and isEncrypted().
Returns true if the socket is encrypted.
See also securityOptions() and isAuthenticated().
Returns the address of the local device. If the socket is not currently connected or bound, returns QBluetoothAddress::invalid.
See also localPsm().
Returns the PSM that the socket is bound to on the local device. If the socket is not bound, returns -1
See also localAddress().
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().
Reads a datagram from the socket. The data specifies the pointer to a buffer of at least maxSize. The address and psm parameters specify where to store the address and psm of the remote device that sent the datagram. The result is discarded if address or psm are NULL.
If the data buffer maxSize is smaller than the incoming MTU, the data that does not fit will be discarded.
Note: Some Linux implementations do not currently return remote address information.
See also incomingMtu().
Returns the address of the remote device. If the socket is not currently connected, returns QBluetoothAddress::invalid.
See also remotePsm().
Returns the PSM of the remote device. If the socket is not currently connected, returns -1.
See also remoteAddress().
Returns the security options currently active for the socket.
See also setSecurityOptions(), isAuthenticated(), and isEncrypted().
Sets the security options on the socket to options. Returns true if the options could be set successfully and false otherwise.
See also securityOptions(), isAuthenticated(), and isEncrypted().
Copyright © 2009 Trolltech | Trademarks | Qt Extended 4.4.3 |