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

+43
View File
@@ -0,0 +1,43 @@
/**
* Websocket interface for building control unit
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Ehrlicher, SLSE, 2017-01-30
*/
#pragma once
#include <QTcpServer>
#include "logger.h"
#include "abstract_socket_handler.h"
namespace GuezNasat
{
class TcpSocketHandler : public AbstractSocketHandler
{
Q_OBJECT
public:
explicit TcpSocketHandler(QObject *parent = nullptr);
bool init(quint16 listenPort) override;
bool isConnected() const override
{
return !m_tcpSockets.isEmpty();
}
protected:
bool sendTelegramInternal(const QByteArray &tele) override;
QByteArray parseBuffer(const QByteArray &buffer);
static bool findNextSyncStartByte(const QByteArray &buffer, int &iCurReadPos);
static bool findNextSyncEndByte(const QByteArray &buffer, int &iCurReadPos);
private Q_SLOTS:
void onNewConnection();
void onTcpSocketDisconnected();
void onReadyRead();
private:
QTcpServer *m_tcpSocketServer;
QHash<QTcpSocket *, QByteArray> m_tcpSockets;
};
} // namespace GuezNasat