~ubuntu-branches/ubuntu/wily/qtconnectivity-opensource-src/wily

« back to all changes in this revision

Viewing changes to src/nfc/qllcpsocket_p.h

  • Committer: Package Import Robot
  • Author(s): Lisandro Damián Nicanor Pérez Meyer, Timo Jyrinki
  • Date: 2014-02-23 00:01:49 UTC
  • mfrom: (0.1.3 experimental) (1.1.1)
  • Revision ID: package-import@ubuntu.com-20140223000149-ht3k3x21dr5n5dol
Tags: 5.2.1-1
[ Timo Jyrinki ]
* New upstream release
* Move mkspecs to the new location
* Make private headers cleaning non version specific
* Add examples package
* Add dependencies to build against the 5.2.1 versions

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
**
40
40
****************************************************************************/
41
41
 
42
 
#ifndef QLLCPSOCKET_P_H
43
 
#define QLLCPSOCKET_P_H
44
 
 
45
 
#include "qnfcglobal.h"
46
 
 
47
 
#include "qllcpsocket.h"
48
 
 
49
 
QT_BEGIN_NAMESPACE_NFC
50
 
 
51
 
class QLlcpSocketPrivate
 
42
#ifndef QLLCPSOCKET_H
 
43
#define QLLCPSOCKET_H
 
44
 
 
45
//
 
46
//  W A R N I N G
 
47
//  -------------
 
48
//
 
49
// This file is not part of the Qt API.  It exists purely as an
 
50
// implementation detail.  This header file may change from version to
 
51
// version without notice, or even be removed.
 
52
//
 
53
// We mean it.
 
54
//
 
55
 
 
56
#include <QtCore/QIODevice>
 
57
#include <QtNetwork/QAbstractSocket>
 
58
#include <QtNfc/qnfcglobal.h>
 
59
 
 
60
QT_BEGIN_NAMESPACE
 
61
 
 
62
class QNearFieldTarget;
 
63
class QLlcpSocketPrivate;
 
64
 
 
65
class Q_NFC_EXPORT QLlcpSocket : public QIODevice
52
66
{
53
 
    Q_DECLARE_PUBLIC(QLlcpSocket)
 
67
    Q_OBJECT
 
68
 
 
69
    Q_DECLARE_PRIVATE(QLlcpSocket)
 
70
 
 
71
    friend class QLlcpServerPrivate;
54
72
 
55
73
public:
56
 
    QLlcpSocketPrivate(QLlcpSocket *q);
57
 
 
58
 
    ~QLlcpSocketPrivate();
59
 
    
 
74
    enum SocketState {
 
75
        UnconnectedState = QAbstractSocket::UnconnectedState,
 
76
        ConnectingState = QAbstractSocket::ConnectingState,
 
77
        ConnectedState = QAbstractSocket::ConnectedState,
 
78
        ClosingState = QAbstractSocket::ClosingState,
 
79
        BoundState = QAbstractSocket::BoundState,
 
80
        ListeningState = QAbstractSocket::ListeningState
 
81
    };
 
82
 
 
83
    enum SocketError {
 
84
        UnknownSocketError = QAbstractSocket::UnknownSocketError,
 
85
        RemoteHostClosedError = QAbstractSocket::RemoteHostClosedError,
 
86
        SocketAccessError = QAbstractSocket::SocketAccessError,
 
87
        SocketResourceError = QAbstractSocket::SocketResourceError
 
88
    };
 
89
 
 
90
    explicit QLlcpSocket(QObject *parent = 0);
 
91
    ~QLlcpSocket();
 
92
 
60
93
    void connectToService(QNearFieldTarget *target, const QString &serviceUri);
61
94
    void disconnectFromService();
62
95
 
 
96
    void close();
 
97
 
63
98
    bool bind(quint8 port);
64
99
 
65
100
    bool hasPendingDatagrams() const;
74
109
                         QNearFieldTarget *target, quint8 port);
75
110
    qint64 writeDatagram(const QByteArray &datagram, QNearFieldTarget *target, quint8 port);
76
111
 
77
 
    QLlcpSocket::SocketError error() const;
78
 
    QLlcpSocket::SocketState state() const;
79
 
 
 
112
    SocketError error() const;
 
113
    SocketState state() const;
 
114
 
 
115
    qint64 bytesAvailable() const;
 
116
    bool canReadLine() const;
 
117
 
 
118
    bool waitForReadyRead(int msecs = 30000);
 
119
    bool waitForBytesWritten(int msecs = 30000);
 
120
    virtual bool waitForConnected(int msecs = 30000);
 
121
    virtual bool waitForDisconnected(int msecs = 30000);
 
122
    bool isSequential() const;
 
123
 
 
124
Q_SIGNALS:
 
125
    void connected();
 
126
    void disconnected();
 
127
    void error(QLlcpSocket::SocketError socketError);
 
128
    void stateChanged(QLlcpSocket::SocketState socketState);
 
129
 
 
130
protected:
80
131
    qint64 readData(char *data, qint64 maxlen);
81
132
    qint64 writeData(const char *data, qint64 len);
82
133
 
83
 
    qint64 bytesAvailable() const;
84
 
    bool canReadLine() const;
85
 
 
86
 
    bool waitForReadyRead(int msecs);
87
 
    bool waitForBytesWritten(int msecs);
88
 
    bool waitForConnected(int msecs);
89
 
    bool waitForDisconnected(int msecs);
90
 
 
91
134
private:
92
 
    QLlcpSocket *q_ptr;
 
135
    QLlcpSocket(QLlcpSocketPrivate *d, QObject *parent);
 
136
 
 
137
    QLlcpSocketPrivate *d_ptr;
93
138
};
94
139
 
95
 
QT_END_NAMESPACE_NFC
 
140
QT_END_NAMESPACE
96
141
 
97
 
#endif // QLLCPSOCKET_P_H
 
142
#endif // QLLCPSOCKET_H