- training_area_telegrams.cpp: Fixed QJsonObject initializer syntax (Qt6 requires {{}} not ({}))
- training_area_telegrams.cpp: Fixed fromJson() methods to access m_* members directly
- training_area_telegrams.cpp: Fixed brace mismatches in multiple toJson() methods
- training_area_telegrams.h: Changed Header struct to public members for consistency
- tx_mixin.cpp: Fixed getEquipmentNumber() template for direct member access
- lts_coordinate.cpp: Added missing #include <iomanip>
- MIGRATION_STATUS.md: Added migration progress tracking document
C++17 constraint enforced due to RTI Connext DDS 7.7.0 incompatibility with C++20+
Build status: BUILD_RTI=OFF successful (0 errors, warnings only)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
65 lines
1.5 KiB
C++
65 lines
1.5 KiB
C++
|
|
|
|
#pragma once
|
|
#include "client_message_factory.h"
|
|
#include "logger.h"
|
|
#include "ltswebsocketserver_export.h"
|
|
|
|
#include <QtCore/QObject>
|
|
#include <QQueue>
|
|
#include <QtCore/QObject>
|
|
#include <memory>
|
|
|
|
class QTimer;
|
|
|
|
namespace LtsWebSocket
|
|
{
|
|
class ConnectionHandler;
|
|
class ClientConnection;
|
|
|
|
class LTSWEBSOCKETSERVER_EXPORT LtsWebSocketServer : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit LtsWebSocketServer(AbstractClientMessageFactory* messageFactory, QObject* parent = nullptr);
|
|
virtual ~LtsWebSocketServer();
|
|
|
|
bool init(const QString& serviceName, const unsigned short port = 0);
|
|
|
|
bool init(const QString& serviceName, const QPair<quint16, quint16>& portRange);
|
|
|
|
void sendToAllClients(ReplyMessage* message);
|
|
|
|
unsigned short webSocketPort() const;
|
|
|
|
void setMessageDelay(qint32 delay);
|
|
signals:
|
|
|
|
void clientDisconnected(ClientConnection* client);
|
|
|
|
void clientConnected(ClientConnection* client);
|
|
|
|
private slots:
|
|
|
|
void onNewTextMessage(ReplyHandler* client, const QString& message);
|
|
|
|
void onQueueTimerTimeout();
|
|
|
|
private:
|
|
struct MessageCredentials
|
|
{
|
|
ReplyHandler* client{nullptr};
|
|
QString message;
|
|
|
|
MessageCredentials(ReplyHandler* client, const QString& message) : client(client), message(message) {}
|
|
};
|
|
|
|
QQueue<MessageCredentials> m_messageQueue;
|
|
QTimer* m_queueTimer{nullptr};
|
|
AbstractClientMessageFactory* m_messageFactory{nullptr};
|
|
std::unique_ptr<ConnectionHandler> m_connectionHandler;
|
|
qint32 m_messageDelay{0};
|
|
LOGGER_T m_logger;
|
|
};
|
|
} // namespace LtsWebSocket
|