1 | // Copyright (C) 2016 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QPACKETPROTOCOL_P_H |
5 | #define QPACKETPROTOCOL_P_H |
6 | |
7 | #include <QtCore/qobject.h> |
8 | |
9 | // |
10 | // W A R N I N G |
11 | // ------------- |
12 | // |
13 | // This file is not part of the Qt API. It exists purely as an |
14 | // implementation detail. This header file may change from version to |
15 | // version without notice, or even be removed. |
16 | // |
17 | // We mean it. |
18 | // |
19 | |
20 | QT_BEGIN_NAMESPACE |
21 | |
22 | class QIODevice; |
23 | |
24 | class QPacketProtocolPrivate; |
25 | class QPacketProtocol : public QObject |
26 | { |
27 | Q_OBJECT |
28 | Q_DECLARE_PRIVATE(QPacketProtocol) |
29 | public: |
30 | explicit QPacketProtocol(QIODevice *dev, QObject *parent = nullptr); |
31 | |
32 | void send(const QByteArray &data); |
33 | qint64 packetsAvailable() const; |
34 | QByteArray read(); |
35 | bool waitForReadyRead(int msecs = 3000); |
36 | |
37 | Q_SIGNALS: |
38 | void readyRead(); |
39 | void error(); |
40 | |
41 | private: |
42 | void bytesWritten(qint64 bytes); |
43 | void readyToRead(); |
44 | }; |
45 | |
46 | QT_END_NAMESPACE |
47 | |
48 | #endif // QPACKETPROTOCOL_P_H |
49 | |