Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Proxies/TrainingAreaBase/Plugins/UAS/plugin_instance.cpp
T
torstenandCopilot 4c9861a469 BUILD_RTI conditional fixes and Qt6 API updates
- cmake/FindRTI.cmake: Add INTERFACE placeholder targets when RTI not found
- cmake/FindRTI.cmake: Force BUILD_RTI=OFF when RTI not installed
- Lts/Common/LtsSession/CMakeLists.txt: Make LtsSessionDataDds conditional on BUILD_RTI
- Lts/Viewer/CMakeLists.txt: Make LtsDataView conditional on BUILD_RTI
- Lts/Plugins/*/CMakeLists.txt: 97 plugin files wrapped in BUILD_RTI conditionals
- cmake/NGLMacros.cmake: Fix NGL_ADD_BIG_RESOURCES macro (removed premature return())
- Multiple Qt6 API fixes: QLinkedList→std::list, QStringRef→QStringView, etc.
- BUILD_RTI_FIXES_SUMMARY.md: Comprehensive documentation of all fixes

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-08-19 09:24:50 +02:00

113 lines
2.6 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 <QCoreApplication>
namespace UAS
{
TmsIfModuleHandle::TmsIfModuleHandle()
: m_handle(ModuleLoader::load(QString(QCoreApplication::applicationDirPath() + QStringLiteral("/../lib/")).toStdString()))
{}
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() << "UAS PluginInstance running!";
if (!m_dtcPdm)
{
WARNING_LOG() << "m_dtcPdm failed";
throw std::runtime_error("m_dtcPdm failed");
}
m_dtcPdm->enableChargeType();
m_dtcPdm->waitForHistoricalDataChargeType(3000);
if (!m_dtcPpm)
{
WARNING_LOG() << "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;
}
}