Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Proxies/TrainingAreaBase/Plugins/UAS/plugin_instance.cpp
T
torstenandCopilot 7a6be7474e Qt6 migration: Fix BUILD_RTI=OFF build errors in TrainingAreaBase
- training_area_telegrams.cpp: Fixed QJsonObject initializer syntax (Qt6 requires {{}} not ({}))
- training_area_telegrams.cpp: Fixed fromJson() methods to access m_* members directly
- training_area_telegrams.cpp: Fixed brace mismatches in multiple toJson() methods
- training_area_telegrams.h: Changed Header struct to public members for consistency
- tx_mixin.cpp: Fixed getEquipmentNumber() template for direct member access
- lts_coordinate.cpp: Added missing #include <iomanip>
- MIGRATION_STATUS.md: Added migration progress tracking document

C++17 constraint enforced due to RTI Connext DDS 7.7.0 incompatibility with C++20+

Build status: BUILD_RTI=OFF successful (0 errors, warnings only)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-08-23 20:49:23 +02:00

112 lines
2.7 KiB
C++
Executable File

#include "plugin_instance.h"
#include "from_tab.h"
#include "uav_ia_manager.h"
#include <TrainingAreaBase/send_to_dds.h>
#include <TrainingAreaBase/training_area_telegrams.h>
#include <CentralEffectSimulation/ces_dtc.h>
#include <ProjectDataManagement/pdm_dtc.h>
#include <ParticipantManagement/ppm.hpp>
#include <FileManagement/flm_dtc.h>
#include <FileManagement/flm_ftc.h>
#include <TmsIfAdapter/module_loader.h>
#include <TmsIfAdapter/tms_if_adapter.h>
#include <TmsIfAdapter/uav_commander.h>
#include <QtCore/QCoreApplication>
namespace UAS
{
TmsIfModuleHandle::TmsIfModuleHandle() : m_handle(ModuleLoader::load(QString(QCoreApplication::applicationDirPath() + QStringLiteral("/../lib/")).toStdString())),
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) {}
TmsIfModuleHandle::~TmsIfModuleHandle()
{
try
{
ModuleLoader::unload(m_handle);
}
catch(std::exception &ex)
{
qDebug() << "failed to unload tms-if adapter module! " << ex.what();
}
}
PluginInstance::PluginInstance(TrainingAreaBase::Plugin::DataProvider *dataProvider,
const std::shared_ptr<TrainingAreaBase::RecvFromTab> &sendToDds,
const std::shared_ptr<TrainingAreaBase::DdsHandler> &ddsHandler,
NGL::Settings *settings)
: m_exerciseId(dataProvider->exerciseId())
, m_sendToDds(sendToDds)
, m_settings(settings)
, m_tmsIfAdapter(ModuleLoader::get(m_tmsIfModuleHandle()))
, m_ddsHandler(ddsHandler)
, m_dtcPdm(ProjectDataManagement::Interface::Dtc::create(m_ddsHandler->ddsConnector()))
, m_dtcPpm(ParticipantManagement::Interface::Dtc::create(m_ddsHandler->ddsConnector()))
, m_uavIAManager(new UAVInterfaceAdapterManager(m_ddsHandler, m_sendToDds, m_tmsIfAdapter, m_exerciseId, this))
, m_fromTab(new FromTab(ddsHandler, m_sendToDds, m_uavIAManager, m_exerciseId))
{
DEBUG_LOG(m_logger) << "UAS PluginInstance running!";
if (!m_dtcPdm)
{
WARNING_LOG(m_logger) << "m_dtcPdm failed";
throw std::runtime_error("m_dtcPdm failed");
}
m_dtcPdm->enableChargeType();
m_dtcPdm->waitForHistoricalDataChargeType(3000);
if (!m_dtcPpm)
{
WARNING_LOG(m_logger) << "m_dtcPpm failed";
throw std::runtime_error("m_dtcPpm failed");
}
m_dtcPpm->enableParticipant();
m_dtcPpm->waitForHistoricalDataParticipant(3000);
if (m_tmsIfAdapter.isReady())
{
m_uavIAManager->init();
}
else
{
m_tmsIfAdapter.set_isReady_Callback([this]()
{
m_uavIAManager->init();
});
}
}
bool PluginInstance::init()
{
return true;
}
std::shared_ptr<TrainingAreaBase::SendToTab> PluginInstance::sendToTab()
{
return m_fromTab;
}
bool PluginInstance::canSendData() const
{
return true;
}
}