51 lines
1.2 KiB
C++
Executable File
51 lines
1.2 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* Access Data from TRIMBLE and emit contents as QByteArray
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
*/
|
|
#pragma once
|
|
|
|
#include <QtCore/QThread>
|
|
#include <QtNetwork/QAbstractSocket>
|
|
namespace NGL {
|
|
class INGLLogger;
|
|
}
|
|
class QTcpSocket;
|
|
|
|
/*********************************************************
|
|
* HOWTO: *
|
|
* *
|
|
* - Instantiate this Class without parent(!), *
|
|
* - call init() to establish the connection, on success: *
|
|
* - call start() to move it to the thread *
|
|
*********************************************************/
|
|
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:
|
|
QTcpSocket *m_socket;
|
|
int m_hlaRequestIdentifier;
|
|
NGL::INGLLogger &m_logger;
|
|
|
|
private slots:
|
|
void onReadyRead();
|
|
void onSocketError(const QAbstractSocket::SocketError &error);
|
|
|
|
};
|
|
|
|
|
|
} // Namespace HLA
|