Bring the validation-scope line (in-tree Jenkins CI copy, lcov coverage wiring, step-by-step release-scope README, TetraIF unit tests, the LogView runtime icon/resource fix, Dockerfile, rpmbuild and the new_docker_build.sh driver with the DEB output path) on top of the XmlPatterns branch pruned to the Release 2 scope. Conflict policy: - Out-of-scope targets/modules: keep the prune (deletion wins). - In-scope files that validation had deleted: restored from story/release-2-cleanup (the Release 2 closure, with the pruned-module guards). - In-scope sources carrying migration work: XmlPatterns versions (Qt XmlPatterns rework on QDomDocument, DDS member and logger fixes, first-build fixes). - Scope-aware CMakeLists (top level, PluginInterfaces, LtsWidgets) and .envrc: story/release-2-cleanup / ours versions.
167 lines
2.9 KiB
C++
Executable File
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);
|
|
};
|
|
|
|
}
|
|
}
|
|
}
|
|
|