Files
T
berrux-dev 156c2dfcdc Restore legacy @RDE_HEADER@ comment blocks stripped by the Qt6 migration
The migration pipeline dropped the leading @RDE_HEADER@ comment blocks
from 243 target source files (and 2 cmake macros). Restore them
byte-for-byte from the legacy Qt5 tree
(qt5-before/qt5-legatus-legacy): the exact legacy header is re-inserted
at the top of each file (block-comment, '#'-style, line-comment '//'
styles, BOM and surrounding blank lines included). File bodies are
untouched.

Scope: all in-scope target code, unit-test directories excluded.
190 files already kept their legacy header through the migration and
were left as-is; legacy files without an RDE header were not given
one. Special cases: 3 headers sitting after a '#pragma once' line,
1 BOM-prefixed file, 4 '//'-style TetraIF headers. *.grantlee template
files were not in scope and remain untouched.

Verified: every restored file is byte-exact (legacy preamble + original
body) and the ctest baseline is unchanged (20/23 passed, 3 Not Run as
before).
2026-11-15 23:22:04 +01:00

167 lines
2.9 KiB
C++
Executable File

/**
* @RDE_HEADER@
* The ReplyMessage class is an abstract base class for all possible messages which are sent to the client
* $Id$
* $HeadURL$
* $Author$
* Created by Hannes Fritsche, SLSE, 2017-09-07
*/
#pragma once
#include <QtCore/QVector>
#include <QtCore/QJsonObject>
#include <QtCore/QJsonArray>
#include <QtCore/QString>
#include <LtsWebSocket/reply_message.h>
#include <Core/core.hpp>
namespace TrainingAreaBase
{
namespace WebSocketInterface
{
namespace Messages
{
class ReplyMessage : public LtsWebSocket::ReplyMessage
{
public:
ReplyMessage() = default;
virtual ~ReplyMessage() = default;
virtual QString toJsonString() const;
protected:
template<typename T>
static QJsonArray vecToPath(const QVector<T> &data)
{
QJsonArray result;
for (const T &p : data)
result.append(p.toJson());
return result;
}
protected:
explicit ReplyMessage(const QString &type, const int typeId, const QString &uuid);
};
class ErrorMessage final
: public ReplyMessage
{
public:
struct ErrorData
{
int errorClass = 0;
QString uuid;
QString errorMessage;
ErrorData() = default;
explicit ErrorData(int errorClass_, const QString &uuid_, const QString &errorMessage_)
: errorClass(errorClass_)
, uuid(uuid_)
, errorMessage(errorMessage_)
{}
};
explicit ErrorMessage(const ErrorData &data);
explicit ErrorMessage(int errorClass, const QString &uuid, const QString &errorMessage)
: ErrorMessage(ErrorData(errorClass, uuid, errorMessage))
{}
};
class OkMessage final
: public ReplyMessage
{
public:
struct OkData
{
QString uuid;
QString messageType;
QString info;
};
explicit OkMessage(const OkData &data);
};
class BiteDataMessage final
: public ReplyMessage
{
public:
struct ErrorText
{
QString lang;
QString text;
QJsonObject toJson() const;
};
struct BiteError
{
QVector<ErrorText> errorTexts;
int deviceId = 0;
int subDevice = 0;
int uniqueId = 0;
int errorNo = 0;
QJsonObject toJson() const;
};
struct ConfigurationError
{
QString componentName;
QString text;
QJsonObject toJson() const;
};
struct BasicError
{
QString text;
QJsonObject toJson() const;
};
struct BiteData
{
int equipNo = 0;
int box = 0;
QString lastUpdate;
QVector<BiteError> biteErrors;
QVector<ConfigurationError> configurationErrors;
QVector<BasicError> basicErrors;
QString lastPositionUpdate;
bool isLicensed;
QJsonObject toJson() const;
};
explicit BiteDataMessage(const BiteData &data, const QString &uuid);
};
class PositionMessage final
: public ReplyMessage
{
public:
struct PositionData
{
int equipNo = 0;
Core::GeoPosition pos;
qint64 gpsTime = 0;
};
QJsonObject toJson() const;
explicit PositionMessage(const PositionData &data, const QString &uuid);
};
}
}
}