Migrates residual Lts sources to generated rtiddsgen API

Adds NmeaManagement tests, fixes codegen includes and Qt6 SerialPort CMake target.
This commit is contained in:
berrux-dev committed 2026-09-23 12:05:37 +02:00
1 parent 5485a90385
commit 881d44f4dd
512 files changed
+6887 -6426

No files matched your search

@@ -109,7 +109,7 @@ void AesHandler::onEffectClusterModifyReply(const Core::FunctionReplyObject &rep
ERROR_LOG(m_logger) << "Try send notification0";
m_aesId = replyObject.id();
ProjectDataManagement::EffectSource effectSource
= static_cast<ProjectDataManagement::EffectSource::type>(propertiesObject.value(QStringLiteral("effectSource")).toInt());
= static_cast<ProjectDataManagement::EffectSource>(propertiesObject.value(QStringLiteral("effectSource")).toInt());
ERROR_LOG(m_logger) << "Try send notification1 " << effectSource;
if (effectSource != ProjectDataManagement::EffectSource::ES_ADLER)
@@ -178,7 +178,7 @@ void AesHandler::onEffectClusterModifyReply(const Core::FunctionReplyObject &rep
addr.isRead(false);
const OperatorManagement::User user = m_mainDispatcher->ddsHandler()->dtcOpm()->user(recipientId);
addr.name(user.name());
addr.addressType(NotificationManagement::AddressType_def::Operator);
addr.addressType(NotificationManagement::AddressType::Operator);
recipentVec.emplace_back(addr);
}
req.notification().recipientIds(recipentVec);
@@ -252,7 +252,7 @@ void AesHandler::onAirSupportImpactModifyReply(const Core::FunctionReplyObject &
void AesHandler::handleCreateSingleExplosion(const TrainingAreaBase::TetraIcd::CreateSingleExplosion &data)
{
auto strFromObj = QJsonDocument(data.toJson()).toJson(QJsonDocument::Compact);
m_singleExplosions.insert(data.aesDdsId, AreaEffectSimulation::AesEffectState_def::EsCreated);
m_singleExplosions.insert(data.aesDdsId, AreaEffectSimulation::AesEffectState::EsCreated);
DEBUG_LOG(m_logger) << "TEST SINGLE EXPLOSION CREATED " << strFromObj;
}
@@ -958,11 +958,11 @@ QList<qint32> AesHandler::findAllPendingEffectCluster(int partyId)
{
if (effectCluster.partyId() != partyId)
continue;
if (effectCluster.effectStateId() != AreaEffectSimulation::AesEffectState_def::EsReceived
&& effectCluster.effectStateId() != AreaEffectSimulation::AesEffectState_def::EsCreated)
if (effectCluster.effectStateId() != AreaEffectSimulation::AesEffectState::EsReceived
&& effectCluster.effectStateId() != AreaEffectSimulation::AesEffectState::EsCreated)
continue;
if (effectCluster.effectSourceId() != ProjectDataManagement::EffectSource_def::ES_ADLER /*&&
effectCluster.effectSourceId() != ProjectDataManagement::EffectSource_def::ES_ADLER_STANDALONE*/)
if (effectCluster.effectSourceId() != ProjectDataManagement::EffectSource::ES_ADLER /*&&
effectCluster.effectSourceId() != ProjectDataManagement::EffectSource::ES_ADLER_STANDALONE*/)
continue;
ret.append(effectCluster.id());
@@ -1096,8 +1096,8 @@ void AesHandler::onExplosionSingleChanged(const AreaEffectSimulation::ExplosionS
m_singleExplosions.insert(data.id(), data.effectStateId());
return;
}
if (data.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsActivated
&& m_singleExplosions.value(data.id(), AreaEffectSimulation::AesEffectState::EsActivated) != AreaEffectSimulation::AesEffectState_def::EsActivated)
if (data.effectStateId() == AreaEffectSimulation::AesEffectState::EsActivated
&& m_singleExplosions.value(data.id(), AreaEffectSimulation::AesEffectState::EsActivated) != AreaEffectSimulation::AesEffectState::EsActivated)
{
const auto state = data.effectStateId();
DEBUG_LOG(m_logger) << "----------------- switch state ------------- " << state;
@@ -173,8 +173,8 @@ void FlmHandler::createHQNotification(const int partyId, const int folderId, con
int prio = s->getInteger(QStringLiteral("NOM/notificationPriority"), 3);
DEBUG_LOG(m_logger) << " Setting: NotificationPriority: " << prio;
notif.priority(static_cast<NotificationManagement::Priority_def::type>(prio));
notif.processedPriority(NotificationManagement::Priority_def::Low);
notif.priority(static_cast<NotificationManagement::Priority>(prio));
notif.processedPriority(NotificationManagement::Priority::Low);
notif.exerciseId(m_exerciseId);
for (const auto &userId : m_opmDtc->getOperatorsByOperatorRight(OperatorRights::FileManagementFilesEdit))
@@ -183,7 +183,7 @@ void FlmHandler::createHQNotification(const int partyId, const int folderId, con
addr.addressId(userId);
addr.isRead(false);
addr.name(m_opmDtc->user(userId).name());
addr.addressType(NotificationManagement::AddressType_def::Operator);
addr.addressType(NotificationManagement::AddressType::Operator);
notif.recipientIds().push_back(addr);
}
@@ -120,7 +120,7 @@ int JsonDispatcher::getAssetId(const QString &saaName) const
for (const auto &currAsset : m_mainDispatcher->asmHandler()->getDtc()->assets())
{
if (currAsset.assetTypeId() != AssetManagement::AssetType_def::AdlerSAA)
if (currAsset.assetTypeId() != AssetManagement::AssetType::AdlerSAA)
continue;
const auto &dbSaa = saaNameFromProps(currAsset.properties());
@@ -335,7 +335,7 @@ void JsonDispatcher::onSAARegistration(const int wsId, const int partyId, const
DEBUG_LOG(m_logger) << "onSAARegistration modifyParty"
<< " ==> SAA name " << saaName;
createNotificationRequest(wsId, QString::fromUtf8(tr_lts("Notification", "Reconnect to SAA")),
NotificationManagement::MessageType_def::Success,
NotificationManagement::MessageType::Success,
NotificationManagement::NotificationType::AdlerNotification,
saaName,
{});
@@ -357,7 +357,7 @@ void JsonDispatcher::onSAADeregistration(const int wsId, const int partyId)
const int assetId = getAssetId(saa->getSAAName());
DEBUG_LOG(m_logger) << "Deregistation from " << saa->getSAAName();
createNotificationRequest(wsId, QString::fromUtf8(tr_lts("Notification", "SAADeregistration")),
NotificationManagement::MessageType_def::Info,
NotificationManagement::MessageType::Info,
NotificationManagement::NotificationType::AdlerNotification,
saa->getSAAName(),
{});
@@ -424,7 +424,7 @@ void JsonDispatcher::onSAAStatus(const int wsId, const EXStatus &status)
}
createNotificationRequest(wsId,
title,
NotificationManagement::MessageType_def::Success,
NotificationManagement::MessageType::Success,
NotificationManagement::NotificationType::AdlerNotification,
saa->getSAAName(),
{});
@@ -465,7 +465,7 @@ void JsonDispatcher::onSAAExceptionStatus(const int wsId, const TechnischeDaten
args << exceptionStatus.beschreibung;
createNotificationRequest(wsId, QString::fromUtf8(tr_lts("Notification","Error Message from SAA")),
NotificationManagement::MessageType_def::Error,
NotificationManagement::MessageType::Error,
NotificationManagement::NotificationType::AdlerNotification,
content,
args);
@@ -547,7 +547,7 @@ void JsonDispatcher::sendParticipantInfoNotification(const int wsId, const int p
createNotificationRequest(wsId,
QString::fromUtf8(tr_lts("Notification","Loading Point Position Report")),
NotificationManagement::MessageType_def::Info,
NotificationManagement::MessageType::Info,
NotificationManagement::NotificationType::AdlerNotification,
content,
args);
@@ -664,7 +664,7 @@ void JsonDispatcher::onSSAEXFIREHALT(const int wsId, const FeuerHaltDaten &feuer
}
createNotificationRequest(wsId,
QString::fromUtf8(tr_lts("Notification","Hold your fire")),
NotificationManagement::MessageType_def::Info,
NotificationManagement::MessageType::Info,
NotificationManagement::NotificationType::CombatOrder,
saa->getSAAName(),
{});
@@ -811,7 +811,7 @@ void JsonDispatcher::onAdlerCalculateTrajectoryRequest(const rti::core::SampleId
exFlugbahnberechnung.flugbahnberechnungDaten.zielkoordinate.koordinate.longitude = request.positionTarget().lon() * 180.0 / M_PI;
exFlugbahnberechnung.flugbahnberechnungDaten.zielkoordinate.hoehe = request.positionTarget().z();
exFlugbahnberechnung.flugbahnberechnungDaten.waffensystem = ProjectDataManagement::L26_EffectingSystemType::inner_enum(request.weaponSystemType().underlying() + 1);
exFlugbahnberechnung.flugbahnberechnungDaten.waffensystem = ProjectDataManagement::L26_EffectingSystemType(request.weaponSystemType().underlying() + 1);
DEBUG_LOG(m_logger) << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!77 weaponSystemType " << request.weaponSystemType().underlying();
DEBUG_LOG(m_logger) << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!77 L26_EffectingSystemType " << exFlugbahnberechnung.flugbahnberechnungDaten.waffensystem;
@@ -917,8 +917,8 @@ void JsonDispatcher::getCreateNotificationRequestData(const int wsId,
notif.contentArgs(args);
notif.timeStamp(currentTime);
notif.expiryTime(expiryTime);
notif.priority(NotificationManagement::Priority_def::High);
notif.processedPriority(NotificationManagement::Priority_def::High);
notif.priority(NotificationManagement::Priority::High);
notif.processedPriority(NotificationManagement::Priority::High);
notif.exerciseId(m_mainDispatcher->exerciseId());
const QVector<int> recipientIds = m_mainDispatcher->ddsHandler()->dtcOpm()->getNotificationRecipents(m_mainDispatcher->exerciseId(),
@@ -937,7 +937,7 @@ void JsonDispatcher::getCreateNotificationRequestData(const int wsId,
addr.isRead(false);
const OperatorManagement::User user = m_mainDispatcher->ddsHandler()->dtcOpm()->user(recipientId);
addr.name(user.name());
addr.addressType(NotificationManagement::AddressType_def::Operator);
addr.addressType(NotificationManagement::AddressType::Operator);
notif.recipientIds().push_back(addr);
DEBUG_LOG(m_logger) << "recipientId=" << addr.name()
<< ", addr.addressId=" << addr.addressId();
@@ -945,7 +945,7 @@ void JsonDispatcher::getCreateNotificationRequestData(const int wsId,
NotificationManagement::Address addrSender;
addrSender.name(saa->getSAAName().toStdString());
addrSender.addressType(NotificationManagement::AddressType_def::Service);
addrSender.addressType(NotificationManagement::AddressType::Service);
notif.sender(addrSender);
data.notification(notif);
@@ -105,7 +105,7 @@ bool FromTab::txData(const TrainingAreaBase::TetraIcd::Init &data)
msg.originatorType = TrainingAreaBase::TetraIcd::OriginatorType::ExerciseControl;
msg.tasVitality = 100;
msg.vulnerabilityBits = 0;
msg.vulnerabilityState = TrainingAreaBase::TetraIcd::VulnerabilityState::CombatReady;
msg.vulnerabilityState = TrainingAreaBase::TetraIcd::VulnerabilityState::VulnerabilityState_CombatReady;
m_sendToDds->rxData(msg);
return true;
@@ -193,7 +193,7 @@ bool FromTab::txData(const TrainingAreaBase::TetraIcd::CesHitRequest &data)
msg.chargeTypeId = data.chargeTasCodeDirect;
msg.header.equipmentNumber = eqId;
msg.header.timeStamp = data.header.timeStamp;
msg.vulnerabilityState = TrainingAreaBase::TetraIcd::VulnerabilityState::CatastrophicKill;
msg.vulnerabilityState = TrainingAreaBase::TetraIcd::VulnerabilityState::VulnerabilityState_CatastrophicKill;
msg.originatorId = data.originatorEquipmentNumber;
DEBUG_LOG(m_logger) << "sending state change direct (kill) with jamming for eqId " << msg.header.equipmentNumber;
@@ -213,7 +213,7 @@ bool FromTab::txData(const TrainingAreaBase::TetraIcd::DemandVulnerabilityStateC
const auto &pData = m_dtcPpm->dynamicParticipantData(p);
for (const auto &dyn : pData.stateHistory())
{
if (dyn.vulnerabilityState() == ProjectDataManagement::VulnerabilityState::CatastrophicKill)
if (dyn.vulnerabilityState() == ProjectDataManagement::VulnerabilityState::VulnerabilityState_CatastrophicKill)
{
return false;
}
@@ -235,7 +235,7 @@ void UAVInterfaceAdapterManager::start(const ParticipantManagement::UAS &uas, UA
msg.originatorType = TrainingAreaBase::TetraIcd::OriginatorType::Initialisation;
msg.tasVitality = 100;
msg.vulnerabilityBits = 0;
msg.vulnerabilityState = TrainingAreaBase::TetraIcd::VulnerabilityState::CombatReady;
msg.vulnerabilityState = TrainingAreaBase::TetraIcd::VulnerabilityState::VulnerabilityState_CombatReady;
m_sendToDds->rxData(msg);
@@ -6,6 +6,8 @@
#include "WebSocketInterface/json_keys.h"
#include "WebSocketInterface/data_manager.h"
#include <NGLLogger/NGLLoggerBootstrap.h>
#include <QtCore/QJsonDocument>
#include <QtCore/QUuid>
@@ -42,12 +44,14 @@ LtsWebSocket::AbstractClientMessage *ClientMessageFactory::createMessage(LtsWebS
ClientMessage::ClientMessage(DataManager *dataManager, LtsWebSocket::ReplyHandler *client, const QString &type, const int typeId, const QString &uuid, const QJsonValue &data)
: LtsWebSocket::AbstractClientMessage(client, type, typeId, uuid, data)
, m_dataManager(dataManager)
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
{}
SendBiteRequest::SendBiteRequest(DataManager *dataManager, LtsWebSocket::ReplyHandler *client, const QString &type, const int typeId, const QString &uuid, const QJsonValue &data) : ClientMessage(dataManager, client, type, typeId, uuid, data),
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) {}
SendBiteRequest::SendBiteRequest(DataManager *dataManager, LtsWebSocket::ReplyHandler *client, const QString &type, const int typeId, const QString &uuid, const QJsonValue &data)
: ClientMessage(dataManager, client, type, typeId, uuid, data)
{}
void SendBiteRequest::process()
{
@@ -108,9 +108,9 @@ PositionMessage::PositionMessage(const PositionMessage::PositionData &data, cons
{
m_jsonRepresentation.insert(DATA(),
QJsonObject({{EQUIP_NO(), data.equipNo},
{POS_LAT(), data.pos.lat()},
{POS_LON(), data.pos.lon()},
{POS_Z(), data.pos.z()},
{POS_LAT(), data.pos.lat},
{POS_LON(), data.pos.lon},
{POS_Z(), data.pos.z},
{LAST_POSITION_UPDATE(), data.gpsTime}
}));
}
@@ -23,9 +23,9 @@ DataManager::DataManager(MainHandler *mainHandler)
LtsWebSocket::ReplyMessage* DataManager::sendBiteRequest(const QString &uuid, int equipNo)
{
DemandBiteRequest request;
request.equipmentNumbers().push_back(equipNo);
request.withSelfTest(true);
request.requestId(s_requestId++);
request.equipmentNumbers.push_back(equipNo);
request.withSelfTest = true;
request.requestId = s_requestId++;
rti::core::SampleIdentity sampleIdentity;
m_mainHandler->ftsHandler()->onDemandBiteRequest(sampleIdentity, request);
@@ -7,6 +7,7 @@
#include "WebSocketInterface/Messages/client_message.h"
#include "WebSocketInterface/Messages/reply_message.h"
#include "settings.h"
#include <NGLLogger/NGLLoggerBootstrap.h>
namespace TrainingAreaBase
{
@@ -19,6 +20,7 @@ WebSocketInterfaceHandler::WebSocketInterfaceHandler(MainHandler *mainHandler, Q
, m_messageFactory(nullptr)
, m_dataManager(nullptr)
, m_mainHandler(mainHandler)
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
{
}
@@ -60,7 +60,7 @@ bool DdsHandler::init(const QStringList &qosFileList)
assert(m_dtcPartitionTime.get());
m_dtcPartitionTime->setSubscriberCallback([this](const Core::PartitionTime & data, DataModification)
{
m_curMSecSinceEpoch = data.timeStamp();
m_curMSecSinceEpoch = data.timeStamp;
});
// default dts:...
@@ -3,12 +3,14 @@
#include "exm_handler.h"
#include "main_handler.h"
#include <NGLLogger/NGLLoggerBootstrap.h>
namespace TrainingAreaBase
{
ExmHandler::ExmHandler(MainHandler *mainHandler)
: m_mainHandler(mainHandler)
: m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
, m_mainHandler(mainHandler)
{}
bool ExmHandler::init()
@@ -35,7 +37,7 @@ ExerciseManagement::Exercise ExmHandler::exercise(int exerciseId)
void ExmHandler::onExerciseChanged(const ExerciseManagement::Exercise &data, DataModification modType)
{
if (!data.radioGroupId().is_set() || data.radioGroupId().get() == 0)
if (!data.radioGroupId.is_set() || data.radioGroupId.get() == 0)
modType = DataModification::eRemoved;
bool bExercise2RadioGroupChanged = false;
@@ -44,17 +46,17 @@ void ExmHandler::onExerciseChanged(const ExerciseManagement::Exercise &data, Dat
case DataModification::eAdded:
case DataModification::eModified:
{
auto &val = m_exercise2RadioGroup[data.id()];
if (val != data.radioGroupId().get())
auto &val = m_exercise2RadioGroup[data.id];
if (val != data.radioGroupId.get())
{
bExercise2RadioGroupChanged = true;
val = data.radioGroupId().get();
val = data.radioGroupId.get();
}
break;
}
case DataModification::eRemoved:
{
auto it = m_exercise2RadioGroup.find(data.id());
auto it = m_exercise2RadioGroup.find(data.id);
if (it != m_exercise2RadioGroup.end())
{
bExercise2RadioGroupChanged = true;
@@ -5,6 +5,7 @@
#include <utility>
#include "main_handler.h"
#include "settings.h"
#include <NGLLogger/NGLLoggerBootstrap.h>
#include <QtCore/QJsonDocument>
#include <QJsonParseError>
#include <QtCore/QJsonObject>
@@ -114,8 +115,8 @@ IsmHandler::OpsData IsmHandler::dataFromOpsCode(int ipsCode)
void IsmHandler::onInstrumentationAssetChanged(const InfrastructureManagement::InstrumentationAsset &data, DataModification modType)
{
if (data.mountingPointTypeId() != InfrastructureManagement::MountingPointType::IndoorIPS &&
data.mountingPointTypeId() != InfrastructureManagement::MountingPointType::OutdoorIPS)
if (data.mountingPointTypeId != InfrastructureManagement::MountingPointType::IndoorIPS &&
data.mountingPointTypeId != InfrastructureManagement::MountingPointType::OutdoorIPS)
return;
switch (modType)
{
@@ -127,19 +128,19 @@ void IsmHandler::onInstrumentationAssetChanged(const InfrastructureManagement::I
QHashIterator<int, OpsData> i(m_opsData);
while (i.hasNext()) {
i.next();
if ( i.value().assetId == data.id())
if ( i.value().assetId == data.id)
{
opsCode = i.value().opsCode;
DEBUG_LOG(m_logger) << "onInstrumentationAssetChanged assetId=" << data.id();
DEBUG_LOG(m_logger) << "onInstrumentationAssetChanged assetId=" << data.id;
break;
}
}
OpsData &d = m_opsData[opsCode];
d.assetId = data.id();
d.opsCode = getOpsCodeFromJSon(data.properties());
d.opsTunnel = getIsOpsTunnel(data.properties());
d.mountingPointTypeId = data.mountingPointTypeId().underlying();
d.assetId = data.id;
d.opsCode = getOpsCodeFromJSon(data.properties);
d.opsTunnel = getIsOpsTunnel(data.properties);
d.mountingPointTypeId = static_cast<int>(data.mountingPointTypeId);
updateOpsData(d);
break;
}
@@ -149,10 +150,10 @@ void IsmHandler::onInstrumentationAssetChanged(const InfrastructureManagement::I
QHashIterator<int, OpsData> i(m_opsData);
while (i.hasNext()) {
i.next();
if ( i.value().assetId == data.id())
if ( i.value().assetId == data.id)
{
opsCode = i.value().opsCode;
DEBUG_LOG(m_logger) << "onInstrumentationAssetChanged assetId=" << data.id();
DEBUG_LOG(m_logger) << "onInstrumentationAssetChanged assetId=" << data.id;
break;
}
}
@@ -171,17 +172,17 @@ void IsmHandler::onMountingPointAssetChanged(const InfrastructureManagement::Mou
{
OpsData opsData;
opsData.opsCode = m_dtcIsm->getOpticalCodeFromAssetId(data.assetId());
opsData.assetId = data.assetId();
opsData.opsCode = m_dtcIsm->getOpticalCodeFromAssetId(data.assetId);
opsData.assetId = data.assetId;
updateOpsData(opsData, true);
break;
}
case DataModification::eRemoved:
DEBUG_LOG(m_logger) << "onMountingPointAssetChanged Unmount id=" << data.id()
<< " assetId=" << data.assetId();
DEBUG_LOG(m_logger) << "onMountingPointAssetChanged Unmount id=" << data.id
<< " assetId=" << data.assetId;
removeOpsAsset(data.assetId());
removeOpsAsset(data.assetId);
break;
}
}
@@ -196,12 +197,12 @@ void IsmHandler::rotateBuildingFootprint(int mseId)
return;
}
InfrastructureManagement::MainStructureElement mse = m_dtcIsm->mainStructureElement(mseId);
TetraIcd::RelativePosition relBldgPosition = m_mainHandler->posHandler()->geographicToRelative(mse.geoPosition());
TetraIcd::RelativePosition relBldgPosition = m_mainHandler->posHandler()->geographicToRelative(mse.geoPosition);
DEBUG_LOG(m_logger) << " mainStructureElements.Rotate id=" << mseId;
QTransform matrix;
QPolygonF relBuildingFootprintMgrs;
qreal angle = mse.angle();
qreal angle = mse.angle;
matrix.rotate(angle);
const QPolygonF relBuildingFootprint = m_relBuildingFootprints.value(mseId);
const QPolygonF relBuildingFootprintRotated = matrix.map(relBuildingFootprint);
@@ -233,21 +234,21 @@ void IsmHandler::onMainStructureElementChanged(const InfrastructureManagement::M
int exerciseId = m_mainHandler->ddsHandler()->getExerciseId();
if ( !m_dtcIsm->isElementAssignedToExercise(data, exerciseId))
{
INFO_LOG(m_logger) << "HandlerBuildingData::onMainStructureElementChanged() id=" << data.id() << " remove";
INFO_LOG(m_logger) << "HandlerBuildingData::onMainStructureElementChanged() id=" << data.id << " remove";
m_buildingBoundingBoxes.remove(data.id());
m_relBuildingFootprints.remove(data.id());
m_relBuildingFootprintsRotated.remove((data.id()));
m_buildingBoundingBoxesMgrs.remove(data.id());
m_relBuildingFootprintsRotatedMgrs.remove(data.id());
m_buildingBoundingBoxes.remove(data.id);
m_relBuildingFootprints.remove(data.id);
m_relBuildingFootprintsRotated.remove((data.id));
m_buildingBoundingBoxesMgrs.remove(data.id);
m_relBuildingFootprintsRotatedMgrs.remove(data.id);
for (const auto &se : data.elements())
for (const auto &se : data.elements)
{
if (se.mountingPointTypeId() != InfrastructureManagement::MountingPointType::IndoorIPS &&
se.mountingPointTypeId() != InfrastructureManagement::MountingPointType::OutdoorIPS)
if (se.mountingPointTypeId != InfrastructureManagement::MountingPointType::IndoorIPS &&
se.mountingPointTypeId != InfrastructureManagement::MountingPointType::OutdoorIPS)
continue;
removeOpsDataByStructureElementId(se.id());
removeOpsDataByStructureElementId(se.id);
}
@@ -255,7 +256,7 @@ void IsmHandler::onMainStructureElementChanged(const InfrastructureManagement::M
while (iter.hasNext())
{
iter.next();
if (iter.value().mainStructureElementId == data.id())
if (iter.value().mainStructureElementId == data.id)
{
DEBUG_LOG(m_logger) << "remove from m_opsData, key=" << iter.key();
iter.remove();
@@ -270,36 +271,36 @@ void IsmHandler::onMainStructureElementChanged(const InfrastructureManagement::M
for (const InfrastructureManagement::StructureElement &se : data.elements())
for (const InfrastructureManagement::StructureElement &se : data.elements)
{
if (se.mountingPointTypeId() != InfrastructureManagement::MountingPointType::IndoorIPS &&
se.mountingPointTypeId() != InfrastructureManagement::MountingPointType::OutdoorIPS)
if (se.mountingPointTypeId != InfrastructureManagement::MountingPointType::IndoorIPS &&
se.mountingPointTypeId != InfrastructureManagement::MountingPointType::OutdoorIPS)
continue;
auto it = std::find_if(m_opsData.begin(), m_opsData.end(), [se](const OpsData & d)
{
return d.structureElementId == se.id();
return d.structureElementId == se.id;
});
if (it != m_opsData.end())
updateOpsData(it.value());
}
DEBUG_LOG(m_logger) << " mainStructureElements Vor Rotate id=" << data.id();
DEBUG_LOG(m_logger) << " mainStructureElements Vor Rotate id=" << data.id;
QMap<int, InfrastructureManagement::MainFootprint> mainFootprints = m_dtcIsm->getFootprintsByExerciseId(exerciseId);
if (mainFootprints.contains(data.id()))
if (mainFootprints.contains(data.id))
{
rotateBuildingFootprint(data.id());
rotateBuildingFootprint(data.id);
}
break;
}
case DataModification::eRemoved:
for (const auto &se : data.elements())
for (const auto &se : data.elements)
{
if (se.mountingPointTypeId() != InfrastructureManagement::MountingPointType::IndoorIPS &&
se.mountingPointTypeId() != InfrastructureManagement::MountingPointType::OutdoorIPS)
if (se.mountingPointTypeId != InfrastructureManagement::MountingPointType::IndoorIPS &&
se.mountingPointTypeId != InfrastructureManagement::MountingPointType::OutdoorIPS)
continue;
removeOpsDataByStructureElementId(se.id());
removeOpsDataByStructureElementId(se.id);
}
break;
}
@@ -307,8 +308,8 @@ void IsmHandler::onMainStructureElementChanged(const InfrastructureManagement::M
void IsmHandler::onMainFootprintChanged(const InfrastructureManagement::MainFootprint &data, DataModification modType)
{
DEBUG_LOG(m_logger) << "onMainFootprintChanged id=" << data.id()
<< " size=" << data.elements().size();
DEBUG_LOG(m_logger) << "onMainFootprintChanged id=" << data.id
<< " size=" << data.elements.size();
switch (modType)
{
@@ -317,22 +318,22 @@ void IsmHandler::onMainFootprintChanged(const InfrastructureManagement::MainFoot
{
DEBUG_LOG(m_logger) << "mainStructureElements onMainFootprintChanged id=" << data.id();
DEBUG_LOG(m_logger) << "mainStructureElements onMainFootprintChanged id=" << data.id;
double minX = 0;
double maxX = 0;
double minY = 0;
double maxY = 0;
QPolygonF relBuildingFootprint;
relBuildingFootprint.reserve(data.elements().size());
for (const InfrastructureManagement::FootprintElement &fpElem : data.elements())
relBuildingFootprint.reserve(data.elements.size());
for (const InfrastructureManagement::FootprintElement &fpElem : data.elements)
{
const Core::RelativePosition &relPos = fpElem.relPosition();
minX = std::min(minX, relPos.offsetX());
maxX = std::max(maxX, relPos.offsetX());
minY = std::min(minY, relPos.offsetY());
maxY = std::min(maxY, relPos.offsetY());
const Core::RelativePosition &relPos = fpElem.relPosition;
minX = std::min(minX, relPos.offsetX);
maxX = std::max(maxX, relPos.offsetX);
minY = std::min(minY, relPos.offsetY);
maxY = std::min(maxY, relPos.offsetY);
QPointF point(relPos.offsetX(), relPos.offsetY());
QPointF point(relPos.offsetX, relPos.offsetY);
relBuildingFootprint.append(point);
DEBUG_LOG(m_logger) << "relBuildingFootprint.append() " << point.x() << "/" << point.y() << ")";
@@ -349,12 +350,12 @@ void IsmHandler::onMainFootprintChanged(const InfrastructureManagement::MainFoot
QPointF boundingBoxBottomRight(maxX + m_distanceIpsToGps, minY - m_distanceIpsToGps);
QRectF BoundingBox(boundingBoxTopLeft, boundingBoxBottomRight);
m_buildingBoundingBoxes.insert(data.id(), BoundingBox);
m_buildingBoundingBoxes.insert(data.id, BoundingBox);
m_relBuildingFootprints.insert(data.id(), relBuildingFootprint);
m_relBuildingFootprints.insert(data.id, relBuildingFootprint);
for (const QPointF &p : std::as_const(relBuildingFootprint))
DEBUG_LOG(m_logger) << "relBuildingFootprint = " << p.x() << "/" << p.y();
rotateBuildingFootprint(data.id());
rotateBuildingFootprint(data.id);
break;
}
case DataModification::eRemoved:
@@ -451,24 +452,24 @@ void IsmHandler::updateOpsData(OpsData &data, bool force)
if (!force && !m_dtcIsm->isElementAssignedToExercise(mse, exerciseId))
continue;
for (const InfrastructureManagement::StructureElement &se : mse.elements())
for (const InfrastructureManagement::StructureElement &se : mse.elements)
{
if (se.id() == seId)
if (se.id == seId)
{
data.structureElementId = seId;
data.mainStructureElementId = mse.id();
data.mainStructureElementId = mse.id;
if (se.path().size() > 1)
data.roomId = se.path().at(se.path().size() - 2);
data.position = se.geoPosition();
data.position.z(data.position.z() - mse.geoPosition().z());
m_structure_ElementId2AssetTypeId[seId] = se.mountingPointTypeId().underlying();
if (se.path.size() > 1)
data.roomId = se.path.at(se.path.size() - 2);
data.position = se.geoPosition;
data.position.z = data.position.z - mse.geoPosition.z;
m_structure_ElementId2AssetTypeId[seId] = static_cast<int>(se.mountingPointTypeId);
DEBUG_LOG(m_logger) << "found position for asset " << data.assetId << " with se id " << seId
<< " " << data.position.lon() << "/" << data.position.lat() << "/" << data.position.z()
<< " name=" << se.name()
<< " type=" << se.mountingPointTypeId()
<< " " << data.position.lon << "/" << data.position.lat << "/" << data.position.z
<< " name=" << se.name
<< " type=" << se.mountingPointTypeId
<< " m_structure_ElementId2AssetTypeId.size()=" << m_structure_ElementId2AssetTypeId.size();
data.mountingPointTypeId = se.mountingPointTypeId().underlying();
data.mountingPointTypeId = static_cast<int>(se.mountingPointTypeId);
m_opsData[data.opsCode] = data;
return;
@@ -487,11 +488,11 @@ bool IsmHandler::posInExtendedBuildingFootprint(int mainStructureElementId, cons
return false;
switch (mountPointTypeId) {
case InfrastructureManagement::MountingPointType_def::OutdoorIPS:
case static_cast<int>(InfrastructureManagement::MountingPointType::OutdoorIPS):
DEBUG_LOG(m_logger) << "posInExtendedBuildingFootprint Distance = m_distanceOpsToGps";
distance = m_distanceOpsToGps;
break;
case InfrastructureManagement::MountingPointType_def::IndoorIPS:
case static_cast<int>(InfrastructureManagement::MountingPointType::IndoorIPS):
DEBUG_LOG(m_logger) << "posInExtendedBuildingFootprint Distance = m_distanceIpsToGps";
distance = m_distanceIpsToGps;
break;
@@ -516,7 +517,7 @@ bool IsmHandler::posInExtendedBuildingFootprint(int mainStructureElementId, cons
return false;
TetraIcd::RelativePosition relBldgPosition = m_mainHandler->posHandler()->geographicToRelative(mse.geoPosition());
TetraIcd::RelativePosition relBldgPosition = m_mainHandler->posHandler()->geographicToRelative(mse.geoPosition);
TetraIcd::RelativePosition relPosition = m_mainHandler->posHandler()->geographicToRelative(position);
DEBUG_LOG(m_logger) << "relBldgPosition=" << relBldgPosition.offsetX << "/" << relBldgPosition.offsetY
<< ", relPosition=" << relPosition.offsetX << "/" << relPosition.offsetY;
@@ -178,7 +178,7 @@ bool MainHandler::init(int domainId, int exerciseId)
ERROR_LOG(m_logger) << "Initialisation WebSocketInterfaceHandler failed.";
return false;
}
m_ddsHandler->pacemaker()->addPort(m_handlerWebSocket->serverWebSocketPort(), Core::PortType::WebSocketServer, QStringLiteral("{\"id\":\"TAB\"}"));
m_ddsHandler->pacemaker()->addPort(m_handlerWebSocket->serverWebSocketPort(), Core::CorePortType::WebSocketServer, QStringLiteral("{\"id\":\"TAB\"}"));
DEBUG_LOG(m_logger) << "Initialisation WebSocketInterfaceHandler successful.";
@@ -199,15 +199,15 @@ ProjectDataManagement::RadioGroup MainHandler::exerciseRadioGroup() const
const QMap<int, ProjectDataManagement::RadioGroup> radioGrps = m_pdmHandler->radioGroups();
for (auto it = radioGrps.begin(); it != radioGrps.end(); ++it)
if (it.value().base_group())
if (it.value().base_group)
return it.value();
return ProjectDataManagement::RadioGroup();
}
const auto ex = m_exmHandler->exercise(exerciseId());
if (ex.radioGroupId().is_set())
return m_pdmHandler->radioGroup(ex.radioGroupId().get());
if (ex.radioGroupId.is_set())
return m_pdmHandler->radioGroup(ex.radioGroupId.get());
return ProjectDataManagement::RadioGroup();
}
@@ -252,7 +252,7 @@ TetraIcd::ExerciseEnvironmentData MainHandler::exerciseEnvironmentData() const
exData.utmZone = baseCoord.zone;
exData.grid = zone.mid(3, 2).toStdString();
exData.utmBand = zone.mid(2, 1).at(0).toLatin1();
exData.timeZone = m_exerciseData.defaultTimeZone();
exData.timeZone = m_exerciseData.defaultTimeZone;
return exData;
}
@@ -261,11 +261,11 @@ TetraIcd::ExerciseStateData MainHandler::exerciseStateData() const
{
TetraIcd::ExerciseStateData exData;
if (m_exerciseData.id() != exerciseId())
if (m_exerciseData.id != exerciseId())
return exData;
exData.exerciseId = m_exerciseData.id();
exData.exerciseState = static_cast<TetraIcd::ExerciseStateData::ExerciseState>(m_exerciseData.state().underlying());
exData.exerciseId = m_exerciseData.id;
exData.exerciseState = static_cast<TetraIcd::ExerciseStateData::ExerciseState>(m_exerciseData.state);
return exData;
}
@@ -279,7 +279,7 @@ TetraIcd::ExerciseEquipmentAssignmentComplete MainHandler::exerciseEquipmentAssi
for (const auto &it : exercises)
{
const ProjectDataManagement::RadioGroup rg = radioGroups.value(it.second);
if (rg.id() == 0)
if (rg.id == 0)
{
WARNING_LOG(m_logger) << "Got a radio group id " << it.second << " for exercise " << it.first
<< " but could not find valid data for it - ignoring!";
@@ -287,9 +287,9 @@ TetraIcd::ExerciseEquipmentAssignmentComplete MainHandler::exerciseEquipmentAssi
}
TrainingAreaBase::TetraIcd::GroupIssiInformation gissi;
gissi.exerciseId = it.first;
gissi.serverIssi = rg.issi();
gissi.broadcastIssi1 = rg.group_issi1();
gissi.broadcastIssi2 = rg.group_issi2();
gissi.serverIssi = rg.issi;
gissi.broadcastIssi1 = rg.group_issi1;
gissi.broadcastIssi2 = rg.group_issi2;
eeac.groupIssiInformation.push_back(std::move(gissi));
}
return eeac;
@@ -325,7 +325,7 @@ int MainHandler::domainId() const
void MainHandler::onExerciseChanged(const ExerciseManagement::Exercise &data, DataModification modType)
{
if (data.id() != exerciseId())
if (data.id != exerciseId())
return;
m_exerciseData = data;
@@ -359,9 +359,8 @@ void MainHandler::onConnectionState(const QString &name, bool connectionState)
DEBUG_LOG(m_logger) << "Publishing connection states: " << m_ifcConnectionState.size();
TrainingAreaBase::Connections connections;
connections.id(1);
for (auto it = m_ifcConnectionState.cbegin(); it != m_ifcConnectionState.cend(); ++it)
connections.connections().push_back(
connections.id = 1; for (auto it = m_ifcConnectionState.cbegin(); it != m_ifcConnectionState.cend(); ++it)
connections.connections.push_back(
TrainingAreaBase::ConnectionState(it.key().toStdString(), it.value()));
m_ddsHandler->dtsTab()->publish(connections);
@@ -395,9 +394,9 @@ void MainHandler::onDirectMessage(const QByteArray &jsonMessage)
QString isOk;
for (const ProjectDataManagement::CanComponentString &ccs : qAsConst(m_ccsMap))
{
if (ccs.bitMask() == bitValue)
if (ccs.pdm_bitMask == bitValue)
{
name = m_pdmHandler->dtc()->trCanComponentStringName(ccs.id());
name = m_pdmHandler->dtc()->trCanComponentStringName(ccs.id);
break;
}
}
@@ -442,28 +441,24 @@ void MainHandler::onDirectMessage(const QByteArray &jsonMessage)
QString text;
QJsonObject error = ele.toObject();
ParticipantManagement::BiteError bitError;
bitError.canDeviceNumber(error.value(QStringLiteral("canDeviceNumber")).toInt());
bitError.errorNumber(error.value(QStringLiteral("errorNumber")).toInt());
bitError.subdeviceNumber(error.value(QStringLiteral("subdeviceNumber")).toInt());
bitError.uniqueId(error.value(QStringLiteral("uniqueId")).toInt());
if (bitError.subdeviceNumber() != 0)
bitError.canDeviceNumber = error.value(QStringLiteral("canDeviceNumber")).toInt(); bitError.errorNumber = error.value(QStringLiteral("errorNumber")).toInt(); bitError.subdeviceNumber = error.value(QStringLiteral("subdeviceNumber")).toInt(); bitError.uniqueId = error.value(QStringLiteral("uniqueId")).toInt();
if (bitError.subdeviceNumber != 0)
text = (tr("Error: %1 \nComponent: %2 \nSubdev: %3 \nUId: %4 ")
.arg(getErrorString(bitError),
getCanDeviceName(bitError.canDeviceNumber()),
getSubDeviceName(bitError.subdeviceNumber()))
.arg(QString::number( bitError.uniqueId(), 16 ).toUpper()));
getCanDeviceName(bitError.canDeviceNumber),
getSubDeviceName(bitError.subdeviceNumber))
.arg(QString::number( bitError.uniqueId, 16 ).toUpper()));
else if (bitError.canDeviceNumber() != 0)
else if (bitError.canDeviceNumber != 0)
text = (tr("Error: %1 \nComponent: %2")
.arg(getErrorString(bitError),
getCanDeviceName(bitError.canDeviceNumber())));
getCanDeviceName(bitError.canDeviceNumber)));
WebSocketInterface::Messages::BiteDataMessage::BiteError biteErrorLocal;
biteErrorLocal.deviceId = bitError.canDeviceNumber();
biteErrorLocal.subDevice = bitError.subdeviceNumber();
biteErrorLocal.errorNo = bitError.errorNumber();
biteErrorLocal.uniqueId = bitError.uniqueId();
biteErrorLocal.deviceId = bitError.canDeviceNumber;
biteErrorLocal.subDevice = bitError.subdeviceNumber;
biteErrorLocal.errorNo = bitError.errorNumber;
biteErrorLocal.uniqueId = bitError.uniqueId;
WebSocketInterface::Messages::BiteDataMessage::ErrorText errorT;
errorT.lang = QStringLiteral("de_DE");
@@ -483,22 +478,22 @@ void MainHandler::onDirectMessage(const QByteArray &jsonMessage)
QString MainHandler::getErrorString(const ParticipantManagement::BiteError &error) const
{
const bool subDevice = (error.subdeviceNumber() != 0);
const bool subDevice = (error.subdeviceNumber != 0);
for (const ProjectDataManagement::BiteComponentText &bct : m_bctMap)
{
if (((subDevice && bct.subDeviceId() == error.subdeviceNumber()) ||
(bct.canDeviceId() == error.canDeviceNumber())) &&
(bct.errorNumber() == error.errorNumber()))
return m_pdmHandler->dtc()->trBiteComponentTextName(bct.id());
if (((subDevice && bct.subDeviceId == error.subdeviceNumber) ||
(bct.canDeviceId == error.canDeviceNumber)) &&
(bct.errorNumber == error.errorNumber))
return m_pdmHandler->dtc()->trBiteComponentTextName(bct.id);
}
return tr("Unknown (%1)").arg(error.errorNumber());
return tr("Unknown (%1)").arg(error.errorNumber);
}
QString MainHandler::getCanDeviceName(int id) const
{
for (const ProjectDataManagement::CanComponentString &ccs : m_ccsMap)
{
if (ccs.canDeviceId() == id)
return m_pdmHandler->dtc()->trCanComponentStringName(ccs.id());
if (ccs.canDeviceId == id)
return m_pdmHandler->dtc()->trCanComponentStringName(ccs.id);
}
return tr("Unknown (%1)").arg(id);
}
@@ -507,8 +502,8 @@ QString MainHandler::getSubDeviceName(int id) const
{
for (const ProjectDataManagement::CanComponentString &ccs : m_ccsMap)
{
if (ccs.subDeviceId() == id)
return m_pdmHandler->dtc()->trCanComponentStringName(ccs.id());
if (ccs.subDeviceId == id)
return m_pdmHandler->dtc()->trCanComponentStringName(ccs.id);
}
return tr("Unknown (%1)").arg(id);
}
@@ -517,8 +512,8 @@ void MainHandler::onPositionChanged(int equipNo, const ParticipantManagement::Pa
{
WebSocketInterface::Messages::PositionMessage::PositionData positionData;
positionData.equipNo = equipNo;
positionData.pos = pos.pos();
positionData.gpsTime = pos.sampleTime();
positionData.pos = pos.pos;
positionData.gpsTime = pos.sampleTime;
WebSocketInterface::Messages::PositionMessage *msg = new WebSocketInterface::Messages::PositionMessage(positionData, QUuid::createUuid().toString());
@@ -98,7 +98,7 @@ private:
std::shared_ptr<DbHandler> m_dbHandler;
std::shared_ptr<RecvFromTab> m_rxHandler;
std::shared_ptr<RecvFromDdsFts> m_ftsHandler;
std::shared_ptr<SendToTab> m_txHandler;
std::shared_ptr<TxMixin> m_txHandler;
std::shared_ptr<RecvFromDdsAes> m_aesHandler;
std::shared_ptr<IsmHandler> m_ismHandler;
std::shared_ptr<ExmHandler> m_exmHandler;
@@ -6,6 +6,7 @@
#include "main_handler.h"
#include <ProjectDataManagement/pdm_dtc.h>
#include <NGLLogger/NGLLoggerBootstrap.h>
namespace TrainingAreaBase
{
@@ -66,9 +67,9 @@ bool PdmHandler::initializePdm()
auto cbTasVulKind = [this](const ProjectDataManagement::VulnerabilityKind &k)
{
const int realTasKindId = k.taVulnerabilityKind() & 0x00FFFFFF;
const int realTypeId = (k.taVulnerabilityKind() & 0x00FF0000) >> 16;
const int fallbackTypeId = (k.taVulnerabilityKind() & 0xFF000000) >> 24;
const int realTasKindId = k.taVulnerabilityKind & 0x00FFFFFF;
const int realTypeId = (k.taVulnerabilityKind & 0x00FF0000) >> 16;
const int fallbackTypeId = (k.taVulnerabilityKind & 0xFF000000) >> 24;
m_vulnerabilityKinds[realTasKindId] = k;
TRACE_LOG(m_logger) << "realTasKindId: " << realTasKindId << ", realTypeId: " << realTypeId << ", fallbackTypeId: " << fallbackTypeId;
if (fallbackTypeId)
@@ -107,10 +108,10 @@ ProjectDataManagement::GearClass PdmHandler::gearClassFromChargeTypeId(int charg
for (const auto &gearType2ChargeType : std::as_const(m_gearTypeChargeTypes))
{
if (gearType2ChargeType.chargeTypeId() == chargeTypeId)
if (gearType2ChargeType.chargeTypeId == chargeTypeId)
{
const auto gearType = m_gearTypes.value(gearType2ChargeType.gearTypeId());
return gearType.gearClassId();
const auto gearType = m_gearTypes.value(gearType2ChargeType.gearTypeId);
return gearType.gearClassId;
}
}
return ProjectDataManagement::GearClass::GearClass_Unknown;
@@ -134,7 +135,7 @@ ProjectDataManagement::BuildingChargeEffect PdmHandler::buildingChargeEffect(int
for (const auto &bce : std::as_const(m_buildingChargeEffects))
{
if (bce.chargeTypeId() == chargeTypeId)
if (bce.chargeTypeId == chargeTypeId)
return bce;
}
return {};
@@ -172,7 +173,7 @@ int PdmHandler::vulnerabilityKindId(int tasVulnerabilityKindId, int equipmentNum
DEBUG_LOG(m_logger) << "vulnerability type with id " << typeId
<< " and index " << index << " is using fallback typeId " << fallBackTypeId;
}
return it.value().taVulnerabilityKind();
return it.value().taVulnerabilityKind;
}
@@ -216,11 +217,11 @@ int PdmHandler::chargeTypeIdFromGearAndChargeTasCode(int gearTasCode, int charge
{
for (const auto &gearType2ChargeType : std::as_const(m_gearTypeChargeTypes))
{
if (gearType2ChargeType.gearTypeId() == gearTasCode)
if (gearType2ChargeType.gearTypeId == gearTasCode)
{
const auto chargeType = m_chargeTypes.value(gearType2ChargeType.chargeTypeId());
if (chargeType.id() == chargeTasCode)
return chargeType.id();
const auto chargeType = m_chargeTypes.value(gearType2ChargeType.chargeTypeId);
if (chargeType.id == chargeTasCode)
return chargeType.id;
}
}
}
@@ -246,8 +247,8 @@ int PdmHandler::gearTypeIdFromTasGearTasCode(int gearTasCode)
for (const auto &gearType : std::as_const(m_gearTypes))
{
if (gearType.tasCode() == gearTasCode)
return gearType.id();
if (gearType.tasCode == gearTasCode)
return gearType.id;
}
WARNING_LOG(m_logger) << "Got unmapped training area gear type id "
@@ -257,32 +258,32 @@ int PdmHandler::gearTypeIdFromTasGearTasCode(int gearTasCode)
int PdmHandler::legacyChargeTypeIgniterType(int chargeTypeId, int igniterTypeId, int igniterFunctionId)
{
return m_dtcPdm->getChargeTypeIgniterTypeIgniterFunction(chargeTypeId, igniterTypeId, igniterFunctionId).chargeLegacyId();
return m_dtcPdm->getChargeTypeIgniterTypeIgniterFunction(chargeTypeId, igniterTypeId, igniterFunctionId).chargeLegacyId;
}
double PdmHandler::impactRadius(const AreaEffectSimulation::ChargeStruct &chargeStruct) const
{
return m_dtcPdm->impactRadius(chargeStruct.chargeTypeId(), chargeStruct.igniterTypeId(), chargeStruct.igniterFunctionId());
return m_dtcPdm->impactRadius(chargeStruct.chargeTypeId, chargeStruct.igniterTypeId, chargeStruct.igniterFunctionId);
}
double PdmHandler::impactEdgeLength(const AreaEffectSimulation::ChargeStruct &chargeStruct) const
{
return m_dtcPdm->impactEdgeLength(chargeStruct.chargeTypeId(), chargeStruct.igniterTypeId(), chargeStruct.igniterFunctionId());
return m_dtcPdm->impactEdgeLength(chargeStruct.chargeTypeId, chargeStruct.igniterTypeId, chargeStruct.igniterFunctionId);
}
bool PdmHandler::isSmartChargeType(const AreaEffectSimulation::ChargeStruct &chargeStruct) const
{
return m_dtcPdm->isSmart(chargeStruct.chargeTypeId(), chargeStruct.igniterTypeId(), chargeStruct.igniterFunctionId());
return m_dtcPdm->isSmart(chargeStruct.chargeTypeId, chargeStruct.igniterTypeId, chargeStruct.igniterFunctionId);
}
bool PdmHandler::isIedChargeType(const AreaEffectSimulation::ChargeStruct &chargeStruct) const
{
return m_dtcPdm->isIed(chargeStruct.chargeTypeId(), chargeStruct.igniterTypeId(), chargeStruct.igniterFunctionId());
return m_dtcPdm->isIed(chargeStruct.chargeTypeId, chargeStruct.igniterTypeId, chargeStruct.igniterFunctionId);
}
bool PdmHandler::isReactivatableChargeType(const AreaEffectSimulation::ChargeStruct &chargeStruct) const
{
return m_dtcPdm->isReactivatable(chargeStruct.chargeTypeId(), chargeStruct.igniterTypeId(), chargeStruct.igniterFunctionId());
return m_dtcPdm->isReactivatable(chargeStruct.chargeTypeId, chargeStruct.igniterTypeId, chargeStruct.igniterFunctionId);
}
bool PdmHandler::isIndirect(int chargeTypeId) const
@@ -291,16 +292,16 @@ bool PdmHandler::isIndirect(int chargeTypeId) const
}
int PdmHandler::hazardDistance(const AreaEffectSimulation::ChargeStruct &chargeStruct) const
{
return m_dtcPdm->hazardDistance(chargeStruct.chargeTypeId(), chargeStruct.igniterTypeId(), chargeStruct.igniterFunctionId());
return m_dtcPdm->hazardDistance(chargeStruct.chargeTypeId, chargeStruct.igniterTypeId, chargeStruct.igniterFunctionId);
}
bool PdmHandler::isLaserGuidable(const AreaEffectSimulation::ChargeStruct &chargeStruct) const
{
return m_dtcPdm->isLaserGuidable(chargeStruct.chargeTypeId(), chargeStruct.igniterTypeId(), chargeStruct.igniterFunctionId());
return m_dtcPdm->isLaserGuidable(chargeStruct.chargeTypeId, chargeStruct.igniterTypeId, chargeStruct.igniterFunctionId);
}
bool PdmHandler::isUasDroppable(const AreaEffectSimulation::ChargeStruct &chargeStruct) const
{
return m_dtcPdm->isUasDroppable(chargeStruct.chargeTypeId(), chargeStruct.igniterTypeId(), chargeStruct.igniterFunctionId());
return m_dtcPdm->isUasDroppable(chargeStruct.chargeTypeId, chargeStruct.igniterTypeId, chargeStruct.igniterFunctionId);
}
}
@@ -4,6 +4,7 @@
#include "position_handler.h"
#include "exm_handler.h"
#include "logger.h"
#include <NGLLogger/NGLLoggerBootstrap.h>
#include <AssetManagement/asm_dtc.h>
using namespace TrainingAreaBase;
@@ -28,7 +29,7 @@ bool PositionHandler::initCoordinateConversion() const
constexpr int ddsTimeout = 10 * 1000;
const auto ex = m_mainHandler->exmHandler()->exercise(m_mainHandler->exerciseId());
if (ex.id() <= 0)
if (ex.id <= 0)
{
ERROR_LOG(m_logger) << "Can not retrieve exercise information for id " << m_mainHandler->exerciseId();
return false;
@@ -38,18 +39,18 @@ bool PositionHandler::initCoordinateConversion() const
ERROR_LOG(m_logger) << "Error initializing AssetManagement DTC";
return false;
}
const auto ta = m_dtcAsm->trainingArea(ex.trainingAreaId());
if (ta.id() <= 0)
const auto ta = m_dtcAsm->trainingArea(ex.trainingAreaId);
if (ta.id <= 0)
{
ERROR_LOG(m_logger) << "Can not retrieve training are information for id " << ex.trainingAreaId();
ERROR_LOG(m_logger) << "Can not retrieve training are information for id " << ex.trainingAreaId;
return false;
}
m_dtcAsm.reset();
const LtsCoordTrans::UtmCoordinate bottomLeft(LtsCoordTrans::UtmCoordinate::fromGeographic(ta.bottomLeft().lon(), ta.bottomLeft().lat()));
const QPointF mid(bottomLeft.geographic(ta.width() / 2, ta.height() / 2));
const LtsCoordTrans::UtmCoordinate bottomLeft(LtsCoordTrans::UtmCoordinate::fromGeographic(ta.bottomLeft.lon, ta.bottomLeft.lat));
const QPointF mid(bottomLeft.geographic(ta.width / 2, ta.height / 2));
@@ -60,8 +61,8 @@ bool PositionHandler::initCoordinateConversion() const
m_utm2Geographic = LtsCoordTrans::UtmCoordinate::fromMgrs(mgrs);
LtsCoordTrans::UtmCoordinate topRight(bottomLeft);
topRight.x += ta.width();
topRight.y += ta.height();
topRight.x += ta.width;
topRight.y += ta.height;
m_relPosBottomLeft = bottomLeft.relativeTo(m_utm2Geographic);
m_relPosTopRight = topRight.relativeTo(m_utm2Geographic);
@@ -69,8 +70,8 @@ bool PositionHandler::initCoordinateConversion() const
NOTICE_LOG(m_logger) << "Training area bottomLeft: " << m_relPosBottomLeft.x() << "," << m_relPosBottomLeft.y()
<< ", topRight: " << m_relPosTopRight.x() << "," << m_relPosTopRight.y()
<< ", base point: " << mgrs
<< ", width:" << ta.width()
<< ", height: " << ta.height();
<< ", width:" << ta.width
<< ", height: " << ta.height;
return true;
}
@@ -84,13 +85,13 @@ Core::GeoPosition2D PositionHandler::relativeToGeographic2D(const TetraIcd::Rela
{
const QPointF point(m_utm2Geographic.geographic(p.offsetX, p.offsetY));
ret.lon(point.x());
ret.lat(point.y());
ret.lon = point.x();
ret.lat = point.y();
}
else
{
ret.lon(nan(""));
ret.lat(nan(""));
ret.lon = nan("");
ret.lat = nan("");
}
return ret;
}
@@ -99,17 +100,17 @@ Core::GeoPosition PositionHandler::relativeToGeographic(const TetraIcd::Relative
{
const Core::GeoPosition2D pos2d(relativeToGeographic2D(p));
Core::GeoPosition ret;
ret.lon(pos2d.lon());
ret.lat(pos2d.lat());
ret.z(p.offsetZ);
ret.lon = pos2d.lon;
ret.lat = pos2d.lat;
ret.z = p.offsetZ;
DEBUG_LOG(m_logger) << "x/y -> lon/lat: " << p.offsetX << "," << p.offsetY
<< " -> " << ret.lon() * LtsCoordTrans::rad2deg() << "," << ret.lat() * LtsCoordTrans::rad2deg();
<< " -> " << ret.lon * LtsCoordTrans::rad2deg() << "," << ret.lat * LtsCoordTrans::rad2deg();
return ret;
}
QPointF PositionHandler::geographicToRelativePointF(const Core::GeoPosition2D &p) const
{
return geographicToRelativePointF(Core::GeoPosition(p.lon(), p.lat(), 0));
return geographicToRelativePointF(Core::GeoPosition(p.lon, p.lat, 0));
}
QPointF PositionHandler::geographicToRelativePointF(const Core::GeoPosition &p) const
@@ -117,21 +118,21 @@ QPointF PositionHandler::geographicToRelativePointF(const Core::GeoPosition &p)
initCoordinateConversion();
const LtsCoordTrans::UtmCoordinate point(LtsCoordTrans::UtmCoordinate::fromGeographic(p.lon(), p.lat(), m_utm2Geographic.zone));
const LtsCoordTrans::UtmCoordinate point(LtsCoordTrans::UtmCoordinate::fromGeographic(p.lon, p.lat, m_utm2Geographic.zone));
return QPointF(point.x - m_utm2Geographic.x, point.y - m_utm2Geographic.y);
}
TetraIcd::RelativePosition PositionHandler::geographicToRelative(const Core::GeoPosition2D &p, double z) const
{
return geographicToRelative(Core::GeoPosition(p.lon(), p.lat(), z));
return geographicToRelative(Core::GeoPosition(p.lon, p.lat, z));
}
TetraIcd::RelativePosition PositionHandler::geographicToRelative(const Core::GeoPosition &p) const
{
const QPointF rel(geographicToRelativePointF(p));
const TetraIcd::RelativePosition ret(qRound(rel.x()), qRound(rel.y()), p.z());
DEBUG_LOG(m_logger) << "lon/lat -> x/y: " << p.lon() * LtsCoordTrans::rad2deg() << "," << p.lat() * LtsCoordTrans::rad2deg()
const TetraIcd::RelativePosition ret(qRound(rel.x()), qRound(rel.y()), p.z);
DEBUG_LOG(m_logger) << "lon/lat -> x/y: " << p.lon * LtsCoordTrans::rad2deg() << "," << p.lat * LtsCoordTrans::rad2deg()
<< " -> " << ret.offsetX << "," << ret.offsetY;
return ret;
}
@@ -153,7 +154,7 @@ double PositionHandler::speed (const TetraIcd::RelativePosition &relPos, const i
if (deltaTime == 0)
return 0.0;
TetraIcd::RelativePosition lastRelPosition = geographicToRelative(lastParticipantPosition.pos.position());
TetraIcd::RelativePosition lastRelPosition = geographicToRelative(lastParticipantPosition.pos.position);
QLineF line(QPointF(lastRelPosition.offsetX, lastRelPosition.offsetY),
QPointF(relPos.offsetX, relPos.offsetY));
@@ -191,7 +192,7 @@ TrainingAreaBase::TabPosition PositionHandler::lastPosition(int equipNo) const
lastPos = m_lastPosition.value(equipNo);
return lastPos.pos;
}
ret.position(Core::GeoPosition(nan(""), nan(""), nan("")));
ret.position = Core::GeoPosition(nan(""), nan(""), nan(""));
return ret;
}
@@ -4,12 +4,14 @@
#include "ppm_handler.h"
#include "main_handler.h"
#include "send_to_tab.h"
#include <NGLLogger/NGLLoggerBootstrap.h>
#include <QtCore/QTimer>
namespace TrainingAreaBase
{
PpmHandler::PpmHandler(MainHandler *mainHandler)
: m_mainHandler(mainHandler)
: m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
, m_mainHandler(mainHandler)
, m_equipExerciseMappingTimer(new QTimer(this))
{
m_equipExerciseMappingTimer->setSingleShot(true);
@@ -46,10 +48,10 @@ void PpmHandler::onParticipantPositionChanged(const ParticipantManagement::Parti
if (modType == DataModification::eRemoved)
return;
ParticipantManagement::Participant participant = m_ppmDtc->participant(data.participantId());
ParticipantManagement::Participant participant = m_ppmDtc->participant(data.participantId);
int equipNo = 0;
if (participant.equipmentNumber().is_set())
equipNo = participant.equipmentNumber().get();
if (participant.equipmentNumber.is_set())
equipNo = participant.equipmentNumber.get();
if (equipNo > 0)
emit position(equipNo, data);
@@ -64,15 +66,15 @@ void PpmHandler::onEquipmentExerciseMappingChanged(const ParticipantManagement::
case DataModification::eAdded:
case DataModification::eModified:
{
std::unordered_set<int> &equipmentNumbers = m_exerciseEquipmentAssignments[data.exerciseId()];
std::unordered_set<int> &equipmentNumbers = m_exerciseEquipmentAssignments[data.exerciseId];
equipmentNumbers.clear();
for (const ParticipantManagement::Equipment2ParticipantId &e2p : data.mapping())
equipmentNumbers.insert(e2p.equipmentNumber());
for (const ParticipantManagement::Equipment2ParticipantId &e2p : data.mapping)
equipmentNumbers.insert(e2p.equipmentNumber);
break;
}
case DataModification::eRemoved:
{
auto it = m_exerciseEquipmentAssignments.find(data.exerciseId());
auto it = m_exerciseEquipmentAssignments.find(data.exerciseId);
if (it != m_exerciseEquipmentAssignments.end())
m_exerciseEquipmentAssignments.erase(it);
break;
@@ -2,7 +2,10 @@
#pragma once
#include <QtCore/QObject>
#include <ParticipantManagement/ppm.hpp>
#include <ParticipantManagement/ppm_dtc.h>
#include <LtsUtils/LtsUtilsCore/data_modification_enum.h>
#include <unordered_map>
#include <unordered_set>
#include "logger.h"
@@ -8,6 +8,7 @@
#include <AreaEffectSimulation/Utils/polygons.h>
#include <AreaEffectSimulation/aes_translation.h>
#include <ngldb/db_service_handler.h>
#include <NGLLogger/NGLLoggerBootstrap.h>
#include <TrainingAreaBase/tab_fts.h>
#include <QtGui/QTransform>
@@ -17,9 +18,10 @@ namespace TrainingAreaBase
AesStateHandler::AesStateHandler(MainHandler *mainHandler) : m_dbInterface(mainHandler->dbHandler()->db())
, m_exerciseId(mainHandler->exerciseId()),
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) {}
AesStateHandler::AesStateHandler(MainHandler *mainHandler)
: m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
, m_dbInterface(mainHandler->dbHandler()->db())
, m_exerciseId(mainHandler->exerciseId()) {}
template<>
@@ -112,6 +114,7 @@ RecvFromDdsAes::RecvFromDdsAes(MainHandler *mainHandler,
const std::shared_ptr<SendToTab> &txCallback,
QObject *parent)
: QObject(parent)
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
, m_ddsConnector(mainHandler->ddsHandler()->ddsConnector())
, m_txCallback(txCallback)
, m_aesStateHandler(new AesStateHandler(mainHandler))
@@ -211,67 +214,67 @@ int RecvFromDdsAes::aesChargeId(int aesId) const
{
auto it = m_currentBCContaminations.find(aesId);
if (it != m_currentBCContaminations.end())
return it->second.chargeStruct().chargeTypeId();
return it->second.chargeStruct.chargeTypeId;
}
{
auto it = m_currentExplosionArea.find(aesId);
if (it != m_currentExplosionArea.end())
return it->second.chargeStruct().chargeTypeId();
return it->second.chargeStruct.chargeTypeId;
}
{
auto it = m_currentExplosionCluster.find(aesId);
if (it != m_currentExplosionCluster.end())
return it->second.chargeStruct().chargeTypeId();
return it->second.chargeStruct.chargeTypeId;
}
{
auto it = m_currentExplosionSingle.find(aesId);
if (it != m_currentExplosionSingle.end())
return it->second.chargeStruct().chargeTypeId();
return it->second.chargeStruct.chargeTypeId;
}
{
auto it = m_currentMineArea.find(aesId);
if (it != m_currentMineArea.end())
return it->second.chargeStruct().chargeTypeId();
return it->second.chargeStruct.chargeTypeId;
}
{
auto it = m_currentNContamination.find(aesId);
if (it != m_currentNContamination.end())
return it->second.chargeStruct().chargeTypeId();
return it->second.chargeStruct.chargeTypeId;
}
{
auto it = m_currentDusSingleMine.find(aesId);
if (it != m_currentDusSingleMine.end())
return it->second.chargeStruct().chargeTypeId();
return it->second.chargeStruct.chargeTypeId;
}
{
auto it = m_currentGasPipes.find(aesId);
if (it != m_currentGasPipes.end())
return it->second.chargeStruct().chargeTypeId();
return it->second.chargeStruct.chargeTypeId;
}
{
auto it = m_currentFunctionalArea.find(aesId);
if (it != m_currentFunctionalArea.end())
return it->second.chargeStruct().chargeTypeId();
return it->second.chargeStruct.chargeTypeId;
}
{
auto it = m_currentBoobyTraps.find(aesId);
if (it != m_currentBoobyTraps.end())
return it->second.chargeStruct().chargeTypeId();
return it->second.chargeStruct.chargeTypeId;
}
{
auto it = m_currentOffRouteMines.find(aesId);
if (it != m_currentOffRouteMines.end())
return it->second.chargeStruct().chargeTypeId();
return it->second.chargeStruct.chargeTypeId;
}
{
auto it = m_currentTechnicalArea.find(aesId);
if (it != m_currentTechnicalArea.end())
return it->second.chargeStruct().chargeTypeId();
return it->second.chargeStruct.chargeTypeId;
}
{
auto it = m_currentAirSupportImpacts.find(aesId);
if (it != m_currentAirSupportImpacts.end())
return it->second.chargeStruct().chargeTypeId();
return it->second.chargeStruct.chargeTypeId;
}
return -1;
}
@@ -344,18 +347,18 @@ TetraIcd::AreaEffectSimulationType RecvFromDdsAes::aesTypeFromId(int aesId) cons
bool RecvFromDdsAes::sendSingleFireSMArt(const SendCesHitRequest &request)
{
AreaEffectSimulation::ExplosionSingle data;
data.chargeStruct().chargeTypeId(request.chargeTypeId());
data.effectDuration(1);
data.effectStart(request.effectTime());
data.id(request.aesId());
data.impactPosition(request.position().position());
data.isDeleted(false);
data.participantId(request.participantId());
data.partyId(request.partyId());
data.chargeStruct.chargeTypeId = request.chargeTypeId;
data.effectDuration = 1;
data.effectStart = request.effectTime;
data.id = request.aesId;
data.impactPosition = request.position.position;
data.isDeleted = false;
data.participantId = request.participantId;
data.partyId = request.partyId;
bool bAlreadyExists = false;
const int aesTetraId = m_aesStateHandler->createAesTetraId(request.aesId(), bAlreadyExists);
const int aesTetraId = m_aesStateHandler->createAesTetraId(request.aesId, bAlreadyExists);
if (!bAlreadyExists)
{
@@ -364,8 +367,8 @@ bool RecvFromDdsAes::sendSingleFireSMArt(const SendCesHitRequest &request)
dataChanged(data, bOnlyNameChanged);
}
sendCreateEffectSimulation(data, aesTetraId, request.equipmentNumber());
m_aesStateHandler->update(request.aesId(), aesTetraId, true);
sendCreateEffectSimulation(data, aesTetraId, request.equipmentNumber);
m_aesStateHandler->update(request.aesId, aesTetraId, true);
return true;
}
@@ -375,19 +378,19 @@ bool RecvFromDdsAes::sendSingleFireSMArt(const SendCesHitRequest &request)
template <typename T>
void RecvFromDdsAes::handleEffectSimulation(const T &data, DataModification modType, TetraIcd::AreaEffectSimulationType aesType)
{
DEBUG_LOG(m_logger) << "RecvFromDdsAes::handleEffectSimulation(id=" << data.id()
DEBUG_LOG(m_logger) << "RecvFromDdsAes::handleEffectSimulation(id=" << data.id
<< ", modType: " << static_cast<int>(modType)
<< ", type=" << static_cast<int>(aesType)
<< ", name: " << data.name()
<< ", state: " << data.effectStateId()
<< ", old state: " << m_currentEffectState.value(data.id()) << ")";
<< ", name: " << data.name
<< ", state: " << data.effectStateId
<< ", old state: " << m_currentEffectState.value(data.id) << ")";
if (std::is_same<T, AreaEffectSimulation::ExplosionSingle>::value ||
std::is_same<T, AreaEffectSimulation::ExplosionArea>::value ||
std::is_same<T, AreaEffectSimulation::ExplosionCluster>::value
)
{
if (m_mainHandler->pdmHandler()->isSmartChargeType(data.chargeStruct()))
if (m_mainHandler->pdmHandler()->isSmartChargeType(data.chargeStruct))
{
DEBUG_LOG(m_logger) << "Do not send SMART Single/AreaFire to Tetra as broadcast, hits are send directly.";
return;
@@ -401,28 +404,28 @@ void RecvFromDdsAes::handleEffectSimulation(const T &data, DataModification modT
case DataModification::eRemoved:
{
if (data.effectStateId() == AreaEffectSimulation::AesEffectState::EsPaused &&
m_currentEffectState.value(data.id()) != AreaEffectSimulation::AesEffectState::EsPaused)
if (data.effectStateId == AreaEffectSimulation::AesEffectState::EsPaused &&
m_currentEffectState.value(data.id) != AreaEffectSimulation::AesEffectState::EsPaused)
{
const int aesTetraId = m_aesStateHandler->getAesTetraId(data.id());
const int aesTetraId = m_aesStateHandler->getAesTetraId(data.id);
if (aesTetraId <= 0)
{
handleSendToTetra(data, aesType);
}
sendPauseEffectSimulation(data.id());
sendPauseEffectSimulation(data.id);
}
else if (data.effectStateId() == AreaEffectSimulation::AesEffectState::EsActivated &&
m_currentEffectState.value(data.id()) == AreaEffectSimulation::AesEffectState::EsPaused)
else if (data.effectStateId == AreaEffectSimulation::AesEffectState::EsActivated &&
m_currentEffectState.value(data.id) == AreaEffectSimulation::AesEffectState::EsPaused)
{
sendResumeEffectSimulation(data);
}
else if (!data.effectStart().is_set() ||
data.effectStart().get() == 0 ||
data.effectStateId() == AreaEffectSimulation::AesEffectState::EsRemoved ||
data.effectStateId() == AreaEffectSimulation::AesEffectState::EsExpired)
else if (!data.effectStart.is_set() ||
data.effectStart.get() == 0 ||
data.effectStateId == AreaEffectSimulation::AesEffectState::EsRemoved ||
data.effectStateId == AreaEffectSimulation::AesEffectState::EsExpired)
{
if (modType == DataModification::eAdded)
@@ -434,7 +437,7 @@ void RecvFromDdsAes::handleEffectSimulation(const T &data, DataModification modT
sendRemoveEffectSimulation(aesType, data.id());
sendRemoveEffectSimulation(aesType, data.id);
resetStartTime(data);
}
else
@@ -442,10 +445,10 @@ void RecvFromDdsAes::handleEffectSimulation(const T &data, DataModification modT
if (!(std::is_same<T, AreaEffectSimulation::FunctionalArea>::value) ||
(data.effectStateId() == AreaEffectSimulation::AesEffectState::EsActivated))
(data.effectStateId == AreaEffectSimulation::AesEffectState::EsActivated))
handleSendToTetra(data, aesType);
}
m_currentEffectState[data.id()] = data.effectStateId();
m_currentEffectState[data.id] = data.effectStateId;
break;
}
}
@@ -456,7 +459,7 @@ void RecvFromDdsAes::handleSendToTetra(const T &data, TetraIcd::AreaEffectSimul
{
bool bAlreadyExists = false;
const int aesTetraId = m_aesStateHandler->createAesTetraId(data.id(), bAlreadyExists);
const int aesTetraId = m_aesStateHandler->createAesTetraId(data.id, bAlreadyExists);
bool bOnlyNameChanged = false;
@@ -475,15 +478,15 @@ void RecvFromDdsAes::handleSendToTetra(const T &data, TetraIcd::AreaEffectSimul
!std::is_same<T, AreaEffectSimulation::TechnicalArea>::value)
{
sendModifyEffectSimulationName(aesType,
m_aesStateHandler->getAesTetraId(data.id()),
data.name(),
data.id());
m_aesStateHandler->update(data.id(), aesTetraId, true);
m_aesStateHandler->getAesTetraId(data.id),
data.name,
data.id);
m_aesStateHandler->update(data.id, aesTetraId, true);
}
else if (bSomethingChanged)
{
sendCreateEffectSimulation(data, aesTetraId);
m_aesStateHandler->update(data.id(), aesTetraId, true);
m_aesStateHandler->update(data.id, aesTetraId, true);
}
}
@@ -513,11 +516,11 @@ void RecvFromDdsAes::onMineAreaChanged(const AreaEffectSimulation::MineArea &dat
handleEffectSimulation(data, modType, TetraIcd::AreaEffectSimulationType::MineArea);
auto it = m_temporarySingleMineState.find(data.id());
auto it = m_temporarySingleMineState.find(data.id);
if (it != m_temporarySingleMineState.end())
{
onTriggeredImpactsChanged(it->second, DataModification::eModified);
m_temporarySingleMineState.erase(data.id());
m_temporarySingleMineState.erase(data.id);
}
}
@@ -540,29 +543,29 @@ void RecvFromDdsAes::onTriggeredImpactsChanged(const AreaEffectSimulation::Trigg
{
if (modType == DataModification::eRemoved)
return;
if (data.aesTypeId() != AreaEffectSimulation::AesType::AtMineAreaSingleMines)
if (data.aesTypeId != AreaEffectSimulation::AesType::AtMineAreaSingleMines)
return;
if (data.aesItemId() == 0)
if (data.aesItemId == 0)
return;
bool completeUntriggered = true;
for (size_t i = 0; i < data.bitfield().size() && completeUntriggered; ++i)
for (size_t i = 0; i < data.bitfield.size() && completeUntriggered; ++i)
{
if ((i + 1) * 8 <= static_cast<unsigned long>(data.impactCount()))
if ((i + 1) * 8 <= static_cast<unsigned long>(data.impactCount))
{
if (data.bitfield().at(i) != 0xFF)
if (data.bitfield.at(i) != 0xFF)
completeUntriggered = false;
}
else
{
uint8_t endMask = 0;
for (uint32_t j = 0; j < (static_cast<unsigned long>(data.impactCount()) - i * 8); ++j)
for (uint32_t j = 0; j < (static_cast<unsigned long>(data.impactCount) - i * 8); ++j)
endMask |= 0x80 >> j;
if (data.bitfield().at(i) != endMask)
if (data.bitfield.at(i) != endMask)
completeUntriggered = false;
}
}
@@ -570,24 +573,24 @@ void RecvFromDdsAes::onTriggeredImpactsChanged(const AreaEffectSimulation::Trigg
return;
auto it = m_currentMineArea.find(data.aesItemId());
auto it = m_currentMineArea.find(data.aesItemId);
if (it != m_currentMineArea.end())
{
const auto &mineArea = it->second;
if (mineArea.isDus() || mineArea.isConcrete())
if (mineArea.isDus || mineArea.isConcrete)
{
INFO_LOG(m_logger) << "Not publishing mineArea single state for " << data.aesItemId() << " - is a DUS mineArea";
INFO_LOG(m_logger) << "Not publishing mineArea single state for " << data.aesItemId << " - is a DUS mineArea";
return;
}
switch (mineArea.effectStateId().underlying())
switch (mineArea.effectStateId)
{
case AreaEffectSimulation::AesEffectState::EsError:
case AreaEffectSimulation::AesEffectState::EsExpired:
case AreaEffectSimulation::AesEffectState::EsRemoved:
case AreaEffectSimulation::AesEffectState::EsUnknown:
{
INFO_LOG(m_logger) << "Not publishing mineArea single state for " << data.aesItemId() << " - with state " << AreaEffectSimulation::toString(mineArea.effectStateId());
INFO_LOG(m_logger) << "Not publishing mineArea single state for " << data.aesItemId << " - with state " << AreaEffectSimulation::toString(mineArea.effectStateId);
return;
}
default:
@@ -596,18 +599,18 @@ void RecvFromDdsAes::onTriggeredImpactsChanged(const AreaEffectSimulation::Trigg
}
else
{
INFO_LOG(m_logger) << "Storing mineArea single state, as we dont have the corresponding mineArea yet aesId" << data.aesItemId();
m_temporarySingleMineState[data.aesItemId()] = data;
INFO_LOG(m_logger) << "Storing mineArea single state, as we dont have the corresponding mineArea yet aesId" << data.aesItemId;
m_temporarySingleMineState[data.aesItemId] = data;
return;
}
TetraIcd::MineAreaSingleMineState out;
out.aesDdsId = data.aesItemId();
out.aesDdsId = data.aesItemId;
out.mineCount = data.impactCount();
out.mineState.reserve(data.bitfield().size());
for (const auto &c : data.bitfield())
out.mineCount = data.impactCount;
out.mineState.reserve(data.bitfield.size());
for (const auto &c : data.bitfield)
out.mineState.push_back(c);
txData(out);
@@ -618,7 +621,7 @@ void RecvFromDdsAes::onDusMineStateChanged(const AreaEffectSimulation::DusMineSt
if (modType == DataModification::eRemoved)
return;
const auto &vec = data.mines();
const auto &vec = data.mines;
if (vec.size() == 0)
return;
@@ -627,26 +630,26 @@ void RecvFromDdsAes::onDusMineStateChanged(const AreaEffectSimulation::DusMineSt
{
if (!m_mainHandler->pdmHandler()->isReactivatableChargeType({mine.chargeTypeId(), 0,0}))
if (!m_mainHandler->pdmHandler()->isReactivatableChargeType({mine.chargeTypeId, 0,0}))
continue;
if (mine != m_allReactivatableDusMines.value(mine.eqId()))
if (mine != m_allReactivatableDusMines.value(mine.eqId))
{
if (!mine.triggered() &&
m_allReactivatableDusMines.contains(mine.eqId()) && m_allReactivatableDusMines.value(mine.eqId()).triggered()
if (!mine.triggered &&
m_allReactivatableDusMines.contains(mine.eqId) && m_allReactivatableDusMines.value(mine.eqId).triggered
)
m_minesToSend << mine.eqId();
m_minesToSend << mine.eqId;
m_allReactivatableDusMines.insert(mine.eqId(), mine);
m_allReactivatableDusMines.insert(mine.eqId, mine);
}
}
if (!m_minesToSend.isEmpty())
m_sendDusMineReactivtionTimer->start();
else
INFO_LOG(m_logger) << "Nothing changed in DusMineState of MineArea: " << data.id();
INFO_LOG(m_logger) << "Nothing changed in DusMineState of MineArea: " << data.id;
}
void RecvFromDdsAes::onSendDusMineReactivationTimeout()
@@ -655,7 +658,7 @@ void RecvFromDdsAes::onSendDusMineReactivationTimeout()
out.dusSerialNumbers.reserve(m_minesToSend.size());
for (const auto &mineId : std::as_const(m_minesToSend))
{
m_allReactivatableDusMines[mineId].triggered(false);
m_allReactivatableDusMines[mineId].triggered = false;
out.dusSerialNumbers.push_back(mineId);
}
m_minesToSend.clear();
@@ -693,19 +696,19 @@ void RecvFromDdsAes::onExplosionClusterChanged(const AreaEffectSimulation::Explo
template<typename T, typename S>
void setCommonParams(T &out, const S &in, const int aesTetraId)
{
out.aesDdsId = in.id();
out.aesDdsId = in.id;
Q_UNUSED(aesTetraId);
out.name = in.name();
out.partyId = in.partyId().is_set() ? in.partyId().get() : 0;
out.name = in.name;
out.partyId = in.partyId.is_set() ? in.partyId.get() : 0;
}
template<typename T, typename S>
void setCommonCombatParams(T &out, const S &in, const int aesTetraId)
{
setCommonParams(out, in, aesTetraId);
out.effectStart = in.effectStart().is_set() ? in.effectStart().get() : 0;
out.effectDuration = in.effectDuration();
out.effectStart = in.effectStart.is_set() ? in.effectStart.get() : 0;
out.effectDuration = in.effectDuration;
}
@@ -718,27 +721,27 @@ void RecvFromDdsAes::onEffectsChanged(const AreaEffectSimulation::Effects &data,
if (data.aesTypeId().underlying() != AreaEffectSimulation::AesType_def::AtExplosionClusterSingleExplosions)
if (data.aesTypeId != AreaEffectSimulation::AesType::AtExplosionClusterSingleExplosions)
return;
const int aesItemId = data.aesItemId();
const int aesItemId = data.aesItemId;
if (aesItemId <= 0)
return;
const AreaEffectSimulation::ExplosionCluster &aes = m_dtcAes->explosionCluster(aesItemId);
if (aes.id() != aesItemId)
if (aes.id != aesItemId)
return;
const bool bIsLaserGuidable = m_mainHandler->pdmHandler()->isLaserGuidable(aes.chargeStruct());
const bool bIsLaserGuidable = m_mainHandler->pdmHandler()->isLaserGuidable(aes.chargeStruct);
if (!bIsLaserGuidable)
return;
const std::vector<AreaEffectSimulation::SingleEffect> &singleEffectsRef = data.singleEffects();
const std::vector<AreaEffectSimulation::SingleEffect> &singleEffectsRef = data.singleEffects;
if (!singleEffectsRef.empty())
{
@@ -762,23 +765,23 @@ void RecvFromDdsAes::onEffectsChanged(const AreaEffectSimulation::Effects &data,
const AreaEffectSimulation::SingleEffect &firstSingleEffect = singleEffectsRef.front();
const Core::GeoPosition &fsePosition = firstSingleEffect.position();
const Core::GeoPosition &fsePosition = firstSingleEffect.position;
cAes.relCorner = m_posHandler->geographicToRelative(fsePosition);
cAes.width = qRound(aes.area().width());
cAes.height = qRound(aes.area().height());
cAes.rotationAngle = aes.area().rotation();
cAes.mhpRotation = aes.mhpRotation();
cAes.mhpWidth = aes.mhpWidth();
cAes.mhpLength = aes.mhpLength();
cAes.impactCount = aes.impactCount();
cAes.impactEdgeLength = qRound(pdm()->impactEdgeLength(aes.chargeStruct()));
cAes.hazardDistance = m_mainHandler->pdmHandler()->hazardDistance(aes.chargeStruct());
cAes.width = qRound(aes.area.width);
cAes.height = qRound(aes.area.height);
cAes.rotationAngle = aes.area.rotation;
cAes.mhpRotation = aes.mhpRotation;
cAes.mhpWidth = aes.mhpWidth;
cAes.mhpLength = aes.mhpLength;
cAes.impactCount = aes.impactCount;
cAes.impactEdgeLength = qRound(pdm()->impactEdgeLength(aes.chargeStruct));
cAes.hazardDistance = m_mainHandler->pdmHandler()->hazardDistance(aes.chargeStruct);
std::vector<TetraIcd::RelativePosition> &mhPointsRef = cAes.mhPoints;
mhPointsRef.clear();
mhPointsRef.reserve(aes.mhPoints().size());
for (const Core::GeoPosition2D &pos : std::as_const(aes.mhPoints()))
mhPointsRef.reserve(aes.mhPoints.size());
for (const Core::GeoPosition2D &pos : std::as_const(aes.mhPoints))
mhPointsRef.emplace_back(m_posHandler->geographicToRelative(pos, 0));
@@ -795,9 +798,9 @@ void RecvFromDdsAes::onEffectsChanged(const AreaEffectSimulation::Effects &data,
void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::AirSupportImpact &aes, int aesTetraId)
{
if (aes.isCentral())
if (aes.isCentral)
{
sendRemoveEffectSimulation(TetraIcd::AreaEffectSimulationType::ExplosionSingle, aes.id());
sendRemoveEffectSimulation(TetraIcd::AreaEffectSimulationType::ExplosionSingle, aes.id);
return;
}
DEBUG_LOG(m_logger) << "RecvFromDdsAes::sendCreateEffectSimulation(AirSupportImpact, "
@@ -807,13 +810,13 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::AirS
setCommonCombatParams(cAes, aes, aesTetraId);
cAes.header.equipmentNumber = 0;
cAes.relEffectPosition = m_posHandler->geographicToRelative(aes.impactPosition(), 0);
cAes.relEffectPosition = m_posHandler->geographicToRelative(aes.impactPosition, 0);
const auto chargeType(pdm()->chargeTypeFromId(aes.chargeStruct().chargeTypeId()));
cAes.chargeTypeId = chargeType.legacyId() > 0 ? chargeType.legacyId() : chargeType.id();
const auto chargeType(pdm()->chargeTypeFromId(aes.chargeStruct.chargeTypeId));
cAes.chargeTypeId = chargeType.legacyId > 0 ? chargeType.legacyId : chargeType.id;
cAes.effectDiameter = qRound(2 * pdm()->impactRadius(aes.chargeStruct()));
cAes.effectDiameter = qRound(2 * pdm()->impactRadius(aes.chargeStruct));
if (cAes.chargeTypeId <= 0)
return;
@@ -823,33 +826,33 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::AirS
void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::BCContamination &aes, int aesTetraId)
{
if (aes.isCentral())
if (aes.isCentral)
{
sendRemoveEffectSimulation(TetraIcd::AreaEffectSimulationType::CContamination, aes.id());
sendRemoveEffectSimulation(TetraIcd::AreaEffectSimulationType::CContamination, aes.id);
return;
}
DEBUG_LOG(m_logger) << "RecvFromDdsAes::sendCreateEffectSimulation(BCContamination, "
<< aesTetraId << ")";
TetraIcd::CreateCContamination cAes;
cAes.expansionFactor = pdm()->dtc()->expansionFactor(aes.chargeStruct().chargeTypeId(),
aes.chargeStruct().igniterTypeId(),
aes.chargeStruct().igniterFunctionId());
cAes.expansionFactor = pdm()->dtc()->expansionFactor(aes.chargeStruct.chargeTypeId,
aes.chargeStruct.igniterTypeId,
aes.chargeStruct.igniterFunctionId);
setCommonCombatParams(cAes, aes, aesTetraId);
cAes.relEffectPosition = m_posHandler->geographicToRelative(aes.impactPosition(), 0);
cAes.effectRadius = qRound(aes.impactRadius());
cAes.propagationDirection = aes.propagationDirection();
cAes.windSpeed = qRound(aes.windSpeed());
cAes.validityTimeWind = aes.weatherTimestamp();
cAes.relPositionValidityTimeWind = m_posHandler->geographicToRelative(aes.weatherPosition(), 0);
cAes.relEffectPosition = m_posHandler->geographicToRelative(aes.impactPosition, 0);
cAes.effectRadius = qRound(aes.impactRadius);
cAes.propagationDirection = aes.propagationDirection;
cAes.windSpeed = qRound(aes.windSpeed);
cAes.validityTimeWind = aes.weatherTimestamp;
cAes.relPositionValidityTimeWind = m_posHandler->geographicToRelative(aes.weatherPosition, 0);
const auto chargeType(pdm()->chargeTypeFromId(aes.chargeStruct().chargeTypeId()));
cAes.chargeTypeId = chargeType.legacyId() > 0 ? chargeType.legacyId() : chargeType.id();
const auto chargeType(pdm()->chargeTypeFromId(aes.chargeStruct.chargeTypeId));
cAes.chargeTypeId = chargeType.legacyId > 0 ? chargeType.legacyId : chargeType.id;
switch (pdm()->dtc()->volatilityTypeId(aes.chargeStruct().chargeTypeId(),
aes.chargeStruct().igniterTypeId(),
aes.chargeStruct().igniterFunctionId()).underlying())
switch (pdm()->dtc()->volatilityTypeId(aes.chargeStruct.chargeTypeId,
aes.chargeStruct.igniterTypeId,
aes.chargeStruct.igniterFunctionId))
{
case ProjectDataManagement::VolatilityType::Floating:
cAes.volatility = TetraIcd::CreateCContamination::Volatiliy::Floating;
@@ -870,9 +873,9 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::BCCo
void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::ExplosionArea &aes, int aesTetraId)
{
if (aes.isCentral())
if (aes.isCentral)
{
sendRemoveEffectSimulation(TetraIcd::AreaEffectSimulationType::ExplosionArea, aes.id());
sendRemoveEffectSimulation(TetraIcd::AreaEffectSimulationType::ExplosionArea, aes.id);
return;
}
DEBUG_LOG(m_logger) << "RecvFromDdsAes::sendCreateEffectSimulation(ExplosionArea, "
@@ -880,17 +883,17 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::Expl
TetraIcd::CreateAreaExplosion cAes;
setCommonCombatParams(cAes, aes, aesTetraId);
cAes.relCorner = m_posHandler->geographicToRelative(aes.area().cornerBottomLeft(), 0);
cAes.width = qRound(aes.area().width());
cAes.height = qRound(aes.area().height());
cAes.rotationAngle = aes.area().rotation();
cAes.impactCount = aes.cannonCount() * aes.cannonRounds();
cAes.impactEdgeLength = qRound(pdm()->impactEdgeLength(aes.chargeStruct()));
cAes.hazardDistance = m_mainHandler->pdmHandler()->hazardDistance(aes.chargeStruct());
cAes.relCorner = m_posHandler->geographicToRelative(aes.area.cornerBottomLeft, 0);
cAes.width = qRound(aes.area.width);
cAes.height = qRound(aes.area.height);
cAes.rotationAngle = aes.area.rotation;
cAes.impactCount = aes.cannonCount * aes.cannonRounds;
cAes.impactEdgeLength = qRound(pdm()->impactEdgeLength(aes.chargeStruct));
cAes.hazardDistance = m_mainHandler->pdmHandler()->hazardDistance(aes.chargeStruct);
const auto chargeType(pdm()->chargeTypeFromId(aes.chargeStruct().chargeTypeId()));
cAes.chargeTypeId = chargeType.legacyId() > 0 ? chargeType.legacyId() : chargeType.id();
const auto chargeType(pdm()->chargeTypeFromId(aes.chargeStruct.chargeTypeId));
cAes.chargeTypeId = chargeType.legacyId > 0 ? chargeType.legacyId : chargeType.id;
if (cAes.chargeTypeId <= 0)
return;
@@ -901,7 +904,7 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::Expl
void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::ExplosionCluster &aes, int aesTetraId)
{
const bool bIsLaserGuidable = m_mainHandler->pdmHandler()->isLaserGuidable(aes.chargeStruct());
const bool bIsLaserGuidable = m_mainHandler->pdmHandler()->isLaserGuidable(aes.chargeStruct);
DEBUG_LOG(m_logger) << "RecvFromDdsAes::sendCreateEffectSimulation "
<< ", aes " << aes
@@ -914,9 +917,9 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::Expl
return;
}
if (aes.isCentral())
if (aes.isCentral)
{
sendRemoveEffectSimulation(TetraIcd::AreaEffectSimulationType::ExplosionArea, aes.id());
sendRemoveEffectSimulation(TetraIcd::AreaEffectSimulationType::ExplosionArea, aes.id);
return;
}
DEBUG_LOG(m_logger) << "RecvFromDdsAes::sendCreateEffectSimulation(ExplosionArea, "
@@ -926,25 +929,25 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::Expl
setCommonCombatParams(cAes, aes, aesTetraId);
cAes.relCorner = m_posHandler->geographicToRelative(aes.area().cornerBottomLeft(), 0);
cAes.width = qRound(aes.area().width());
cAes.height = qRound(aes.area().height());
cAes.rotationAngle = aes.area().rotation();
cAes.mhpRotation = aes.mhpRotation();
cAes.mhpWidth = aes.mhpWidth();
cAes.mhpLength = aes.mhpLength();
cAes.impactCount = aes.impactCount();
cAes.impactEdgeLength = qRound(pdm()->impactEdgeLength(aes.chargeStruct()));
cAes.impactRadius = m_mainHandler->pdmHandler()->impactRadius(aes.chargeStruct());
cAes.relCorner = m_posHandler->geographicToRelative(aes.area.cornerBottomLeft, 0);
cAes.width = qRound(aes.area.width);
cAes.height = qRound(aes.area.height);
cAes.rotationAngle = aes.area.rotation;
cAes.mhpRotation = aes.mhpRotation;
cAes.mhpWidth = aes.mhpWidth;
cAes.mhpLength = aes.mhpLength;
cAes.impactCount = aes.impactCount;
cAes.impactEdgeLength = qRound(pdm()->impactEdgeLength(aes.chargeStruct));
cAes.impactRadius = m_mainHandler->pdmHandler()->impactRadius(aes.chargeStruct);
std::vector<TetraIcd::RelativePosition> &mhPointsRef = cAes.mhPoints;
mhPointsRef.clear();
mhPointsRef.reserve(aes.mhPoints().size());
for (const Core::GeoPosition2D &pos : std::as_const(aes.mhPoints()))
mhPointsRef.reserve(aes.mhPoints.size());
for (const Core::GeoPosition2D &pos : std::as_const(aes.mhPoints))
mhPointsRef.emplace_back(m_posHandler->geographicToRelative(pos, 0));
int chargeTypeId = 0;
const auto chargeType(pdm()->chargeTypeFromId(aes.chargeStruct().chargeTypeId()));
chargeTypeId = pdm()->legacyChargeTypeIgniterType(aes.chargeStruct().chargeTypeId(), aes.chargeStruct().igniterTypeId(), aes.chargeStruct().igniterFunctionId());
const auto chargeType(pdm()->chargeTypeFromId(aes.chargeStruct.chargeTypeId));
chargeTypeId = pdm()->legacyChargeTypeIgniterType(aes.chargeStruct.chargeTypeId, aes.chargeStruct.igniterTypeId, aes.chargeStruct.igniterFunctionId);
@@ -952,7 +955,7 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::Expl
cAes.chargeTypeId = chargeTypeId;
else
{
cAes.chargeTypeId = chargeType.legacyId() > 0 ? chargeType.legacyId() : chargeType.id();
cAes.chargeTypeId = chargeType.legacyId > 0 ? chargeType.legacyId : chargeType.id;
}
if (cAes.chargeTypeId <= 0)
@@ -963,9 +966,9 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::Expl
void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::ExplosionSingle &aes, int aesTetraId, int equipmentNumber)
{
if (aes.isCentral())
if (aes.isCentral)
{
sendRemoveEffectSimulation(TetraIcd::AreaEffectSimulationType::ExplosionSingle, aes.id());
sendRemoveEffectSimulation(TetraIcd::AreaEffectSimulationType::ExplosionSingle, aes.id);
return;
}
DEBUG_LOG(m_logger) << "RecvFromDdsAes::sendCreateEffectSimulation(ExplosionSingle, "
@@ -974,12 +977,12 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::Expl
setCommonCombatParams(cAes, aes, aesTetraId);
cAes.header.equipmentNumber = equipmentNumber;
cAes.relEffectPosition = m_posHandler->geographicToRelative(aes.impactPosition(), 0);
cAes.effectDiameter = qRound(2 * pdm()->impactRadius(aes.chargeStruct()));
cAes.relEffectPosition = m_posHandler->geographicToRelative(aes.impactPosition, 0);
cAes.effectDiameter = qRound(2 * pdm()->impactRadius(aes.chargeStruct));
const auto chargeType(pdm()->chargeTypeFromId(aes.chargeStruct().chargeTypeId()));
cAes.chargeTypeId = chargeType.legacyId() > 0 ? chargeType.legacyId() : chargeType.id();
const auto chargeType(pdm()->chargeTypeFromId(aes.chargeStruct.chargeTypeId));
cAes.chargeTypeId = chargeType.legacyId > 0 ? chargeType.legacyId : chargeType.id;
if (cAes.chargeTypeId <= 0)
return;
@@ -989,9 +992,9 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::Expl
void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::MineArea &aes, int aesTetraId)
{
if (aes.isCentral())
if (aes.isCentral)
{
sendRemoveEffectSimulation(TetraIcd::AreaEffectSimulationType::MineArea, aes.id());
sendRemoveEffectSimulation(TetraIcd::AreaEffectSimulationType::MineArea, aes.id);
return;
}
DEBUG_LOG(m_logger) << "RecvFromDdsAes::sendCreateEffectSimulation(MineArea, "
@@ -1002,33 +1005,33 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::Mine
cAes.layingDepth = aes.width();
cAes.layingDensity = aes.density();
cAes.layingDepth = aes.width;
cAes.layingDensity = aes.density;
const auto chargeType(pdm()->chargeTypeFromId(aes.chargeStruct().chargeTypeId()));
cAes.chargeTypeId = chargeType.legacyId() > 0 ? chargeType.legacyId() : chargeType.id();
const auto chargeType(pdm()->chargeTypeFromId(aes.chargeStruct.chargeTypeId));
cAes.chargeTypeId = chargeType.legacyId > 0 ? chargeType.legacyId : chargeType.id;
TetraIcd::MineAreaSegment segment;
cAes.segments.reserve(aes.segments().size());
for (size_t i = 0; i < aes.segments().size(); ++i)
cAes.segments.reserve(aes.segments.size());
for (size_t i = 0; i < aes.segments.size(); ++i)
{
const AreaEffectSimulation::MineSegment &s = aes.segments().at(i);
if (aes.isCenterLine())
const AreaEffectSimulation::MineSegment &s = aes.segments.at(i);
if (aes.isCenterLine)
{
segment.relStart = m_posHandler->geographicToRelative(s.positionStart(), 0);
segment.relEnd = m_posHandler->geographicToRelative(s.positionEnd(), 0);
segment.relStart = m_posHandler->geographicToRelative(s.positionStart, 0);
segment.relEnd = m_posHandler->geographicToRelative(s.positionEnd, 0);
}
else
{
const QPointF relStart = m_posHandler->geographicToRelativePointF(s.positionStart());
const QPointF relEnd = m_posHandler->geographicToRelativePointF(s.positionEnd());
const QPointF relStart = m_posHandler->geographicToRelativePointF(s.positionStart);
const QPointF relEnd = m_posHandler->geographicToRelativePointF(s.positionEnd);
const QLineF line({relStart.x(), relStart.y()}, {relEnd.x(), relEnd.y()});
DEBUG_LOG(m_logger) << "relStart: x: " << relStart.x() << ", y: " << relStart.y();
DEBUG_LOG(m_logger) << "relEnd: x: " << relEnd.x() << ", y: " << relEnd.y();
QTransform trans;
trans.rotate(0-line.angle());
const QPointF ofs = trans.map(QPointF(aes.width() / 2, 0));
const QPointF ofs = trans.map(QPointF(aes.width / 2, 0));
DEBUG_LOG(m_logger) << "ofs: x: " << ofs.x() << ", y: " << ofs.y();
segment.relStart.offsetX = qRound(relStart.x() + ofs.y());
@@ -1050,9 +1053,9 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::Mine
void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::NContamination &aes, int aesTetraId)
{
if (aes.isCentral())
if (aes.isCentral)
{
sendRemoveEffectSimulation(TetraIcd::AreaEffectSimulationType::NContamination, aes.id());
sendRemoveEffectSimulation(TetraIcd::AreaEffectSimulationType::NContamination, aes.id);
return;
}
DEBUG_LOG(m_logger) << "RecvFromDdsAes::sendCreateEffectSimulation(NContamination, "
@@ -1060,23 +1063,23 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::NCon
TetraIcd::CreateNContamination cAes;
setCommonCombatParams(cAes, aes, aesTetraId);
cAes.relEffectPosition = m_posHandler->geographicToRelative(aes.impactPosition(), 0);
cAes.innerRadius = qRound(aes.impactRadius());
cAes.borderLengthInner = qRound(aes.borderLengthInner());
cAes.borderLengthOuter = qRound(aes.borderLengthOuter());
cAes.spanAngle = aes.spanAngle();
cAes.rotationAngle = aes.rotationAngle();
cAes.relEffectPosition = m_posHandler->geographicToRelative(aes.impactPosition, 0);
cAes.innerRadius = qRound(aes.impactRadius);
cAes.borderLengthInner = qRound(aes.borderLengthInner);
cAes.borderLengthOuter = qRound(aes.borderLengthOuter);
cAes.spanAngle = aes.spanAngle;
cAes.rotationAngle = aes.rotationAngle;
cAes.chargeTypeId = aes.chargeStruct().chargeTypeId();
cAes.chargeTypeId = aes.chargeStruct.chargeTypeId;
txData(cAes);
}
void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::FunctionalArea &aes, int aesTetraId)
{
if (aes.isCentral())
if (aes.isCentral)
{
sendRemoveEffectSimulation(TetraIcd::AreaEffectSimulationType::FunctionalArea, aes.id());
sendRemoveEffectSimulation(TetraIcd::AreaEffectSimulationType::FunctionalArea, aes.id);
return;
}
DEBUG_LOG(m_logger) << "RecvFromDdsAes::sendCreateEffectSimulation(FunctionalArea, "
@@ -1084,24 +1087,24 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::Func
TetraIcd::CreateFunctionalArea fAes;
setCommonParams(fAes, aes, aesTetraId);
fAes.relEffectPosition = m_posHandler->geographicToRelative(aes.area().cornerBottomLeft(), 0);
fAes.width = qRound(aes.area().width());
fAes.height = qRound(aes.area().height());
fAes.deconMode = static_cast<TetraIcd::FunctionalAreaOperatingMode>(aes.deconMode().underlying());
fAes.deconTimeout = aes.deconTime();
fAes.maintenanceMode = static_cast<TetraIcd::FunctionalAreaOperatingMode>(aes.maintMode().underlying());
fAes.maintenanceTimeout = aes.maintTime();
fAes.medicalMode = static_cast<TetraIcd::FunctionalAreaOperatingMode>(aes.medicMode().underlying());
fAes.medicalTimeout = aes.medicTime();
fAes.relEffectPosition = m_posHandler->geographicToRelative(aes.area.cornerBottomLeft, 0);
fAes.width = qRound(aes.area.width);
fAes.height = qRound(aes.area.height);
fAes.deconMode = static_cast<TetraIcd::FunctionalAreaOperatingMode>(aes.deconMode);
fAes.deconTimeout = aes.deconTime;
fAes.maintenanceMode = static_cast<TetraIcd::FunctionalAreaOperatingMode>(aes.maintMode);
fAes.maintenanceTimeout = aes.maintTime;
fAes.medicalMode = static_cast<TetraIcd::FunctionalAreaOperatingMode>(aes.medicMode);
fAes.medicalTimeout = aes.medicTime;
txData(fAes);
}
void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::TechnicalArea &aes, int aesTetraId)
{
if (aes.isCentral())
if (aes.isCentral)
{
sendRemoveEffectSimulation(TetraIcd::AreaEffectSimulationType::TechnicalArea, aes.id());
sendRemoveEffectSimulation(TetraIcd::AreaEffectSimulationType::TechnicalArea, aes.id);
return;
}
@@ -1109,22 +1112,22 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::Tech
<< aesTetraId << ")";
TetraIcd::TechnicalArea fAes;
fAes.aesDdsId = aes.id();
fAes.aesDdsId = aes.id;
fAes.name = aes.name();
fAes.taType = static_cast<TetraIcd::TechnicalArea::Type>(aes.type().underlying());
fAes.relCorner = m_posHandler->geographicToRelative(aes.area().cornerBottomLeft(), 0);
fAes.width = qRound(aes.area().width());
fAes.height = qRound(aes.area().height());
fAes.name = aes.name;
fAes.taType = static_cast<TetraIcd::TechnicalArea::Type>(aes.type);
fAes.relCorner = m_posHandler->geographicToRelative(aes.area.cornerBottomLeft, 0);
fAes.width = qRound(aes.area.width);
fAes.height = qRound(aes.area.height);
txData(fAes);
}
void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::DusSingleMine &aes, int aesTetraId)
{
if (aes.isCentral())
if (aes.isCentral)
{
sendRemoveEffectSimulation(TetraIcd::AreaEffectSimulationType::DusSingleMineSimulator, aes.id());
sendRemoveEffectSimulation(TetraIcd::AreaEffectSimulationType::DusSingleMineSimulator, aes.id);
return;
}
DEBUG_LOG(m_logger) << "RecvFromDdsAes::sendCreateEffectSimulation(DusSingleMine, "
@@ -1132,13 +1135,13 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::DusS
TetraIcd::CreateDusSingleMine dAes;
setCommonParams(dAes, aes, aesTetraId);
dAes.relEffectPosition = m_posHandler->geographicToRelative(aes.position(), 0);
dAes.effectStart = aes.effectStart().get();
dAes.effectDuration = aes.effectDuration();
dAes.mineId = aes.mineId();
dAes.relEffectPosition = m_posHandler->geographicToRelative(aes.position, 0);
dAes.effectStart = aes.effectStart.get();
dAes.effectDuration = aes.effectDuration;
dAes.mineId = aes.mineId;
const auto chargeType(pdm()->chargeTypeFromId(aes.chargeStruct().chargeTypeId()));
dAes.chargeTypeId = chargeType.legacyId() > 0 ? chargeType.legacyId() : chargeType.id();
const auto chargeType(pdm()->chargeTypeFromId(aes.chargeStruct.chargeTypeId));
dAes.chargeTypeId = chargeType.legacyId > 0 ? chargeType.legacyId : chargeType.id;
txData(dAes);
}
@@ -1242,15 +1245,15 @@ void RecvFromDdsAes::sendPauseEffectSimulation(int aesDdsId)
template<>
void RecvFromDdsAes::sendResumeEffectSimulation(const AreaEffectSimulation::ExplosionArea &aes)
{
if (aes.isCentral())
if (aes.isCentral)
{
sendRemoveEffectSimulation(TetraIcd::AreaEffectSimulationType::ExplosionArea, aes.id());
sendRemoveEffectSimulation(TetraIcd::AreaEffectSimulationType::ExplosionArea, aes.id);
return;
}
const int aesDdsId = aes.id();
const int aesDdsId = aes.id;
if (aesDdsId == 0)
return;
const int aesTetraId = m_aesStateHandler->getAesTetraId(aes.id());
const int aesTetraId = m_aesStateHandler->getAesTetraId(aes.id);
if (aesTetraId == 0)
{
DEBUG_LOG(m_logger) << "Could not find a valid tetra id for aes dds id " << aesDdsId ;
@@ -1265,15 +1268,15 @@ void RecvFromDdsAes::sendResumeEffectSimulation(const AreaEffectSimulation::Expl
<< ", tetraId=" << aesTetraId << ")";
TetraIcd::ResumeEffectSimulation dAes;
dAes.aesDdsId = aes.id();
dAes.aesDdsId = aes.id;
dAes.sequelNumber = AreaEffectSimulation::Polygons::getSequelNumber(aes.id(),
aes.cannonCount() * aes.cannonRounds(),
aes.originalEffectDuration(),
aes.effectDuration());
dAes.nextImpact = aes.remainExplosionNumber();
dAes.resumeTime = aes.effectStart().is_set() ? aes.effectStart().get() : 0;
dAes.remainDuration = aes.effectDuration();
dAes.sequelNumber = AreaEffectSimulation::Polygons::getSequelNumber(aes.id,
aes.cannonCount * aes.cannonRounds,
aes.originalEffectDuration,
aes.effectDuration);
dAes.nextImpact = aes.remainExplosionNumber;
dAes.resumeTime = aes.effectStart.is_set() ? aes.effectStart.get() : 0;
dAes.remainDuration = aes.effectDuration;
txData(dAes);
}
@@ -1282,15 +1285,15 @@ void RecvFromDdsAes::sendResumeEffectSimulation(const AreaEffectSimulation::Expl
template<>
void RecvFromDdsAes::sendResumeEffectSimulation(const AreaEffectSimulation::ExplosionCluster &aes)
{
if (aes.isCentral())
if (aes.isCentral)
{
sendRemoveEffectSimulation(TetraIcd::AreaEffectSimulationType::ExplosionArea, aes.id());
sendRemoveEffectSimulation(TetraIcd::AreaEffectSimulationType::ExplosionArea, aes.id);
return;
}
const int aesDdsId = aes.id();
const int aesDdsId = aes.id;
if (aesDdsId == 0)
return;
const int aesTetraId = m_aesStateHandler->getAesTetraId(aes.id());
const int aesTetraId = m_aesStateHandler->getAesTetraId(aes.id);
if (aesTetraId == 0)
{
WARNING_LOG(m_logger) << "Could not find a valid tetra id for aes dds id " << aesDdsId ;
@@ -1305,15 +1308,15 @@ void RecvFromDdsAes::sendResumeEffectSimulation(const AreaEffectSimulation::Expl
<< ", tetraId=" << aesTetraId << ")";
TetraIcd::ResumeEffectSimulation dAes;
dAes.aesDdsId = aes.id();
dAes.aesDdsId = aes.id;
dAes.sequelNumber = AreaEffectSimulation::Polygons::getSequelNumber(aes.id(),
aes.impactCount(),
aes.originalEffectDuration(),
aes.effectDuration());
dAes.nextImpact = aes.remainExplosionNumber();
dAes.resumeTime = aes.effectStart().is_set() ? aes.effectStart().get() : 0;
dAes.remainDuration = aes.effectDuration();
dAes.sequelNumber = AreaEffectSimulation::Polygons::getSequelNumber(aes.id,
aes.impactCount,
aes.originalEffectDuration,
aes.effectDuration);
dAes.nextImpact = aes.remainExplosionNumber;
dAes.resumeTime = aes.effectStart.is_set() ? aes.effectStart.get() : 0;
dAes.remainDuration = aes.effectDuration;
txData(dAes);
}
@@ -1355,7 +1358,7 @@ void RecvFromDdsAes::resetAllDusMines()
QTimer::singleShot(300, this, [this]()
{
for (AreaEffectSimulation::DusMine &mine : m_allReactivatableDusMines)
mine.triggered(false);
mine.triggered = false;
m_minesToSend.clear();
connect(m_sendDusMineReactivtionTimer, &QTimer::timeout,
this, &RecvFromDdsAes::onSendDusMineReactivationTimeout);
@@ -51,7 +51,8 @@ public:
}
private:
NGL::INGLLogger &m_logger;
QMap<int, int> m_tetraId2ddsId;
QMap<int, int> m_ddsId2TetraId;
QSet<int> m_aesInTetraAvailable;
@@ -149,8 +150,7 @@ private:
void doSpecialization(const AreaEffectSimulation::ExplosionArea &data, std::unordered_map<int, AreaEffectSimulation::ExplosionArea> &cont)
{
cont[data.id()].remainExplosionNumber(data.remainExplosionNumber());
}
cont[data.id].remainExplosionNumber = data.remainExplosionNumber; }
template<typename T>
void doSpecialization(const T &data, std::unordered_map<int, T> &cont)
{
@@ -161,20 +161,18 @@ private:
bool dataChanged(const T &data, std::unordered_map<int, T> &cont, bool &onlyNameChanged)
{
onlyNameChanged = false;
auto it = cont.find(data.id());
auto it = cont.find(data.id);
T dataTmp(data);
dataTmp.sampleTime(0);
dataTmp.sampleTime = 0;
if (it == cont.end())
{
cont.emplace(std::make_pair(data.id(), std::move(dataTmp)));
cont.emplace(std::make_pair(data.id, std::move(dataTmp)));
DEBUG_LOG(m_logger) << "new AES Item: " << data;
return true;
}
it->second.effectStateId(data.effectStateId());
it->second.effectStateId = data.effectStateId;
doSpecialization(data, cont);
@@ -186,9 +184,7 @@ private:
T tmp(it->second);
tmp.name(data.name());
tmp.sampleTime(data.sampleTime());
onlyNameChanged = (tmp == data);
tmp.name = data.name; tmp.sampleTime = data.sampleTime; onlyNameChanged = (tmp == data);
std::swap(it->second, dataTmp);
@@ -207,15 +203,13 @@ private:
{
AreaEffectSimulation::ExplosionArea copy(current);
copy.remainExplosionNumber(0);
return dataChanged(copy, m_currentExplosionArea, onlyNameChanged);
copy.remainExplosionNumber = 0; return dataChanged(copy, m_currentExplosionArea, onlyNameChanged);
}
bool dataChanged(const AreaEffectSimulation::ExplosionCluster &current, bool &onlyNameChanged)
{
AreaEffectSimulation::ExplosionCluster copy(current);
copy.remainExplosionNumber(0);
return dataChanged(copy, m_currentExplosionCluster, onlyNameChanged);
copy.remainExplosionNumber = 0; return dataChanged(copy, m_currentExplosionCluster, onlyNameChanged);
}
bool dataChanged(const AreaEffectSimulation::ExplosionSingle &current, bool &onlyNameChanged)
@@ -270,60 +264,59 @@ private:
auto it = cont.find(aesDdsId);
if (it == cont.end())
return;
it->second.effectStart(0);
}
it->second.effectStart = 0; }
void resetStartTime(const AreaEffectSimulation::AirSupportImpact &current)
{
resetStartTime(current.id(), m_currentBCContaminations);
resetStartTime(current.id, m_currentBCContaminations);
}
void resetStartTime(const AreaEffectSimulation::BCContamination &current)
{
resetStartTime(current.id(), m_currentBCContaminations);
resetStartTime(current.id, m_currentBCContaminations);
}
void resetStartTime(const AreaEffectSimulation::ExplosionArea &current)
{
resetStartTime(current.id(), m_currentExplosionArea);
resetStartTime(current.id, m_currentExplosionArea);
}
void resetStartTime(const AreaEffectSimulation::ExplosionCluster &current)
{
resetStartTime(current.id(), m_currentExplosionCluster);
resetStartTime(current.id, m_currentExplosionCluster);
}
void resetStartTime(const AreaEffectSimulation::ExplosionSingle &current)
{
resetStartTime(current.id(), m_currentExplosionSingle);
resetStartTime(current.id, m_currentExplosionSingle);
}
void resetStartTime(const AreaEffectSimulation::MineArea &current)
{
resetStartTime(current.id(), m_currentMineArea);
resetStartTime(current.id, m_currentMineArea);
}
void resetStartTime(const AreaEffectSimulation::NContamination &current)
{
resetStartTime(current.id(), m_currentNContamination);
resetStartTime(current.id, m_currentNContamination);
}
void resetStartTime(const AreaEffectSimulation::FunctionalArea &current)
{
resetStartTime(current.id(), m_currentFunctionalArea);
resetStartTime(current.id, m_currentFunctionalArea);
}
void resetStartTime(const AreaEffectSimulation::TechnicalArea &current)
{
resetStartTime(current.id(), m_currentTechnicalArea);
resetStartTime(current.id, m_currentTechnicalArea);
}
void resetStartTime(const AreaEffectSimulation::DusSingleMine &current)
{
resetStartTime(current.id(), m_currentDusSingleMine);
resetStartTime(current.id, m_currentDusSingleMine);
}
void resetStartTime(const AreaEffectSimulation::GasPipe &current)
{
resetStartTime(current.id(), m_currentGasPipes);
resetStartTime(current.id, m_currentGasPipes);
}
void resetStartTime(const AreaEffectSimulation::BoobyTrap &current)
{
resetStartTime(current.id(), m_currentBoobyTraps);
resetStartTime(current.id, m_currentBoobyTraps);
}
void resetStartTime(const AreaEffectSimulation::OffRouteMine &current)
{
resetStartTime(current.id(), m_currentOffRouteMines);
resetStartTime(current.id, m_currentOffRouteMines);
}
std::shared_ptr<PdmHandler> pdm();
@@ -342,6 +335,7 @@ private:
void onSendDusMineReactivationTimeout();
private:
NGL::INGLLogger &m_logger;
std::unordered_map<int, AreaEffectSimulation::AirSupportImpact> m_currentAirSupportImpacts;
std::unordered_map<int, AreaEffectSimulation::BCContamination> m_currentBCContaminations;
std::unordered_map<int, AreaEffectSimulation::ExplosionArea> m_currentExplosionArea;
@@ -62,104 +62,104 @@ RecvFromDdsFts::RecvFromDdsFts(MainHandler *mainHandler, const std::shared_ptr<I
void RecvFromDdsFts::onDemandBiteRequest(const rti::core::SampleIdentity &cookie, const DemandBiteRequest &request)
{
TetraIcd::DemandBite data;
data.withSelfTest = request.withSelfTest();
data.withSelfTest = request.withSelfTest;
bool bRet = true;
// TODO: fixme
for (const int equipNo : request.equipmentNumbers())
for (const int equipNo : request.equipmentNumbers)
{
data.header.equipmentNumber = equipNo;
if (!m_txCallback->txData(data))
bRet = false;
}
m_ftsTab->demandBiteReply(cookie, fillFro(request.requestId(), bRet));
m_ftsTab->demandBiteReply(cookie, fillFro(request.requestId, bRet));
}
void RecvFromDdsFts::onDemandInitRequest(const rti::core::SampleIdentity &cookie, const DemandInitRequest &request)
{
TetraIcd::Init data;
data.workstationId = request.workstationId();
data.resetManipulation = request.resetManipulation();
data.resetVulnerabilityState = request.resetVulnerabilityState();
data.restockCharges = request.restockCharges();
data.restockSanitationMaterial = request.restockSanitationMaterial();
data.workstationId = request.workstationId;
data.resetManipulation = request.resetManipulation;
data.resetVulnerabilityState = request.resetVulnerabilityState;
data.restockCharges = request.restockCharges;
data.restockSanitationMaterial = request.restockSanitationMaterial;
bool bRet = true;
// TODO: fixme
for (const int equipNo : request.equipmentNumbers())
for (const int equipNo : request.equipmentNumbers)
{
data.header.equipmentNumber = equipNo;
if (!m_txCallback->txData(data))
bRet = false;
}
m_ftsTab->demandInitReply(cookie, fillFro(request.requestId(), bRet));
m_ftsTab->demandInitReply(cookie, fillFro(request.requestId, bRet));
}
void RecvFromDdsFts::onSendSetVulnerabilityModelRequest(const rti::core::SampleIdentity &cookie, const SendSetVulnerabilityModelRequest &request)
{
TetraIcd::SetVulnerabilityModel data;
data.header.equipmentNumber = request.equipmentNumber();
data.vulnerabilityModelMineIed = request.vulnerabilityModelMineIed();
data.vulnerabilityModelAreaFire = request.vulnerabilityModelAreaFire();
data.vulnerabilityModelOperatingResource = request.vulnerabilityModelOperationalResource();
data.vulnerabilityModelAcWeaponry = request.vulnerabilityModelACWeaponry();
data.header.equipmentNumber = request.equipmentNumber;
data.vulnerabilityModelMineIed = request.vulnerabilityModelMineIed;
data.vulnerabilityModelAreaFire = request.vulnerabilityModelAreaFire;
data.vulnerabilityModelOperatingResource = request.vulnerabilityModelOperationalResource;
data.vulnerabilityModelAcWeaponry = request.vulnerabilityModelACWeaponry;
m_ftsTab->sendSetVulnerabilityModelReply(cookie, fillFro(request.participantId(), m_txCallback->txData(data)));
m_ftsTab->sendSetVulnerabilityModelReply(cookie, fillFro(request.participantId, m_txCallback->txData(data)));
}
void RecvFromDdsFts::onDemandConfigurationReportRequest(const rti::core::SampleIdentity &cookie, const DemandConfigurationReportRequest &request)
{
TetraIcd::DemandEquipmentConfigurationReport data;
data.header.equipmentNumber = request.equipmentNumber();
data.header.equipmentNumber = request.equipmentNumber;
m_ftsTab->demandConfigurationReportReply(cookie, fillFro(request.participantId(), m_txCallback->txData(data)));
m_ftsTab->demandConfigurationReportReply(cookie, fillFro(request.participantId, m_txCallback->txData(data)));
}
void RecvFromDdsFts::onDemandVulnerabilityStateChangeRequest(const rti::core::SampleIdentity &cookie, const DemandVulnerabilityStateChangeRequest &request)
{
TetraIcd::DemandVulnerabilityStateChange data;
data.reqestedState = static_cast<TetraIcd::VulnerabilityState>(request.vulnerabilityState().underlying());
data.workstationId = request.workstationId();
data.vulnerabilityVitalityIndex = getVulnerabilityVitalityIndexFromVitalityAndVba(request.vulnerabilityKind(), request.vitality());
data.reqestedState = static_cast<TetraIcd::VulnerabilityState>(request.vulnerabilityState);
data.workstationId = request.workstationId;
data.vulnerabilityVitalityIndex = getVulnerabilityVitalityIndexFromVitalityAndVba(request.vulnerabilityKind, request.vitality);
bool bRet = true;
// TODO: fixme
for (const int equipNo : request.equipmentNumbers())
for (const int equipNo : request.equipmentNumbers)
{
data.header.equipmentNumber = equipNo;
if (!m_txCallback->txData(data))
bRet = false;
}
m_ftsTab->demandVulnerabilityStateChangeReply(cookie, fillFro(request.requestId(), bRet));
m_ftsTab->demandVulnerabilityStateChangeReply(cookie, fillFro(request.requestId, bRet));
}
void RecvFromDdsFts::onSendLanguageSelectionRequest(const rti::core::SampleIdentity &cookie, const SendLanguageSelectionRequest &request)
{
TetraIcd::LanguageSelection data;
data.header.equipmentNumber = request.equipmentNumber();
data.languageSelection = static_cast<TetraIcd::Language>(request.language().underlying());
data.header.equipmentNumber = request.equipmentNumber;
data.languageSelection = static_cast<TetraIcd::Language>(request.language);
m_ftsTab->sendLanguageSelectionReply(cookie, fillFro(request.participantId(), m_txCallback->txData(data)));
m_ftsTab->sendLanguageSelectionReply(cookie, fillFro(request.participantId, m_txCallback->txData(data)));
}
void RecvFromDdsFts::onSendEquipmentMessageRequest(const rti::core::SampleIdentity &cookie, const SendEquipmentMessageRequest &request)
{
if (request.sender().is_set() &&
request.subject().is_set() &&
request.message().is_set())
if (request.sender.is_set() &&
request.subject.is_set() &&
request.message.is_set())
{
// Message to O/C
TetraIcd::EquipmentMessageOC data;
data.senderId = request.sender().get();
data.subject = request.subject().get();
data.message = request.message().get();
data.senderId = request.sender.get();
data.subject = request.subject.get();
data.message = request.message.get();
data.header.timeStamp = QDateTime::currentMSecsSinceEpoch();
bool bRet = true;
// TODO: fixme
for (const int equipNo : request.equipmentNumbers())
for (const int equipNo : request.equipmentNumbers)
{
data.header.equipmentNumber = equipNo;
data.receiverId = equipNo;
@@ -172,10 +172,10 @@ void RecvFromDdsFts::onSendEquipmentMessageRequest(const rti::core::SampleIdenti
else
{
TetraIcd::EquipmentMessage data;
if (request.messageId().is_set())
data.msgId = request.messageId().get();
else if (request.message().is_set())
data.message = request.message().get();
if (request.messageId.is_set())
data.msgId = request.messageId.get();
else if (request.message.is_set())
data.message = request.message.get();
else
{
m_ftsTab->sendEquipmentMessageReply(cookie, fillFro(0, false));
@@ -184,14 +184,14 @@ void RecvFromDdsFts::onSendEquipmentMessageRequest(const rti::core::SampleIdenti
}
bool bRet = true;
// TODO: fixme
for (const int equipNo : request.equipmentNumbers())
for (const int equipNo : request.equipmentNumbers)
{
data.header.equipmentNumber = equipNo;
if (!m_txCallback->txData(data))
bRet = false;
}
m_ftsTab->sendEquipmentMessageReply(cookie, fillFro(request.requestId(), bRet));
m_ftsTab->sendEquipmentMessageReply(cookie, fillFro(request.requestId, bRet));
}
}
@@ -199,82 +199,82 @@ void RecvFromDdsFts::onSendOcDataRequest(const rti::core::SampleIdentity &cookie
{
TetraIcd::OpaquePayloadDataOut data;
data.payloadType = TetraIcd::OpaquePayloadDataBase::Type::OC;
data.header.equipmentNumber = request.equipmentNumber();
data.payload = request.payload();
data.header.equipmentNumber = request.equipmentNumber;
data.payload = request.payload;
m_ftsTab->sendOcDataReply(cookie, fillFro(request.participantId(), m_txCallback->txData(data)));
m_ftsTab->sendOcDataReply(cookie, fillFro(request.participantId, m_txCallback->txData(data)));
}
void RecvFromDdsFts::onSendFireSmokeMarkerDataRequest(const rti::core::SampleIdentity &cookie, const SendFireSmokeMarkerDataRequest &request)
{
TetraIcd::OpaquePayloadDataOut data;
data.payloadType = TetraIcd::OpaquePayloadDataBase::Type::FireSmokeMarker;
data.header.equipmentNumber = request.equipmentNumber();
data.payload = request.payload();
data.header.equipmentNumber = request.equipmentNumber;
data.payload = request.payload;
m_ftsTab->sendFireSmokeMarkerDataReply(cookie, fillFro(request.participantId(), m_txCallback->txData(data)));
m_ftsTab->sendFireSmokeMarkerDataReply(cookie, fillFro(request.participantId, m_txCallback->txData(data)));
}
void RecvFromDdsFts::onSendGeopairingDataRequest(const rti::core::SampleIdentity &cookie, const SendGeopairingDataRequest &request)
{
TetraIcd::OpaquePayloadDataOut data;
data.payloadType = TetraIcd::OpaquePayloadDataBase::Type::Geopairing;
data.header.equipmentNumber = request.equipmentNumber();
data.payload = request.payload();
data.header.equipmentNumber = request.equipmentNumber;
data.payload = request.payload;
m_ftsTab->sendGeopairingDataReply(cookie, fillFro(request.participantId(), m_txCallback->txData(data)));
m_ftsTab->sendGeopairingDataReply(cookie, fillFro(request.participantId, m_txCallback->txData(data)));
}
void RecvFromDdsFts::onSendTargetDataRequest(const rti::core::SampleIdentity &cookie, const SendTargetDataRequest &request)
{
TetraIcd::OpaquePayloadDataOut data;
data.payloadType = TetraIcd::OpaquePayloadDataBase::Type::Target;
data.header.equipmentNumber = request.equipmentNumber();
data.payload = request.payload();
data.header.equipmentNumber = request.equipmentNumber;
data.payload = request.payload;
m_ftsTab->sendTargetDataReply(cookie, fillFro(request.participantId(), m_txCallback->txData(data)));
m_ftsTab->sendTargetDataReply(cookie, fillFro(request.participantId, m_txCallback->txData(data)));
}
void RecvFromDdsFts::onSendCesHitInformationRequest(const rti::core::SampleIdentity &cookie, const SendCesHitInformation &request)
{
TetraIcd::CesHitInformation data;
data.header.equipmentNumber = request.equipmentNumber();
data.header.timeStamp = request.effectTime();
data.originatorEquipmentNumber = request.originatorEquipmentNumber();
const auto &ct = m_mainHandler->pdmHandler()->chargeTypeFromId(request.chargeTypeId());
data.chargeTasCodeDirect = ct.id();
data.chargeTasCodeIndirect = ct.id();
data.directionDegree = request.directionDegree();
data.distance = request.distanceToOrignator();
data.effectPercent = request.effectPercent();
data.header.equipmentNumber = request.equipmentNumber;
data.header.timeStamp = request.effectTime;
data.originatorEquipmentNumber = request.originatorEquipmentNumber;
const auto &ct = m_mainHandler->pdmHandler()->chargeTypeFromId(request.chargeTypeId);
data.chargeTasCodeDirect = ct.id;
data.chargeTasCodeIndirect = ct.id;
data.directionDegree = request.directionDegree;
data.distance = request.distanceToOrignator;
data.effectPercent = request.effectPercent;
m_ftsTab->sendCesHitInformationReply(cookie, fillFro(request.participantId(), m_txCallback->txData(data)));
m_ftsTab->sendCesHitInformationReply(cookie, fillFro(request.participantId, m_txCallback->txData(data)));
}
void RecvFromDdsFts::onSendCesHitRequest(const rti::core::SampleIdentity &cookie, const SendCesHitRequest &request)
{
DEBUG_LOG(m_logger) << "onSendCesHitRequest: " << request.equipmentNumber() << " - " << request.effectTime()
<< " request.chargeTypeId=" << request.chargeTypeId()
<< " request.eventType()=" << request.eventType()
<< " request.aesId()=" << request.aesId()
<< " aesTypeFromId=" << m_mainHandler->aesHandler()->aesTypeFromId(request.aesId());
DEBUG_LOG(m_logger) << "onSendCesHitRequest: " << request.equipmentNumber << " - " << request.effectTime
<< " request.chargeTypeId=" << request.chargeTypeId
<< " request.pdmEventType=" << request.pdmEventType
<< " request.aesId()=" << request.aesId
<< " aesTypeFromId=" << m_mainHandler->aesHandler()->aesTypeFromId(request.aesId);
// NOTE: igniterType/IgniterFunciton = 0 as long as SendCesHitRequest does not contain values
if (m_mainHandler->pdmHandler()->isSmartChargeType({request.chargeTypeId(), 0,0}))
if (m_mainHandler->pdmHandler()->isSmartChargeType({request.chargeTypeId, 0,0}))
{
// special handling for smart - must be send as singleFire
m_ftsTab->sendCesHitReply(cookie,
fillFro(request.participantId(),
fillFro(request.participantId,
m_mainHandler->aesHandler()->sendSingleFireSMArt(request)));
return;
}
TetraIcd::CesHitRequest data;
//test
data.reserve2 = request.originatorEquipmentNumber();
data.reserve1 = request.chargeTypeId();
data.header.equipmentNumber = request.equipmentNumber();
data.header.timeStamp = request.effectTime();
const auto &ct = m_mainHandler->pdmHandler()->chargeTypeFromId(request.chargeTypeId());
data.reserve2 = request.originatorEquipmentNumber;
data.reserve1 = request.chargeTypeId;
data.header.equipmentNumber = request.equipmentNumber;
data.header.timeStamp = request.effectTime;
const auto &ct = m_mainHandler->pdmHandler()->chargeTypeFromId(request.chargeTypeId);
// GUEZE-359 Steilfeuer mit Sekundaerwirkung wird als Mun 371, ... gesendet. Fuehrt zu Treffer DUS statt WirkSim
//#ifdef GUEZ_MODE
// if ( request.chargeTypeId() > 370 && request.chargeTypeId() < 390 )
@@ -288,78 +288,78 @@ void RecvFromDdsFts::onSendCesHitRequest(const rti::core::SampleIdentity &cookie
// data.chargeTasCodeIndirect = ct.id();
// }
//#else
if ((request.eventType() == ProjectDataManagement::EventType::HitBuilding) && (ct.legacyId() > 0))
if ((request.pdmEventType == ProjectDataManagement::PdmEventType::EventType_HitBuilding) && (ct.legacyId > 0))
{
data.chargeTasCodeDirect = 201; // immer den direkten code (fuer wirkfelder: pseudo-osag code >= 201)
data.chargeTasCodeIndirect = 201;
}
else if (ct.legacyId() > 0)
else if (ct.legacyId > 0)
{
data.chargeTasCodeDirect = ct.legacyId();
data.chargeTasCodeIndirect = ct.legacyId();
data.chargeTasCodeDirect = ct.legacyId;
data.chargeTasCodeIndirect = ct.legacyId;
}
else
{
data.chargeTasCodeDirect = ct.id();
data.chargeTasCodeIndirect = ct.id();
data.chargeTasCodeDirect = ct.id;
data.chargeTasCodeIndirect = ct.id;
}
//#endif
data.mineId = request.mineId();
if (request.aesId() != 0)
data.mineId = request.mineId;
if (request.aesId != 0)
{
//data.aesTetraIdUnused = m_mainHandler->aesHandler()->tetraIdFromDdsId(request.aesId());
data.aesDdsId = request.aesId();
data.aesDdsId = request.aesId;
//TODO: !!!!!! Use new EventType to check which AreaEffectSimulationType will be chosen.
if (request.eventType() == ProjectDataManagement::EventType::ExplosionCluster)
if (request.pdmEventType == ProjectDataManagement::PdmEventType::EventType_ExplosionCluster)
data.aesType = TetraIcd::AreaEffectSimulationType::ExplosionArea;
else
data.aesType = m_mainHandler->aesHandler()->aesTypeFromId(request.aesId());
data.aesType = m_mainHandler->aesHandler()->aesTypeFromId(request.aesId);
/*!
\brief Take the new event type attribute to check if its is a HazardArea(DangerZone/Gefahrenbereich)
*
* */
if ((request.eventType() == ProjectDataManagement::EventType::LeaveHazardDistance) ||
(request.eventType() == ProjectDataManagement::EventType::EnterHazardDistance))
if ((request.pdmEventType == ProjectDataManagement::PdmEventType::EventType_LeaveHazardDistance) ||
(request.pdmEventType == ProjectDataManagement::PdmEventType::EventType_EnterHazardDistance))
{
INFO_LOG(m_logger) << "HarzardArea: " << request.effectTime();
data.reserve1 = request.mineId();
INFO_LOG(m_logger) << "HarzardArea: " << request.effectTime;
data.reserve1 = request.mineId;
data.aesType = TetraIcd::AreaEffectSimulationType::DangerZoneExplosion;
}
else if (request.eventType() == ProjectDataManagement::EventType::AirSupport)
else if (request.pdmEventType == ProjectDataManagement::PdmEventType::EventType_AirSupport)
{
data.aesType = TetraIcd::AreaEffectSimulationType::AirSupport;
}
}
else
data.originatorEquipmentNumber = request.originatorEquipmentNumber();
const auto &tabPos = request.position();
data.buildingId = tabPos.moutObjectId().is_set() ? tabPos.moutObjectId().get() : 0;
data.roomId = tabPos.moutRoomId().is_set() ? tabPos.moutRoomId().get() : 0;
data.remainEffectPercent = request.remainEffectPercent();
data.relPosition = m_mainHandler->posHandler()->geographicToRelative(tabPos.position());
data.originatorEquipmentNumber = request.originatorEquipmentNumber;
const auto &tabPos = request.position;
data.buildingId = tabPos.moutObjectId.is_set() ? tabPos.moutObjectId.get() : 0;
data.roomId = tabPos.moutRoomId.is_set() ? tabPos.moutRoomId.get() : 0;
data.remainEffectPercent = request.remainEffectPercent;
data.relPosition = m_mainHandler->posHandler()->geographicToRelative(tabPos.position);
// NOTE: igniterType/IgniterFunciton = 0 as long as SendCesHitRequest does not contain values
if (m_mainHandler->pdmHandler()->isSmartChargeType({request.chargeTypeId(),0,0}))
data.remainEffectTasCodeDirect = calculateRemainEffectTasCode(ct.id(), request.remainEffectPercent());
else if ((request.eventType() == ProjectDataManagement::EventType::HitBuilding) ||
(request.eventType() == ProjectDataManagement::EventType::HitEffectSimulation) // GUEZE-2873 / GUEZE-2888
if (m_mainHandler->pdmHandler()->isSmartChargeType({request.chargeTypeId,0,0}))
data.remainEffectTasCodeDirect = calculateRemainEffectTasCode(ct.id, request.remainEffectPercent);
else if ((request.pdmEventType == ProjectDataManagement::PdmEventType::EventType_HitBuilding) ||
(request.pdmEventType == ProjectDataManagement::PdmEventType::EventType_HitEffectSimulation) // GUEZE-2873 / GUEZE-2888
) //Gebäude Sekudärwirkung
{
data.remainEffectTasCodeDirect = calculateRemainEffectTasCode(ct.id(), request.remainEffectPercent());
DEBUG_LOG(m_logger) << "PDM::EventType = " << request.eventType()
<< " equipmentNumber=" << request.equipmentNumber()
data.remainEffectTasCodeDirect = calculateRemainEffectTasCode(ct.id, request.remainEffectPercent);
DEBUG_LOG(m_logger) << "PDM::EventType = " << request.pdmEventType
<< " equipmentNumber=" << request.equipmentNumber
<< " originatorEquipmentNumber=" << data.originatorEquipmentNumber
<< " chargeType=" << ct.id()
<< " remainEffectPercent()=" << request.remainEffectPercent()
<< " chargeType=" << ct.id
<< " remainEffectPercent()=" << request.remainEffectPercent
<< " -> remainEffectTasCodeDirect=" << data.remainEffectTasCodeDirect ;
}
else
data.remainEffectTasCodeDirect = request.remainEffectPercent();//calculateRemainEffectTasCode(ct.id(), request.remainEffectPercent());
data.remainEffectTasCodeDirect = request.remainEffectPercent;//calculateRemainEffectTasCode(ct.id(), request.remainEffectPercent());
// [GUEZE-3469] Funktionsraum dekontaminiert faelschlicherweise
if (m_mainHandler->aesHandler()->aesTypeFromId(request.aesId()) == TetraIcd::AreaEffectSimulationType::FunctionalArea)
if (m_mainHandler->aesHandler()->aesTypeFromId(request.aesId) == TetraIcd::AreaEffectSimulationType::FunctionalArea)
{
// GUEZSB60_ICD_52_Zentrale-TNE
// 3.3.2.5.9.6 Trefferereignis Sekundärwirkung
@@ -370,39 +370,39 @@ void RecvFromDdsFts::onSendCesHitRequest(const rti::core::SampleIdentity &cookie
// Feld Reserve1: Betriebsmodus (MS-Byte) / Wartezeit (LS-Byte) für Instandsetzungsmaßnahmen
// Feld Reserve2: Betriebsmodus (MS-Byte) / Wartezeit (LS-Byte) für San.-dienstliche Versorgung
AreaEffectSimulation::FunctionalArea fa = m_mainHandler->aesHandler()->dtcAes()->functionalArea(request.aesId());
DEBUG_LOG(m_logger) << "fa maintMode=" << fa.maintMode()
<< " maintTime=" <<fa.maintTime()
<< " deconMode=" << fa.deconMode()
<< " deconTime=" << fa.deconTime()
<< " medicMode=" << fa.medicMode()
<< " medicTime=" << fa.medicTime();
AreaEffectSimulation::FunctionalArea fa = m_mainHandler->aesHandler()->dtcAes()->functionalArea(request.aesId);
DEBUG_LOG(m_logger) << "fa maintMode=" << fa.maintMode
<< " maintTime=" <<fa.maintTime
<< " deconMode=" << fa.deconMode
<< " deconTime=" << fa.deconTime
<< " medicMode=" << fa.medicMode
<< " medicTime=" << fa.medicTime;
data.chargeTasCodeDirect = 0;
data.reserve1 = 0;
data.reserve2 = 0;
if (fa.deconMode() == AreaEffectSimulation::AesOperatingMode_def::OmWaitingTime)
if (fa.deconMode == AreaEffectSimulation::AesOperatingMode::OmWaitingTime)
{
qint32 msb = AreaEffectSimulation::AesOperatingMode_def::OmWaitingTime << 8;
qint32 lsb = fa.deconTime() / 1000 / 60 / 10; // dissolution in 10 minute steps
qint32 msb = static_cast<qint32>(AreaEffectSimulation::AesOperatingMode::OmWaitingTime) << 8;
qint32 lsb = fa.deconTime / 1000 / 60 / 10; // dissolution in 10 minute steps
data.chargeTasCodeIndirect = msb | lsb;
DEBUG_LOG(m_logger) << "deconMode: remainEffectTasCodeDirect=" << data.chargeTasCodeIndirect
<< " msb=" << msb
<< " lsb=" << lsb;
}
if (fa.maintMode() == AreaEffectSimulation::AesOperatingMode_def::OmWaitingTime)
if (fa.maintMode == AreaEffectSimulation::AesOperatingMode::OmWaitingTime)
{
qint32 msb = AreaEffectSimulation::AesOperatingMode_def::OmWaitingTime << 8;
qint32 lsb = fa.maintTime() / 1000 / 60 / 10; // dissolution in 10 minute steps
qint32 msb = static_cast<qint32>(AreaEffectSimulation::AesOperatingMode::OmWaitingTime) << 8;
qint32 lsb = fa.maintTime / 1000 / 60 / 10; // dissolution in 10 minute steps
data.reserve1 = msb | lsb;
DEBUG_LOG(m_logger) << "maintMode: reserve1=" << data.reserve1
<< " msb=" << msb
<< " lsb=" << lsb;
}
if (fa.medicMode() == AreaEffectSimulation::AesOperatingMode_def::OmWaitingTime)
if (fa.medicMode == AreaEffectSimulation::AesOperatingMode::OmWaitingTime)
{
qint32 msb = AreaEffectSimulation::AesOperatingMode_def::OmWaitingTime << 8;
qint32 lsb = fa.medicTime() / 1000 / 60 / 10; // dissolution in 10 minute steps
qint32 msb = static_cast<qint32>(AreaEffectSimulation::AesOperatingMode::OmWaitingTime) << 8;
qint32 lsb = fa.medicTime / 1000 / 60 / 10; // dissolution in 10 minute steps
data.reserve2 = msb | lsb;
DEBUG_LOG(m_logger) << "medicMode: reserve2=" << data.reserve2
<< " msb=" << msb
@@ -410,130 +410,130 @@ void RecvFromDdsFts::onSendCesHitRequest(const rti::core::SampleIdentity &cookie
}
}
m_ftsTab->sendCesHitReply(cookie, fillFro(request.participantId(), m_txCallback->txData(data)));
m_ftsTab->sendCesHitReply(cookie, fillFro(request.participantId, m_txCallback->txData(data)));
}
void RecvFromDdsFts::onSendParticipantSwVerionsRequest(const rti::core::SampleIdentity &cookie, const SendParticipantSwVerionsRequest &request)
{
DEBUG_LOG(m_logger) << "onSendParticipantSwVerionsRequest: " << request.equipmentNumber() << " - " << request.equipmentFunctionId();
DEBUG_LOG(m_logger) << "onSendParticipantSwVerionsRequest: " << request.equipmentNumber << " - " << request.equipmentFunctionId;
TetraIcd::ParticipantSwVersionsRequest data;
data.header.equipmentNumber = request.equipmentNumber();
data.equipmentFunctionId = request.equipmentFunctionId();
data.header.equipmentNumber = request.equipmentNumber;
data.equipmentFunctionId = request.equipmentFunctionId;
m_ftsTab->sendParticipantSwVerionsReply(cookie, fillFro(request.equipmentNumber(), m_txCallback->txData(data)));
m_ftsTab->sendParticipantSwVerionsReply(cookie, fillFro(request.equipmentNumber, m_txCallback->txData(data)));
}
void RecvFromDdsFts::onSendParticipantModeRequest(const rti::core::SampleIdentity &cookie, const SendParticipantModeRequest &request)
{
TetraIcd::ParticipantMode data;
data.header.equipmentNumber = request.equipmentNumber();
data.language = static_cast<TetraIcd::Language>(request.language().underlying());
data.operationMode = static_cast<TetraIcd::ParticipantMode::OperationMode>(request.operationMode().underlying());
data.reactivationDetoxication = request.reactivationDetoxication();
data.reactivationMaintenance = request.reactivationMaintenance();
data.reactivationMedic = request.reactivationMedic();
data.modeVest = static_cast<TetraIcd::ParticipantMode::WphMode>(request.protectionModeVest().underlying());
data.modeHelmet = static_cast<TetraIcd::ParticipantMode::WphMode>(request.protectionModeHelmet().underlying());
data.personellProtectionMode = static_cast<TetraIcd::ParticipantMode::PersonellProtection>(request.personellProtection().underlying());
data.protectionLevel = static_cast<TetraIcd::ParticipantMode::ProtectionLevel>(request.protectionLevel().underlying());
data.handgrenadeSearchMode = static_cast<TetraIcd::ParticipantMode::HandgrenadeSearchMode>(request.handgrenadeSearchMode().underlying());
data.internationalMode = static_cast<TetraIcd::ParticipantMode::InternationalMode>(request.internationalMode().underlying());
data.abcProtectionMode = static_cast<TetraIcd::ParticipantMode::ABCProtectionMode>(request.abcProtectionMode().underlying());
data.header.equipmentNumber = request.equipmentNumber;
data.language = static_cast<TetraIcd::Language>(request.language);
data.operationMode = static_cast<TetraIcd::ParticipantMode::OperationMode>(request.operationMode);
data.reactivationDetoxication = request.reactivationDetoxication;
data.reactivationMaintenance = request.reactivationMaintenance;
data.reactivationMedic = request.reactivationMedic;
data.modeVest = static_cast<TetraIcd::ParticipantMode::WphMode>(request.protectionModeVest);
data.modeHelmet = static_cast<TetraIcd::ParticipantMode::WphMode>(request.protectionModeHelmet);
data.personellProtectionMode = static_cast<TetraIcd::ParticipantMode::PersonellProtection>(request.personellProtection);
data.protectionLevel = static_cast<TetraIcd::ParticipantMode::ProtectionLevel>(request.protectionLevel);
data.handgrenadeSearchMode = static_cast<TetraIcd::ParticipantMode::HandgrenadeSearchMode>(request.handgrenadeSearchMode);
data.internationalMode = static_cast<TetraIcd::ParticipantMode::InternationalMode>(request.internationalMode);
data.abcProtectionMode = static_cast<TetraIcd::ParticipantMode::ABCProtectionMode>(request.abcProtectionMode);
m_ftsTab->sendParticipantModeReply(cookie, fillFro(request.requestId(), m_txCallback->txData(data)));
m_ftsTab->sendParticipantModeReply(cookie, fillFro(request.requestId, m_txCallback->txData(data)));
}
void RecvFromDdsFts::onDemandParticipantModeRequest(const rti::core::SampleIdentity &cookie, const DemandParticipantModeRequest &request)
{
TetraIcd::DemandParticipantMode data;
data.header.equipmentNumber = request.equipmentNumber();
data.header.equipmentNumber = request.equipmentNumber;
m_ftsTab->demandParticipantModeReply(cookie, fillFro(request.equipmentNumber(), m_txCallback->txData(data)));
m_ftsTab->demandParticipantModeReply(cookie, fillFro(request.equipmentNumber, m_txCallback->txData(data)));
}
void RecvFromDdsFts::onSendParticipantConfigurationRequest(const rti::core::SampleIdentity &cookie, const SendParticipantConfigurationRequest &request)
{
TetraIcd::ParticipantConfiguration data;
data.header.equipmentNumber = request.equipmentNumber();
data.header.equipmentNumber = request.equipmentNumber;
// positioning
data.positionIntervallVehicle = request.positionIntervallVehicle();
data.positionIntervallPersonell = request.positionIntervallPersonell();
data.positionIntervallAircraft = request.positionIntervallAircraft();
data.positionTransmissionIntervall = request.positionTransmissionIntervall();
data.heightbarrier = request.heightbarrier();
data.faultPositionHandling = static_cast<TetraIcd::ParticipantConfiguration::FaultPositionHandling>(request.faultPositionHandling().underlying());
data.switchingPositionIntervall = static_cast<TetraIcd::ParticipantConfiguration::SwitchingPositionIntervall>(request.switchingPositionIntervall().underlying());
data.positionIntervallVehicle = request.positionIntervallVehicle;
data.positionIntervallPersonell = request.positionIntervallPersonell;
data.positionIntervallAircraft = request.positionIntervallAircraft;
data.positionTransmissionIntervall = request.positionTransmissionIntervall;
data.heightbarrier = request.heightbarrier;
data.faultPositionHandling = static_cast<TetraIcd::ParticipantConfiguration::FaultPositionHandling>(request.faultPositionHandling);
data.switchingPositionIntervall = static_cast<TetraIcd::ParticipantConfiguration::SwitchingPositionIntervall>(request.switchingPositionIntervall);
// radio protocoll parameter
data.waittimeAdditionalBroadcastDemand = request.waittimeAdditionalBroadcastDemand();
data.factorWaittimeIncreaseAtHighload = request.factorWaittimeIncreaseHighload();
data.waittimeAdditionalBroadcastDemand = request.waittimeAdditionalBroadcastDemand;
data.factorWaittimeIncreaseAtHighload = request.factorWaittimeIncreaseHighload;
// automatic vulnerability increase
data.waittimeAutomaticVulnerabilityIncreaseLevel1 = request.waittimeAutomaticVulnerabilityIncreaseLevel1();
data.waittimeAutomaticVulnerabilityIncreaseLevel2 = request.waittimeAutomaticVulnerabilityIncreaseLevel2();
data.waittimeAutomaticVulnerabilityIncreaseLevel3 = request.waittimeAutomaticVulnerabilityIncreaseLevel3();
data.waittimeAutomaticVulnerabilityIncreaseLevel1 = request.waittimeAutomaticVulnerabilityIncreaseLevel1;
data.waittimeAutomaticVulnerabilityIncreaseLevel2 = request.waittimeAutomaticVulnerabilityIncreaseLevel2;
data.waittimeAutomaticVulnerabilityIncreaseLevel3 = request.waittimeAutomaticVulnerabilityIncreaseLevel3;
// optical code
data.opticalCode = static_cast<TetraIcd::ParticipantConfiguration::OpticalCode>(request.opticalCode().underlying());
data.opticalCode = static_cast<TetraIcd::ParticipantConfiguration::OpticalCode>(request.opticalCode);
// vulnerability model
data.vulnerabilityModel = request.vulnerabilityModel();
data.validTimeOps = request.validTimeOps();
data.vulnerabilityModel = request.vulnerabilityModel;
data.validTimeOps = request.validTimeOps;
m_ftsTab->sendParticipantConfigurationReply(cookie, fillFro(request.equipmentNumber(), m_txCallback->txData(data)));
m_ftsTab->sendParticipantConfigurationReply(cookie, fillFro(request.equipmentNumber, m_txCallback->txData(data)));
}
void RecvFromDdsFts::onSendParticipantBlockedAreaRequest(const rti::core::SampleIdentity &cookie, const SendParticipantBlockedAreaRequest &request)
{
TetraIcd::CesHitRequest data;
data.header.equipmentNumber = request.equipmentNumber();
data.header.equipmentNumber = request.equipmentNumber;
data.header.timeStamp = QDateTime::currentMSecsSinceEpoch(); // TODO
data.aesType = TetraIcd::AreaEffectSimulationType::SpecialArea;
data.remainEffectPercent = request.blockedAreaMode() == BlockedAreaMode::Enter ? 1 : 0;
data.remainEffectPercent = request.blockedAreaMode == BlockedAreaMode::Enter ? 1 : 0;
m_ftsTab->sendParticipantBlockedAreaReply(cookie, fillFro(request.equipmentNumber(), m_txCallback->txData(data)));
m_ftsTab->sendParticipantBlockedAreaReply(cookie, fillFro(request.equipmentNumber, m_txCallback->txData(data)));
}
void RecvFromDdsFts::onSendParticipantBeStillWarningRequest(const rti::core::SampleIdentity &cookie, const SendParticipantBeStillWarningRequest &request)
{
TetraIcd::CesHitRequest data;
data.header.equipmentNumber = request.equipmentNumber();
data.header.equipmentNumber = request.equipmentNumber;
data.header.timeStamp = QDateTime::currentMSecsSinceEpoch(); // TODO
data.aesType = TetraIcd::AreaEffectSimulationType::BeStillWarning;
data.remainEffectPercent = 0;
WARNING_LOG(m_logger) << "sendParticipantBeStillWarningReply equipmentNumber=" << request.equipmentNumber();
m_ftsTab->sendParticipantBeStillWarningReply(cookie, fillFro(request.equipmentNumber(), m_txCallback->txData(data)));
WARNING_LOG(m_logger) << "sendParticipantBeStillWarningReply equipmentNumber=" << request.equipmentNumber;
m_ftsTab->sendParticipantBeStillWarningReply(cookie, fillFro(request.equipmentNumber, m_txCallback->txData(data)));
}
void RecvFromDdsFts::onSendSetSanitationRequest(const rti::core::SampleIdentity &cookie, const SendSetSanitationRequest &request)
{
TetraIcd::Sanitation data;
data.header.equipmentNumber = request.equipmentNumber();
data.header.equipmentNumber = request.equipmentNumber;
data.header.timeStamp = QDateTime::currentMSecsSinceEpoch();
data.proceduresTaken = request.sanitationProceduresTaken();
data.proceduresTaken = request.sanitationProceduresTaken;
data.sanitationResult = TetraIcd::SanitationResult::NoEffect;
data.sanitationEvaluation = TetraIcd::SanitationEvaluation::Okay; // To have a 0 for TETRA
data.uniqeId = 0;
data.originatorEquipmentNumber = request.originatorEquipmentNumber();
data.qualification = static_cast<TetraIcd::Qualification>(request.qualification().underlying());
m_ftsTab->sendSetSanitationReply(cookie, fillFro(request.equipmentNumber(), m_txCallback->txData(data)));
data.originatorEquipmentNumber = request.originatorEquipmentNumber;
data.qualification = static_cast<TetraIcd::Qualification>(request.qualification);
m_ftsTab->sendSetSanitationReply(cookie, fillFro(request.equipmentNumber, m_txCallback->txData(data)));
}
void RecvFromDdsFts::onSendSelectiveReammunitionRequest(const rti::core::SampleIdentity &cookie, const SendSelectiveReammunitionRequest &request)
{
DEBUG_LOG(m_logger) << "onSendSelectiveReammunitionRequest for equipment number: " << request.equipmentNumber();
DEBUG_LOG(m_logger) << "onSendSelectiveReammunitionRequest for equipment number: " << request.equipmentNumber;
TetraIcd::SelectiveReammunition data;
data.header.equipmentNumber = request.equipmentNumber();
data.header.equipmentNumber = request.equipmentNumber;
data.header.timeStamp = QDateTime::currentMSecsSinceEpoch();
data.gearId = request.gearId();
for(auto ra : request.reammunition())
data.gearId = request.gearId;
for(auto ra : request.reammunition)
{
TetraIcd::Reammunition tra;
tra.chargeTypeId = ra.chargeTypeId();
tra.newDefaultStock = ra.newDefaultStock();
tra.newStock = ra.newStock();
tra.tracerRatio = ra.tracerRatio();
tra.chargeTypeId = ra.chargeTypeId;
tra.newDefaultStock = ra.newDefaultStock;
tra.newStock = ra.newStock;
tra.tracerRatio = ra.tracerRatio;
data.reammunitions.push_back(tra);
}
m_ftsTab->sendSelectiveReammunitionReply(cookie, fillFro(request.equipmentNumber(), m_txCallback->txData(data)));
m_ftsTab->sendSelectiveReammunitionReply(cookie, fillFro(request.equipmentNumber, m_txCallback->txData(data)));
}
void RecvFromDdsFts::onSendResetAllDusMinesRequest(const rti::core::SampleIdentity &cookie, const SendResetAllDusMinesRequest &request)
@@ -549,20 +549,20 @@ void RecvFromDdsFts::onSendResetAllDusMinesRequest(const rti::core::SampleIdenti
void RecvFromDdsFts::onDemandParticipantConfigurationRequest(const rti::core::SampleIdentity &cookie, const DemandParticipantConfigurationRequest &request)
{
TetraIcd::DemandParticipantConfiguration data;
data.header.equipmentNumber = request.equipmentNumber();
data.header.equipmentNumber = request.equipmentNumber;
m_ftsTab->demandParticipantConfigurationReply(cookie, fillFro(request.equipmentNumber(), m_txCallback->txData(data)));
m_ftsTab->demandParticipantConfigurationReply(cookie, fillFro(request.equipmentNumber, m_txCallback->txData(data)));
}
void RecvFromDdsFts::onSetDevicePowerRequest(const rti::core::SampleIdentity &cookie, const SetDevicePowerRequest &request)
{
TetraIcd::SetDevicePowerRequest data;
data.header.equipmentNumber = request.equipmentNumber();
data.header.equipmentNumber = request.equipmentNumber;
data.header.timeStamp = QDateTime::currentMSecsSinceEpoch();
data.powerType = static_cast<TetraIcd::PowerMethod>(request.powerType().underlying());
data.subdeviceId = request.subdeviceId();
data.powerType = static_cast<TetraIcd::PowerMethod>(request.powerType);
data.subdeviceId = request.subdeviceId;
m_ftsTab->setDevicePowerReply(cookie, fillFro(request.equipmentNumber(), m_txCallback->txData(data)));
m_ftsTab->setDevicePowerReply(cookie, fillFro(request.equipmentNumber, m_txCallback->txData(data)));
}
void RecvFromDdsFts::onAdlerCalculateTrajectoryRequest(const rti::core::SampleIdentity &cookie, const AdlerCalculateTrajectoryRequest &request)
@@ -574,30 +574,30 @@ void RecvFromDdsFts::onAdlerCalculateTrajectoryRequest(const rti::core::SampleId
void RecvFromDdsFts::onSendOcCommandRequest(const rti::core::SampleIdentity &cookie, const SendOcCommandRequest &request)
{
TetraIcd::OcCommand data;
data.action = request.action();
data.action = request.action;
bool bRet = true;
for (const int equipNo : request.equipmentNumbers())
for (const int equipNo : request.equipmentNumbers)
{
data.header.equipmentNumber = equipNo;
if (!m_txCallback->txData(data))
bRet = false;
}
m_ftsTab->sendOcCommandReply(cookie, fillFro(request.requestId(), bRet));
m_ftsTab->sendOcCommandReply(cookie, fillFro(request.requestId, bRet));
}
void RecvFromDdsFts::onSendUasWaypointRequest(const rti::core::SampleIdentity &cookie, const SendUasWaypointRequest &request)
{
TetraIcd::UAVPerformMission mission;
mission.header.equipmentNumber = request.equipmentNumber();
mission.header.equipmentNumber = request.equipmentNumber;
mission.header.timeStamp = QDateTime::currentMSecsSinceEpoch();
mission.missionName = QString::fromStdString(request.name());
mission.missionId = request.planId();
mission.missionName = QString::fromStdString(request.name);
mission.missionId = request.planId;
ERROR_LOG(m_logger) << "####################### request.equipmentNumber(): " << request.equipmentNumber() << ", request.name(): " << request.name() << ", mission.header.equipmentNumber: " << mission.header.equipmentNumber << ", properties: " << request.properties();
ERROR_LOG(m_logger) << "####################### request.equipmentNumber(): " << request.equipmentNumber << ", request.name(): " << request.name << ", mission.header.equipmentNumber: " << mission.header.equipmentNumber << ", properties: " << request.properties;
TetraIcd::UAVAction action;
action.task = TetraIcd::UAVActionTask::Loiter;
@@ -610,7 +610,7 @@ void RecvFromDdsFts::onSendUasWaypointRequest(const rti::core::SampleIdentity &c
try
{
const auto props = LtsUtils::JsonObject::fromJsonSafe(request.properties());
const auto props = LtsUtils::JsonObject::fromJsonSafe(request.properties);
lat = props.value<double>("location_y");
lon = props.value<double>("location_x");
@@ -619,7 +619,7 @@ void RecvFromDdsFts::onSendUasWaypointRequest(const rti::core::SampleIdentity &c
catch (const std::exception &ex)
{
ERROR_LOG(m_logger) << "props is missing critical values: " << ex.what();
m_ftsTab->sendUasWaypointReply(cookie, fillFro(request.equipmentNumber(), false));
m_ftsTab->sendUasWaypointReply(cookie, fillFro(request.equipmentNumber, false));
return;
}
@@ -630,16 +630,16 @@ void RecvFromDdsFts::onSendUasWaypointRequest(const rti::core::SampleIdentity &c
mission.actions.push_back(action);
bool ret = m_txCallback->txData(mission); // send waypoint to uav via uas tab plugin
m_ftsTab->sendUasWaypointReply(cookie, fillFro(request.equipmentNumber(), ret));
m_ftsTab->sendUasWaypointReply(cookie, fillFro(request.equipmentNumber, ret));
}
void RecvFromDdsFts::onSendModifyUasStateRequest(const rti::core::SampleIdentity &cookie, const SendModifyUasStateRequest &request)
{
TetraIcd::UAVChangeState changeState;
changeState.header.equipmentNumber = request.equipmentNumber();
changeState.header.equipmentNumber = request.equipmentNumber;
changeState.header.timeStamp = QDateTime::currentMSecsSinceEpoch();
changeState.requestedState = static_cast<TetraIcd::UAVState>(request.uasState().underlying());
m_ftsTab->sendModifyUasStateReply(cookie, fillFro(request.equipmentNumber(), m_txCallback->txData(changeState)));
changeState.requestedState = static_cast<TetraIcd::UAVState>(request.uasState);
m_ftsTab->sendModifyUasStateReply(cookie, fillFro(request.equipmentNumber, m_txCallback->txData(changeState)));
}
void RecvFromDdsFts::onSendExFireReadinessRequest(const rti::core::SampleIdentity &cookie, const SendExFireReadinessRequest &request)
@@ -647,37 +647,37 @@ void RecvFromDdsFts::onSendExFireReadinessRequest(const rti::core::SampleIdentit
TetraIcd::ExFireReadiness fireReadiness;
fireReadiness.header.equipmentNumber = 100;
fireReadiness.header.timeStamp = QDateTime::currentMSecsSinceEpoch();
fireReadiness.partyId = request.partyId();
fireReadiness.reference = QString::fromStdString(request.reference());
fireReadiness.partyId = request.partyId;
fireReadiness.reference = QString::fromStdString(request.reference);
m_ftsTab->sendExFireReadinessReply(cookie, fillFro(request.participantId(), m_txCallback->txData(fireReadiness)));
m_ftsTab->sendExFireReadinessReply(cookie, fillFro(request.participantId, m_txCallback->txData(fireReadiness)));
}
void RecvFromDdsFts::onSendExFiredReportRequest(const rti::core::SampleIdentity &cookie, const SendExFiredReportRequest &request)
{
TetraIcd::ExFiredReport firedReport;
firedReport.header.equipmentNumber = request.participantId();
firedReport.header.equipmentNumber = request.participantId;
firedReport.header.timeStamp = QDateTime::currentMSecsSinceEpoch();
firedReport.partyId = request.partyId();
firedReport.reference = QString::fromStdString(request.reference());
firedReport.unitIdentifier = QString::fromStdString(request.unitIdentifier());
firedReport.identifier = QString::fromStdString(request.identifier());
firedReport.partyId = request.partyId;
firedReport.reference = QString::fromStdString(request.reference);
firedReport.unitIdentifier = QString::fromStdString(request.unitIdentifier);
firedReport.identifier = QString::fromStdString(request.identifier);
m_ftsTab->sendExFiredReportReply(cookie, fillFro(request.participantId(), m_txCallback->txData(firedReport)));
m_ftsTab->sendExFiredReportReply(cookie, fillFro(request.participantId, m_txCallback->txData(firedReport)));
}
void RecvFromDdsFts::onSendExConfirmationReportRequest(const rti::core::SampleIdentity &cookie, const SendExConfirmationReportRequest &request)
{
TetraIcd::ExConfirmationReport confirmationReport;
confirmationReport.header.equipmentNumber = request.participantId();
confirmationReport.header.equipmentNumber = request.participantId;
confirmationReport.header.timeStamp = QDateTime::currentMSecsSinceEpoch();
confirmationReport.partyId = request.partyId();
confirmationReport.reference = QString::fromStdString(request.reference());
confirmationReport.unitIdentifier = QString::fromStdString(request.unitIdentifier());
confirmationReport.identifier = QString::fromStdString(request.identifier());
confirmationReport.partyId = request.partyId;
confirmationReport.reference = QString::fromStdString(request.reference);
confirmationReport.unitIdentifier = QString::fromStdString(request.unitIdentifier);
confirmationReport.identifier = QString::fromStdString(request.identifier);
m_ftsTab->sendExConfirmationReportReply(cookie, fillFro(request.participantId(), m_txCallback->txData(confirmationReport)));
m_ftsTab->sendExConfirmationReportReply(cookie, fillFro(request.participantId, m_txCallback->txData(confirmationReport)));
}
@@ -757,7 +757,7 @@ int RecvFromDdsFts::calculateRemainEffectTasCode(int chargeTypeIdBase, int remai
if (remainEffectPercent > 100)
remainEffectPercent = 100;
const int destructiveFactor = m_mainHandler->pdmHandler()->buildingChargeEffect(chargeTypeIdBase).destructiveFactor();
const int destructiveFactor = m_mainHandler->pdmHandler()->buildingChargeEffect(chargeTypeIdBase).destructiveFactor;
const int categorie = getDestructiveCategorie(destructiveFactor);
const auto &value = m_categorieData.value(categorie);
File diff suppressed because it is too large. Load diff