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).
129 lines
2.8 KiB
C++
Executable File
129 lines
2.8 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
|
|
*/
|
|
#include "WebSocketInterface/Messages/reply_message.h"
|
|
#include "WebSocketInterface/json_keys.h"
|
|
|
|
#include <QtCore/QUuid>
|
|
#include <QtCore/QJsonDocument>
|
|
#include <QtGlobal>
|
|
namespace TrainingAreaBase
|
|
{
|
|
namespace WebSocketInterface
|
|
{
|
|
|
|
using namespace JsonKeys;
|
|
|
|
namespace Messages
|
|
{
|
|
|
|
|
|
|
|
QString ReplyMessage::toJsonString() const
|
|
{
|
|
return QString::fromUtf8(QJsonDocument(m_jsonRepresentation).toJson(QJsonDocument::Compact));
|
|
}
|
|
|
|
ReplyMessage::ReplyMessage(const QString &type, const int typeId, const QString &uuid)
|
|
: LtsWebSocket::ReplyMessage(type, typeId, uuid)
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
OkMessage::OkMessage(const OkMessage::OkData &data)
|
|
: ReplyMessage(OK(), 1, data.uuid)
|
|
{
|
|
m_jsonRepresentation.insert(DATA(),
|
|
QJsonObject({
|
|
{MESSAGE_TYPE(), data.messageType},
|
|
{INFO(), data.info}
|
|
}));
|
|
}
|
|
|
|
|
|
|
|
ErrorMessage::ErrorMessage(const ErrorMessage::ErrorData &data)
|
|
: ReplyMessage(ERROR_(), -1, data.uuid)
|
|
{
|
|
m_jsonRepresentation.insert(DATA(),
|
|
QJsonObject({
|
|
{ERROR_CLASS(), data.errorClass},
|
|
{ERROR_MESSAGE(), data.errorMessage}
|
|
}));
|
|
}
|
|
|
|
|
|
|
|
|
|
QJsonObject BiteDataMessage::ErrorText::toJson() const
|
|
{
|
|
return QJsonObject({{LANG(), lang},
|
|
{_TEXT(), text}
|
|
});
|
|
}
|
|
|
|
QJsonObject BiteDataMessage::ConfigurationError::toJson() const
|
|
{
|
|
return QJsonObject({{COMPONENT_NAME(), componentName},
|
|
{_TEXT(), text}
|
|
});
|
|
}
|
|
|
|
QJsonObject BiteDataMessage::BasicError::toJson() const
|
|
{
|
|
return QJsonObject({{ERROR_TEXT(), text}});
|
|
}
|
|
|
|
|
|
QJsonObject BiteDataMessage::BiteError::toJson() const
|
|
{
|
|
return QJsonObject({{ERROR_TEXT(), vecToPath(errorTexts)},
|
|
{DEVICE_ID(), deviceId},
|
|
{SUBDEVICE(), subDevice},
|
|
{UNIQUE_ID(), uniqueId},
|
|
{ERROR_NO(), errorNo},
|
|
});
|
|
}
|
|
|
|
|
|
BiteDataMessage::BiteDataMessage(const BiteDataMessage::BiteData &data, const QString &uuid)
|
|
: ReplyMessage(BITE_DATA(), 2, uuid)
|
|
{
|
|
m_jsonRepresentation.insert(DATA(),
|
|
QJsonObject({{EQUIP_NO(), data.equipNo},
|
|
{BOX(), data.box},
|
|
{LAST_UPDATE(), data.lastUpdate},
|
|
{BITE_ERRORS(), vecToPath(data.biteErrors)},
|
|
{CONFIGURATION_ERRORS(), vecToPath(data.configurationErrors)},
|
|
{BASIC_ERRORS(), vecToPath(data.basicErrors)},
|
|
{LAST_POSITION_UPDATE(), data.lastPositionUpdate},
|
|
{IS_LICENSED(), data.isLicensed}
|
|
}));
|
|
}
|
|
|
|
|
|
PositionMessage::PositionMessage(const PositionMessage::PositionData &data, const QString &uuid)
|
|
: ReplyMessage(POSITION_DATA(), 3, uuid)
|
|
{
|
|
m_jsonRepresentation.insert(DATA(),
|
|
QJsonObject({{EQUIP_NO(), data.equipNo},
|
|
{POS_LAT(), data.pos.lat},
|
|
{POS_LON(), data.pos.lon},
|
|
{POS_Z(), data.pos.z},
|
|
{LAST_POSITION_UPDATE(), data.gpsTime}
|
|
}));
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
}
|