Initial commit

This commit is contained in:
torsten committed 2026-08-13 18:33:10 +02:00
commit b7d90b9afe
16245 files changed
+3396666

No files matched your search

+59
View File
@@ -0,0 +1,59 @@
/**
* Connection Handler for the RS232 serial connection to the sfm
* $Id$
* $HeadURL$
* $Author$
* Created by Philipp Dassow, NLST, 2018-01-29
*/
#pragma once
#include <QObject>
#include <QTcpSocket>
#include <LtsUtilsCore/sfm_bytemessage_converter.h>
#include "logger.h"
class QTimer;
namespace EffectShowClient
{
class ConnectionHandlerTcp : public QObject
{
Q_OBJECT
public:
explicit ConnectionHandlerTcp(QObject *parent = nullptr);
~ConnectionHandlerTcp();
bool init();
bool send(const QByteArray &message);
bool open();
void close();
bool isOpen() const;
signals:
/**
* @brief received emits a byte pair with command and payload byte when a available. It is guaranteed that there will be 2 bytes
* @param ba is a byte pair, with command 1st and payload 2nd.
*/
void received(const QByteArray &ba);
void connectedToSerialConverter();
private slots:
void read();
void handleError(QAbstractSocket::SocketError error);
private:
bool isValidCommandByte(const unsigned char command);
bool isValidPayloadByte(const unsigned char payload);
QTcpSocket *m_socket;
QTimer *m_timer;
QByteArray m_currentDataRead;
NGL::INGLLogger &m_logger;
};
} // namespace EffectShowClient