Files
qt-migration-legatus/qt5-before/dlbo/Lts/Services/ParticipantManagement/dds_handler.cpp
T
torstenandCopilot 7173785915 Qt6 Migration: Complete migration with DDS/RTI support and build validation
Major Changes:
- Merged latest Qt5 devel content from dlbo (292 files changed, 7 new dirs)
- Consolidated forward-declarations and include folders
- Removed unneeded modules per Niklas' repo check list

Build System Fixes:
- Fixed CMake VERSION_GREATER syntax in ParticipantManagement/CMakeLists.txt
- Added VLC packages (libvlc-dev, vlc-plugin-base) to docker_build.sh
- Added PostgreSQL dev packages (libpq-dev, postgresql-server-dev-all) to Dockerfile
- Fixed locale warnings (ANSI_X3.4-1968 → C.UTF-8)
- Fixed ArcGIS SDK path warnings when BUILD_ARCGIS=OFF

Code Generation Fixes:
- Fixed IDL enum collisions (PortType→CorePortType/DdsutPortType, PdmEventType)
- Fixed Grantlee template svc_translation.cpp.grantlee:
  - Changed {{ idl_enum.name }}_def:: to {{ idl_enum.name }}::
  - Fixed .underlying() calls for C++11 scoped enums (enum class)
- Removed generated files from repo (moc_*, *_dtc.h, *_ftc.h)

Validation:
- BUILD_RTI=ON: SUCCESS
- BUILD_RTI=OFF: SUCCESS
- C++17 standard maintained for RTI 7.7 compatibility
- Ubuntu 26.04 Docker environment verified

Remaining Warnings (expected):
- BgViewer, KDChart, KDReports, Poppler-Qt6 not found (optional features)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-09-15 18:20:26 +00:00

164 lines
6.1 KiB
C++

/**
* DdsHandler for PPM
* $Id$
* $HeadURL$
* $Author$
* Created by Hanna E. Rathje, SLSE, 2015-09-02
*/
#include "dds_handler.h"
#include "exercise_time.h"
#include <DDS/Core/pacemaker.h>
#include <DDS/DTS/generic_dts_impl.h>
#include <QThread>
namespace ParticipantManagement
{
DdsHandler::DdsHandler(int domainId, int exerciseId)
: m_ddsConnector(std::make_shared<DDSConnector::DdsConnector>(domainId, exerciseId <= 0 ? IDL::PartitionType::Global : IDL::PartitionType::Exercise, exerciseId))
, m_logger(getLogger("DdsHandler"))
{
DEBUG_LOG(m_logger) << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
}
DdsHandler::~DdsHandler()
{
m_exerciseTime = nullptr;
m_pacemaker = nullptr;
m_ddsAnyExDts = nullptr;
m_ddsAnyExFts = nullptr;
m_ddsFts = nullptr;
m_ddsDts = nullptr;
m_ddsDtc = nullptr;
m_topicLockMaster = nullptr;
m_ddsConnector = nullptr;
}
bool DdsHandler::init(const QStringList &qosFileList)
{
if (!m_ddsConnector->init(qosFileList))
{
ERROR_LOG(m_logger) << "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);
// Core::PartitionTime -> ExerciseTime
std::shared_ptr<DTS::PartitionTime> dtsPartitionTime;
dtsPartitionTime.reset(m_ddsConnector->createDTS<DTS::PartitionTimeImpl>());
m_exerciseTime = std::make_shared<ExerciseTime>(dtsPartitionTime);
ERROR_LOG(m_logger) << "OKKKKK THIS THE NEW MAIN HANDLER DDS " << this->thread();
m_ddsDts = ParticipantManagement::Interface::Dts::create(m_ddsConnector);
m_ddsFts = ParticipantManagement::Interface::Fts::create(m_ddsConnector);
m_ddsDtc = ParticipantManagement::Interface::Dtc::create(m_ddsConnector);
m_pdmDtc = ProjectDataManagement::Interface::Dtc::create(m_ddsConnector);
m_ddsDtc->enableEquipmentExerciseMapping(true);
const int exerciseId = m_ddsConnector->getPartitionId();
m_exAnyConnector = std::make_shared<DDSConnector::DdsConnector>(m_ddsConnector->getDomainParticipant(), IDL::PartitionType::Any);
if (!m_exAnyConnector->init(qosFileList))
{
ERROR_LOG(m_logger) << "Could not init Dds Connector with IDL::PartitionType::Any";
return false;
}
m_exAnyConnector->initPublisherSubscriber();
m_ddsAnyExDts = ParticipantManagement::Interface::Dts::create(m_exAnyConnector);
m_ddsAnyExDts->enableEquipmentExerciseMapping(true);
m_ddsAnyExDts->enableUASRadioLinkConnectionStatus(true);
if (exerciseId <= 0)
{
DEBUG_LOG(m_logger) << "Creating * FTS: " << m_exAnyConnector->getDefaultPartition();
m_ddsAnyExFts = ParticipantManagement::Interface::Fts::create(m_exAnyConnector);
// do not enable anything here - enable where it is used (inside type handling) to make sure
// no other service get a subscription matched information without actually having data
}
const bool bExe = exerciseId > 0; // ex_N
const bool bGlob = exerciseId <= 0; // ex_0
if (!m_ddsDts->enableBite(true) ||
!m_ddsDts->enableDynamicParticipantData(bExe) ||
!m_ddsDts->enableEquipmentType(false) || // published in IDL::PartitionType::Any
!m_ddsDts->enableParticipantGearEvent(bExe) ||
!m_ddsDts->enableEquipmentExerciseMapping(false) || // published in IDL::PartitionType::Any
!m_ddsDts->enableParticipant() ||
!m_ddsDts->enableParticipantPosition(bExe) ||
!m_ddsDts->enableParticipantOrganisation(bExe) ||
!m_ddsDts->enableTargetInformation(bExe) ||
!m_ddsDts->enableParty(bGlob || bExe) ||
!m_ddsDts->enableTemplateParticipant(false) || // published in IDL::PartitionType::Any
!m_ddsDts->enableType(false) || // published in IDL::PartitionType::Any
!m_ddsDts->enableCtaError() ||
!m_ddsDts->enableParticipantMode(bExe) ||
!m_ddsDts->enableEquipmentSystemEvent(bExe) ||
!m_ddsDts->enableHitLineInfo(bExe) ||
!m_ddsDts->enableUnitPosition() ||
!m_ddsDts->enableUAS(bGlob || bExe) ||
!m_ddsDts->enableMissionPlan(bExe)
)
{
ERROR_LOG(m_logger) << "Error initializing DTS";
return false;
}
if (!m_ddsFts->enableCallBite() ||
!m_ddsFts->enableChangePartyUsedState(bExe) || // unused?
!m_ddsFts->enableEquipmentSystemEventData() ||
!m_ddsFts->enableGetParticipants() ||
!m_ddsFts->enableInitParticipant() ||
!m_ddsFts->enableModifyEquipmentTypeData(false) || // published in IDL::PartitionType::Any
!m_ddsFts->enableModifyParticipantData() ||
!m_ddsFts->enableModifyPartyData() ||
!m_ddsFts->enableModifyTemplateData(bGlob) ||
!m_ddsFts->enableModifyType(false) || // published in IDL::PartitionType::Any
!m_ddsFts->enableModifyState() ||
!m_ddsFts->enableRegisterParticipant() ||
!m_ddsFts->enableModifyTargetInformation() ||
!m_ddsFts->enableRemoveParty() ||
!m_ddsFts->enableRemoveType(false) || // published in IDL::PartitionType::Any
!m_ddsFts->enableSendMessage() ||
!m_ddsFts->enableSetParticipantMode() ||
!m_ddsFts->enableSyncParties(bExe) ||
!m_ddsFts->enableSetSimulatedPosition(bExe) ||
!m_ddsFts->enableSetSimulatedPositionRelative(bExe) ||
!m_ddsFts->enableSetSimulatedParticipantFormation(bExe) ||
!m_ddsFts->enableSetSanitation(bExe) ||
!m_ddsFts->enableSelectiveReammunition(bExe) ||
!m_ddsFts->enableSetAsSimulated(bExe) ||
!m_ddsFts->enableOcCommand(bExe) ||
!m_ddsFts->enableSetAsSimulated(bExe) ||
!m_ddsFts->enableModifyMissionPlan(bExe)||
!m_ddsFts->enableRemoveMissionPlan(bExe) ||
!m_ddsFts->enableSetMissionActionFulfilled(bExe)||
!m_ddsFts->enableModifyUasState(bExe)
)
{
ERROR_LOG(m_logger) << "Error initializing FTS";
return false;
}
m_pdmDtc->enableChargeType(true);
return true;
}
void DdsHandler::longActionBreak()
{
// m_pacemaker->publishState(); //not threadSafe!
// m_exerciseTime->publishPartitionTime();
}
} // namespace ParticipantManagement