Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qpacketprotocol_p.h
Go to the documentation of this file.
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
20QT_BEGIN_NAMESPACE
21
22class QIODevice;
23
26{
27 Q_OBJECT
28 Q_DECLARE_PRIVATE(QPacketProtocol)
29public:
30 explicit QPacketProtocol(QIODevice *dev, QObject *parent = nullptr);
31
32 void send(const QByteArray &data);
35 bool waitForReadyRead(int msecs = 3000);
36
38 void readyRead();
39 void error();
40
41private:
42 void bytesWritten(qint64 bytes);
43 void readyToRead();
44};
45
46QT_END_NAMESPACE
47
48#endif // QPACKETPROTOCOL_P_H
ImageReaderError error() const
Returns the type of error that occurred last.
QList< QByteArray > packets
bool writeToDevice(const char *bytes, qint64 size)
QList< qint32 > sendingPackets
bool readFromDevice(char *buffer, qint64 size)
The QPacketProtocol class encapsulates communicating discrete packets across fragmented IO channels,...
void send(const QByteArray &data)
Transmit the packet.
bool waitForReadyRead(int msecs=3000)
This function locks until a new packet is available for reading and the \l{QIODevice::}...
qint64 packetsAvailable() const
Returns the number of received packets yet to be read.
QByteArray read()
Return the next unread packet, or an empty QByteArray if no packets are available.