- NGL_ADD_LIBRARY2: 87 CMakeLists.txt konvertiert für Export-Header Generierung - 44 Export-Header Include-Pfade korrigiert (_export.h) - 81 DDS-Stub-Header generiert (*_dtc.h, *_fts.h, *_dts.h, *_ftc.h) - INGLLogger: Duplikat gelöscht, m_logger Member entfernt, variadische Makros - Q_FUNC_INFO Redefinition behoben (Qt6 definiert bereits) - FATAL_LOG Makro hinzugefügt - InfrastructureManagement DDS-Stubs (ism.hpp, ism_enums.hpp, ism_ftc.h) - FilterManagement DDS-Stubs (flt_ftc.h, flt_dts.h) - AreaEffectSimulation DDS-Stubs (aes.hpp, aes_enums.hpp) - SymbolAppearance Klasse vollständig definiert mit content() Methode - BuildingComponentFilter Klasse definiert mit Copy-Konstruktor - Ftc Factory: nullptr Return (abstract class) - AesFilter Klasse in aes.hpp hinzugefügt - Dtc Klasse in ppm.hpp mit participantChanged Signal - AesType Enum: alle 15 At* Werte definiert - AesEffectState_def: EsReceived hinzugefügt - DataModification Enum: eAdded/eModified/eRemoved - function_reply_object.h → core_types.h Include-Pfad (72 Dateien) - Enum-Class-Streaming Template-Operator in INGLLogger.h - ism_mounting_point.h: QImage → QtGui/QImage, QGuiApplication/QScreen - ism_data_plugin_interface.h: QSet Include, Include-Reihenfolge - QRegExp → QRegularExpression in tpm_js_parser.cpp - .underlying() Aufrufe zu direktem Enum-Vergleich korrigiert - Include-Pfade: aes.hpp in symbol_appearance_settings_impl.h und aes_display_filter_impl.h Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
105 lines
3.2 KiB
C++
Executable File
105 lines
3.2 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* Routing Test - main object
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
*/
|
|
|
|
|
|
#include "main_handler.h"
|
|
#include <LtsPluginManager/lts_plugin_loader.h>
|
|
#include <DDS/Generic/topic_type_plugin.h>
|
|
#include <DDS/QosProfile/DDS_DefaultQos.h>
|
|
#include <ExerciseManagement/exm_dtc.h>
|
|
#include <rti/config/Logger.hpp>
|
|
#include <nglapplication/nglloggerhandler.h>
|
|
|
|
#include <Core/core_dts_types.h>
|
|
#include <DDS/Core/pacemaker.h>
|
|
#include <DDS/DTS/generic_dts_impl.h>
|
|
|
|
namespace RoutingService
|
|
{
|
|
|
|
MainHandler::MainHandler()
|
|
: m_logger(getLogger("MainHandler"))
|
|
{
|
|
}
|
|
|
|
MainHandler::~MainHandler()
|
|
{
|
|
m_pacemaker = nullptr;
|
|
shutdown();
|
|
}
|
|
|
|
bool MainHandler::init(int domainIdIn, int domainIdOut, unsigned short tcpPortOut)
|
|
{
|
|
shutdown();
|
|
|
|
if (!DDS::QosProfile::setDefault())
|
|
{
|
|
ERROR_LOG() << "Error setting default QoS from xml-file ";
|
|
return false;
|
|
}
|
|
|
|
NGL::LoggerHandler *lh = NGL::LoggerHandler::getLoggerHandler();
|
|
if (lh)
|
|
{
|
|
const QByteArray postfix = lh->loggerNamePostfix().toLocal8Bit() + "_dds_";
|
|
const QByteArray prefix = lh->loggerNamePrefix().toLocal8Bit();
|
|
|
|
rti::config::Logger &ddsLogger = rti::config::Logger::instance();
|
|
//ddsLogger.output_file(fdopen(STDOUT_FILENO, "w"));
|
|
ddsLogger.output_file_set(postfix.data(), prefix.data(), 10 * 1024 * 1024, 10);
|
|
ddsLogger.verbosity(rti::config::Verbosity_def::WARNING);
|
|
//ddsLogger.verbosity_by_category(rti::config::LogCategory_def::COMMUNICATION, rti::config::Verbosity_def::STATUS_ALL);
|
|
}
|
|
|
|
std::shared_ptr<DDSConnector::DdsConnector> ddsConnectorIn(
|
|
new DDSConnector::DdsConnector(domainIdIn, IDL::PartitionType::Global));
|
|
ddsConnectorIn->initDomainParticipant();
|
|
ddsConnectorIn->initPublisherSubscriber(); // for ExerciseManagement::Exercise, Core::SituationReplay, Heartbeat
|
|
|
|
QUrl tcpDiscoveryUrl;
|
|
tcpDiscoveryUrl.setPort(tcpPortOut);
|
|
std::shared_ptr<DDSConnector::DdsConnector> ddsConnectorOut(
|
|
new DDSConnector::DdsConnector(domainIdOut, IDL::PartitionType::Global, 0, tcpDiscoveryUrl));
|
|
ddsConnectorOut->initDomainParticipant();
|
|
|
|
m_sessionHandler.reset(new SessionHandler(IDL::PartitionType::Exercise, ddsConnectorIn, ddsConnectorOut));
|
|
|
|
m_pacemaker = std::make_shared<Core::Pacemaker>(ddsConnectorIn);
|
|
m_pacemaker->setNewState(Core::RunningState::Starting);
|
|
|
|
m_partitionHandler.reset(new PartitionHandler(ddsConnectorIn));
|
|
connect(m_partitionHandler.get(), &PartitionHandler::createSession,
|
|
m_sessionHandler.get(), &SessionHandler::onCreateSession);
|
|
connect(m_partitionHandler.get(), &PartitionHandler::destroySession,
|
|
m_sessionHandler.get(), &SessionHandler::onDestroySession);
|
|
|
|
if (!m_partitionHandler->init() ||
|
|
!m_sessionHandler->init())
|
|
{
|
|
m_pacemaker->setNewState(Core::RunningState::StartingError);
|
|
return false;
|
|
}
|
|
|
|
const QString ex_0(QString::fromStdString(DDSConnector::DdsConnector::getPartitionString(IDL::PartitionType::Global)));
|
|
m_sessionHandler->onCreateSession(ex_0, ex_0);
|
|
|
|
m_pacemaker->setNewState(Core::RunningState::Running);
|
|
|
|
return true;
|
|
}
|
|
|
|
void MainHandler::shutdown()
|
|
{
|
|
if (m_sessionHandler)
|
|
m_sessionHandler->shutdown();
|
|
m_sessionHandler = nullptr;
|
|
m_partitionHandler = nullptr;
|
|
}
|
|
|
|
} // namespace RoutingService
|