Complete Qt6 migration: full clean build green across groups G1-G12 incl. runtime plugin set

new_docker_build.sh gains Group 12 (212 GUI/Data plugins); fixes LtsUtilsGuiDds visibility (LTO-stripped exports), LtsProjectionWorkstation unity name shadow, 6 unity-off dirs (dup file-scope statics, ddsftc INTERFACE sources) and reconfigures BUILD_FILTERMANAGEMENT/BUILD_PLUGINS_SERVICEMONITOR=ON
This commit is contained in:
berrux-dev committed 2026-10-20 09:36:57 +02:00
1 parent eb1d949edc
commit 815e16368e
1718 files changed
+126739 -18495

No files matched your search

@@ -36,10 +36,10 @@ Core::FunctionReplyObject FiringUnitValidator::firingUnitError(const QHash<int,
for (const ParticipantData &currentData : participantData)
{
if (!m_typeHandler->isFiringUnitType(currentData.typeId()))
if (!m_typeHandler->isFiringUnitType(currentData.typeId))
continue;
int unitModId = currentData.modId();
int unitModId = currentData.modId;
error = getError(modIdToParticipantId, participantData, unitModId);
@@ -61,7 +61,7 @@ QString FiringUnitValidator::getError(const QHash<int, int> &modIdToParticipantI
for (const ParticipantData &currentData : participantData)
{
if (currentData.superiorModId() != unitModId)
if (currentData.superiorModId != unitModId)
continue;
// capacity error
@@ -71,16 +71,16 @@ QString FiringUnitValidator::getError(const QHash<int, int> &modIdToParticipantI
return tr("There are only %1 participants allowed per firing unit.").arg(maxParticipantsPerFiringUnit);
// false type error
hasFalseTypeError = !m_typeHandler->isArtilleryParticipantType(currentData.typeId());
hasFalseTypeError = !m_typeHandler->isArtilleryParticipantType(currentData.typeId);
if (hasFalseTypeError)
return tr("There are only artillery participants allowed in firing units.");
// mixed type error
if (typeId == -1)
typeId = currentData.typeId();
typeId = currentData.typeId;
hasMixedTypeError = currentData.typeId() != typeId;
hasMixedTypeError = currentData.typeId != typeId;
if (hasMixedTypeError)
return tr("There are no mixed types allowed in firing units.");
@@ -39,7 +39,7 @@ void GetParticipants::onGetParticipantsRequest(const rti::core::SampleIdentity &
recordReplay.initDtc(nullptr, m_mainHandler->exerciseId());
NSqlQuery q(m_mainHandler->db()->database());
recordReplay.readParticipantAt(q, request.timeStamp());
recordReplay.readParticipantAt(q, request.timeStamp);
// key is sampleTime -> multiMap
auto participantsMmap = recordReplay.getParticipantMap();
@@ -49,23 +49,23 @@ void GetParticipants::onGetParticipantsRequest(const rti::core::SampleIdentity &
for (auto it = participantsMmap.begin(); it != participantsMmap.end(); ++it)
{
Participant &p = it.value();
if (p.isDeleted())
participants.remove(p.id());
if (p.isDeleted)
participants.remove(p.id);
else
participants[p.id()] = std::move(p);
participants[p.id] = std::move(p);
}
DEBUG_LOG(m_logger) << "Starting to read participant from record replay. Size: "
<< participants.size();
GetParticipantsReply reply;
reply.requestId(request.requestId());
reply.requestId = request.requestId;
auto &vecPart = reply.participants();
auto &vecPart = reply.participants;
vecPart.reserve(participants.size());
for (auto it = participants.begin(); it != participants.end(); ++it)
{
if (request.partyId() >= 0 && it.value().partyId() != request.partyId())
if (request.partyId >= 0 && it.value().partyId != request.partyId)
continue;
vecPart.push_back(it.value());
}
@@ -35,15 +35,15 @@ public:
virtual ~Participant();
int32_t id() const { return m_participantData.id(); }
int32_t typeId() const { return m_participantData.typeId(); }
int32_t superiorId() const { return m_participantData.superiorId(); }
int32_t id() const { return m_participantData.id; }
int32_t typeId() const { return m_participantData.typeId; }
int32_t superiorId() const { return m_participantData.superiorId; }
// return optional?
int32_t equipmentNumber() const { return m_participantData.equipmentNumber.is_set() ? m_participantData.equipmentNumber.get() : 0; }
int32_t partyId() const { return m_participantData.partyId(); }
bool isDeleted() const { return m_participantData.isDeleted(); }
ParticipantAssignState assignState() const { return m_participantData.assignState(); }
const std::vector<int32_t> &inferiors() const { return m_participantData.inferiorIds(); }
int32_t equipmentNumber() const { return m_participantData.equipmentNumber.has_value() ? m_participantData.equipmentNumber.get() : 0; }
int32_t partyId() const { return m_participantData.partyId; }
bool isDeleted() const { return m_participantData.isDeleted; }
ParticipantAssignState assignState() const { return m_participantData.assignState; }
const std::vector<int32_t> &inferiors() const { return m_participantData.inferiorIds; }
ParticipantPosition position() const { return m_positionPublished; }
const DynamicParticipantData &dynamicParticipantData() const { return m_dynamicData; }
const ParticipantManagement::Participant &participantData() const { return m_participantData; }
@@ -52,8 +52,8 @@ bool ParticipantForExercise::applyEquipmentExerciseMapping(int newEqId)
<< ", " << dbEem.exerciseId;
if (!m_mainHandler->dbEx0()->insert(dbEem))
{
m_participantData.equipmentNumber().reset();
m_participantData.assignState(ParticipantAssignState::NotAssigned);
m_participantData.equipmentNumber.reset();
m_participantData.assignState = ParticipantAssignState::NotAssigned;
publishParticipant();
return false;
}
@@ -104,15 +104,15 @@ void ParticipantForExercise::removeFromDds() // only called on shutdown
void ParticipantForExercise::registerInfoFromFt(const RegisterParticipantRequest &request)
{
m_participantData.info(request.info());
m_participantData.identification(request.identification());
m_participantData.info = request.info;
m_participantData.identification = request.identification;
}
bool ParticipantForExercise::registerFromFt(const RegisterParticipantRequest &request)
{
int newEquipmentNumber = request.equipmentNumber();
int newEquipmentNumber = request.equipmentNumber;
// just to be sure ...
if (request.assignState() == ParticipantAssignState::NotAssigned)
if (request.assignState == ParticipantAssignState::NotAssigned)
newEquipmentNumber = 0;
if (!updateEquipmentExerciseMapping(equipmentNumber(), newEquipmentNumber))
@@ -122,17 +122,17 @@ bool ParticipantForExercise::registerFromFt(const RegisterParticipantRequest &re
id());
INFO_LOG(m_logger) << "Set assign state for participant " << id() << " from "
<< assignState() << " to " << request.assignState()
<< assignState() << " to " << request.assignState
<< ", old eqid: " << equipmentNumber() << ", new eqid: "
<< newEquipmentNumber;
if (newEquipmentNumber)
m_participantData.equipmentNumber(newEquipmentNumber);
m_participantData.equipmentNumber = newEquipmentNumber;
else
m_participantData.equipmentNumber().reset();
m_participantData.assignState(request.assignState());
m_participantData.info(request.info());
m_participantData.identification(request.identification());
m_participantData.equipmentNumber.reset();
m_participantData.assignState = request.assignState;
m_participantData.info = request.info;
m_participantData.identification = request.identification;
return true;
}
@@ -41,7 +41,7 @@ void ParticipantHandler::clearParticipants()
{
// clear maps
for (auto it = m_hitLineInfoMap.cbegin(); it != m_hitLineInfoMap.cend(); ++it)
dts()->removeHitLineInfoByKey(it.value().id());
dts()->removeHitLineInfoByKey(it.value().id);
m_hitLineInfoMap.clear();
for (auto p : std::as_const(m_participants))
@@ -97,49 +97,49 @@ void ParticipantHandler::onNewGearEvent(const TrainingAreaBase::EquipmentGearEve
{
if (isTelegramInFuture(gearEvent))
{
WARNING_LOG(m_logger) << "Got an EquipmentGearEvent which has a timestamp in the future: " << gearEvent.sampleTime();
WARNING_LOG(m_logger) << "Got an EquipmentGearEvent which has a timestamp in the future: " << gearEvent.sampleTime;
return;
}
// NOTE: gearEvent.chargeAmount() is not used because there is no usecase for this value ... atm
Participant *participantToBeChanged = participantByEquipmentNumber(gearEvent.equipmentNumber());
Participant *participantToBeChanged = participantByEquipmentNumber(gearEvent.equipmentNumber);
if (!participantToBeChanged)
{
WARNING_LOG(m_logger) << "Got gear charge state for unknown equipment number " << gearEvent.equipmentNumber();
WARNING_LOG(m_logger) << "Got gear charge state for unknown equipment number " << gearEvent.equipmentNumber;
return;
}
participantToBeChanged->setGearCharge(gearEvent.charge(), gearEvent.sampleTime());
participantToBeChanged->setGearCharge(gearEvent.charge, gearEvent.sampleTime);
participantToBeChanged->publishDynamicData();
// publish gear event
dts()->publish(
ParticipantGearEvent(participantToBeChanged->id(),
gearEvent.sampleTime(),
gearEvent.chargeAmount(),
GearCharge(gearEvent.charge().gearId(), gearEvent.charge().gearTypeId(), gearEvent.charge().chargeTypeId(), gearEvent.charge().remain())));
gearEvent.sampleTime,
gearEvent.chargeAmount,
GearCharge(gearEvent.charge.gearId, gearEvent.charge.gearTypeId, gearEvent.charge.chargeTypeId, gearEvent.charge.remain)));
}
void ParticipantHandler::onNewGearChargeStateFromProxy(const TrainingAreaBase::EquipmentGearChargeState &chargeState)
{
if (isTelegramInFuture(chargeState))
{
WARNING_LOG(m_logger) << "Got an EquipmentGearChargeState which has a timestamp in the future: " << chargeState.sampleTime();
WARNING_LOG(m_logger) << "Got an EquipmentGearChargeState which has a timestamp in the future: " << chargeState.sampleTime;
return;
}
const int equipNo = chargeState.equipmentNumber();
const int equipNo = chargeState.equipmentNumber;
Participant *participantToBeChanged = equipNo < 0 ? participantById(-equipNo) : participantByEquipmentNumber(equipNo);
if (!participantToBeChanged)
{
WARNING_LOG(m_logger) << "Got gear charge state for unknown equipment number " << chargeState.equipmentNumber();
WARNING_LOG(m_logger) << "Got gear charge state for unknown equipment number " << chargeState.equipmentNumber;
return;
}
for (const TrainingAreaBase::GearCharge &charge : chargeState.charge())
participantToBeChanged->setGearCharge(charge, chargeState.sampleTime());
for (const TrainingAreaBase::GearCharge &charge : chargeState.charge)
participantToBeChanged->setGearCharge(charge, chargeState.sampleTime);
participantToBeChanged->publishDynamicData();
emit gearChargeChanged(participantToBeChanged->id(), participantToBeChanged->partyId());
@@ -149,13 +149,13 @@ void ParticipantHandler::onNewGearAssignmentFromProxy(const TrainingAreaBase::Eq
{
if (isTelegramInFuture(gearAssignment))
{
WARNING_LOG(m_logger) << "Got an EquipmentGearAssignment which has a timestamp in the future: " << gearAssignment.sampleTime();
WARNING_LOG(m_logger) << "Got an EquipmentGearAssignment which has a timestamp in the future: " << gearAssignment.sampleTime;
return;
}
Participant *participantToBeChanged = participantByEquipmentNumber(gearAssignment.equipmentNumber());
Participant *participantToBeChanged = participantByEquipmentNumber(gearAssignment.equipmentNumber);
if (!participantToBeChanged)
{
WARNING_LOG(m_logger) << "Got gear assignment for unknown equipment number " << gearAssignment.equipmentNumber();
WARNING_LOG(m_logger) << "Got gear assignment for unknown equipment number " << gearAssignment.equipmentNumber;
return;
}
@@ -167,34 +167,34 @@ void ParticipantHandler::onNewStateFromProxy(const TrainingAreaBase::EquipmentSt
{
if (isTelegramInFuture(data))
{
WARNING_LOG(m_logger) << "Got an EquipmentState which has a timestamp in the future: " << data.sampleTime();
WARNING_LOG(m_logger) << "Got an EquipmentState which has a timestamp in the future: " << data.sampleTime;
return;
}
// 1. handle included EquipmentPosition:
TrainingAreaBase::EquipmentPosition pos;
pos.equipmentNumber(data.equipmentNumber());
pos.sampleTime(data.sampleTime());
if (data.position.is_set())
pos.equipmentNumber = data.equipmentNumber;
pos.sampleTime = data.sampleTime;
if (data.position.has_value())
{
pos.position(data.position.get());
pos.position = data.position.get();
onNewPositionFromProxy(pos);
}
// 2. handle EquipmentState
Participant *participantToBeChanged = participantByEquipmentNumber(data.equipmentNumber());
Participant *participantToBeChanged = participantByEquipmentNumber(data.equipmentNumber);
if (!participantToBeChanged)
{
WARNING_LOG(m_logger) << "Got equipment state for unknown equipment number " << data.equipmentNumber();
WARNING_LOG(m_logger) << "Got equipment state for unknown equipment number " << data.equipmentNumber;
return;
}
// convert eqNo to participantId if originator was a participant and data.originatorId() is an equipment number
int originatorId = data.originatorId();
int originatorId = data.originatorId;
Participant *originParticipant = nullptr;
if (data.originatorType() == ProjectDataManagement::StateChangeOriginator::Participant)
if (data.originatorType == ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_Participant)
{
originParticipant = participantByEquipmentNumber(data.originatorId());
originParticipant = participantByEquipmentNumber(data.originatorId);
if (originParticipant)
originatorId = originParticipant->id();
else
@@ -203,20 +203,20 @@ void ParticipantHandler::onNewStateFromProxy(const TrainingAreaBase::EquipmentSt
// Make Laser Designations to Laser Designations
auto dtcPdm = m_bdp->pdmDtc();
if (dtcPdm && dtcPdm->getChargeTypeSpecialProperty(data.originatorChargeTypeId(), 0, 0) == ProjectDataManagement::ChargeTypeProperty::LTD && originParticipant)
if (dtcPdm && dtcPdm->getChargeTypeSpecialProperty(data.originatorChargeTypeId, 0, 0) == ProjectDataManagement::ChargeTypeProperty::LTD && originParticipant)
{
QSet<int> ldGearTypes{1043}; // Need Property for LTD...
DynamicParticipantData dpd = originParticipant->dynamicParticipantData();
auto it = std::find_if(dpd.gear().cbegin(), dpd.gear().cend(), [ldGearTypes](const GearInformation &gi) { return ldGearTypes.contains(gi.gearTypeId()); });
if (it != dpd.gear().cend())
auto it = std::find_if(dpd.gear.cbegin(), dpd.gear.cend(), [ldGearTypes](const GearInformation &gi) { return ldGearTypes.contains(gi.gearTypeId); });
if (it != dpd.gear.cend())
{
for (auto &ld : dpd.designations())
for (auto &ld : dpd.designations)
{
if (ld.gearId() != it->gearId())
if (ld.gearId != it->gearId)
continue;
ld.spotLocation() = pos.position().position();
ld.outputPower() = 1.0;
ld.spotLocation = pos.position.position;
ld.outputPower = 1.0;
originParticipant->setDynamicData(dpd);
originParticipant->publishDynamicData();
break;
@@ -229,7 +229,7 @@ void ParticipantHandler::onNewStateFromProxy(const TrainingAreaBase::EquipmentSt
participantToBeChanged->publishDynamicData();
createHitlineInfo(originatorId, originParticipant, participantToBeChanged, pos, data.originatorChargeTypeId(), data.sampleTime());
createHitlineInfo(originatorId, originParticipant, participantToBeChanged, pos, data.originatorChargeTypeId, data.sampleTime);
}
void ParticipantHandler::createHitlineInfo(int, Participant *, Participant *, const TrainingAreaBase::EquipmentPosition &, int, qint64)
@@ -242,17 +242,17 @@ void ParticipantHandler::onNewPositionFromProxy(const TrainingAreaBase::Equipmen
{
if (isTelegramInFuture(position))
{
WARNING_LOG(m_logger) << "Got an EquipmentPosition which has a timestamp in the future: " << position.sampleTime();
WARNING_LOG(m_logger) << "Got an EquipmentPosition which has a timestamp in the future: " << position.sampleTime;
return;
}
if (isTelegramOutdated(position) && position.position().reportingSource() != Core::PositionReportingSource::SetByOperator)
if (isTelegramOutdated(position) && position.position.reportingSource != Core::PositionReportingSource::SetByOperator)
{
INFO_LOG(m_logger) << "position is outdated: " << position;
return;
}
DEBUG_LOG(m_logger) << "Got new position from proxy: " << position;
const int equipNo = position.equipmentNumber();
const int equipNo = position.equipmentNumber;
// negative - treat as participantId
Participant *participantWithNewPosition = equipNo < 0 ? participantById(-equipNo) : participantByEquipmentNumber(equipNo);
@@ -270,11 +270,11 @@ void ParticipantHandler::onNewEquipmentOperationalStateFromProxy(const TrainingA
{
if (isTelegramInFuture(operationalState))
{
WARNING_LOG(m_logger) << "Got an EquipmentOperationalState which has a timestamp in the future: " << operationalState.sampleTime();
WARNING_LOG(m_logger) << "Got an EquipmentOperationalState which has a timestamp in the future: " << operationalState.sampleTime;
return;
}
Participant *participantToUpdate = participantByEquipmentNumber(operationalState.equipmentNumber());
Participant *participantToUpdate = participantByEquipmentNumber(operationalState.equipmentNumber);
if (!participantToUpdate)
{
WARNING_LOG(m_logger) << "Got EquipmentOperationalState for unknown equipment number: " << operationalState;
@@ -289,30 +289,30 @@ void ParticipantHandler::onNewBiteFromProxy(const TrainingAreaBase::EquipmentBit
{
if (isTelegramInFuture(bite))
{
WARNING_LOG(m_logger) << "Got an EquipmentBite which has a timestamp in the future: " << bite.sampleTime();
WARNING_LOG(m_logger) << "Got an EquipmentBite which has a timestamp in the future: " << bite.sampleTime;
return;
}
if (isTelegramOutdated(bite))
{
WARNING_LOG(m_logger) << "Got an EquipmentBite which has a timestamp in the past: " << bite.sampleTime();
WARNING_LOG(m_logger) << "Got an EquipmentBite which has a timestamp in the past: " << bite.sampleTime;
return;
}
Bite biteData;
Participant *p = participantByEquipmentNumber(bite.equipmentNumber());
biteData.participantId(p ? p->id() : -1);
biteData.equipmentNumber(bite.equipmentNumber());
biteData.sampleTime(bite.sampleTime());
biteData.registerType(bite.registerType());
biteData.biteState(bite.biteState());
biteData.configState(bite.configState());
biteData.batteryState(bite.batteryState());
biteData.configError(bite.configError());
Participant *p = participantByEquipmentNumber(bite.equipmentNumber);
biteData.participantId = p ? p->id() : -1;
biteData.equipmentNumber = bite.equipmentNumber;
biteData.sampleTime = bite.sampleTime;
biteData.registerType = bite.registerType;
biteData.biteState = bite.biteState;
biteData.configState = bite.configState;
biteData.batteryState = bite.batteryState;
biteData.configError = bite.configError;
biteData.biteErrors().reserve(bite.biteErrors().size());
for (const TrainingAreaBase::EquipmentBiteError &error : bite.biteErrors())
biteData.biteErrors().emplace_back(error.errorNumber(), error.canDeviceNumber(), error.subdeviceNumber(), error.uniqueId());
biteData.biteErrors.reserve(bite.biteErrors.size());
for (const TrainingAreaBase::EquipmentBiteError &error : bite.biteErrors)
biteData.biteErrors.emplace_back(error.errorNumber, error.canDeviceNumber, error.subdeviceNumber, error.uniqueId);
dts()->publish(biteData);
}
@@ -321,11 +321,11 @@ void ParticipantHandler::onNewCtaDataErrorFromProxy(const TrainingAreaBase::CtaD
{
CtaError ctasErrorData;
ctasErrorData.equipmentNumber(error.equipmentNumber());
ctasErrorData.timeReceipt(currentTimeMSec());
ctasErrorData.timePlayerUnit(error.sampleTime());
ctasErrorData.errorReason(error.reason());
ctasErrorData.telegramId(error.originTelegramId());
ctasErrorData.equipmentNumber = error.equipmentNumber;
ctasErrorData.timeReceipt = currentTimeMSec();
ctasErrorData.timePlayerUnit = error.sampleTime;
ctasErrorData.errorReason = error.reason;
ctasErrorData.telegramId = error.originTelegramId;
dts()->publish(ctasErrorData);
}
@@ -334,39 +334,39 @@ void ParticipantHandler::onNewParticipantModeReport(const TrainingAreaBase::Part
{
if (isTelegramInFuture(report))
{
WARNING_LOG(m_logger) << "Got a ParticipantModeReport which has a timestamp in the future: " << report.sampleTime();
WARNING_LOG(m_logger) << "Got a ParticipantModeReport which has a timestamp in the future: " << report.sampleTime;
return;
}
if (isTelegramOutdated(report))
{
WARNING_LOG(m_logger) << "Got a ParticipantModeReport which has a timestamp in the past: " << report.sampleTime();
WARNING_LOG(m_logger) << "Got a ParticipantModeReport which has a timestamp in the past: " << report.sampleTime;
return;
}
Participant *participant = participantByEquipmentNumber(report.equipmentNumber());
Participant *participant = participantByEquipmentNumber(report.equipmentNumber);
if (!participant)
{
ERROR_LOG(m_logger) << LOGFUNCTION << "Could not find participant with equipment number " << report.equipmentNumber();
ERROR_LOG(m_logger) << LOGFUNCTION << "Could not find participant with equipment number " << report.equipmentNumber;
return;
}
ParticipantMode ddsData;
ddsData.participantId(participant->id());
ddsData.language(report.language());
ddsData.opMode(report.operationMode());
ddsData.reactivationDecontamination(report.reactivationDetoxication());
ddsData.reactivationMaintenance(report.reactivationMaintenance());
ddsData.reactivationMedic(report.reactivationMedic());
ddsData.modeVest(report.protectionModeVest());
ddsData.modeHelmet(report.protectionModeHelmet());
ddsData.modePersonalProtection(report.personellProtectionMode());
ddsData.protectionLevel(report.protectionLevel());
ddsData.handgrenadeSearchMode(report.handgrenadeSearchMode());
ddsData.internationalMode(report.internationalMode());
ddsData.abcProtectionMode(report.abcProtectionMode());
ddsData.participantId = participant->id();
ddsData.language = report.language;
ddsData.opMode = report.operationMode;
ddsData.reactivationDecontamination = report.reactivationDetoxication;
ddsData.reactivationMaintenance = report.reactivationMaintenance;
ddsData.reactivationMedic = report.reactivationMedic;
ddsData.modeVest = report.protectionModeVest;
ddsData.modeHelmet = report.protectionModeHelmet;
ddsData.modePersonalProtection = report.personellProtectionMode;
ddsData.protectionLevel = report.protectionLevel;
ddsData.handgrenadeSearchMode = report.handgrenadeSearchMode;
ddsData.internationalMode = report.internationalMode;
ddsData.abcProtectionMode = report.abcProtectionMode;
ddsData.sampleTime(report.sampleTime());
ddsData.sampleTime = report.sampleTime;
participant->setMode(ddsData);
participant->publishMode();
}
@@ -375,30 +375,30 @@ void ParticipantHandler::onNewSpecialSensorData(const TrainingAreaBase::SpecialS
{
if (isTelegramInFuture(data))
{
WARNING_LOG(m_logger) << "Got a SpecialSensorData which has a timestamp in the future: " << data.sampleTime();
WARNING_LOG(m_logger) << "Got a SpecialSensorData which has a timestamp in the future: " << data.sampleTime;
return;
}
if (isTelegramOutdated(data))
{
WARNING_LOG(m_logger) << "Got a SpecialSensorData which has a timestamp in the past: " << data.sampleTime();
WARNING_LOG(m_logger) << "Got a SpecialSensorData which has a timestamp in the past: " << data.sampleTime;
return;
}
Participant *participant = data.equipmentNumber() < 0 ? participantById(-data.equipmentNumber()) : participantByEquipmentNumber(data.equipmentNumber());
Participant *participant = data.equipmentNumber < 0 ? participantById(-data.equipmentNumber) : participantByEquipmentNumber(data.equipmentNumber);
if (!participant)
{
ERROR_LOG(m_logger) << LOGFUNCTION << "Could not find participant with equipment number " << data.equipmentNumber();
ERROR_LOG(m_logger) << LOGFUNCTION << "Could not find participant with equipment number " << data.equipmentNumber;
return;
}
TrainingAreaBase::EquipmentPosition pos;
pos.equipmentNumber(data.equipmentNumber());
pos.sampleTime(data.sampleTime());
if (data.position.is_set())
pos.equipmentNumber = data.equipmentNumber;
pos.sampleTime = data.sampleTime;
if (data.position.has_value())
{
Core::GeoPosition geoPos(data.position.get().lon(), data.position.get().lat(), 0);
pos.position().position(geoPos);
Core::GeoPosition geoPos(data.position.get().lon, data.position.get().lat, 0);
pos.position.position = geoPos;
if (participant->setPosition(pos))
participant->publishPosition();
}
@@ -410,13 +410,13 @@ void ParticipantHandler::onNewSpecialSensorData(const TrainingAreaBase::SpecialS
void ParticipantHandler::onNewLaserDesignation(const TrainingAreaBase::LaserDesignation &data)
{
DEBUG_LOG(m_logger) << "New Laser Designation: "
<< "Code: " << data.code() << ", GearID: " << data.gearId() << ", EqNo: " << data.equipmentNumber() << ", Lon: " << data.spotLocation().lon()
<< ", Lat: " << data.spotLocation().lat() << ", Power: " << data.outputPower();
Participant *participant = participantByEquipmentNumber(data.equipmentNumber());
<< "Code: " << data.code << ", GearID: " << data.gearId << ", EqNo: " << data.equipmentNumber << ", Lon: " << data.spotLocation.lon
<< ", Lat: " << data.spotLocation.lat << ", Power: " << data.outputPower;
Participant *participant = participantByEquipmentNumber(data.equipmentNumber);
if (!participant)
{
ERROR_LOG(m_logger) << LOGFUNCTION << "Could not find participant with equipment number " << data.equipmentNumber();
ERROR_LOG(m_logger) << LOGFUNCTION << "Could not find participant with equipment number " << data.equipmentNumber;
return;
}
@@ -457,17 +457,17 @@ void ParticipantHandler::onLaserDesignationRemoved(int equipmentNumber, int gear
void ParticipantHandler::onBuildingHitLineInfo(const Buildings::BuildingHitLineInfo &data)
{
DEBUG_LOG(m_logger) << "onBuildingHitLineInfo "
<< "BuildingId=" << data.buildingId() << " originatorParticipantId=" << data.originatorParticipantId();
<< "BuildingId=" << data.buildingId << " originatorParticipantId=" << data.originatorParticipantId;
auto dtcPdm = m_bdp->pdmDtc();
// NOTE: igniterTypeId/IgniterFunction = 0 as long as BuildingHitLineInfo does not contain values
if (dtcPdm->getChargeTypeSpecialProperty(data.chargeTypeId(), 0, 0) != ProjectDataManagement::ChargeTypeProperty::LTD)
if (dtcPdm->getChargeTypeSpecialProperty(data.chargeTypeId, 0, 0) != ProjectDataManagement::ChargeTypeProperty::LTD)
return;
Participant *participant = participantById(data.originatorParticipantId());
Participant *participant = participantById(data.originatorParticipantId);
if (!participant)
{
ERROR_LOG(m_logger) << LOGFUNCTION << "Could not find participant with participantId: " << data.originatorParticipantId();
ERROR_LOG(m_logger) << LOGFUNCTION << "Could not find participant with participantId: " << data.originatorParticipantId;
return;
}
@@ -480,68 +480,68 @@ void ParticipantHandler::onBuildingHitLineInfo(const Buildings::BuildingHitLineI
DEBUG_LOG(m_logger) << "setDynamicData";
participant->setDynamicData(dpd);
DEBUG_LOG(m_logger) << "publishDynamicData"
<< " dpd.designations().size()=" << dpd.designations().size();
<< " dpd.designations().size()=" << dpd.designations.size();
participant->publishDynamicData();
}
void ParticipantHandler::onSanitaryMaterialStockReport(const TrainingAreaBase::ParticipantSanitaryMaterialStockReport &data)
{
DEBUG_LOG(m_logger) << "onSanitaryMaterialStockReport";
Participant *participant = participantByEquipmentNumber(data.equipmentNumber());
Participant *participant = participantByEquipmentNumber(data.equipmentNumber);
if (!participant)
{
ERROR_LOG(m_logger) << LOGFUNCTION << "Could not find participant with equipment number " << data.equipmentNumber();
ERROR_LOG(m_logger) << LOGFUNCTION << "Could not find participant with equipment number " << data.equipmentNumber;
return;
}
if (data.qualification() == TrainingAreaBase::Qualification::NotDefined)
if (data.qualification == TrainingAreaBase::Qualification::NotDefined)
{
DEBUG_LOG(m_logger) << "!!! Clear Materials : equipment number " << data.equipmentNumber();
DEBUG_LOG(m_logger) << "!!! Clear Materials : sample time " << data.sampleTime();
DEBUG_LOG(m_logger) << "!!! Clear Materials : equipment number " << data.equipmentNumber;
DEBUG_LOG(m_logger) << "!!! Clear Materials : sample time " << data.sampleTime;
participant->setSanitationMaterial(0,
std::vector<int>(),
data.uniqueId(),
data.sampleTime(),
data.uniqueId,
data.sampleTime,
Qualification::NotAssigned,
data.originatorEquipmentNumber()); // this is a deassociation so clear material
data.originatorEquipmentNumber); // this is a deassociation so clear material
}
else
{
DEBUG_LOG(m_logger) << "!!! Set Materials : equipment number " << data.equipmentNumber();
DEBUG_LOG(m_logger) << "!!! Set Materials : sample time " << data.sampleTime();
participant->setSanitationMaterial(data.sanitaryMaterialCount(),
data.sanitaryMaterialStock(),
data.uniqueId(),
data.sampleTime(),
static_cast<ParticipantManagement::Qualification>(data.qualification().underlying()),
data.originatorEquipmentNumber());
DEBUG_LOG(m_logger) << "!!! Set Materials : equipment number " << data.equipmentNumber;
DEBUG_LOG(m_logger) << "!!! Set Materials : sample time " << data.sampleTime;
participant->setSanitationMaterial(data.sanitaryMaterialCount,
data.sanitaryMaterialStock,
data.uniqueId,
data.sampleTime,
static_cast<ParticipantManagement::Qualification>(data.qualification),
data.originatorEquipmentNumber);
}
participant->publishDynamicData();
}
void ParticipantHandler::onParticipantSanitation(const TrainingAreaBase::ParticipantSanitation &data)
{
Participant *participant = participantByEquipmentNumber(data.equipmentNumber());
Participant *participantOrig = participantByEquipmentNumber(data.originatorEquipmentNumber());
Participant *participant = participantByEquipmentNumber(data.equipmentNumber);
Participant *participantOrig = participantByEquipmentNumber(data.originatorEquipmentNumber);
if (!participant)
{
ERROR_LOG(m_logger) << LOGFUNCTION << "Could not find participant with equipment number " << data.equipmentNumber();
ERROR_LOG(m_logger) << LOGFUNCTION << "Could not find participant with equipment number " << data.equipmentNumber;
return;
}
int participantOrigId = data.originatorEquipmentNumber();
int participantOrigId = data.originatorEquipmentNumber;
if (participantOrig)
participantOrigId = participantOrig->id();
if (data.qualification() == TrainingAreaBase::Qualification::NotDefined && data.proceduresTaken() == 0)
if (data.qualification == TrainingAreaBase::Qualification::NotDefined && data.proceduresTaken == 0)
{
DEBUG_LOG(m_logger) << "!!! Clear Sanitation = " << data.sampleTime();
DEBUG_LOG(m_logger) << "!!! Clear Sanitation: equipNo = " << data.equipmentNumber();
participant->setSanitationMaterial(0, std::vector<int>(), 0, data.sampleTime(), Qualification::NotAssigned, 0); // this is a deassociation so clear material
DEBUG_LOG(m_logger) << "!!! Clear Sanitation = " << data.sampleTime;
DEBUG_LOG(m_logger) << "!!! Clear Sanitation: equipNo = " << data.equipmentNumber;
participant->setSanitationMaterial(0, std::vector<int>(), 0, data.sampleTime, Qualification::NotAssigned, 0); // this is a deassociation so clear material
}
else
{
DEBUG_LOG(m_logger) << "!!! SetSanitation: sample time = " << data.sampleTime();
DEBUG_LOG(m_logger) << "!!! SetSanitation: equipNo = " << data.equipmentNumber();
participant->setSanitation(data.proceduresTaken(), data.sanitationResult(), data.sanitationEvaluation(), participantOrigId, data.qualification(), data.sampleTime());
DEBUG_LOG(m_logger) << "!!! SetSanitation: sample time = " << data.sampleTime;
DEBUG_LOG(m_logger) << "!!! SetSanitation: equipNo = " << data.equipmentNumber;
participant->setSanitation(data.proceduresTaken, data.sanitationResult, data.sanitationEvaluation, participantOrigId, data.qualification, data.sampleTime);
}
participant->publishDynamicData();
}
@@ -549,67 +549,67 @@ void ParticipantHandler::onParticipantSanitation(const TrainingAreaBase::Partici
void ParticipantHandler::onOperatorAction(const TrainingAreaBase::OperatorAction &data)
{
// maybe use other commands later?!
if (data.action() != 8 && data.action() != 35)
if (data.action != 8 && data.action != 35)
return;
Participant *participant = participantByEquipmentNumber(data.equipmentNumber());
Participant *participant = participantByEquipmentNumber(data.equipmentNumber);
if (!participant)
{
ERROR_LOG(m_logger) << LOGFUNCTION << "Could not find participant with equipment number " << data.equipmentNumber();
ERROR_LOG(m_logger) << LOGFUNCTION << "Could not find participant with equipment number " << data.equipmentNumber;
return;
}
if (participant->setOperatorAction(data.action(), data.operatorId(), data.sampleTime()))
if (participant->setOperatorAction(data.action, data.operatorId, data.sampleTime))
participant->publishDynamicData();
}
void ParticipantHandler::onEquipmentEvent(const TrainingAreaBase::EquipmentEvent &data)
{
// maybe use other commands later?!
if (data.source().subDeviceId() != 14 || data.source().equipmentFunctionId() != 5)
if (data.source.subDeviceId != 14 || data.source.equipmentFunctionId != 5)
return;
if (data.code() == 1 || data.code() == 2) // 1: 9Liner 2: Transport
if (data.code == 1 || data.code == 2) // 1: 9Liner 2: Transport
{
Participant *participant = participantByEquipmentNumber(data.equipmentNumber());
Participant *participant = participantByEquipmentNumber(data.equipmentNumber);
if (!participant)
return;
if (participant->setEquipmentEvent(data.code(), data.sampleTime()))
if (participant->setEquipmentEvent(data.code, data.sampleTime))
participant->publishDynamicData();
}
}
void ParticipantHandler::onNewFunctionalAreaEntryChanged(const TrainingAreaBase::FunctionalAreaEntry &data)
{
Participant *participant = participantByEquipmentNumber(data.equipmentNumber());
Participant *participant = participantByEquipmentNumber(data.equipmentNumber);
if (!participant)
{
ERROR_LOG(m_logger) << LOGFUNCTION << "Could not find participant with equipment number " << data.equipmentNumber();
ERROR_LOG(m_logger) << LOGFUNCTION << "Could not find participant with equipment number " << data.equipmentNumber;
return;
}
TrainingAreaBase::EquipmentPosition pos;
pos.equipmentNumber(data.equipmentNumber());
pos.sampleTime(data.sampleTime());
Core::GeoPosition geoPos(data.position().lon(), data.position().lat(), 0);
pos.position().position(geoPos);
pos.equipmentNumber = data.equipmentNumber;
pos.sampleTime = data.sampleTime;
Core::GeoPosition geoPos(data.position.lon, data.position.lat, 0);
pos.position.position = geoPos;
if (participant->setPosition(pos))
participant->publishPosition();
StateInformation oldState = youngestStateInformation(participant->dynamicParticipantData().stateHistory(), false);
StateInformation oldState = youngestStateInformation(participant->dynamicParticipantData().stateHistory, false);
TrainingAreaBase::EquipmentState state;
state.equipmentNumber(data.equipmentNumber());
state.originatorId(data.aesItemId());
state.originatorType(ProjectDataManagement::StateChangeOriginator::FunctionalArea);
state.sampleTime(data.sampleTime());
state.vulnerabilityState(ProjectDataManagement::VulnerabilityState::VulnerabilityState_HitWithNoEffect); // no effect - it's an entry into a functional area
state.vulnerabilityBits(oldState.vulnerabilityBits());
state.vulnerabilityKindId(oldState.vulnerabilityKindId());
state.vitality(oldState.vitality());
state.equipmentNumber = data.equipmentNumber;
state.originatorId = data.aesItemId;
state.originatorType = ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_FunctionalArea;
state.sampleTime = data.sampleTime;
state.vulnerabilityState = ProjectDataManagement::VulnerabilityState::VulnerabilityState_HitWithNoEffect; // no effect - it's an entry into a functional area
state.vulnerabilityBits = oldState.vulnerabilityBits;
state.vulnerabilityKindId = oldState.vulnerabilityKindId;
state.vitality = oldState.vitality;
participant->setState(state, data.aesItemId());
participant->setState(state, data.aesItemId);
participant->publishDynamicData();
}
@@ -626,9 +626,9 @@ void ParticipantHandler::onHitLineInfoTimeout()
auto it = m_hitLineInfoMap.begin();
while (it != m_hitLineInfoMap.end())
{
if (!isOutdated(tNow, it.value().sampleTime()))
if (!isOutdated(tNow, it.value().sampleTime))
break;
dts()->removeHitLineInfoByKey(it.value().id());
dts()->removeHitLineInfoByKey(it.value().id);
it = m_hitLineInfoMap.erase(it);
}
@@ -636,11 +636,11 @@ void ParticipantHandler::onHitLineInfoTimeout()
void ParticipantHandler::setPosition(const ParticipantManagement::ParticipantPosition &data)
{
Participant *participant = participantById(data.participantId());
Participant *participant = participantById(data.participantId);
if (!participant)
{
ERROR_LOG(m_logger) << LOGFUNCTION << "Could not find participant with id " << data.participantId();
ERROR_LOG(m_logger) << LOGFUNCTION << "Could not find participant with id " << data.participantId;
return;
}
@@ -651,7 +651,7 @@ void ParticipantHandler::setHitlineInfoFromReplay(const HitLineInfo &data)
{
if (!dts()->publish(data))
return;
m_hitLineInfoMap.insert(data.id(), data);
m_hitLineInfoMap.insert(data.id, data);
}
void ParticipantHandler::setUASFromReplay(const UAS &data)
@@ -687,43 +687,43 @@ void ParticipantHandler::updateLaserDesignation(DynamicParticipantData &data, co
LOGGER_T m_logger = getLogger("ParticipantHandler.Laser");
DEBUG_LOG(m_logger) << "-Update Laser Designation - Start ";
for (LaserDesignation &laserDesignation : data.designations())
for (LaserDesignation &laserDesignation : data.designations)
{
if (laserDesignation.gearId() != newLaserDesignation.gearId())
if (laserDesignation.gearId != newLaserDesignation.gearId)
continue;
DEBUG_LOG(m_logger) << "-Update Laser Designation - Gear with id " << laserDesignation.gearId() << " found in designations";
laserDesignation.code(newLaserDesignation.code());
DEBUG_LOG(m_logger) << "-Update Laser Designation - Gear with id " << laserDesignation.gearId << " found in designations";
laserDesignation.code = newLaserDesignation.code;
if (!qFuzzyIsNull(laserDesignation.outputPower()) && !qFuzzyIsNull(newLaserDesignation.spotLocation().lat())
&& !qFuzzyIsNull(newLaserDesignation.spotLocation().lon()))
laserDesignation.spotLocation(Core::GeoPosition(newLaserDesignation.spotLocation().lon(), newLaserDesignation.spotLocation().lat(), 0.0));
if (!qFuzzyIsNull(laserDesignation.outputPower) && !qFuzzyIsNull(newLaserDesignation.spotLocation.lat)
&& !qFuzzyIsNull(newLaserDesignation.spotLocation.lon))
laserDesignation.spotLocation = Core::GeoPosition(newLaserDesignation.spotLocation.lon, newLaserDesignation.spotLocation.lat, 0.0);
// If Laser was on before and now is turned off, we have to reset spot Location
if (!qFuzzyIsNull(laserDesignation.outputPower()) && qFuzzyIsNull(newLaserDesignation.outputPower()))
laserDesignation.spotLocation(Core::GeoPosition(0.0, 0.0, 0.0));
if (!qFuzzyIsNull(laserDesignation.outputPower) && qFuzzyIsNull(newLaserDesignation.outputPower))
laserDesignation.spotLocation = Core::GeoPosition(0.0, 0.0, 0.0);
laserDesignation.outputPower(newLaserDesignation.outputPower());
laserDesignation.outputPower = newLaserDesignation.outputPower;
DEBUG_LOG(m_logger) << "-Update Laser Designation - Data updated, returning";
return;
}
DEBUG_LOG(m_logger) << "-Update Laser Designation - Gear with id " << newLaserDesignation.gearId() << " NOT found in designations";
DEBUG_LOG(m_logger) << "-Update Laser Designation - Gear with id " << newLaserDesignation.gearId << " NOT found in designations";
int gearId = newLaserDesignation.gearId();
auto it = std::find_if(data.gear().cbegin(), data.gear().cend(), [gearId](const GearInformation &gi) { return gearId == gi.gearId(); });
if (it == data.gear().cend()) // No gear, no designation...
int gearId = newLaserDesignation.gearId;
auto it = std::find_if(data.gear.cbegin(), data.gear.cend(), [gearId](const GearInformation &gi) { return gearId == gi.gearId; });
if (it == data.gear.cend()) // No gear, no designation...
{
DEBUG_LOG(m_logger) << "-Update Laser Designation - Gear with id " << newLaserDesignation.gearId() << " NOT found in Gears";
DEBUG_LOG(m_logger) << "-Update Laser Designation - Gear with id " << newLaserDesignation.gearId << " NOT found in Gears";
return;
}
DEBUG_LOG(m_logger) << "-Update Laser Designation - Gear with id " << newLaserDesignation.gearId() << " found in Gears";
DEBUG_LOG(m_logger) << "-Update Laser Designation - Gear with id " << newLaserDesignation.gearId << " found in Gears";
DEBUG_LOG(m_logger) << "-Update Laser Designation - Adding new designation";
data.designations().emplace_back(newLaserDesignation.gearId(),
Core::GeoPosition(newLaserDesignation.spotLocation().lon(), newLaserDesignation.spotLocation().lat(), 0.0),
newLaserDesignation.code(),
newLaserDesignation.outputPower());
data.designations.emplace_back(newLaserDesignation.gearId,
Core::GeoPosition(newLaserDesignation.spotLocation.lon, newLaserDesignation.spotLocation.lat, 0.0),
newLaserDesignation.code,
newLaserDesignation.outputPower);
}
void ParticipantHandler::updateLaserDesignation(DynamicParticipantData &dataInOut, const Buildings::BuildingHitLineInfo &newLaserDesignation)
@@ -733,28 +733,28 @@ void ParticipantHandler::updateLaserDesignation(DynamicParticipantData &dataInOu
// Mehrere Designatoren pro Teilnehmer werden nicht unterstützt.
DEBUG_LOG(m_logger) << "-Update Laser Designation by Building Hitline Info";
for (LaserDesignation &laserDesignation : dataInOut.designations())
for (LaserDesignation &laserDesignation : dataInOut.designations)
{
DEBUG_LOG(m_logger) << "-Update Laser Designation by Building Hitline Info - Updating (first) Designation with GearId " << laserDesignation.gearId();
laserDesignation.outputPower(1.0);
laserDesignation.spotLocation(newLaserDesignation.buildingPos());
DEBUG_LOG(m_logger) << "-Update Laser Designation by Building Hitline Info - Updating (first) Designation with GearId " << laserDesignation.gearId;
laserDesignation.outputPower = 1.0;
laserDesignation.spotLocation = newLaserDesignation.buildingPos;
return;
}
QSet<int> ldGearTypes{1043}; // Need Property for LTD...
auto it = std::find_if(dataInOut.gear().cbegin(), dataInOut.gear().cend(), [ldGearTypes](const GearInformation &gi) { return ldGearTypes.contains(gi.gearTypeId()); });
if (it != dataInOut.gear().cend())
auto it = std::find_if(dataInOut.gear.cbegin(), dataInOut.gear.cend(), [ldGearTypes](const GearInformation &gi) { return ldGearTypes.contains(gi.gearTypeId); });
if (it != dataInOut.gear.cend())
{
LaserDesignation ld;
ld.gearId() = it->gearId();
ld.code() = 0;
ld.spotLocation() = newLaserDesignation.buildingPos();
ld.outputPower(1.0);
dataInOut.designations().emplace_back(ld);
ld.gearId = it->gearId;
ld.code = 0;
ld.spotLocation = newLaserDesignation.buildingPos;
ld.outputPower = 1.0;
dataInOut.designations.emplace_back(ld);
ERROR_LOG(m_logger) << "-Update Laser Designation by Building Hitline Info - Added Designation";
}
ERROR_LOG(m_logger) << "-Update Laser Designation by Building Hitline Info - No laserDesignation available participantId="
<< newLaserDesignation.originatorParticipantId();
<< newLaserDesignation.originatorParticipantId;
}
void ParticipantHandler::removeLaserDesignation(DynamicParticipantData &data, qint32 gearId)
@@ -762,17 +762,17 @@ void ParticipantHandler::removeLaserDesignation(DynamicParticipantData &data, qi
LOGGER_T m_logger = getLogger("ParticipantHandler.Laser");
DEBUG_LOG(m_logger) << "-Remove Laser Designation: Start";
auto validationFunction = [gearId](ParticipantManagement::LaserDesignation laserDesignation) { return laserDesignation.gearId() == gearId; };
auto eraseIterator = std::find_if(data.designations().begin(), data.designations().end(), validationFunction);
auto validationFunction = [gearId](ParticipantManagement::LaserDesignation laserDesignation) { return laserDesignation.gearId == gearId; };
auto eraseIterator = std::find_if(data.designations.begin(), data.designations.end(), validationFunction);
if (eraseIterator == data.designations().end())
if (eraseIterator == data.designations.end())
{
DEBUG_LOG(m_logger) << "-Remove Laser Designation: GearId NOT found";
return;
}
DEBUG_LOG(m_logger) << "-Remove Laser Designation: Removing Designation";
data.designations().erase(eraseIterator);
data.designations.erase(eraseIterator);
}
} // namespace ParticipantHandling
@@ -151,10 +151,10 @@ class ParticipantHandler
static bool isSupportTypeClass(const TypeClass &typeClass);
// t - 11min <= sampleTime
template <typename T> inline bool isTelegramOutdated(const T &tele) const { return isSampleTimeOutdated(tele.sampleTime()); }
template <typename T> inline bool isTelegramOutdated(const T &tele) const { return isSampleTimeOutdated(tele.sampleTime); }
virtual bool isSampleTimeOutdated(qint64 sampleTime) const;
// sampleTime > t + 1min
template <typename T> inline bool isTelegramInFuture(const T &tele) const { return isSampleTimeInFuture(tele.sampleTime()); }
template <typename T> inline bool isTelegramInFuture(const T &tele) const { return isSampleTimeInFuture(tele.sampleTime); }
virtual bool isSampleTimeInFuture(qint64 sampleTime) const;
protected:
@@ -217,7 +217,7 @@ void ProxyListener::onLaserDesignationChanged(const TrainingAreaBase::LaserDesig
if (modType == DataModification::eRemoved)
{
DEBUG_LOG(m_logger) << "Got no laser designation data: " << data;
emit laserDesignationRemoved(data.equipmentNumber(), data.gearId());
emit laserDesignationRemoved(data.equipmentNumber, data.gearId);
return;
}
@@ -264,25 +264,25 @@ void ProxyListener::onUASStatusChanged(const TrainingAreaBase::UASStatus &data,
m_mainHandler->ddsHandler()->dtc()->waitForHistoricalDataParticipant(3000);
int participantId = m_mainHandler->ddsHandler()->dtc()->participantIdByEquipmentNumber(data.equipmentNumber());
int participantId = m_mainHandler->ddsHandler()->dtc()->participantIdByEquipmentNumber(data.equipmentNumber);
if (participantId <= 0)
return;
const auto uas = m_mainHandler->ddsHandler()->dtc()->getUasByParticipantId(participantId, m_mainHandler->exerciseId());
if (uas.id() <= 0)
if (uas.id <= 0)
return;
//new PPM Telegram
UASRadioLinkConnectionStatus newState;
newState.id(uas.id());
newState.uasState(data.uasState());
newState.id = uas.id;
newState.uasState = data.uasState;
DEBUG_LOG(m_logger) << "Publish new UAS State " << newState;
m_mainHandler->ddsHandler()->exAnyDts()->publish(newState);
}
void ProxyListener::onUASMissionStatusChanged(const TrainingAreaBase::UASMissionStatus &data, DataModification modType)
{
DEBUG_LOG(m_logger) << "currentTask = " << (int)data.currentTask().underlying() << ", currentMissionName = " << data.currentMissionName() << ", name of ended mission: " << data.missionEnded();
DEBUG_LOG(m_logger) << "currentTask = " << (int)data.currentTask << ", currentMissionName = " << data.currentMissionName << ", name of ended mission: " << data.missionEnded;
/*
was wenn random mehrfach hintereinander loiter gesendet wird??
dann überspringt er eine action! der tab darf also nur senden wenn wirklich ein state change kam
@@ -295,25 +295,25 @@ void ProxyListener::onUASMissionStatusChanged(const TrainingAreaBase::UASMission
return;
}
if (!data.currentMissionName().empty() || data.currentTask().underlying() != ProjectDataManagement::UasActionTask::Loiter || data.missionEnded().empty())
if (!data.currentMissionName.empty() || data.currentTask != ProjectDataManagement::UasActionTask::Loiter || data.missionEnded.empty())
{
//DEBUG As this will happen a lot
DEBUG_LOG(m_logger) << "not fulfilling current mission ("<<data.currentMissionName()<<") action because either a mission is still active or current task ("<<(int)data.currentTask().underlying()<<") is not Loiter or mission not ended ("<< data.missionEnded() << (data.missionEnded().empty() ? " [NOT ENDED]" : " [ ENDED ]")<<")";
DEBUG_LOG(m_logger) << "not fulfilling current mission ("<<data.currentMissionName<<") action because either a mission is still active or current task ("<<(int)data.currentTask<<") is not Loiter or mission not ended ("<< data.missionEnded << (data.missionEnded.empty() ? " [NOT ENDED]" : " [ ENDED ]")<<")";
return;
}
m_mainHandler->ddsHandler()->dtc()->waitForHistoricalDataParticipant(3000);
const int participantId = m_mainHandler->ddsHandler()->dtc()->participantIdByEquipmentNumber(data.equipmentNumber());
const int participantId = m_mainHandler->ddsHandler()->dtc()->participantIdByEquipmentNumber(data.equipmentNumber);
if (participantId <= 0)
{
ERROR_LOG(m_logger) << "participant for eqid " << data.equipmentNumber() << " not found - unable to fulfill current mission action";
ERROR_LOG(m_logger) << "participant for eqid " << data.equipmentNumber << " not found - unable to fulfill current mission action";
return;
}
QTimer::singleShot(1000, [this, participantId, data]() // give tab plugin time to clean stuff up before sending new missions (by marking an action as fulfilled)
{
// mission empty & task = loiter? mission done, run next mission (by setting current mission's current action as fulfilled, which will trigger the next action automatically (see ces))
if (!m_mainHandler->missionPlanHandler()->setCurrentMissionActionFulfilled(participantId, QString::fromStdString(data.missionEnded())))
if (!m_mainHandler->missionPlanHandler()->setCurrentMissionActionFulfilled(participantId, QString::fromStdString(data.missionEnded)))
{
ERROR_LOG(m_logger) << "setCurrentMissionActionFulfilled didn't work out";
return;
@@ -351,13 +351,13 @@ Core::FunctionReplyObject ProxyListener::demandVulnerabilityStateChange(const rt
if (!m_mainHandler->tabFtc()->demandVulnerabilityStateChangeRequest(req, this))
return Core::FunctionReplyObject(tr_lts("dds", "Error passing the Vulnerability state change request to the proxy"));
const int requestId = req.requestId();
const int requestId = req.requestId;
auto cb = [this, requestId]()
{
INFO_LOG(m_logger) << "VulnerabilityStateChange timeout for " << requestId;
onDemandVulnerabilityStateChangeReply(Core::FunctionReplyObject(requestId, tr_lts("dds", "Timeout while waiting for the proxy")));
};
addToTrainingAreaRequests(cb, req.requestId(), cookie);
addToTrainingAreaRequests(cb, req.requestId, cookie);
return Core::FunctionReplyObject();
}
@@ -374,17 +374,17 @@ void ProxyListener::onDemandVulnerabilityStateChangeReply(const Core::FunctionRe
Core::FunctionReplyObject ProxyListener::sendModifyUasStateRequest(const rti::core::SampleIdentity &cookie,
const TrainingAreaBase::SendModifyUasStateRequest &req)
{
DEBUG_LOG(m_logger) << " -- [ProxyListener] sendModifyUasStateRequest uasId: " << req.uasId();
DEBUG_LOG(m_logger) << " -- [ProxyListener] sendModifyUasStateRequest uasId: " << req.uasId;
if (!m_mainHandler->tabFtc()->sendModifyUasStateRequest(req, this))
return Core::FunctionReplyObject(tr_lts("dds", "Error passing the UAS state change request to the proxy"));
const int requestId = req.requestId();
const int requestId = req.requestId;
auto cb = [this, requestId]()
{
INFO_LOG(m_logger) << "ModifyUasState timeout for " << requestId;
onSendModifyUasStateReply(Core::FunctionReplyObject(requestId, tr_lts("dds", "Timeout while waiting for the proxy")));
};
addToTrainingAreaRequests(cb, req.requestId(), cookie);
addToTrainingAreaRequests(cb, req.requestId, cookie);
return Core::FunctionReplyObject();
}
@@ -404,13 +404,13 @@ Core::FunctionReplyObject ProxyListener::demandInitRequest(const rti::core::Samp
if (!m_mainHandler->tabFtc()->demandInitRequest(req, this))
return Core::FunctionReplyObject(tr_lts("dds", "Error passing the INIT request to the proxy"));
const int requestId = req.requestId();
const int requestId = req.requestId;
auto cb = [this, requestId]()
{
INFO_LOG(m_logger) << "DemandInit timeout for " << requestId;
onDemandInitReply(Core::FunctionReplyObject(requestId, tr_lts("dds", "Timeout while waiting for the proxy")));
};
addToTrainingAreaRequests(cb, req.requestId(), cookie);
addToTrainingAreaRequests(cb, req.requestId, cookie);
return Core::FunctionReplyObject();
}
@@ -431,13 +431,13 @@ Core::FunctionReplyObject ProxyListener::sendEquipmentMessage(const rti::core::S
if (!m_mainHandler->tabFtc()->sendEquipmentMessageRequest(req, this))
return Core::FunctionReplyObject(tr_lts("dds", "Error passing SendMessage request to the proxy"));
const int requestId = req.requestId();
const int requestId = req.requestId;
auto cb = [this, requestId]()
{
INFO_LOG(m_logger) << "SendMessage timeout for " << requestId;
onSendEquipmentMessageReply(Core::FunctionReplyObject(requestId, tr_lts("dds", "Timeout while waiting for the proxy")));
};
addToTrainingAreaRequests(cb, req.requestId(), cookie);
addToTrainingAreaRequests(cb, req.requestId, cookie);
return Core::FunctionReplyObject();
}
@@ -456,17 +456,17 @@ Core::FunctionReplyObject ProxyListener::sendParticipantModeRequest(const rti::c
const TrainingAreaBase::SendParticipantModeRequest &req)
{
if (!m_mainHandler->tabFtc()->sendParticipantModeRequest(req, this))
return Core::FunctionReplyObject(req.participantId(), tr_lts("dds", "Error passing the INIT request to the proxy"));
return Core::FunctionReplyObject(req.participantId, tr_lts("dds", "Error passing the INIT request to the proxy"));
const int requestId = req.requestId();
const int requestId = req.requestId;
auto cb = [this, requestId]()
{
INFO_LOG(m_logger) << "SendParticipantMode timeout for " << requestId;
onSendParticipantModeReply(Core::FunctionReplyObject(requestId, tr_lts("dds", "Timeout while waiting for the proxy")));
};
addToTrainingAreaRequests(cb, req.requestId(), cookie);
addToTrainingAreaRequests(cb, req.requestId, cookie);
return Core::FunctionReplyObject(req.participantId());
return Core::FunctionReplyObject(req.participantId);
}
void ProxyListener::onSendParticipantModeReply(const Core::FunctionReplyObject &replyObject)
@@ -481,15 +481,15 @@ void ProxyListener::onSendParticipantModeReply(const Core::FunctionReplyObject &
Core::FunctionReplyObject ProxyListener::sendSetSanitationRequest(const rti::core::SampleIdentity &cookie, const TrainingAreaBase::SendSetSanitationRequest &req)
{
if (!m_mainHandler->tabFtc()->sendSetSanitationRequest(req, this))
return Core::FunctionReplyObject(req.participantId(), tr_lts("dds", "Error passing the SetSanitation request to the proxy"));
const int requestId = req.requestId();
return Core::FunctionReplyObject(req.participantId, tr_lts("dds", "Error passing the SetSanitation request to the proxy"));
const int requestId = req.requestId;
auto cb = [this, requestId]()
{
INFO_LOG(m_logger) << "sendSetSanitationRequest timeout for " << requestId;
onSendSetSanitationReply(Core::FunctionReplyObject(requestId, tr_lts("dds", "Timeout while waiting for the proxy")));
};
addToTrainingAreaRequests(cb, req.requestId(), cookie);
return Core::FunctionReplyObject(req.participantId());
addToTrainingAreaRequests(cb, req.requestId, cookie);
return Core::FunctionReplyObject(req.participantId);
}
void ProxyListener::onSendSetSanitationReply(const Core::FunctionReplyObject &replyObject)
@@ -504,15 +504,15 @@ void ProxyListener::onSendSetSanitationReply(const Core::FunctionReplyObject &re
Core::FunctionReplyObject ProxyListener::selectiveReammunitionRequest(const rti::core::SampleIdentity &cookie, const TrainingAreaBase::SendSelectiveReammunitionRequest &req)
{
if (!m_mainHandler->tabFtc()->sendSelectiveReammunitionRequest(req, this))
return Core::FunctionReplyObject(req.participantId(), tr_lts("dds", "Error passing the SendSelectiveReammunition request to the proxy"));
const int requestId = req.requestId();
return Core::FunctionReplyObject(req.participantId, tr_lts("dds", "Error passing the SendSelectiveReammunition request to the proxy"));
const int requestId = req.requestId;
auto cb = [this, requestId]()
{
INFO_LOG(m_logger) << "selectiveReammunitionRequest timeout for " << requestId;
onSendSelectiveReammunitionReply(Core::FunctionReplyObject(requestId, tr_lts("dds", "Timeout while waiting for the proxy")));
};
addToTrainingAreaRequests(cb, req.requestId(), cookie);
return Core::FunctionReplyObject(req.participantId());
addToTrainingAreaRequests(cb, req.requestId, cookie);
return Core::FunctionReplyObject(req.participantId);
}
void ProxyListener::onSendSelectiveReammunitionReply(const Core::FunctionReplyObject &replyObject)
@@ -531,13 +531,13 @@ Core::FunctionReplyObject ProxyListener::sendOcCommandRequest(const rti::core::S
if (!m_mainHandler->tabFtc()->sendOcCommandRequest(req, this))
return Core::FunctionReplyObject(tr_lts("dds", "Error passing the OcCommand request to the proxy"));
const int requestId = req.requestId();
const int requestId = req.requestId;
auto cb = [this, requestId]()
{
INFO_LOG(m_logger) << "SendOcCommand timeout for " << requestId;
onSendOcCommandReply(Core::FunctionReplyObject(requestId, tr_lts("dds", "Timeout while waiting for the proxy")));
};
addToTrainingAreaRequests(cb, req.requestId(), cookie);
addToTrainingAreaRequests(cb, req.requestId, cookie);
return Core::FunctionReplyObject();
}
@@ -80,13 +80,13 @@ void UnitPositionCalculator::onPositionChanged(int participantId, int64_t positi
DEBUG_LOG(m_logger) << "Position for participant " << participantId << " changed to "
<< pos << " (" << positionTime / 1000 << "s)";
CalculatedUnitPosition &data = getParticipant(participantId);
if (data.sampleTimeLeader() >= positionTime)
if (data.sampleTimeLeader >= positionTime)
return;
data.sampleTimeCenter(positionTime);
data.sampleTimeLeader(positionTime);
data.positionCenter(pos);
data.positionLeader(pos);
data.sampleTimeCenter = positionTime;
data.sampleTimeLeader = positionTime;
data.positionCenter = pos;
data.positionLeader = pos;
m_bSomethingChangedSinceLastCalculation = true;
}
@@ -122,10 +122,10 @@ UnitPositionCalculator::CalculatedUnitPosition &UnitPositionCalculator::getParti
DEBUG_LOG(m_logger) << "No information for participant " << participantId << " - creating dummy data";
CalculatedUnitPosition data;
data.participantId(participantId);
data.participantId = participantId;
static const Core::GeoPosition s_invalidPos(std::nan(""), std::nan(""), std::nan(""));
data.positionCenter(s_invalidPos);
data.positionLeader(s_invalidPos);
data.positionCenter = s_invalidPos;
data.positionLeader = s_invalidPos;
it = m_participantData.insert({participantId, std::move(data)}).first;
}
return it->second;
@@ -174,12 +174,12 @@ UnitPositionCalculator::Result UnitPositionCalculator::doCalculation(std::unorde
for (const auto &data : participantData)
{
const int superiorId = data.second.superiorId;
const int participantId = data.second.participantId();
const int participantId = data.second.participantId;
DEBUG_LOG(logger) << "Participant " << participantId << " has superior " << superiorId;
if (superiorId == 0 || participantData.find(superiorId) == participantData.end())
{
DEBUG_LOG(logger) << "Participant " << participantId << " is a toplevel participant";
topLevelIds.push_back(data.second.participantId());
topLevelIds.push_back(data.second.participantId);
}
}
// TODO: check for correct (non-cyclic) hierarchy?
@@ -214,13 +214,13 @@ void UnitPositionCalculator::calculatePosition(int participantId,
if (data.inferiorIds.size() == 0)
{
DEBUG_LOG(logger) << dbgLvlSpaces << "Participant " << participantId
<< " is a leaf: " << data.positionCenter()
<< " (" << data.sampleTimeCenter() / 1000 << "s)";
<< " is a leaf: " << data.positionCenter
<< " (" << data.sampleTimeCenter / 1000 << "s)";
return;
}
data.positionCenter(s_invalidPos);
data.positionLeader(s_invalidPos);
data.positionCenter = s_invalidPos;
data.positionLeader = s_invalidPos;
// calculate position for inferiors
DEBUG_LOG(logger) << dbgLvlSpaces << "Participant " << participantId << ": Start calculating child positions";
@@ -249,15 +249,15 @@ void UnitPositionCalculator::calculatePosition(int participantId,
const CalculatedUnitPosition &child = itChild->second;
// older than 10 minutes -> ignore
if (LtsUtils::isPositionTimeOutdated(currentTime, child.sampleTimeCenter()))
if (LtsUtils::isPositionTimeOutdated(currentTime, child.sampleTimeCenter))
{
DEBUG_LOG(logger) << dbgLvlSpaces << "Child " << inferiorId << ": position out-of-date - ignoring";
continue;
}
// invalid position -> ignore
if (std::isnan(child.positionCenter().lon()) ||
std::isnan(child.positionCenter().lat()))
if (std::isnan(child.positionCenter.lon) ||
std::isnan(child.positionCenter.lat))
{
DEBUG_LOG(logger) << dbgLvlSpaces << "Child " << inferiorId << ": has invalid position - ignoring";
continue;
@@ -266,36 +266,36 @@ void UnitPositionCalculator::calculatePosition(int participantId,
if (bFirst)
{
bFirst = false;
data.positionLeader(child.positionLeader());
data.sampleTimeLeader(child.sampleTimeLeader());
data.positionLeader = child.positionLeader;
data.sampleTimeLeader = child.sampleTimeLeader;
}
const auto utm = LtsCoordTrans::UtmCoordinate::fromGeographic(child.positionCenter().lon(),
child.positionCenter().lat(),
const auto utm = LtsCoordTrans::UtmCoordinate::fromGeographic(child.positionCenter.lon,
child.positionCenter.lat,
utmZone);
if (utmZone == -1)
utmZone = utm.zone;
pos += LtsUtils::QPoint3D(utm.x, utm.y, child.positionCenter().z());
if (child.sampleTimeCenter() > childPositionTime)
childPositionTime = child.sampleTimeCenter();
pos += LtsUtils::QPoint3D(utm.x, utm.y, child.positionCenter.z);
if (child.sampleTimeCenter > childPositionTime)
childPositionTime = child.sampleTimeCenter;
++childCount;
}
data.sampleTimeCenter(childPositionTime);
data.sampleTimeCenter = childPositionTime;
if (childCount > 0)
{
pos /= childCount;
const LtsCoordTrans::UtmCoordinate utm(utmZone, pos.x(), pos.y(),true);
const QPointF lonLat = utm.geographic();
data.positionCenter(Core::GeoPosition(lonLat.x(), lonLat.y(), pos.z()));
data.positionCenter = Core::GeoPosition(lonLat.x(), lonLat.y(), pos.z());
}
DEBUG_LOG(logger) << dbgLvlSpaces
<< "Participant " << participantId
<< ": Mean position: " << data.positionCenter()
<< ": Mean position: " << data.positionCenter
<< " #relavant children: " << childCount
<< " (" << data.sampleTimeCenter() / 1000 << "s)";
<< " (" << data.sampleTimeCenter / 1000 << "s)";
result.push_back(std::move(data));
}
@@ -307,7 +307,7 @@ void UnitPositionCalculator::onCalculationDone()
auto dts = m_participantHandler->dts();
for (const auto &pos : calculatedPositions)
{
auto it = m_publishedPositionData.find(pos.participantId());
auto it = m_publishedPositionData.find(pos.participantId);
if (it != m_publishedPositionData.end())
{
ParticipantManagement::UnitPosition &up = it->second;
@@ -315,13 +315,13 @@ void UnitPositionCalculator::onCalculationDone()
if (up == pos)
continue;
// nan == nan is always false, have to check it on our own
if (std::isnan(up.positionCenter().lat()) && std::isnan(pos.positionCenter().lat()))
if (std::isnan(up.positionCenter.lat) && std::isnan(pos.positionCenter.lat))
continue;
up = pos;
}
else
{
m_publishedPositionData.insert(std::make_pair(pos.participantId(), pos));
m_publishedPositionData.insert(std::make_pair(pos.participantId, pos));
}
dts->publish(pos);
}