- Copied complete Lts/Tools directory from qt5-before to qt6-after - Updated 32 CMakeLists.txt files (Qt5:: → Qt6::) - Tools subdirectory already included in parent Lts/CMakeLists.txt - All 72 tool submodules now present in qt6-migrated-legatus - Includes: Adler, ArAssets, ConfigX, DBAdministration, DBUpdate, DdsView, InfrastructureManagement, and 67 more tools - C++17 standard (RTI 7.7.0 compatibility maintained) - Tests deferred until final validation phase Migration progress: ✅ Lts/Application (68 files) ✅ Lts/DDS (verified Qt6-ready) ✅ Lts/Plugins (60 submodules, verified) ✅ Lts/Projects (5 submodules, verified) ✅ Lts/Proxies (13 submodules, verified) ✅ Lts/Services (47 submodules, verified) ✅ Lts/Tools (72 submodules, copied + CMake updated) ✅ Lts/Viewer (LtsFileDialog, LtsReportDisplay, SituationMap) 🟡 TetraIF (partial) 🟡 Z (partial: nglwidgets, QtSingleApplication, qsql_informix, WMS_Interface)
89 lines
2.8 KiB
C++
Executable File
89 lines
2.8 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* The ProxyEmulator class emulates FTs of the TetraRadio Proxy to send position data
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Hannes Baeuerle, SLSE, 2016-08-09
|
|
*/
|
|
|
|
#include "proxy_emulator.h"
|
|
#include <QtCore/QDateTime>
|
|
#include <QtCore/QThread>
|
|
#include <QPointF>
|
|
#include <QtCore/QMap>
|
|
#include <LtsCoordTrans/lts_coord_trans.h>
|
|
#include <NGLLogger/NGLLoggerBootstrap.h>
|
|
|
|
VulnerabilityStateGenerator::ProxyEmulator::ProxyEmulator(const std::shared_ptr<DDSConnector::DdsConnector> &ddsConnector, QObject *parent)
|
|
: QObject(parent)
|
|
, m_ddsConnector(ddsConnector)
|
|
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger(metaObject()->className()))
|
|
{}
|
|
|
|
bool VulnerabilityStateGenerator::ProxyEmulator::init()
|
|
{
|
|
m_tabDts = (TrainingAreaBase::Interface::Dts::create(m_ddsConnector));
|
|
|
|
DEBUG_LOG(m_logger) << "Initializing TAB DTS ...";
|
|
if (!m_tabDts->enableAll())
|
|
{
|
|
ERROR_LOG(m_logger) << "Could not init TAB DTS";
|
|
return false;
|
|
}
|
|
DEBUG_LOG(m_logger) << "... done";
|
|
|
|
return true;
|
|
}
|
|
|
|
void VulnerabilityStateGenerator::ProxyEmulator::giveInitState(const QMap<qint32, ParticipantManagement::Participant> &participants)
|
|
{
|
|
DEBUG_LOG(m_logger) << participants.size()
|
|
<< " participants found. Trying to give them init states."
|
|
;
|
|
int participantsWithEquipmentNumber = 0;
|
|
for (auto it = participants.begin(); it != participants.end(); ++it)
|
|
{
|
|
const ParticipantManagement::Participant ¤tParticipant = it.value();
|
|
|
|
if (currentParticipant.m_equipmentNumber().is_set())
|
|
{
|
|
++participantsWithEquipmentNumber;
|
|
TrainingAreaBase::EquipmentState state;
|
|
|
|
state.m_equipmentNumber(currentParticipant.m_equipmentNumber().get());
|
|
state.sampleTime(QDateTime::currentMSecsSinceEpoch());
|
|
state.vulnerabilityState(ProjectDataManagement::VulnerabilityState_def::CombatReady);
|
|
|
|
m_tabDts->publish(state);
|
|
}
|
|
}
|
|
|
|
if (participants.size() != participantsWithEquipmentNumber)
|
|
{
|
|
DEBUG_LOG(m_logger) << "Actually gave "
|
|
<< participantsWithEquipmentNumber
|
|
<< " participants an init position, because the rest does not have an equipment number"
|
|
;
|
|
}
|
|
else
|
|
{
|
|
DEBUG_LOG(m_logger) << "... done";
|
|
}
|
|
}
|
|
|
|
void VulnerabilityStateGenerator::ProxyEmulator::publishNewState(ProjectDataManagement::VulnerabilityState newState, ParticipantManagement::Participant participant)
|
|
{
|
|
TrainingAreaBase::EquipmentState state;
|
|
|
|
state.m_equipmentNumber(participant.m_equipmentNumber().get());
|
|
state.sampleTime(QDateTime::currentMSecsSinceEpoch());
|
|
state.vulnerabilityState(newState);
|
|
|
|
DEBUG_LOG(m_logger) << "participantId: " << participant.m_id() << ", state: " << newState << ", equipNo: " << participant.m_equipmentNumber().get();
|
|
m_tabDts->publish(state);
|
|
}
|
|
|
|
|
|
|