The QLlcpSocket class provides an NFC LLCP socket. More...
#include <QLlcpSocket>
Inherits: QIODevice.
This class was introduced in Qt Mobility 1.2.
enum | SocketError { UnknownSocketError, RemoteHostClosedError, SocketAccessError, SocketResourceError } |
enum | SocketState { UnconnectedState, ConnectingState, ConnectedState, ClosingState, BoundState, ListeningState } |
QLlcpSocket ( QObject * parent = 0 ) | |
~QLlcpSocket () | |
bool | bind ( quint8 port ) |
void | connectToService ( QNearFieldTarget * target, const QString & serviceUri ) |
void | disconnectFromService () |
SocketError | error () const |
bool | hasPendingDatagrams () const |
qint64 | pendingDatagramSize () const |
qint64 | readDatagram ( char * data, qint64 maxSize, QNearFieldTarget ** target = 0, quint8 * port = 0 ) |
SocketState | state () const |
virtual bool | waitForConnected ( int msecs = 30000 ) |
virtual bool | waitForDisconnected ( int msecs = 30000 ) |
qint64 | writeDatagram ( const char * data, qint64 size ) |
qint64 | writeDatagram ( const char * data, qint64 size, QNearFieldTarget * target, quint8 port ) |
qint64 | writeDatagram ( const QByteArray & datagram ) |
qint64 | writeDatagram ( const QByteArray & datagram, QNearFieldTarget * target, quint8 port ) |
virtual qint64 | bytesAvailable () const |
virtual bool | canReadLine () const |
virtual void | close () |
virtual bool | isSequential () const |
virtual bool | waitForBytesWritten ( int msecs = 30000 ) |
virtual bool | waitForReadyRead ( int msecs = 30000 ) |
void | connected () |
void | disconnected () |
void | error ( QLlcpSocket::SocketError socketError ) |
void | stateChanged ( QLlcpSocket::SocketState socketState ) |
The QLlcpSocket class provides an NFC LLCP socket.
NFC LLCP protocol is a peer-to-peer communication protocol between two NFC compliant devices.
This enum describes the errors that can occur. The most recent error can be retrieved through a call to error().
Constant | Value | Description |
---|---|---|
QLlcpSocket::UnknownSocketError | QAbstractSocket::UnknownSocketError | An unidentified error has occurred. |
QLlcpSocket::RemoteHostClosedError | QAbstractSocket::RemoteHostClosedError | The remote host closed the connection. |
QLlcpSocket::SocketAccessError | QAbstractSocket::SocketAccessError | The socket operation failed because the application lacked the required privileges. |
QLlcpSocket::SocketResourceError | QAbstractSocket::SocketResourceError | The local system ran out of resources (e.g., too many sockets). |
This enum describes the different state in which a socket can be.
Constant | Value | Description |
---|---|---|
QLlcpSocket::UnconnectedState | QAbstractSocket::UnconnectedState | The socket is not connected. |
QLlcpSocket::ConnectingState | QAbstractSocket::ConnectingState | The socket has started establishing a connection. |
QLlcpSocket::ConnectedState | QAbstractSocket::ConnectedState | A connection is established. |
QLlcpSocket::ClosingState | QAbstractSocket::ClosingState | The socket is about to close. |
QLlcpSocket::BoundState | QAbstractSocket::BoundState | The socket is bound to a local port (for servers). |
QLlcpSocket::ListeningState | QAbstractSocket::ListeningState | The socket is listening for incoming connections (for internal use). |
Construct a new unconnected LLCP socket with parent.
Destroys the LLCP socket.
Binds the LLCP socket to local port. Returns true on success; otherwise returns false.
Reimplemented from QIODevice::bytesAvailable().
Reimplemented from QIODevice::canReadLine().
Reimplemented from QIODevice::close().
Disconnects the socket.
Connects to the service identified by the URI serviceUri on target.
This signal is emitted after connectToService() has been called and a connection has been successfully established.
See also connectToService() and disconnected().
Disconnects the socket.
This signal is emitted when the socket has been disconnected.
See also disconnectFromService().
Returns the type of error that last occurred.
This signal is emitted when an error occurs. The socketError parameter describes the error.
Returns true if at least one datagram (service data units) is waiting to be read; otherwise returns false.
See also pendingDatagramSize() and readDatagram().
Reimplemented from QIODevice::isSequential().
Always returns true.
Returns the size of the first pending datagram (service data unit). If there is no datagram available, this function returns -1.
See also hasPendingDatagrams() and readDatagram().
Receives a datagram no larger than maxSize bytes and stores it in data. The sender's details are stored in target and port (unless the pointers are 0).
Returns the size of the datagram on success; otherwise returns -1.
If maxSize is too small, the rest of the datagram will be lost. To avoid loss of data, call pendingDatagramSize() to determine the size of the pending datagram before attempting to read it. If maxSize is 0, the datagram will be discarded.
See also writeDatagram(), hasPendingDatagrams(), and pendingDatagramSize().
Returns the state of the socket.
This signal is emitted when the state of the socket changes. The socketState parameter describes the new state.
Reimplemented from QIODevice::waitForBytesWritten().
Waits until the socket is connected, up to msecs milliseconds. If the connection has been established, this function returns true; otherwise it returns false. In the case where it returns false, you can call error() to determine the cause of the error.
If msecs is -1, this function will not time out.
Waits until the socket is disconnected, up to msecs milliseconds. If the connection has been disconnected, this function returns true; otherwise it returns false. In the case where it returns false, you can call error() to determine the cause of the error.
If msecs is -1, this function will not time out.
Reimplemented from QIODevice::waitForReadyRead().
Sends the datagram at data of size size to the service that this socket is connected to. Returns the number of bytes sent on success; otherwise return -1;
Sends the datagram at data of size size to the service identified by the URI port on target. Returns the number of bytes sent on success; otherwise returns -1.
See also readDatagram().
This is an overloaded function.
Sends the datagram datagram to the service that this socket is connected to.
This is an overloaded function.
Sends the datagram datagram to the service identified by the URI port on target.