- 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>
346 lines
13 KiB
C++
Executable File
346 lines
13 KiB
C++
Executable File
/**
|
|
* DdsHandlerAes for DDS
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by gr, SLSE, 2015-09-02
|
|
*/
|
|
|
|
#include "dds_handler.h"
|
|
|
|
#include <DDS/Core/pacemaker.h>
|
|
|
|
namespace CentralEffectSimulation
|
|
{
|
|
|
|
DdsHandler::DdsHandler(int domainId, int exerciseId)
|
|
: m_ddsConnector(std::make_shared<DDSConnector::DdsConnector>(domainId, IDL::PartitionType::Exercise, exerciseId))
|
|
, m_participantEventId(0)
|
|
, m_exerciseId(exerciseId)
|
|
{
|
|
DEBUG_LOG() << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
|
}
|
|
|
|
bool DdsHandler::init(const QStringList &qosFileList)
|
|
{
|
|
if (!m_ddsConnector->init(qosFileList))
|
|
{
|
|
ERROR_LOG() << "Error initializing dds connections - aborting";
|
|
return false;
|
|
}
|
|
|
|
// default initialize Publisher and Subscriber
|
|
m_ddsConnector->initPublisherSubscriber();
|
|
m_ddsConnector->enableBatchedWriter(false);
|
|
|
|
// Pacemaker
|
|
m_pacemaker = std::make_shared<Core::Pacemaker>(m_ddsConnector);
|
|
m_topicLockMaster = std::make_shared<Core::TopicLockMaster>(m_ddsConnector);
|
|
|
|
m_dtcCore = Core::Interface::Dtc::create(m_ddsConnector);
|
|
m_dtcCore->enablePartitionTime();
|
|
|
|
m_dtsCes = CentralEffectSimulation::Interface::Dts::create(m_ddsConnector);
|
|
m_dtsCes->enableParticipantEvent();
|
|
m_dtsCes->enableBuildingOwnership();
|
|
m_dtsCes->enableSimulatedMovement();
|
|
|
|
m_ftsCes = CentralEffectSimulation::Interface::Fts::create(m_ddsConnector);
|
|
m_ftsCes->enableDetonationLocation();
|
|
m_ftsCes->enableSetOwnership();
|
|
m_ftsCes->enableSimulatedMovementModify();
|
|
m_ftsCes->enableSimulatedMovementRemove();
|
|
m_ftsCes->enableSimulatedMovementRemoveByParticipantId();
|
|
|
|
m_ftcTab = TrainingAreaBase::Interface::Ftc::create(m_ddsConnector);
|
|
if (!m_ftcTab->enableSendCesHit() ||
|
|
!m_ftcTab->enableSendCesHitInformation() ||
|
|
!m_ftcTab->enableSendGeopairingData() ||
|
|
!m_ftcTab->enableSendParticipantBlockedArea() ||
|
|
!m_ftcTab->enableSendParticipantBeStillWarning() ||
|
|
!m_ftcTab->enableDemandInit())
|
|
{
|
|
ERROR_LOG() << "Could not enable SendCesHit";
|
|
return false;
|
|
}
|
|
|
|
m_ftcBld = Buildings::Interface::Ftc::create(m_ddsConnector);
|
|
if (!m_ftcBld->enableSendCesHitOnBuilding())
|
|
{
|
|
ERROR_LOG() << "Could not enable SendCesHitOnBuilding";
|
|
return false;
|
|
}
|
|
if (!m_ftcBld->enableSendCesHit3DonBuilding())
|
|
{
|
|
ERROR_LOG() << "Could not enable SendCesHit3DonBuilding";
|
|
return false;
|
|
}
|
|
if (!m_ftcBld->enableSetBuildingStates())
|
|
{
|
|
ERROR_LOG() << "Could not enable SetBuildingStates";
|
|
return false;
|
|
}
|
|
|
|
// Subsribe for InfrastructureManagement::MainStructureElement
|
|
m_dtcIsm = InfrastructureManagement::Interface::Dtc::create(m_ddsConnector);
|
|
if (!m_dtcIsm->enableMainFootprint() ||
|
|
!m_dtcIsm->enableMainStructureElement())
|
|
{
|
|
ERROR_LOG() << "Could not enable ISM data topics";
|
|
return false;
|
|
} // if
|
|
m_dtcIsm->waitForHistoricalDataMainFootprint(20000);
|
|
m_dtcIsm->waitForHistoricalDataMainStructureElement(20000);
|
|
|
|
// Subsribe for AreaEffectSimulation::TriggeredExplosions
|
|
m_dtcAes = AreaEffectSimulation::Interface::Dtc::create(m_ddsConnector);
|
|
|
|
if (!m_dtcAes->enableTriggeredImpacts() ||
|
|
!m_dtcAes->enableExplosionSingle() ||
|
|
!m_dtcAes->enableExplosionArea() ||
|
|
!m_dtcAes->enableAesItemView() ||
|
|
!m_dtcAes->enableFunctionalArea() ||
|
|
!m_dtcAes->enableBorderline() ||
|
|
!m_dtcAes->enableNContamination() ||
|
|
!m_dtcAes->enableMineArea() ||
|
|
!m_dtcAes->enableDangerArea() ||
|
|
!m_dtcAes->enableDusSingleMine())
|
|
{
|
|
ERROR_LOG() << "Could not initialize AES data topics";
|
|
return false;
|
|
}
|
|
|
|
DEBUG_LOG() << "create FTC AES";
|
|
m_ftcAes = AreaEffectSimulation::Interface::Ftc::create(m_ddsConnector);
|
|
DEBUG_LOG() << "init FTC AES";
|
|
if (!m_ftcAes->enableAll())
|
|
{
|
|
ERROR_LOG() << "Could not initialize AreaEffectSimulation enableType function topic";
|
|
return false;
|
|
}
|
|
|
|
// Subsribe for ProjectDataManagement::ChargeType
|
|
m_dtcPdm = ProjectDataManagement::Interface::Dtc::create(m_ddsConnector);
|
|
m_dtcPdm->waitForHistoricalDataChargeType(2000);
|
|
|
|
if (!m_dtcPdm->enableChargeType())
|
|
{
|
|
ERROR_LOG() << "Could not initialize ProjectDataManagement enableChargeType data topic client";
|
|
return false;
|
|
}
|
|
|
|
m_dtcPpm = ParticipantManagement::Interface::Dtc::create(m_ddsConnector);
|
|
if (!m_dtcPpm->enableDynamicParticipantData())
|
|
{
|
|
ERROR_LOG() << "Could not initialize ParticipantManagement enableDynamicParticipantData data topic client";
|
|
return false;
|
|
}
|
|
if (!m_dtcPpm->enableParticipantPosition())
|
|
{
|
|
ERROR_LOG() << "Could not initialize ParticipantManagement enableParticipantPosition data topic client";
|
|
return false;
|
|
}
|
|
if (!m_dtcPpm->enableParticipant())
|
|
{
|
|
ERROR_LOG() << "Could not initialize ParticipantManagement enableParticipant data topic client";
|
|
return false;
|
|
}
|
|
if (!m_dtcPpm->enableType())
|
|
{
|
|
ERROR_LOG() << "Could not initialize ParticipantManagement enableType data topic client";
|
|
return false;
|
|
}
|
|
|
|
DEBUG_LOG() << "create FTC PPM";
|
|
m_ftcPpm = ParticipantManagement::Interface::Ftc::create(m_ddsConnector);
|
|
DEBUG_LOG() << "init FTC PPM";
|
|
if (!m_ftcPpm->enableAll())
|
|
{
|
|
ERROR_LOG() << "Could not initialize ParticipantManagement enableType function topic";
|
|
return false;
|
|
}
|
|
|
|
m_dtsTab = TrainingAreaBase::Interface::Dts::create(m_ddsConnector);
|
|
if (!m_dtsTab->enableEquipmentPosition())
|
|
{
|
|
ERROR_LOG() << "Could not initialize TrainingAreaBase enableEquipmentPosition data topic server";
|
|
return false;
|
|
}
|
|
if (!m_ftcTab->enableSendParticipantBlockedArea())
|
|
{
|
|
ERROR_LOG() << "Could not initialize TrainingAreaBase enableSendParticipantBlockedArea function";
|
|
return false;
|
|
}
|
|
|
|
m_dtcBld = Buildings::Interface::Dtc::create(m_ddsConnector);
|
|
if (!m_dtcBld->enableBuildingState())
|
|
{
|
|
ERROR_LOG() << "Could not initialize Buildings data topic client";
|
|
return false;
|
|
}
|
|
|
|
m_dtcTab = TrainingAreaBase::Interface::Dtc::create(m_ddsConnector);
|
|
if (!m_dtcTab->enableGeopairingData())
|
|
{
|
|
ERROR_LOG() << "Could not initialize TrainingAreaBase data topic client";
|
|
return false;
|
|
}
|
|
|
|
m_dtcMdm = MeteoDataManagement::Interface::Dtc::create(m_ddsConnector);
|
|
if (!m_dtcMdm->enableMeteoData())
|
|
{
|
|
ERROR_LOG() << "Could not initialize MeteoData data topic client";
|
|
return false;
|
|
}
|
|
|
|
|
|
// for Elevation :
|
|
m_asmDtc = AssetManagement::Interface::Dtc::create(m_ddsConnector);
|
|
m_asmDtc->waitForHistoricalDataTrainingArea(1000);
|
|
m_exmDtc = ExerciseManagement::Interface::Dtc::create(m_ddsConnector);
|
|
m_exmDtc->waitForHistoricalDataExercise(1000);
|
|
// : for Elevation
|
|
|
|
return true;
|
|
} // end of init
|
|
//-----------------------------------------------------------------------------
|
|
|
|
qint64 DdsHandler::currentPartitionTime() const
|
|
{
|
|
return m_dtcCore->partitionTime().timeStamp();
|
|
}
|
|
|
|
int DdsHandler::participantId2EquipNo(const int participantId) const
|
|
{
|
|
return m_dtcPpm->equipmentNumberByParticipantId(participantId);
|
|
} // end of participantId2EquipNo()
|
|
|
|
int DdsHandler::equipNo2ParticipantId(const int equipmentNumber) const
|
|
{
|
|
return m_dtcPpm->participantIdByEquipmentNumber(equipmentNumber);
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// ///////////////////////////////////
|
|
// P D M (ProjectDataManagement)
|
|
// ///////////////////////////////////
|
|
double DdsHandler::chargeTypeRadius(const AreaEffectSimulation::ChargeStruct &chargeStruct)
|
|
{
|
|
const double radius = m_dtcPdm->impactRadius(chargeStruct.chargeTypeId(), chargeStruct.igniterTypeId(), chargeStruct.igniterFunctionId());
|
|
DEBUG_LOG() << "chargeTypeRadius = " << radius;
|
|
return radius;
|
|
} // getRadiusOfMunition
|
|
|
|
double DdsHandler::chargeHeight(const AreaEffectSimulation::ChargeStruct &chargeStruct)
|
|
{
|
|
const double height = m_dtcPdm->height(chargeStruct.chargeTypeId(), chargeStruct.igniterTypeId(), chargeStruct.igniterFunctionId());
|
|
DEBUG_LOG() << "chargeHeight = " << height;
|
|
return height;
|
|
}
|
|
|
|
bool DdsHandler::isSmartChargeType(const AreaEffectSimulation::ChargeStruct &chargeStruct)
|
|
{
|
|
const bool isSmart = m_dtcPdm->isSmart(chargeStruct.chargeTypeId(), chargeStruct.igniterTypeId(), chargeStruct.igniterFunctionId());
|
|
DEBUG_LOG() << "isSmartChargeType = " << isSmart;
|
|
return isSmart;
|
|
} // isSmartType
|
|
|
|
bool DdsHandler::isSmoke(const AreaEffectSimulation::ChargeStruct &chargeStruct)
|
|
{
|
|
const bool isSmoke = m_dtcPdm->isSmoke(chargeStruct.chargeTypeId(), chargeStruct.igniterTypeId(), chargeStruct.igniterFunctionId());
|
|
DEBUG_LOG() << "isSmoke = " << isSmoke;
|
|
return isSmoke;
|
|
} // isSmoke
|
|
|
|
bool DdsHandler::isLaserGuidable(const AreaEffectSimulation::ChargeStruct &chargeStruct)
|
|
{
|
|
const bool isLaserGuidable = m_dtcPdm->isLaserGuidable(chargeStruct.chargeTypeId(), chargeStruct.igniterTypeId(), chargeStruct.igniterFunctionId());
|
|
DEBUG_LOG() << "isLaserGuidable = " << isLaserGuidable;
|
|
return isLaserGuidable;
|
|
}
|
|
|
|
bool DdsHandler::isJamming(const AreaEffectSimulation::ChargeStruct &chargeStruct)
|
|
{
|
|
const bool isJamming = m_dtcPdm->isJamming(chargeStruct.chargeTypeId(), chargeStruct.igniterTypeId(), chargeStruct.igniterFunctionId());
|
|
DEBUG_LOG() << "isJamming = " << isJamming;
|
|
return isJamming;
|
|
}
|
|
|
|
bool DdsHandler::isDus(const AreaEffectSimulation::ChargeStruct &chargeStruct)
|
|
{
|
|
const bool isDus = m_dtcPdm->mineClass(chargeStruct.chargeTypeId(), chargeStruct.igniterTypeId(), chargeStruct.igniterFunctionId())== AreaEffectSimulation::MineClass::Concrete;
|
|
DEBUG_LOG() << "isDus = " << isDus;
|
|
return isDus;
|
|
}
|
|
|
|
bool DdsHandler::isAtMine(const AreaEffectSimulation::ChargeStruct &chargeStruct)
|
|
{
|
|
const bool isAtMine = m_dtcPdm->isAtMine(chargeStruct.chargeTypeId(), chargeStruct.igniterTypeId(), chargeStruct.igniterFunctionId());
|
|
DEBUG_LOG() << "isAtMine = " << isAtMine;
|
|
return isAtMine;
|
|
}
|
|
|
|
ProjectDataManagement::VolatilityType DdsHandler::volatilityTypeId(const AreaEffectSimulation::ChargeStruct &chargeStruct)
|
|
{
|
|
const ProjectDataManagement::VolatilityType volatilityType= m_dtcPdm->volatilityTypeId(chargeStruct.chargeTypeId(),
|
|
chargeStruct.igniterTypeId(),
|
|
chargeStruct.igniterFunctionId());
|
|
DEBUG_LOG() << "volatilityType=" << volatilityType;
|
|
return volatilityType;
|
|
}
|
|
|
|
int DdsHandler::remainingTasCode(const AreaEffectSimulation::ChargeStruct &chargeStruct) const
|
|
{
|
|
return m_dtcPdm->remainingTasCode(chargeStruct.chargeTypeId(), chargeStruct.igniterTypeId(), chargeStruct.igniterFunctionId());
|
|
}
|
|
|
|
int DdsHandler::secondaryRemainingTasCode(const AreaEffectSimulation::ChargeStruct &chargeStruct) const
|
|
{
|
|
return m_dtcPdm->secondaryRemainingTasCode(chargeStruct.chargeTypeId(), chargeStruct.igniterTypeId(), chargeStruct.igniterFunctionId());
|
|
}
|
|
|
|
int DdsHandler::getLethalRadius(const AreaEffectSimulation::ChargeStruct &chargeStruct) const
|
|
{
|
|
return m_dtcPdm->getLethalRadius(chargeStruct.chargeTypeId(), chargeStruct.igniterTypeId(), chargeStruct.igniterFunctionId());
|
|
}
|
|
|
|
int DdsHandler::getNonLethalRadius(const AreaEffectSimulation::ChargeStruct &chargeStruct) const
|
|
{
|
|
return m_dtcPdm->getNonLethalRadius(chargeStruct.chargeTypeId(), chargeStruct.igniterTypeId(), chargeStruct.igniterFunctionId());
|
|
}
|
|
|
|
int DdsHandler::getHazardDistance(const AreaEffectSimulation::ChargeStruct &chargeStruct) const
|
|
{
|
|
return m_dtcPdm->hazardDistance(chargeStruct.chargeTypeId(), chargeStruct.igniterTypeId(), chargeStruct.igniterFunctionId());
|
|
}
|
|
|
|
ProjectDataManagement::IgniterFunctionBase DdsHandler::getIgniterFunctionBaseFromChargeTypeId(int chargeTypeId, int igniterTypeId, int igniterFunctionId)
|
|
{
|
|
return m_dtcPdm->getChargeTypeIgniterTypeIgniterFunction(chargeTypeId, igniterTypeId, igniterFunctionId).igniterFunctionBaseId();
|
|
}
|
|
|
|
QVector<ProjectDataManagement::CasEffect> DdsHandler::getCasEffects(const AreaEffectSimulation::ChargeStruct &chargeStruct)
|
|
{
|
|
return m_dtcPdm->casEffects(chargeStruct.chargeTypeId(), chargeStruct.igniterTypeId(), chargeStruct.igniterFunctionId());
|
|
}
|
|
|
|
|
|
int32_t DdsHandler::getLegacyIdFromChargeTypeId(const AreaEffectSimulation::ChargeStruct &chargeStruct)
|
|
{
|
|
int32_t legacyId = 0;
|
|
legacyId = m_dtcPdm->getChargeTypeIgniterTypeIgniterFunction(chargeStruct.chargeTypeId(), chargeStruct.igniterTypeId(), chargeStruct.igniterFunctionId()).chargeLegacyId();
|
|
DEBUG_LOG() << "legacyId = " << legacyId;
|
|
return legacyId;
|
|
}
|
|
|
|
int DdsHandler::searchRadius(const AreaEffectSimulation::ChargeStruct &chargeStruct)
|
|
{
|
|
const int searchRadius = m_dtcPdm->searchRadius(chargeStruct.chargeTypeId(), chargeStruct.igniterTypeId(), chargeStruct.igniterFunctionId());
|
|
DEBUG_LOG() << "searchRadius = " << searchRadius;
|
|
return searchRadius;
|
|
} // searchRadius
|
|
|
|
|
|
|
|
} // Namespace CentralEffectSimulation
|