Files

40 lines
663 B
C++
Executable File

#pragma once
#include <QtCore/QThread>
#include <QtNetwork/QAbstractSocket>
namespace NGL {
class INGLLogger;
}
class QTcpSocket;
namespace HighLevelArchitecture {
class SocketReader : public QThread
{
Q_OBJECT
public:
explicit SocketReader(QObject *parent = nullptr);
bool init(const QString &host, quint16 port, int id);
void stopThread();
~SocketReader();
signals:
void newData(const QByteArray &content, int id);
protected:
NGL::INGLLogger &m_logger;
QTcpSocket *m_socket;
int m_hlaRequestIdentifier;
private slots:
void onReadyRead();
void onSocketError(const QAbstractSocket::SocketError &error);
};
}