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).
88 lines
2.7 KiB
C++
Executable File
88 lines
2.7 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* PdmHandler for AdlerJson Plugin
|
|
* $Id: pdm_handler.cpp 62304 2024-03-21 08:17:45Z ewert_j $
|
|
* $HeadURL: svn://slssvn/TDS/branches/product/features/ufom/Lts/Proxies/TrainingAreaBase/Plugins/AdlerJson/pdm_handler.cpp $
|
|
* $Author: ewert_j $
|
|
* Created by Julius Ewert, ESIM, 2024-03-20
|
|
*/
|
|
|
|
#include "pdm_handler.h"
|
|
#include <NGLLogger/NGLLoggerBootstrap.h>
|
|
|
|
#include <QtCore/QJsonArray>
|
|
#include <QtCore/QJsonDocument>
|
|
|
|
namespace AdlerJson
|
|
{
|
|
|
|
|
|
PdmHandler::PdmHandler(QObject *parent) : QObject(parent),
|
|
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) {}
|
|
|
|
bool PdmHandler::init(MainDispatcher* mainDispatcher)
|
|
{
|
|
m_dtcPdm = ProjectDataManagement::Interface::Dtc::create(mainDispatcher->ddsHandler()->ddsConnector());
|
|
|
|
if (!m_dtcPdm->enableChargeType())
|
|
{
|
|
ERROR_LOG(m_logger) << "Can not read data from Pdm";
|
|
return false;
|
|
}
|
|
|
|
m_dtcPdm->waitForHistoricalDataChargeType(5000);
|
|
|
|
if (m_dtcPdm->chargeTypes().size() <= 0)
|
|
FATAL_LOG(m_logger) << "Could not fetch ChargeTypes (yet)!";
|
|
return true;
|
|
}
|
|
|
|
void PdmHandler::getChargeTypes()
|
|
{
|
|
DEBUG_LOG(m_logger) << "Get Charge Types";
|
|
QJsonObject obj;
|
|
QJsonArray dataArray;
|
|
obj[QStringLiteral("type")] = QStringLiteral("ApacheHlaSendChargeTypes");
|
|
obj[QStringLiteral("typeId")] = 8005;
|
|
|
|
|
|
QMap<qint32, ProjectDataManagement::ChargeType> chargeTypes = m_dtcPdm->chargeTypes();
|
|
QMap<qint32, ProjectDataManagement::GearType> gearTypes = m_dtcPdm->gearTypes();
|
|
QMap<qint32, ProjectDataManagement::GearTypeChargeType> gearTypeChargeTypes = m_dtcPdm->gearTypeChargeTypes();
|
|
DEBUG_LOG(m_logger) << "Fetched " << chargeTypes.size() << " ChargeTypes to send to WebSocket. Ommiting those without DIS-Entity though.";
|
|
|
|
for(const ProjectDataManagement::ChargeType &charge : chargeTypes)
|
|
{
|
|
if (charge.disEntity.empty())
|
|
continue;
|
|
|
|
QJsonObject chargeType;
|
|
chargeType[QStringLiteral("id")] = charge.id;
|
|
chargeType[QStringLiteral("name")] = QString::fromStdString(charge.name);
|
|
chargeType[QStringLiteral("entityTypeStruct")] = QString::fromStdString(charge.disEntity);
|
|
int gearTypeId = 0;
|
|
|
|
for(const ProjectDataManagement::GearTypeChargeType &val : gearTypeChargeTypes)
|
|
{
|
|
if(val.chargeTypeId == charge.id)
|
|
{
|
|
gearTypeId = val.gearTypeId;
|
|
break;
|
|
}
|
|
}
|
|
chargeType[QStringLiteral("primaryGearTasCode")] = gearTypes[gearTypeId].tasCode;
|
|
QJsonDocument doc = QJsonDocument::fromJson(QByteArray::fromStdString(charge.properties));
|
|
|
|
QJsonObject prop = doc.object();
|
|
chargeType[QStringLiteral("radius")] = prop[QStringLiteral("impactRadius")];
|
|
|
|
dataArray.push_back(chargeType);
|
|
}
|
|
obj[QStringLiteral("data")] = dataArray;
|
|
|
|
emit sendChargeTypes(obj);
|
|
}
|
|
|
|
|
|
}
|