Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions codeless banner

QBluetoothRfcommSocket Class Reference
[QtBluetoothModule]

The QBluetoothRfcommSocket class represents an RFCOMM client socket. More...

    #include <QBluetoothRfcommSocket>

Inherits QBluetoothAbstractSocket.

Public Functions

Additional Inherited Members


Detailed Description

The QBluetoothRfcommSocket class represents an RFCOMM client socket.

The Bluetooth RFCOMM protocol provides emulation of serial ports over the lower-level protocols of Bluetooth, namely L2CAP. The implementation of RFCOMM protocol under Linux uses sockets, and is in general very similar to TCP socket programming. QBluetoothRfcommSockets are thus stream oriented network sockets and share many of the interface aspects of the Qt TCP sockets.

The channel and address of the connected peer are fetched by calling remoteChannel() and remoteAddress(). localAddress() return address of the local socket.

See also QBluetoothRfcommServer and QBluetoothAbstractSocket.


Member Function Documentation

QBluetoothRfcommSocket::QBluetoothRfcommSocket ( QObject * parent = 0 )

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

QBluetoothRfcommSocket::~QBluetoothRfcommSocket ()

Destroys the socket.

bool QBluetoothRfcommSocket::connect ( const QBluetoothAddress & local, const QBluetoothAddress & remote, int channel, QBluetooth::SecurityOptions options = 0 )

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

Optionally the client can request that the connection be secured by specifying the options parameter. NOTE: This feature might not work under some systems. The options will be set but might be ignored by the implementation.

The function returns true if the connection process 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().

bool QBluetoothRfcommSocket::isAuthenticated () const

Returns true if the socket is authenticated.

See also securityOptions() and isEncrypted().

bool QBluetoothRfcommSocket::isEncrypted () const

Returns true if the socket is encrypted.

See also securityOptions() and isAuthenticated().

QBluetoothAddress QBluetoothRfcommSocket::localAddress () const

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

See also remoteAddress() and remoteChannel().

QBluetoothAddress QBluetoothRfcommSocket::remoteAddress () const

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

See also localAddress() and remoteChannel().

int QBluetoothRfcommSocket::remoteChannel () const

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

See also remoteAddress() and localAddress().

QBluetooth::SecurityOptions QBluetoothRfcommSocket::securityOptions () const

Returns the security options currently active for the socket.

See also isAuthenticated() and isEncrypted().


Copyright © 2009 Trolltech Trademarks
Qt Extended 4.4.3