Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Services/EffectShowManagement/handler_tab_data.cpp
T
torstenandCopilot b774f4035c Qt6 Migration: DDS-Stubs, Logger-Fixes, Export-Header Korrekturen
- 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>
2026-08-19 06:06:24 +02:00

252 lines
11 KiB
C++
Executable File

/**
* Handler for player data
* $Id$
* $HeadURL$
* $Author$
* Created by hjl, SLSE, 2017-02-20
*/
#include <QVector>
#include <LtsUtilsCore/dds_vector.h>
#include <LtsCoordTrans/lts_coord_trans.h>
#include "initialization.h"
#include "handler_tab_data.h"
#include "handler_effect_show.h"
#include "handler_effect_show_vehicle_status.h"
#include "handler_effect_show_actor_relocation.h"
#include "esm_convert_to_tab.h"
#include "settings.h"
namespace EffectShowManagement
{
static inline QString plText(const std::vector<uint8_t> &pl)
{
return QString::fromLatin1(LtsUtils::toQByteArray(pl).toHex());
}
//=============================================================================
HandlerTabData::HandlerTabData(Initialization *mainHandler,
QObject *parent)
: QObject(parent)
, m_mainHandler(mainHandler)
{
} // end of ctor()
//=============================================================================
bool HandlerTabData::init()
{
DEBUG_LOG() << "Begin HandlerTabData";
auto dtcTab = m_mainHandler->dds()->dtcTab();
connect(dtcTab.get(), &TrainingAreaBase::Interface::Dtc::fireSmokeMarkerDataChanged,
this, &HandlerTabData::onFireSmokeMarkerDataChanged);
// Get current data for all Fire Smoke Marker
{
auto cb = [this](const TrainingAreaBase::FireSmokeMarkerData & fireSmokeMarker)
{
onFireSmokeMarkerDataChanged(fireSmokeMarker, DataModification::eAdded);
};
if (!dtcTab->fireSmokeMarkerDatas(cb))
return false;
}
DEBUG_LOG() << "End HandlerTabData";
return true;
} // end of init()
//=============================================================================
void HandlerTabData::effectShowVehicleStatusRequest(int equipmentNumber, int participantId)
{
DEBUG_LOG() << "Trigger Status Request " << equipmentNumber << ' ' << participantId;
TrainingAreaBase::SendFireSmokeMarkerDataRequest out;
out.equipmentNumber(equipmentNumber);
out.participantId(participantId);
out.payload(ConvertToTab::convertStatusRequest());
m_mainHandler->dds()->ftcTab()->sendFireSmokeMarkerDataRequest(out, this);
} // end of onVehicleStatusStatusRequest()
//=============================================================================
void HandlerTabData::relocationOrder(int equipmentNumber, int participantId, const ConvertToTab::RelocationOrder_t &relocationOrder)
{
DEBUG_LOG() << "Trigger Relocation Order " << equipmentNumber << ' ' << participantId;
TrainingAreaBase::SendFireSmokeMarkerDataRequest out;
out.equipmentNumber(equipmentNumber);
out.participantId(participantId);
out.payload(ConvertToTab::convertRelocationOrder(relocationOrder));
m_mainHandler->dds()->ftcTab()->sendFireSmokeMarkerDataRequest(out, this);
} // end of relocationOrder()
//=============================================================================
void HandlerTabData::effectShowOrder(int equipmentNumber, int participantId, const ConvertToTab::EffectShowOrder_t &effectShowOrder)
{
TrainingAreaBase::SendFireSmokeMarkerDataRequest out;
out.equipmentNumber(equipmentNumber);
out.participantId(participantId);
out.payload(ConvertToTab::convertEffectShowOrder(effectShowOrder));
Core::GeoPosition2D posCenter = effectShowOrder.centerPosition;
Core::GeoPosition2D posLl = effectShowOrder.lowerLeftPosition;
DEBUG_LOG() << "Trigger Effect Show Order " << equipmentNumber << ' ' << participantId
<< "\n idEffectShow " << effectShowOrder.idEffectShow
<< "\n startTime " << effectShowOrder.startTime
<< "\n centerPosition " << LtsCoordTrans::mgrsFromGeographic(posCenter.lon(), posCenter.lat())
<< "\n areaDepth " << effectShowOrder.areaDepth
<< "\n areaWidth " << effectShowOrder.areaWidth
<< "\n rotation " << effectShowOrder.rotation
<< "\n lowerLeftPosition " << LtsCoordTrans::mgrsFromGeographic(posLl.lon(), posLl.lat())
<< "\n numOfVolley " << int(effectShowOrder.numOfVolley)
<< "\n shotsPerVolley " << int(effectShowOrder.shotsPerVolley)
<< "\n typeOfAmmunition " << int(effectShowOrder.typeOfAmmunition)
<< "\n duration " << effectShowOrder.duration
<< "\n name " << effectShowOrder.name
<< "\n payload" << plText(out.payload());
m_mainHandler->dds()->ftcTab()->sendFireSmokeMarkerDataRequest(out, this);
} // end of effetShowOrder()
//=============================================================================
void HandlerTabData::effectShowStop(int equipmentNumber, int participantId, const qint16 &idEffectShow)
{
DEBUG_LOG() << "Trigger Effect Show Stop " << equipmentNumber << ' ' << participantId;
TrainingAreaBase::SendFireSmokeMarkerDataRequest out;
out.equipmentNumber(equipmentNumber);
out.participantId(participantId);
out.payload(ConvertToTab::convertEffectShowStop(idEffectShow));
m_mainHandler->dds()->ftcTab()->sendFireSmokeMarkerDataRequest(out, this);
} // end of effectShowStop()
//=============================================================================
void HandlerTabData::effectShowContinue(int equipmentNumber, int participantId, const ConvertToTab::EffectShowContinue_t &effectShowContinue)
{
TrainingAreaBase::SendFireSmokeMarkerDataRequest out;
out.equipmentNumber(equipmentNumber);
out.participantId(participantId);
out.payload(ConvertToTab::convertEffectShowContinue(effectShowContinue));
DEBUG_LOG() << "Trigger Effect Show Continue " << equipmentNumber << ' ' << participantId
<< "\n idEffectShow " << effectShowContinue.idEffectShow
<< "\n executionTime " << effectShowContinue.executionTime
<< "\n payload" << plText(out.payload());
m_mainHandler->dds()->ftcTab()->sendFireSmokeMarkerDataRequest(out, this);
} // end of effectShowContinue()
//=============================================================================
void HandlerTabData::retractOrder(int equipmentNumber, int participantId, const ConvertToTab::RetractOrder_t &retractOrder)
{
TrainingAreaBase::SendFireSmokeMarkerDataRequest out;
out.equipmentNumber(equipmentNumber);
out.participantId(participantId);
out.payload(ConvertToTab::convertOrderRetract(retractOrder));
DEBUG_LOG() << "Trigger Retract Order " << equipmentNumber << ' ' << participantId
<< "\n orderType " << retractOrder.orderType
<< "\n id " << retractOrder.id
<< "\n payload" << plText(out.payload());
m_mainHandler->dds()->ftcTab()->sendFireSmokeMarkerDataRequest(out, this);
} // end of retractOrder()
//=============================================================================
void HandlerTabData::meteoData(int equipmentNumber, int participantId, const MeteoDataManagement::MeteoData &meteoData)
{
TrainingAreaBase::SendFireSmokeMarkerDataRequest out;
out.equipmentNumber(equipmentNumber);
out.participantId(participantId);
out.payload(ConvertToTab::convertMeteoData(meteoData));
DEBUG_LOG() << "Trigger Meteo data " << equipmentNumber << ' ' << participantId
<< "\n temperature " << meteoData.temperature()
<< "\n humidity " << meteoData.humidity()
<< "\n pressure " << meteoData.pressure()
<< "\n windDirection " << meteoData.windDirection()
<< "\n payload" << plText(out.payload());
m_mainHandler->dds()->ftcTab()->sendFireSmokeMarkerDataRequest(out, this);
} // end of
//=============================================================================
void HandlerTabData::onSendFireSmokeMarkerDataReply(const Core::FunctionReplyObject &reply)
{
if (reply.error())
ERROR_LOG() << "Fire Smoke Marker Data could not be send: " << reply.str();
else
DEBUG_LOG() << "Fire Smoke Marker Data send successfully to TAB!";
} // end of onSendFireSmokeMarkerDataReply()
//-----------------------------------------------------------------------------
void HandlerTabData::onFireSmokeMarkerDataChanged(const TrainingAreaBase::FireSmokeMarkerData &data, DataModification modType)
{
if (modType == DataModification::eRemoved)
return;
DEBUG_LOG() << "Got Fire Smoke Marker " << data.sampleTime();
switch (ConvertFromTab::isTelegram(data))
{
case ConvertFromTab::RxTelegram_e::VehicleStatus:
{
DEBUG_LOG() << "Got Vehicle Status";
m_mainHandler->handlerEffectShowVehicleStatus()->vehicleStatusReceived(ConvertFromTab::getVehicleStatus(data));
break;
}
case ConvertFromTab::RxTelegram_e::OrderConfirmation:
{
DEBUG_LOG() << "Got Order Confirmation ";
switch (modType)
{
case DataModification::eAdded:
case DataModification::eModified:
{
const ConvertFromTab::OrderConfirmation_t orderConfirmation = ConvertFromTab::getOrderConfirmation(data);
if (orderConfirmation.orderType == ConvertFromTab::OrderType_e::Relocation)
{
DEBUG_LOG() << "relocationOrderConfirmationReceived(orderConfirmation)";
m_mainHandler->handlerEffectShowActorRelocation()->relocationOrderConfirmationReceived(orderConfirmation);
}
else
{
DEBUG_LOG() << "effectShowOrderConfirmationReceived(orderConfirmation)";
m_mainHandler->handlerEffectShow()->effectShowOrderConfirmationReceived(orderConfirmation);
}
break;
}
case DataModification::eRemoved:
break;
}
break;
}
case ConvertFromTab::RxTelegram_e::unknown:
break;
}
} // end of onFireSmokeMarkerDataChanged()
//-----------------------------------------------------------------------------
void HandlerTabData::publishVehicleStatus(const EffectShowManagement::EffectShowVehicleStatus &vehicleStatus)
{
DEBUG_LOG() << "Vehicle Status published esmParticipantId: " << vehicleStatus.esmParticipantId() << ' ' << vehicleStatus.operational();
m_mainHandler->dds()->dts()->publish(vehicleStatus);
} // end of publishVehicleStatus()
//-----------------------------------------------------------------------------
void HandlerTabData::sendAdlerFqFb(const int aesId)
{
DEBUG_LOG() << "Send Adler Feuerbereitschaft";
TrainingAreaBase::AdlerFqFbRequest out;
out.aesItemId(aesId);
m_mainHandler->dds()->ftcTab()->adlerFqFbRequest(out, this);
}
//=============================================================================
void HandlerTabData::onAdlerFqFbReply(const Core::FunctionReplyObject &reply)
{
if (reply.error())
ERROR_LOG() << "Adler Feuerbereitschaft could not be send: " << reply.str()
<< ", id:" << reply.id();
else
DEBUG_LOG() << "Adler Feuerbereitschaft successfully to TAB!";
}
} // namespace EffectShowManagement