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).
66 lines
1.9 KiB
C++
Executable File
66 lines
1.9 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* AsmHandler 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/UFomHlaJson/pdm_handler.cpp $
|
|
* $Author: ewert_j $
|
|
* Created by Hanna E. Rathje, 2025-11-18
|
|
*/
|
|
|
|
#include "asm_handler.h"
|
|
#include <NGLLogger/NGLLoggerBootstrap.h>
|
|
|
|
#include <QtCore/QJsonArray>
|
|
#include <QtCore/QJsonDocument>
|
|
#include <LtsUtils/LtsUtilsCore/dds_vector.h>
|
|
|
|
|
|
namespace AdlerJson
|
|
{
|
|
AsmHandler::AsmHandler(QObject *parent)
|
|
: QObject(parent)
|
|
, m_dtcAsm(nullptr)
|
|
, m_ftcAsm(nullptr)
|
|
, m_exerciseId(-1)
|
|
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
|
{}
|
|
|
|
bool AsmHandler::init(MainDispatcher* mainDispatcher)
|
|
{
|
|
m_ftcAsm = AssetManagement::Interface::Ftc::create(mainDispatcher->ddsHandler()->ddsConnector());
|
|
m_ftcAsm->enableAssetModify();
|
|
|
|
m_dtcAsm = AssetManagement::Interface::Dtc::create(mainDispatcher->ddsHandler()->ddsConnector());
|
|
if (!m_dtcAsm->enableAsset())
|
|
{
|
|
ERROR_LOG(m_logger)<<" Can't read data from ASM";
|
|
return false;
|
|
}
|
|
m_exerciseId = mainDispatcher->exerciseId();
|
|
m_dtcAsm->waitForHistoricalDataAsset(1000);
|
|
|
|
return true;
|
|
}
|
|
|
|
|
|
void AsmHandler::modifyAssetAdlerProperties(int assetId, bool isSaaConnected)
|
|
{
|
|
WARNING_LOG(m_logger)<<">> modify asset properties: set exerciseId: "<<m_exerciseId<<" assetName: "<<assetId;
|
|
|
|
AssetManagement::Asset asset = m_dtcAsm->asset(assetId);
|
|
if (asset.id <= 0)
|
|
return;
|
|
|
|
QJsonObject assetPropsObj = QJsonDocument::fromJson(asset.properties.c_str()).object();
|
|
assetPropsObj[QStringLiteral("exerciseId")] = isSaaConnected ? m_exerciseId : -1;
|
|
asset.properties = QJsonDocument(assetPropsObj).toJson().toStdString();
|
|
m_ftcAsm->assetModifyRequest(asset);
|
|
}
|
|
|
|
void AsmHandler::onAssetModifyReply(const Core::FunctionReplyObject &reply)
|
|
{
|
|
DEBUG_LOG(m_logger) << "Got Function Reply error ? "<<reply.error();
|
|
}
|
|
|
|
}
|