Migrates OcSituation and ServiceManagement to generated rtiddsgen API

Converts accessor calls to plain member access in osc, oss and obd services.
This commit is contained in:
berrux-dev committed 2026-09-21 02:46:47 +02:00
1 parent 95071993f5
commit 3ec4208139
30 files changed
+1000 -1007

No files matched your search

@@ -35,282 +35,282 @@ bool CentralAesByteReader::getRemoveMessage(size_t &pos, CentralAesByteReader::R
bool CentralAesByteReader::getNContamination(size_t &pos, AreaEffectSimulation::NContaminationModifyRequest &nContamination) const
{
bool result = getAesItemId(pos, nContamination.id());
result &= getName(pos, nContamination.name());
result &= getOptionalNumber(pos, nContamination.effectStart(), &CentralAesByteReader::getEffectStart);
result &= getEffectDuration(pos, nContamination.effectDuration());
result &= getChargeTypeId(pos, nContamination.chargeTypeId());
result &= getImpactPosition(pos, nContamination.impactPosition());
result &= getBorderLengthInner(pos, nContamination.borderLengthInner());
result &= getBorderLengthOuter(pos, nContamination.borderLengthOuter());
result &= getImpactRadius(pos, nContamination.impactRadius());
result &= getSpanAngle(pos, nContamination.spanAngle());
result &= getRotationAngle(pos, nContamination.rotationAngle());
result &= getDetonationValue(pos, nContamination.detonationValue());
result &= getOptionalNumber(pos, nContamination.partyId(), &CentralAesByteReader::getPartyId);
bool result = getAesItemId(pos, nContamination.id);
result &= getName(pos, nContamination.name);
result &= getOptionalNumber(pos, nContamination.effectStart, &CentralAesByteReader::getEffectStart);
result &= getEffectDuration(pos, nContamination.effectDuration);
result &= getChargeTypeId(pos, nContamination.chargeTypeId);
result &= getImpactPosition(pos, nContamination.impactPosition);
result &= getBorderLengthInner(pos, nContamination.borderLengthInner);
result &= getBorderLengthOuter(pos, nContamination.borderLengthOuter);
result &= getImpactRadius(pos, nContamination.impactRadius);
result &= getSpanAngle(pos, nContamination.spanAngle);
result &= getRotationAngle(pos, nContamination.rotationAngle);
result &= getDetonationValue(pos, nContamination.detonationValue);
result &= getOptionalNumber(pos, nContamination.partyId, &CentralAesByteReader::getPartyId);
nContamination.weatherSource(AreaEffectSimulation::AesWeatherSource::AwsNoUpdate);
nContamination.weatherSource = AreaEffectSimulation::AesWeatherSource::AwsNoUpdate;
DEBUG_LOG(m_logger) << "Got NContamination:"
<< "\nid = " << nContamination.id()
<< "\nname = " << nContamination.name()
<< "\neffectStart = " << nContamination.effectStart()
<< "\neffectDuration = " << nContamination.effectDuration()
<< "\nchargeTypeId = " << nContamination.chargeTypeId()
<< "\nimpactPosition = " << nContamination.impactPosition()
<< "\nborderLengthInner = " << nContamination.borderLengthInner()
<< "\nborderLengthOuter = " << nContamination.borderLengthOuter()
<< "\nimpactRadius = " << nContamination.impactRadius()
<< "\nspanAngle = " << nContamination.spanAngle()
<< "\nrotationAngle = " << nContamination.rotationAngle()
<< "\ndetonationValue = " << nContamination.detonationValue()
<< "\npartyId = " << nContamination.partyId();
<< "\nid = " << nContamination.id
<< "\nname = " << nContamination.name
<< "\neffectStart = " << nContamination.effectStart
<< "\neffectDuration = " << nContamination.effectDuration
<< "\nchargeTypeId = " << nContamination.chargeTypeId
<< "\nimpactPosition = " << nContamination.impactPosition
<< "\nborderLengthInner = " << nContamination.borderLengthInner
<< "\nborderLengthOuter = " << nContamination.borderLengthOuter
<< "\nimpactRadius = " << nContamination.impactRadius
<< "\nspanAngle = " << nContamination.spanAngle
<< "\nrotationAngle = " << nContamination.rotationAngle
<< "\ndetonationValue = " << nContamination.detonationValue
<< "\npartyId = " << nContamination.partyId;
return result;
}
bool CentralAesByteReader::getBCContamination(size_t &pos, AreaEffectSimulation::BCContaminationModifyRequest &bCContamination) const
{
bool result = getAesItemId(pos, bCContamination.id());
result &= getName(pos, bCContamination.name());
result &= getOptionalNumber(pos, bCContamination.effectStart(), &CentralAesByteReader::getEffectStart);
result &= getEffectDuration(pos, bCContamination.effectDuration());
result &= getChargeTypeId(pos, bCContamination.chargeTypeId());
result &= getImpactPosition(pos, bCContamination.impactPosition());
result &= getImpactRadius(pos, bCContamination.impactRadius());
result &= getOptionalNumber(pos, bCContamination.partyId(), &CentralAesByteReader::getPartyId);
result &= getOptionalNumber(pos, bCContamination.propagationDirection(), &CentralAesByteReader::getPropagationDirection);
result &= getOptionalNumber(pos, bCContamination.windSpeed(), &CentralAesByteReader::getWindSpeed);
bool result = getAesItemId(pos, bCContamination.id);
result &= getName(pos, bCContamination.name);
result &= getOptionalNumber(pos, bCContamination.effectStart, &CentralAesByteReader::getEffectStart);
result &= getEffectDuration(pos, bCContamination.effectDuration);
result &= getChargeTypeId(pos, bCContamination.chargeTypeId);
result &= getImpactPosition(pos, bCContamination.impactPosition);
result &= getImpactRadius(pos, bCContamination.impactRadius);
result &= getOptionalNumber(pos, bCContamination.partyId, &CentralAesByteReader::getPartyId);
result &= getOptionalNumber(pos, bCContamination.propagationDirection, &CentralAesByteReader::getPropagationDirection);
result &= getOptionalNumber(pos, bCContamination.windSpeed, &CentralAesByteReader::getWindSpeed);
bCContamination.weatherSource(AreaEffectSimulation::AesWeatherSource::AwsNoUpdate);
bCContamination.weatherSource = AreaEffectSimulation::AesWeatherSource::AwsNoUpdate;
DEBUG_LOG(m_logger) << "Got BCContamination:"
<< "\nid = " << bCContamination.id()
<< "\nname = " << bCContamination.name()
<< "\neffectStart = " << bCContamination.effectStart()
<< "\neffectDuration = " << bCContamination.effectDuration()
<< "\nchargeTypeId = " << bCContamination.chargeTypeId()
<< "\nimpactPosition = " << bCContamination.impactPosition()
<< "\nimpactRadius = " << bCContamination.impactRadius()
<< "\nweatherSource = " << bCContamination.weatherSource()
<< "\npartyId = " << bCContamination.partyId()
<< "\npropagationDirection = " << bCContamination.propagationDirection()
<< "\nwindSpeed = " << bCContamination.windSpeed()
<< "\nweatherPosition = " << bCContamination.weatherPosition()
<< "\nweatherTimestamp = " << bCContamination.weatherTimestamp();
<< "\nid = " << bCContamination.id
<< "\nname = " << bCContamination.name
<< "\neffectStart = " << bCContamination.effectStart
<< "\neffectDuration = " << bCContamination.effectDuration
<< "\nchargeTypeId = " << bCContamination.chargeTypeId
<< "\nimpactPosition = " << bCContamination.impactPosition
<< "\nimpactRadius = " << bCContamination.impactRadius
<< "\nweatherSource = " << bCContamination.weatherSource
<< "\npartyId = " << bCContamination.partyId
<< "\npropagationDirection = " << bCContamination.propagationDirection
<< "\nwindSpeed = " << bCContamination.windSpeed
<< "\nweatherPosition = " << bCContamination.weatherPosition
<< "\nweatherTimestamp = " << bCContamination.weatherTimestamp;
return result;
}
bool CentralAesByteReader::getExplosionArea(size_t &pos, AreaEffectSimulation::ExplosionAreaModifyRequest &explosionArea) const
{
bool result = getAesItemId(pos, explosionArea.id());
result &= getName(pos, explosionArea.name());
result &= getOptionalNumber(pos, explosionArea.effectStart(), &CentralAesByteReader::getEffectStart);
result &= getEffectDuration(pos, explosionArea.effectDuration());
result &= getChargeTypeId(pos, explosionArea.chargeTypeId());
result &= getArea(pos, explosionArea.area());
result &= getOptionalNumber(pos, explosionArea.partyId(), &CentralAesByteReader::getPartyId);
result &= getCannonCount(pos, explosionArea.cannonCount());
result &= getCannonRounds(pos, explosionArea.cannonRounds());
result &= getFireRequestTime(pos, explosionArea.fireRequestTime());
result &= getAltitude(pos, explosionArea.altitude());
result &= getPurpose(pos, explosionArea.purpose());
bool result = getAesItemId(pos, explosionArea.id);
result &= getName(pos, explosionArea.name);
result &= getOptionalNumber(pos, explosionArea.effectStart, &CentralAesByteReader::getEffectStart);
result &= getEffectDuration(pos, explosionArea.effectDuration);
result &= getChargeTypeId(pos, explosionArea.chargeTypeId);
result &= getArea(pos, explosionArea.area);
result &= getOptionalNumber(pos, explosionArea.partyId, &CentralAesByteReader::getPartyId);
result &= getCannonCount(pos, explosionArea.cannonCount);
result &= getCannonRounds(pos, explosionArea.cannonRounds);
result &= getFireRequestTime(pos, explosionArea.fireRequestTime);
result &= getAltitude(pos, explosionArea.altitude);
result &= getPurpose(pos, explosionArea.purpose);
DEBUG_LOG(m_logger) << "Got ExplosionArea:"
<< "\nid = " << explosionArea.id()
<< "\nname = " << explosionArea.name()
<< "\neffectStart = " << explosionArea.effectStart()
<< "\neffectDuration = " << explosionArea.effectDuration()
<< "\nchargeTypeId = " << explosionArea.chargeTypeId()
<< "\narea = " << explosionArea.area()
<< "\npartyId = " << explosionArea.partyId()
<< "\ncannonCount = " << explosionArea.cannonCount()
<< "\ncannonRounds = " << explosionArea.cannonRounds()
<< "\nfireRequestTime = " << explosionArea.fireRequestTime()
<< "\naltitude = " << explosionArea.altitude()
<< "\npurpose = " << explosionArea.purpose();
<< "\nid = " << explosionArea.id
<< "\nname = " << explosionArea.name
<< "\neffectStart = " << explosionArea.effectStart
<< "\neffectDuration = " << explosionArea.effectDuration
<< "\nchargeTypeId = " << explosionArea.chargeTypeId
<< "\narea = " << explosionArea.area
<< "\npartyId = " << explosionArea.partyId
<< "\ncannonCount = " << explosionArea.cannonCount
<< "\ncannonRounds = " << explosionArea.cannonRounds
<< "\nfireRequestTime = " << explosionArea.fireRequestTime
<< "\naltitude = " << explosionArea.altitude
<< "\npurpose = " << explosionArea.purpose;
return result;
}
bool CentralAesByteReader::getExplosionSingle(size_t &pos, AreaEffectSimulation::ExplosionSingleModifyRequest &explosionSingle) const
{
bool result = getAesItemId(pos, explosionSingle.id());
result &= getName(pos, explosionSingle.name());
result &= getOptionalNumber(pos, explosionSingle.effectStart(), &CentralAesByteReader::getEffectStart);
result &= getChargeTypeId(pos, explosionSingle.chargeTypeId());
result &= getImpactPosition(pos, explosionSingle.impactPosition());
result &= getOptionalNumber(pos, explosionSingle.partyId(), &CentralAesByteReader::getPartyId);
result &= getFireRequestTime(pos, explosionSingle.fireRequestTime());
result &= getAltitude(pos, explosionSingle.altitude());
result &= getPurpose(pos, explosionSingle.purpose());
bool result = getAesItemId(pos, explosionSingle.id);
result &= getName(pos, explosionSingle.name);
result &= getOptionalNumber(pos, explosionSingle.effectStart, &CentralAesByteReader::getEffectStart);
result &= getChargeTypeId(pos, explosionSingle.chargeTypeId);
result &= getImpactPosition(pos, explosionSingle.impactPosition);
result &= getOptionalNumber(pos, explosionSingle.partyId, &CentralAesByteReader::getPartyId);
result &= getFireRequestTime(pos, explosionSingle.fireRequestTime);
result &= getAltitude(pos, explosionSingle.altitude);
result &= getPurpose(pos, explosionSingle.purpose);
DEBUG_LOG(m_logger) << "Got ExplosionSingle:"
<< "\nid = " << explosionSingle.id()
<< "\nname = " << explosionSingle.name()
<< "\neffectStart = " << explosionSingle.effectStart()
<< "\nchargeTypeId = " << explosionSingle.chargeTypeId()
<< "\nimpactPosition = " << explosionSingle.impactPosition()
<< "\npartyId = " << explosionSingle.partyId()
<< "\nfireRequestTime = " << explosionSingle.fireRequestTime()
<< "\naltitude = " << explosionSingle.altitude()
<< "\npurpose = " << explosionSingle.purpose();
<< "\nid = " << explosionSingle.id
<< "\nname = " << explosionSingle.name
<< "\neffectStart = " << explosionSingle.effectStart
<< "\nchargeTypeId = " << explosionSingle.chargeTypeId
<< "\nimpactPosition = " << explosionSingle.impactPosition
<< "\npartyId = " << explosionSingle.partyId
<< "\nfireRequestTime = " << explosionSingle.fireRequestTime
<< "\naltitude = " << explosionSingle.altitude
<< "\npurpose = " << explosionSingle.purpose;
return result;
}
bool CentralAesByteReader::getMineArea(size_t &pos, AreaEffectSimulation::MineAreaModifyRequest &mineArea) const
{
bool result = getAesItemId(pos, mineArea.id());
result &= getName(pos, mineArea.name());
result &= getOptionalNumber(pos, mineArea.effectStart(), &CentralAesByteReader::getEffectStart);
result &= getEffectDuration(pos, mineArea.effectDuration());
result &= getDensity(pos, mineArea.density());
result &= getWidth(pos, mineArea.width());
result &= getChargeTypeId(pos, mineArea.chargeStruct().chargeTypeId());
result &= getOptionalNumber(pos, mineArea.partyId(), &CentralAesByteReader::getPartyId);
result &= getAesMaLayingProcedureType(pos, mineArea.layingProcedureType());
result &= getIsLayedHidden(pos, mineArea.isLaidHidden());
result &= getIsCenterLine(pos, mineArea.isCenterLine());
result &= getSegments(pos, mineArea.segments());
bool result = getAesItemId(pos, mineArea.id);
result &= getName(pos, mineArea.name);
result &= getOptionalNumber(pos, mineArea.effectStart, &CentralAesByteReader::getEffectStart);
result &= getEffectDuration(pos, mineArea.effectDuration);
result &= getDensity(pos, mineArea.density);
result &= getWidth(pos, mineArea.width);
result &= getChargeTypeId(pos, mineArea.chargeStruct.chargeTypeId);
result &= getOptionalNumber(pos, mineArea.partyId, &CentralAesByteReader::getPartyId);
result &= getAesMaLayingProcedureType(pos, mineArea.layingProcedureType);
result &= getIsLayedHidden(pos, mineArea.isLaidHidden);
result &= getIsCenterLine(pos, mineArea.isCenterLine);
result &= getSegments(pos, mineArea.segments);
DEBUG_LOG(m_logger) << "Got MineArea:"
<< "\nid = " << mineArea.id()
<< "\nname = " << mineArea.name()
<< "\neffectStart = " << mineArea.effectStart()
<< "\neffectDuration = " << mineArea.effectDuration()
<< "\ndensity = " << mineArea.density()
<< "\nwidth = " << mineArea.width()
<< "\nchargeTypeId = " << mineArea.chargeStruct().chargeTypeId()
<< "\npartyId = " << mineArea.partyId()
<< "\nlayingProcedureType = " << mineArea.layingProcedureType()
<< "\nisLaidHidden = " << mineArea.isLaidHidden()
<< "\nisCenterLine = " << mineArea.isCenterLine()
<< "\nsegments.size = " << mineArea.segments().size();
<< "\nid = " << mineArea.id
<< "\nname = " << mineArea.name
<< "\neffectStart = " << mineArea.effectStart
<< "\neffectDuration = " << mineArea.effectDuration
<< "\ndensity = " << mineArea.density
<< "\nwidth = " << mineArea.width
<< "\nchargeTypeId = " << mineArea.chargeStruct.chargeTypeId
<< "\npartyId = " << mineArea.partyId
<< "\nlayingProcedureType = " << mineArea.layingProcedureType
<< "\nisLaidHidden = " << mineArea.isLaidHidden
<< "\nisCenterLine = " << mineArea.isCenterLine
<< "\nsegments.size = " << mineArea.segments.size();
return result;
}
bool CentralAesByteReader::getFunctionalArea(size_t &pos, AreaEffectSimulation::FunctionalAreaModifyRequest &functionalArea) const
{
bool result = getAesItemId(pos, functionalArea.id());
result &= getName(pos, functionalArea.name());
result &= getOptionalNumber(pos, functionalArea.effectStart(), &CentralAesByteReader::getEffectStart);
result &= getEffectDuration(pos, functionalArea.effectDuration());
result &= getChargeTypeId(pos, functionalArea.chargeTypeId());
result &= getArea(pos, functionalArea.area());
result &= getOptionalNumber(pos, functionalArea.partyId(), &CentralAesByteReader::getPartyId);
bool result = getAesItemId(pos, functionalArea.id);
result &= getName(pos, functionalArea.name);
result &= getOptionalNumber(pos, functionalArea.effectStart, &CentralAesByteReader::getEffectStart);
result &= getEffectDuration(pos, functionalArea.effectDuration);
result &= getChargeTypeId(pos, functionalArea.chargeTypeId);
result &= getArea(pos, functionalArea.area);
result &= getOptionalNumber(pos, functionalArea.partyId, &CentralAesByteReader::getPartyId);
std::string pointSymbol;
result &= getPointSymbol(pos, pointSymbol);
if (pointSymbol != std::string())
functionalArea.pointSymbol().set(pointSymbol);
result &= getFunctionalAreaTypeId(pos, functionalArea.functionalAreaTypeId());
result &= getDeconMode(pos, functionalArea.deconMode());
result &= getDeconTime(pos, functionalArea.deconTime());
result &= getMaintMode(pos, functionalArea.maintMode());
result &= getMaintTime(pos, functionalArea.maintTime());
result &= getMedicMode(pos, functionalArea.medicMode());
result &= getMedicTime(pos, functionalArea.medicTime());
functionalArea.pointSymbol.set(pointSymbol);
result &= getFunctionalAreaTypeId(pos, functionalArea.functionalAreaTypeId);
result &= getDeconMode(pos, functionalArea.deconMode);
result &= getDeconTime(pos, functionalArea.deconTime);
result &= getMaintMode(pos, functionalArea.maintMode);
result &= getMaintTime(pos, functionalArea.maintTime);
result &= getMedicMode(pos, functionalArea.medicMode);
result &= getMedicTime(pos, functionalArea.medicTime);
DEBUG_LOG(m_logger) << "Got MineArea:"
<< "\nid = " << functionalArea.id()
<< "\nname = " << functionalArea.name()
<< "\neffectStart = " << functionalArea.effectStart()
<< "\neffectDuration = " << functionalArea.effectDuration()
<< "\nchargeTypeId = " << functionalArea.chargeTypeId()
<< "\narea = " << functionalArea.area()
<< "\npartyId = " << functionalArea.partyId()
<< "\npointSymbol = " << functionalArea.pointSymbol()
<< "\nfunctionalAreaTypeId = " << functionalArea.functionalAreaTypeId()
<< "\ndeconMode = " << functionalArea.deconMode()
<< "\ndeconTime = " << functionalArea.deconTime()
<< "\nmaintMode = " << functionalArea.maintMode()
<< "\nmaintTime = " << functionalArea.maintTime()
<< "\nmedicMode = " << functionalArea.medicMode()
<< "\n medicTime= " << functionalArea.medicTime();
<< "\nid = " << functionalArea.id
<< "\nname = " << functionalArea.name
<< "\neffectStart = " << functionalArea.effectStart
<< "\neffectDuration = " << functionalArea.effectDuration
<< "\nchargeTypeId = " << functionalArea.chargeTypeId
<< "\narea = " << functionalArea.area
<< "\npartyId = " << functionalArea.partyId
<< "\npointSymbol = " << functionalArea.pointSymbol
<< "\nfunctionalAreaTypeId = " << functionalArea.functionalAreaTypeId
<< "\ndeconMode = " << functionalArea.deconMode
<< "\ndeconTime = " << functionalArea.deconTime
<< "\nmaintMode = " << functionalArea.maintMode
<< "\nmaintTime = " << functionalArea.maintTime
<< "\nmedicMode = " << functionalArea.medicMode
<< "\n medicTime= " << functionalArea.medicTime;
return result;
}
bool CentralAesByteReader::getBoobyTrap(size_t &pos, AreaEffectSimulation::BoobyTrapModifyRequest &boobyTrap) const
{
bool result = getAesItemId(pos, boobyTrap.id());
result &= getName(pos, boobyTrap.name());
result &= getEffectDuration(pos, boobyTrap.effectDuration());
result &= getChargeTypeId(pos, boobyTrap.chargeTypeId());
result &= getImpactPosition(pos, boobyTrap.impactPosition());
result &= getImpactRadius(pos, boobyTrap.impactRadius());
result &= getTriggerRadius(pos, boobyTrap.triggerRadius());
result &= getOptionalNumber(pos, boobyTrap.rotationAngle(), &CentralAesByteReader::getRotationAngle);
result &= getOptionalNumber(pos, boobyTrap.centralAngle(), &CentralAesByteReader::getCentralAngle);
result &= getOptionalNumber(pos, boobyTrap.effectStart(), &CentralAesByteReader::getEffectStart);
result &= getOptionalNumber(pos, boobyTrap.partyId(), &CentralAesByteReader::getPartyId);
bool result = getAesItemId(pos, boobyTrap.id);
result &= getName(pos, boobyTrap.name);
result &= getEffectDuration(pos, boobyTrap.effectDuration);
result &= getChargeTypeId(pos, boobyTrap.chargeTypeId);
result &= getImpactPosition(pos, boobyTrap.impactPosition);
result &= getImpactRadius(pos, boobyTrap.impactRadius);
result &= getTriggerRadius(pos, boobyTrap.triggerRadius);
result &= getOptionalNumber(pos, boobyTrap.rotationAngle, &CentralAesByteReader::getRotationAngle);
result &= getOptionalNumber(pos, boobyTrap.centralAngle, &CentralAesByteReader::getCentralAngle);
result &= getOptionalNumber(pos, boobyTrap.effectStart, &CentralAesByteReader::getEffectStart);
result &= getOptionalNumber(pos, boobyTrap.partyId, &CentralAesByteReader::getPartyId);
DEBUG_LOG(m_logger) << "Got BoobyTrap:"
<< "\nid = " << boobyTrap.id()
<< "\nname = " << boobyTrap.name()
<< "\neffectDuration = " << boobyTrap.effectDuration()
<< "\nchargeTypeId = " << boobyTrap.chargeTypeId()
<< "\nimpactPosition = " << boobyTrap.impactPosition()
<< "\nimpactRadius = " << boobyTrap.impactRadius()
<< "\ntriggerRadius = " << boobyTrap.triggerRadius()
<< "\nrotationAngle = " << boobyTrap.rotationAngle()
<< "\ncentralAngle = " << boobyTrap.centralAngle()
<< "\neffectStart = " << boobyTrap.effectStart()
<< "\npartyId = " << boobyTrap.partyId();
<< "\nid = " << boobyTrap.id
<< "\nname = " << boobyTrap.name
<< "\neffectDuration = " << boobyTrap.effectDuration
<< "\nchargeTypeId = " << boobyTrap.chargeTypeId
<< "\nimpactPosition = " << boobyTrap.impactPosition
<< "\nimpactRadius = " << boobyTrap.impactRadius
<< "\ntriggerRadius = " << boobyTrap.triggerRadius
<< "\nrotationAngle = " << boobyTrap.rotationAngle
<< "\ncentralAngle = " << boobyTrap.centralAngle
<< "\neffectStart = " << boobyTrap.effectStart
<< "\npartyId = " << boobyTrap.partyId;
return result;
}
bool CentralAesByteReader::getOffRouteMine(size_t &pos, AreaEffectSimulation::OffRouteMineModifyRequest &offRouteMine) const
{
bool result = getAesItemId(pos, offRouteMine.id());
result &= getName(pos, offRouteMine.name());
result &= getEffectDuration(pos, offRouteMine.effectDuration());
result &= getChargeTypeId(pos, offRouteMine.chargeTypeId());
result &= getArea(pos, offRouteMine.area());
result &= getOptionalNumber(pos, offRouteMine.impactRadius(), &CentralAesByteReader::getImpactRadius);
result &= getOptionalNumber(pos, offRouteMine.effectStart(), &CentralAesByteReader::getEffectStart);
result &= getOptionalNumber(pos, offRouteMine.partyId(), &CentralAesByteReader::getPartyId);
bool result = getAesItemId(pos, offRouteMine.id);
result &= getName(pos, offRouteMine.name);
result &= getEffectDuration(pos, offRouteMine.effectDuration);
result &= getChargeTypeId(pos, offRouteMine.chargeTypeId);
result &= getArea(pos, offRouteMine.area);
result &= getOptionalNumber(pos, offRouteMine.impactRadius, &CentralAesByteReader::getImpactRadius);
result &= getOptionalNumber(pos, offRouteMine.effectStart, &CentralAesByteReader::getEffectStart);
result &= getOptionalNumber(pos, offRouteMine.partyId, &CentralAesByteReader::getPartyId);
DEBUG_LOG(m_logger) << "Got OffRouteMine: "
<< "\nid: " << offRouteMine.id()
<< "\nname = " << offRouteMine.name()
<< "\neffectDuration = " << offRouteMine.effectDuration()
<< "\nchargeTypeId = " << offRouteMine.chargeTypeId()
<< "\narea = " << offRouteMine.area()
<< "\nimpactRadius = " << offRouteMine.impactRadius()
<< "\neffectStart = " << offRouteMine.effectStart()
<< "\npartyId = " << offRouteMine.partyId();
<< "\nid: " << offRouteMine.id
<< "\nname = " << offRouteMine.name
<< "\neffectDuration = " << offRouteMine.effectDuration
<< "\nchargeTypeId = " << offRouteMine.chargeTypeId
<< "\narea = " << offRouteMine.area
<< "\nimpactRadius = " << offRouteMine.impactRadius
<< "\neffectStart = " << offRouteMine.effectStart
<< "\npartyId = " << offRouteMine.partyId;
return result;
}
bool CentralAesByteReader::getExplosionCluster(size_t &pos, AreaEffectSimulation::ExplosionClusterOcModifyRequest &explosionCluster) const
{
bool result = getAesItemId(pos, explosionCluster.id());
result &= getName(pos, explosionCluster.name());
result &= getEffectStart(pos, explosionCluster.effectStart());
result &= getEffectDuration(pos, explosionCluster.effectDuration());
result &= getArea(pos, explosionCluster.area());
result &= getMhpCount(pos, explosionCluster.mhpCount());
result &= getMhpRotation(pos, explosionCluster.mhpRotation());
result &= getImpactCount(pos, explosionCluster.impactCount());
result &= getChargeTypeId(pos, explosionCluster.chargeStruct().chargeTypeId());
result &= getPartyId(pos, explosionCluster.partyId());
bool result = getAesItemId(pos, explosionCluster.id);
result &= getName(pos, explosionCluster.name);
result &= getEffectStart(pos, explosionCluster.effectStart);
result &= getEffectDuration(pos, explosionCluster.effectDuration);
result &= getArea(pos, explosionCluster.area);
result &= getMhpCount(pos, explosionCluster.mhpCount);
result &= getMhpRotation(pos, explosionCluster.mhpRotation);
result &= getImpactCount(pos, explosionCluster.impactCount);
result &= getChargeTypeId(pos, explosionCluster.chargeStruct.chargeTypeId);
result &= getPartyId(pos, explosionCluster.partyId);
DEBUG_LOG(m_logger) << "Got ExplosionCluster:"
<< "\nid: " << explosionCluster.id()
<< "\nname: " << explosionCluster.name()
<< "\neffectStart: " << explosionCluster.effectStart()
<< "\neffectDuration: " << explosionCluster.effectDuration()
<< "\narea: " << explosionCluster.area()
<< "\nmhpCount: " << explosionCluster.mhpCount()
<< "\nmhpRotation: " << explosionCluster.mhpRotation()
<< "\nimpactCount: " << explosionCluster.impactCount()
<< "\nchargeTypeId: " << explosionCluster.chargeStruct().chargeTypeId()
<< "\npartyId: " << explosionCluster.partyId();
<< "\nid: " << explosionCluster.id
<< "\nname: " << explosionCluster.name
<< "\neffectStart: " << explosionCluster.effectStart
<< "\neffectDuration: " << explosionCluster.effectDuration
<< "\narea: " << explosionCluster.area
<< "\nmhpCount: " << explosionCluster.mhpCount
<< "\nmhpRotation: " << explosionCluster.mhpRotation
<< "\nimpactCount: " << explosionCluster.impactCount
<< "\nchargeTypeId: " << explosionCluster.chargeStruct.chargeTypeId
<< "\npartyId: " << explosionCluster.partyId;
return result;
}
@@ -337,10 +337,10 @@ bool CentralAesByteReader::getAltitude(size_t &pos, int32_t &altitude) const
bool CentralAesByteReader::getArea(size_t &pos, AreaEffectSimulation::Area &area) const
{
bool result = getPosition2D(pos, area.cornerBottomLeft());
result &= LtsUtils::get8Byte(m_data, pos, area.width());
result &= LtsUtils::get8Byte(m_data, pos, area.height());
result &= LtsUtils::get8Byte(m_data, pos, area.rotation());
bool result = getPosition2D(pos, area.cornerBottomLeft);
result &= LtsUtils::get8Byte(m_data, pos, area.width);
result &= LtsUtils::get8Byte(m_data, pos, area.height);
result &= LtsUtils::get8Byte(m_data, pos, area.rotation);
return result;
}
@@ -526,8 +526,8 @@ bool CentralAesByteReader::getPointSymbol(size_t &pos, std::string &pointSymbol)
bool CentralAesByteReader::getPosition2D(size_t &pos, Core::GeoPosition2D &position) const
{
bool result = LtsUtils::get8Byte(m_data, pos, position.lon());
result &= LtsUtils::get8Byte(m_data, pos, position.lat());
bool result = LtsUtils::get8Byte(m_data, pos, position.lon);
result &= LtsUtils::get8Byte(m_data, pos, position.lat);
return result;
}
@@ -29,7 +29,7 @@ public:
{}
RemoveMessage()
: RemoveMessage(-1, AreaEffectSimulation::AesType::inner_enum::AtUnknown)
: RemoveMessage(-1, AreaEffectSimulation::AesType::AtUnknown)
{}
};
@@ -48,7 +48,7 @@ bool DdsHandler::init(const QStringList &qosFileList)
qint64 DdsHandler::currentPartitionTime() const
{
return m_dtcCore->partitionTime().timeStamp();
return m_dtcCore->partitionTime().timeStamp;
}
} // namespace OcSituationClient
@@ -144,19 +144,19 @@ void HandlerOcAesData::handleDangerAreas(const QByteArray &data, size_t pos)
uint64_t tmp;
int x = 0, y = 0;
req.chargeTypeId(311); // danger area
req.chargeTypeId = 311; // danger area
for (int i = 0; i < cnt; ++i)
{
LtsUtils::get2Byte(data, pos, tmp);
req.id(tmp);
req.name(data.mid(pos, 8).toStdString());
req.id = tmp;
req.name = data.mid(pos, 8).toStdString();
pos += 8;
LtsUtils::get4Byte(data, pos, tmp);
if (tmp > 0)
req.effectStart(dds::core::optional<rti::core::int64>(tmp * 1000));
req.effectStart = dds::core::optional<rti::core::int64>(tmp * 1000);
else
req.effectStart(dds::core::optional<rti::core::int64>());
req.effectStart = dds::core::optional<rti::core::int64>();
size_t segmentCnt = 0;
LtsUtils::get1Byte(data, pos, segmentCnt);
@@ -168,20 +168,20 @@ void HandlerOcAesData::handleDangerAreas(const QByteArray &data, size_t pos)
LtsUtils::get3Byte(data, pos, x);
segments.emplace_back(relativeFromGeoPosition(x, y));
}
req.segments(segments);
req.segments = segments;
DEBUG_LOG(m_logger) << (aesToBeDeleted.contains(req.id()) ? "Modifying " : "Creating ") << "danger area: " << req;
DEBUG_LOG(m_logger) << (aesToBeDeleted.contains(req.id) ? "Modifying " : "Creating ") << "danger area: " << req;
aesToBeDeleted.removeAll(req.id()); // item was created/modified -> does not need to be deleted
req.id(req.id() * -1); // inverted id to mark as for oc
aesToBeDeleted.removeAll(req.id); // item was created/modified -> does not need to be deleted
req.id = req.id * -1; // inverted id to mark as for oc
m_aesFtc->dangerAreaModifyRequest(req, this);
}
for (int id : qAsConst(aesToBeDeleted))
{
if (m_aesDtc->dangerArea(id).isCentral())
if (m_aesDtc->dangerArea(id).isCentral)
continue;
if (m_aesDtc->dangerArea(id).effectStateId().underlying() > AreaEffectSimulation::AesEffectState::EsRemoved)
if (m_aesDtc->dangerArea(id).effectStateId > AreaEffectSimulation::AesEffectState::EsRemoved)
{
DEBUG_LOG(m_logger) << "Removing danger area id: " << id;
m_aesFtc->dangerAreaRemoveRequest(Core::RemoveElementRequest(id), this);
@@ -201,28 +201,28 @@ void HandlerOcAesData::handleIeds(const QByteArray &data, size_t pos)
unsigned long tmp;
int x = 0, y = 0;
def.pairingState(1); // not paired in OC application
def.pairingState = 1; // not paired in OC application
for (int i = 0; i < cnt; ++i)
{
LtsUtils::get2Byte(data, pos, tmp);
def.iedId(tmp);
def.iedId = tmp;
LtsUtils::get1Byte(data, pos, tmp);
def.type(tmp);
def.type = tmp;
LtsUtils::get1Byte(data, pos, tmp);
def.tautWireTrigger((tmp >> 3) & 0x01);
def.lightBarrierTrigger((tmp >> 2) & 0x01);
def.switchTrigger((tmp >> 1) & 0x01);
def.remoteTrigger((tmp >> 0) & 0x01);
def.tautWireTrigger = (tmp >> 3) & 0x01;
def.lightBarrierTrigger = (tmp >> 2) & 0x01;
def.switchTrigger = (tmp >> 1) & 0x01;
def.remoteTrigger = (tmp >> 0) & 0x01;
LtsUtils::get1Byte(data, pos, tmp);
def.explosiveForce(tmp);
def.explosiveForce = tmp;
LtsUtils::get1Byte(data, pos, tmp);
def.partyId(tmp);
def.partyId = tmp;
LtsUtils::get1Byte(data, pos, tmp);
def.tacticalState(tmp);
def.tacticalState = tmp;
LtsUtils::get3Byte(data, pos, x);
LtsUtils::get3Byte(data, pos, y);
def.position(relativeFromGeoPosition(x, y));
def.position = relativeFromGeoPosition(x, y);
DEBUG_LOG(m_logger) << "Publishing definition ied: " << def;
@@ -242,7 +242,7 @@ void HandlerOcAesData::handleIedPositions(const QByteArray &data, size_t pos)
QMap<int, int> IedEqNumberToDdsId; // iedEqNumber, ddsId
for (const auto &ied : ieds)
IedEqNumberToDdsId.insert(ied.equipmentNumber(), ied.id());
IedEqNumberToDdsId.insert(ied.equipmentNumber, ied.id);
TrainingAreaBase::DefinitionIed def;
unsigned long eqNumber;
@@ -252,18 +252,18 @@ void HandlerOcAesData::handleIedPositions(const QByteArray &data, size_t pos)
{
LtsUtils::get2Byte(data, pos, eqNumber);
const GuezIedManagement::Ied &ied = ieds.value(IedEqNumberToDdsId.value(eqNumber));
def.iedId(eqNumber);
def.type(ied.type().underlying());
def.tautWireTrigger(ied.tautWireTrigger());
def.lightBarrierTrigger(ied.lightBarrierTrigger());
def.switchTrigger(ied.switchTrigger());
def.remoteTrigger(ied.remoteTrigger());
def.explosiveForce(ied.explosiveForce());
def.partyId(ied.partyId());
def.tacticalState(ied.tacticalState().underlying());
def.iedId = eqNumber;
def.type = ied.type;
def.tautWireTrigger = ied.tautWireTrigger;
def.lightBarrierTrigger = ied.lightBarrierTrigger;
def.switchTrigger = ied.switchTrigger;
def.remoteTrigger = ied.remoteTrigger;
def.explosiveForce = ied.explosiveForce;
def.partyId = ied.partyId;
def.tacticalState = ied.tacticalState;
LtsUtils::get3Byte(data, pos, x);
LtsUtils::get3Byte(data, pos, y);
def.position(relativeFromGeoPosition(x, y));
def.position = relativeFromGeoPosition(x, y);
m_tabDts->publish(def);
}
@@ -278,11 +278,11 @@ Core::GeoPosition2D HandlerOcAesData::relativeFromGeoPosition(int x, int y)
void HandlerOcAesData::onSpecificsExerciseChanged(const TrainingAreaBaseOC::SpecificsExercise &data, DataModification mod)
{
if (mod == DataModification::eAdded || mod == DataModification::eModified)
m_utmCoord = LtsCoordTrans::UtmCoordinate::fromMgrs(QString::number(data.zone()) +
QLatin1Char(data.band()) +
QString::fromStdString(data.square()) +
QString::number(data.northing()).rightJustified(7, QLatin1Char('0')) +
QString::number(data.easting()).rightJustified(7, QLatin1Char('0')));
m_utmCoord = LtsCoordTrans::UtmCoordinate::fromMgrs(QString::number(data.zone) +
QLatin1Char(data.band) +
QString::fromStdString(data.square) +
QString::number(data.northing).rightJustified(7, QLatin1Char('0')) +
QString::number(data.easting).rightJustified(7, QLatin1Char('0')));
}
} // namespace OcSituationClient
@@ -64,82 +64,82 @@ bool HandlerOcCentralAesData::init()
m_aesDtc->nContaminations(
[this](const AreaEffectSimulation::NContamination &data)
{
if (!data.isCentral())
if (!data.isCentral)
return;
m_allCentralAesItems.insert(data.id(), AreaEffectSimulation::AesType::AtNContamination);
m_allCentralAesItems.insert(data.id, AreaEffectSimulation::AesType::AtNContamination);
});
m_aesDtc->bCContaminations(
[this](const AreaEffectSimulation::BCContamination &data)
{
if (!data.isCentral())
if (!data.isCentral)
return;
m_allCentralAesItems.insert(data.id(), AreaEffectSimulation::AesType::AtBCContamination);
m_allCentralAesItems.insert(data.id, AreaEffectSimulation::AesType::AtBCContamination);
});
m_aesDtc->explosionAreas(
[this](const AreaEffectSimulation::ExplosionArea &data)
{
if (!data.isCentral())
if (!data.isCentral)
return;
m_allCentralAesItems.insert(data.id(), AreaEffectSimulation::AesType::AtExplosionArea);
m_allCentralAesItems.insert(data.id, AreaEffectSimulation::AesType::AtExplosionArea);
});
m_aesDtc->explosionSingles(
[this](const AreaEffectSimulation::ExplosionSingle &data)
{
if (!data.isCentral())
if (!data.isCentral)
return;
m_allCentralAesItems.insert(data.id(), AreaEffectSimulation::AesType::AtExplosionSingle);
m_allCentralAesItems.insert(data.id, AreaEffectSimulation::AesType::AtExplosionSingle);
});
m_aesDtc->mineAreas(
[this](const AreaEffectSimulation::MineArea &data)
{
if (!data.isCentral())
if (!data.isCentral)
return;
m_allCentralAesItems.insert(data.id(), AreaEffectSimulation::AesType::AtMineArea);
m_allCentralAesItems.insert(data.id, AreaEffectSimulation::AesType::AtMineArea);
});
m_aesDtc->functionalAreas(
[this](const AreaEffectSimulation::FunctionalArea &data)
{
if (!data.isCentral())
if (!data.isCentral)
return;
m_allCentralAesItems.insert(data.id(), AreaEffectSimulation::AesType::AtFunctionalArea);
m_allCentralAesItems.insert(data.id, AreaEffectSimulation::AesType::AtFunctionalArea);
});
m_aesDtc->boobyTraps(
[this](const AreaEffectSimulation::BoobyTrap &data)
{
if (!data.isCentral())
if (!data.isCentral)
return;
m_allCentralAesItems.insert(data.id(), AreaEffectSimulation::AesType::AtBoobyTrap);
m_allCentralAesItems.insert(data.id, AreaEffectSimulation::AesType::AtBoobyTrap);
});
m_aesDtc->offRouteMines(
[this](const AreaEffectSimulation::OffRouteMine &data)
{
if (!data.isCentral())
if (!data.isCentral)
return;
m_allCentralAesItems.insert(data.id(), AreaEffectSimulation::AesType::AtOffRouteMine);
m_allCentralAesItems.insert(data.id, AreaEffectSimulation::AesType::AtOffRouteMine);
});
m_aesDtc->explosionClusters(
[this](const AreaEffectSimulation::ExplosionCluster &data)
{
if (!data.isCentral())
if (!data.isCentral)
return;
m_allCentralAesItems.insert(data.id(), AreaEffectSimulation::AesType::AtExplosionCluster);
m_allCentralAesItems.insert(data.id, AreaEffectSimulation::AesType::AtExplosionCluster);
});
connect(m_aesDtc.get(), &AreaEffectSimulation::Interface::Dtc::nContaminationChanged, this, &HandlerOcCentralAesData::onNContaminationChanged);
@@ -185,8 +185,8 @@ void HandlerOcCentralAesData::process(const QByteArray &data, bool bIsInitial)
LtsUtils::get1Byte(data, centralAesItemsOverloaded);
TrainingAreaBaseOC::CentralAesOverload centralAesOverload;
centralAesOverload.id(1);
centralAesOverload.hasOverload(centralAesItemsOverloaded);
centralAesOverload.id = 1;
centralAesOverload.hasOverload = centralAesItemsOverloaded;
m_tabocDts->publish(centralAesOverload);
DEBUG_LOG(m_logger) << "Central AesItems overloaded: " << centralAesItemsOverloaded;
@@ -232,7 +232,7 @@ void HandlerOcCentralAesData::process(const QByteArray &data, bool bIsInitial)
DEBUG_LOG(m_logger) << "Got AesType " << aesType;
switch (aesType.underlying())
switch (aesType)
{
case AreaEffectSimulation::AesType::AtUnknown:
case AreaEffectSimulation::AesType::AtDangerArea:
@@ -249,7 +249,7 @@ void HandlerOcCentralAesData::process(const QByteArray &data, bool bIsInitial)
case AreaEffectSimulation::AesType::AtExplosionSingleCentralTrajectory:
case AreaEffectSimulation::AesType::AtBoobyTrapSecondary:
case AreaEffectSimulation::AesType::AtOffRouteMineSecondary:
FATAL_LOG(m_logger) << "Got false AesType: " << aesType.underlying() << " --> aborting.";
FATAL_LOG(m_logger) << "Got false AesType: " << aesType << " --> aborting.";
return;
case AreaEffectSimulation::AesType::AtNContamination:
{
@@ -335,7 +335,7 @@ void HandlerOcCentralAesData::process(const QByteArray &data, bool bIsInitial)
else
DEBUG_LOG(m_logger) << "MineArea added/modified.";
mineArea.distance() = 0.5;
mineArea.distance = 0.5;
checkId(mineArea);
m_aesFtc->mineAreaModifyRequest(mineArea, this);
@@ -505,7 +505,7 @@ void HandlerOcCentralAesData::tryRemoveAesItem(qint32 aesItemId, AreaEffectSimul
{
using namespace AreaEffectSimulation;
switch (aesType.underlying())
switch (aesType)
{
case AesType::AtUnknown:
case AesType::AtDangerArea:
@@ -522,7 +522,7 @@ void HandlerOcCentralAesData::tryRemoveAesItem(qint32 aesItemId, AreaEffectSimul
case AesType::AtExplosionSingleCentralTrajectory:
case AesType::AtBoobyTrapSecondary:
case AesType::AtOffRouteMineSecondary:
WARNING_LOG(m_logger) << "Got false AesType: " << aesType.underlying() << " --> aborting.";
WARNING_LOG(m_logger) << "Got false AesType: " << aesType << " --> aborting.";
break;
case AesType::AtNContamination:
removeAesItem(aesItemId, &AreaEffectSimulation::Interface::Ftc::nContaminationRemoveRequest);
@@ -582,18 +582,18 @@ void HandlerOcCentralAesData::onReply(const Core::FunctionReplyObject &reply) co
template <typename T> void HandlerOcCentralAesData::onAesItemChanged(const T &aesItem, DataModification modType, AreaEffectSimulation::AesType aesType)
{
if (!aesItem.isCentral())
if (!aesItem.isCentral)
return;
switch (modType)
{
case DataModification::eAdded:
m_allCentralAesItems[aesItem.id()] = aesType;
DEBUG_LOG(m_logger) << "Added new AES Item: id=" << aesItem.id() << ", type=" << aesType;
m_allCentralAesItems[aesItem.id] = aesType;
DEBUG_LOG(m_logger) << "Added new AES Item: id=" << aesItem.id << ", type=" << aesType;
break;
case DataModification::eRemoved:
m_allCentralAesItems.remove(aesItem.id());
DEBUG_LOG(m_logger) << "Removed AES Item with id=" << aesItem.id();
m_allCentralAesItems.remove(aesItem.id);
DEBUG_LOG(m_logger) << "Removed AES Item with id=" << aesItem.id;
break;
case DataModification::eModified:
default:
@@ -603,8 +603,8 @@ template <typename T> void HandlerOcCentralAesData::onAesItemChanged(const T &ae
template <typename T> void HandlerOcCentralAesData::checkId(T &aesItem) const
{
if (!m_allCentralAesItems.contains(aesItem.id()))
aesItem.id(aesItem.id() * -1);
if (!m_allCentralAesItems.contains(aesItem.id))
aesItem.id = aesItem.id * -1;
}
void HandlerOcCentralAesData::removeAesItem(
@@ -252,7 +252,7 @@ void HandlerOcData::onOcDataChanged(const TrainingAreaBase::OcData &data, DataMo
if ((modType != DataModification::eAdded) && (modType != DataModification::eModified))
return;
QByteArray payload = LtsUtils::toQByteArray(data.payload());
QByteArray payload = LtsUtils::toQByteArray(data.payload);
unsigned int telegramId;
LtsUtils::get1Byte(payload, telegramId);
@@ -309,10 +309,10 @@ void HandlerOcData::onTechnicalStateSfmChanged(const TrainingAreaBaseOC::Technic
if ((modType != DataModification::eAdded) && (modType != DataModification::eModified))
return;
if (m_licensed != data.licensed())
if (m_licensed != data.licensed)
{
m_licensed = data.licensed();
if (data.licensed())
m_licensed = data.licensed;
if (data.licensed)
{
DEBUG_LOG(m_logger) << "Newly licensed -> demanding situation / sending messages";
demandSituation(true);
@@ -327,13 +327,13 @@ void HandlerOcData::onOwnPosition(const TrainingAreaBaseOC::OwnPosition &data, D
return;
TrainingAreaBase::EquipmentPosition out;
out.sampleTime(data.timeStamp());
out.position().position(Core::GeoPosition(data.position().lon(), data.position().lat(), 0));
if (data.moutObjectId().is_set())
out.position().moutObjectId().set(data.moutObjectId().get());
if (data.moutRoomId().is_set())
out.position().moutRoomId().set(data.moutRoomId().get());
out.equipmentNumber(m_tabocDtc->specificsEquipment(1).equipmentNumber());
out.sampleTime = data.timeStamp;
out.position.position(Core::GeoPosition(data.position.lon, data.position.lat, 0));
if (data.moutObjectId.is_set())
out.position.moutObjectId.set(data.moutObjectId.get());
if (data.moutRoomId.is_set())
out.position.moutRoomId.set(data.moutRoomId.get());
out.equipmentNumber = m_tabocDtc->specificsEquipment(1).equipmentNumber;
m_tabDts->publish(out);
}
@@ -342,12 +342,12 @@ void HandlerOcData::onOperatorMessageChanged(const Messaging::OperatorMessage &d
{
if (DataModification::eRemoved == modType)
return;
DEBUG_LOG(m_logger) << data.recipientId() << "new message changed is send" << data.isSend() << " id" << data.id() ;
const int ownEqNo = m_tabocDtc->specificsEquipment(1).equipmentNumber();
if (data.recipientId() > 0)
DEBUG_LOG(m_logger) << data.recipientId << "new message changed is send" << data.isSend << " id" << data.id ;
const int ownEqNo = m_tabocDtc->specificsEquipment(1).equipmentNumber;
if (data.recipientId > 0)
{
if (data.isSend() ||
((data.recipientType() == Messaging::AddressType::ObserverController) && (data.recipientId() == getParticipantIdByEquipmentNumber(ownEqNo))))
if (data.isSend ||
((data.recipientType == Messaging::AddressType::ObserverController) && (data.recipientId == getParticipantIdByEquipmentNumber(ownEqNo))))
return; // is already send or its a message we have received from TETRA
}
else
@@ -358,37 +358,37 @@ void HandlerOcData::onOperatorMessageChanged(const Messaging::OperatorMessage &d
QByteArray payload;
LtsUtils::set1Byte(OcSituation::TelegramId::Message, payload);
if (data.recipientType() == Messaging::AddressType::Operator)
LtsUtils::set2Byte(data.recipientId(), payload);
if (data.recipientType == Messaging::AddressType::Operator)
LtsUtils::set2Byte(data.recipientId, payload);
else
{
const auto participantEqNo = m_ppmDtc->participant(data.recipientId()).equipmentNumber();
const auto participantEqNo = m_ppmDtc->participant(data.recipientId).equipmentNumber;
if (!participantEqNo.is_set())
{
WARNING_LOG(m_logger) << "Recipient with id " << data.recipientId() << " has no equipment number set - can not send message";
WARNING_LOG(m_logger) << "Recipient with id " << data.recipientId << " has no equipment number set - can not send message";
return;
}
LtsUtils::set2Byte(participantEqNo.get(), payload);
}
LtsUtils::set1Byte(data.recipientType().underlying(), payload);
LtsUtils::set1Byte(data.recipientType, payload);
// always send with our own equipment number
LtsUtils::set2Byte(ownEqNo, payload);
LtsUtils::set1Byte(Messaging::AddressType::ObserverController, payload);
LtsUtils::set2Byte(data.exerciseId(), payload);
LtsUtils::set2Byte(data.exerciseId, payload);
payload.append(QByteArray::fromStdString(data.subject()));
payload.append(QByteArray::fromStdString(data.subject));
payload.append('\n'); // separating subject from message
payload.append(QByteArray::fromStdString(data.message()));
payload.append(QByteArray::fromStdString(data.message));
TrainingAreaBase::SendOcDataRequest out;
out.payload(LtsUtils::convert<std::vector<uint8_t>>(payload));
out.payload = LtsUtils::convert<std::vector<uint8_t>>(payload);
DEBUG_LOG(m_logger) << "Sending operator message: " << data;
m_tabFtc->sendOcDataRequest(out, this);
m_msgFtc->modifyOperatorMessageRequest(Messaging::ModifyOperatorMessageRequest(data.id(), data.isRead(), true, data.isDeleted()), this);
m_msgFtc->modifyOperatorMessageRequest(Messaging::ModifyOperatorMessageRequest(data.id, data.isRead, true, data.isDeleted), this);
}
}
@@ -401,14 +401,14 @@ void HandlerOcData::onUserChanged(const OperatorManagement::User &data, DataModi
{
TRACE_LOG(m_logger) << LOGFUNCTION;
if (modType != DataModification::eModified || data.id() == 99) // id 99 = Organisator
if (modType != DataModification::eModified || data.id == 99) // id 99 = Organisator
return;
// on the abt there is only one user logged in, so if the workstation id of any
// user changes, we remember the user. now we are able to see, if the user logs out
if (data.workstationId() != 0)
if (data.workstationId != 0)
{
DEBUG_LOG(m_logger) << "User " << data.name() << " logged in.";
DEBUG_LOG(m_logger) << "User " << data.name << " logged in.";
m_user = data;
@@ -417,9 +417,9 @@ void HandlerOcData::onUserChanged(const OperatorManagement::User &data, DataModi
// if we get new information about the user we remembered and the workstation id is 0, the use is logged out
// or all applications are closed. now we have to stop situation data (if already requested) and forget the user.
if (m_user.id() == data.id() && data.workstationId() == 0)
if (m_user.id == data.id && data.workstationId == 0)
{
DEBUG_LOG(m_logger) << "User " << m_user.name() << " logged out.";
DEBUG_LOG(m_logger) << "User " << m_user.name << " logged out.";
if (m_centerEquipmentId > 0 || m_position.is_set())
{
@@ -441,7 +441,7 @@ void HandlerOcData::onUserChanged(const OperatorManagement::User &data, DataModi
void HandlerOcData::onSendDemandEvaluationSchemaRequest(const rti::core::SampleIdentity &cookie, const SendDemandEvaluationSchemaRequest &request)
{
demandEvaluationSchema(request.schemaId());
demandEvaluationSchema(request.schemaId);
m_fts->sendDemandEvaluationSchemaReply(cookie, Core::FunctionReplyObject());
}
@@ -451,20 +451,20 @@ void HandlerOcData::onSendEvaluationRequest(const rti::core::SampleIdentity &coo
QByteArray payload;
LtsUtils::set1Byte(OcSituation::TelegramId::Evaluation, payload);
LtsUtils::set2Byte(request.schemaId(), payload);
LtsUtils::set4Byte(request.senderOperatorId(), payload);
if (request.receiverOperatorId().is_set())
LtsUtils::set4Byte(request.receiverOperatorId().get(), payload);
LtsUtils::set2Byte(request.schemaId, payload);
LtsUtils::set4Byte(request.senderOperatorId, payload);
if (request.receiverOperatorId.is_set())
LtsUtils::set4Byte(request.receiverOperatorId.get(), payload);
else
LtsUtils::set4Byte(0, payload);
LtsUtils::set8Byte(request.timeStamp(), payload);
LtsUtils::set2Byte(request.hierarchy().size(), payload);
payload.append(request.hierarchy().c_str(), request.hierarchy().size());
LtsUtils::set2Byte(request.text().size(), payload);
payload.append(request.text().c_str(), request.text().size());
LtsUtils::set8Byte(request.timeStamp, payload);
LtsUtils::set2Byte(request.hierarchy.size(), payload);
payload.append(request.hierarchy.c_str(), request.hierarchy.size());
LtsUtils::set2Byte(request.text.size(), payload);
payload.append(request.text.c_str(), request.text.size());
TrainingAreaBase::SendOcDataRequest out;
out.payload(LtsUtils::convert<std::vector<uint8_t>>(payload));
out.payload = LtsUtils::convert<std::vector<uint8_t>>(payload);
m_tabFtc->sendOcDataRequest(out, this);
@@ -475,12 +475,12 @@ void HandlerOcData::onSendDemandSituationRequest(const rti::core::SampleIdentity
{
DEBUG_LOG(m_logger) << "New demand situation request from UI: " << request;
m_centerEquipmentId = request.centerEquipmentId();
m_radius = request.radius();
m_position = request.position();
m_useFilter = request.filterActive();
m_typeClassList = request.typeClassList();
m_partyList = request.partyList();
m_centerEquipmentId = request.centerEquipmentId;
m_radius = request.radius;
m_position = request.position;
m_useFilter = request.filterActive;
m_typeClassList = request.typeClassList;
m_partyList = request.partyList;
demandSituation(true);
@@ -490,7 +490,7 @@ void HandlerOcData::onSendDemandSituationRequest(const rti::core::SampleIdentity
void HandlerOcData::onSendEquipmentMessageOcRequest(const rti::core::SampleIdentity &cookie, const OcSituationServer::SendEquipmentMessageRequest &request)
{
// just answer so the messaging service does work normally, messages are send when received from DTC
m_ossFts->sendEquipmentMessageOcReply(cookie, Core::FunctionReplyObject(request.requestId()));
m_ossFts->sendEquipmentMessageOcReply(cookie, Core::FunctionReplyObject(request.requestId));
return;
}
@@ -499,22 +499,22 @@ void HandlerOcData::onSendEquipmentErrorRegistrationRequest(const rti::core::Sam
QByteArray payload;
LtsUtils::set1Byte(OcSituation::TelegramId::EquipmentErrorRegistration, payload);
LtsUtils::set2Byte(request.ocEquipmentNumber(), payload);
LtsUtils::set2Byte(request.ocEquipmentNumber, payload);
QByteArray faultEquipmentNumber(QByteArray::fromStdString(request.faultEquipmentNumber()));
QByteArray faultEquipmentNumber(QByteArray::fromStdString(request.faultEquipmentNumber));
faultEquipmentNumber.resize(36); // see ICD
payload.append(faultEquipmentNumber);
QByteArray device(QByteArray::fromStdString(request.device()));
QByteArray device(QByteArray::fromStdString(request.device));
device.resize(36); // see ICD
payload.append(device);
QByteArray text(QByteArray::fromStdString(request.text()));
QByteArray text(QByteArray::fromStdString(request.text));
if (text.size() > 255)
text.resize(255);
LtsUtils::set1Byte(text.size(), payload);
payload.append(text);
TrainingAreaBase::SendOcDataRequest out;
out.payload(LtsUtils::convert<std::vector<uint8_t>>(payload));
out.payload = LtsUtils::convert<std::vector<uint8_t>>(payload);
m_tabFtc->sendOcDataRequest(out, this);
m_fts->sendEquipmentErrorRegistrationReply(cookie, Core::FunctionReplyObject());
@@ -525,12 +525,12 @@ void HandlerOcData::onSendEquipmentRegistrationRequest(const rti::core::SampleId
QByteArray payload;
LtsUtils::set1Byte(OcSituation::TelegramId::EquipmentRegistration, payload);
LtsUtils::set2Byte(request.participantId(), payload);
LtsUtils::set2Byte(request.equipmentNumber(), payload);
LtsUtils::set2Byte(request.participantId, payload);
LtsUtils::set2Byte(request.equipmentNumber, payload);
TrainingAreaBase::SendOcDataRequest out;
out.payload(LtsUtils::convert<std::vector<uint8_t>>(payload));
out.payload = LtsUtils::convert<std::vector<uint8_t>>(payload);
m_tabFtc->sendOcDataRequest(out, this);
DEBUG_LOG(m_logger) << "try send out to OcData";
@@ -547,14 +547,14 @@ void HandlerOcData::demandEvaluationSchema(int schemaId)
LtsUtils::set2Byte(schemaId, payload);
TrainingAreaBase::SendOcDataRequest out;
out.payload(LtsUtils::convert<std::vector<uint8_t>>(payload));
out.payload = LtsUtils::convert<std::vector<uint8_t>>(payload);
m_tabFtc->sendOcDataRequest(out, this);
}
void HandlerOcData::demandSituation(bool initial)
{
if (!m_tabocDtc->technicalStateSfm(1).licensed())
if (!m_tabocDtc->technicalStateSfm(1).licensed)
return;
if (m_centerEquipmentId < -1)
@@ -592,8 +592,8 @@ void HandlerOcData::demandSituation(bool initial)
if (m_position.is_set())
{
LtsUtils::set1Byte(OcSituation::SituationCenterType::Position, payload);
LtsUtils::set8Byte(m_position.get().lon(), payload);
LtsUtils::set8Byte(m_position.get().lat(), payload);
LtsUtils::set8Byte(m_position.get().lon, payload);
LtsUtils::set8Byte(m_position.get().lat, payload);
}
else
{
@@ -615,7 +615,7 @@ void HandlerOcData::demandSituation(bool initial)
}
TrainingAreaBase::SendOcDataRequest out;
out.payload(LtsUtils::convert<std::vector<uint8_t>>(payload));
out.payload = LtsUtils::convert<std::vector<uint8_t>>(payload);
m_tabFtc->sendOcDataRequest(out, this);
@@ -635,7 +635,7 @@ void HandlerOcData::demandAesItems(OcSituation::AesType aesType)
LtsUtils::set1Byte(aesType, payload);
TrainingAreaBase::SendOcDataRequest out;
out.payload(LtsUtils::convert<std::vector<uint8_t>>(payload));
out.payload = LtsUtils::convert<std::vector<uint8_t>>(payload);
m_tabFtc->sendOcDataRequest(out, this);
}
@@ -646,7 +646,7 @@ void HandlerOcData::sendNewMessages()
auto cb = [this](const Messaging::OperatorMessage & message)
{
if (message.recipientId() > 0 && !message.isSend())
if (message.recipientId > 0 && !message.isSend)
onOperatorMessageChanged(message, DataModification::eModified);
};
m_msgDtc->operatorMessages(cb);
@@ -662,9 +662,9 @@ void HandlerOcData::handleMessage(const QByteArray &data)
// get receiver
LtsUtils::get2Byte(data, pos, tmp);
int ownParticipantId = getParticipantIdByEquipmentNumber(m_tabocDtc->specificsEquipment(1).equipmentNumber());
int ownParticipantId = getParticipantIdByEquipmentNumber(m_tabocDtc->specificsEquipment(1).equipmentNumber);
if (ownParticipantId > 0)
out.recipientIds().push_back(ownParticipantId);
out.recipientIds.push_back(ownParticipantId);
else
{
ERROR_LOG(m_logger) << "Receiver invalid, do not publish message.";
@@ -673,14 +673,14 @@ void HandlerOcData::handleMessage(const QByteArray &data)
// get address type
LtsUtils::get1Byte(data, pos, tmp);
out.recipientType(Messaging::AddressType::ObserverController);
out.recipientType = Messaging::AddressType::ObserverController;
// get sender
LtsUtils::get2Byte(data, pos, tmp);
out.senderId(tmp);
out.senderId = tmp;
// get address type
LtsUtils::get1Byte(data, pos, addressType);
out.senderType(static_cast<Messaging::AddressType::inner_enum>(addressType));
out.senderType = static_cast<Messaging::AddressType>(addressType);
/*
if (addressType == Messaging::AddressType::ObserverController)
{
@@ -698,19 +698,19 @@ void HandlerOcData::handleMessage(const QByteArray &data)
*/
//excerciseID
LtsUtils::get2Byte(data, pos, tmp);
out.exerciseId(tmp);
out.exerciseId = tmp;
//text
const QByteArray msg(data.right(data.size() - pos));
int idx = msg.indexOf('\n');
if (idx < 0)
{
out.subject((tr("Message from %1").arg(out.senderId())).toStdString());
out.message(msg.constData());
out.subject = (tr("Message from %1").arg(out.senderId)).toStdString();
out.message = msg.constData();
}
else
{
out.subject(msg.left(idx).constData());
out.message(msg.mid(idx + 1).constData());
out.subject = msg.left(idx).constData();
out.message = msg.mid(idx + 1).constData();
}
DEBUG_LOG(m_logger) << "Got new message: " << out;
@@ -726,12 +726,12 @@ void HandlerOcData::handleEvaluationSchema(const QByteArray &data)
// get schema id
LtsUtils::get2Byte(data, pos, tmp);
out.id(static_cast<int>(tmp) * -1); // to mark as from oc
out.id = static_cast<int>(tmp) * -1; // to mark as from oc
// get schema string
const QByteArray uncompressed = MainHandler::tryUncompress(data.mid(pos), true);
out.schemadata(uncompressed.toStdString());
out.schemadata = uncompressed.toStdString();
// set sendToTa true
out.sendToTa(true);
out.sendToTa = true;
DEBUG_LOG(m_logger) << "Got new evaluation schema: ";
@@ -95,7 +95,7 @@ void HandlerOcSituationData::process(const QByteArray &data, bool bIsInitial)
{
DEBUG_LOG(m_logger) << "Processing initial situation data.";
int ownEquipmentNumber = m_tabocDtc->specificsEquipment(1).equipmentNumber();
int ownEquipmentNumber = m_tabocDtc->specificsEquipment(1).equipmentNumber;
int ownParticipantId = -1;
for (const int &participantId : qAsConst(m_participantId2EqId))
{
@@ -133,14 +133,14 @@ void HandlerOcSituationData::process(const QByteArray &data, bool bIsInitial)
void HandlerOcSituationData::removeAllPositions()
{
TrainingAreaBase::EquipmentPosition invalidPos;
invalidPos.position().position().lon(nan(""));
invalidPos.position().position().lat(nan(""));
invalidPos.position().reportingSource(Core::PositionReportingSource::SetByOperator); // SetByOperator -> nan is allowed
invalidPos.sampleTime(m_dds->currentPartitionTime());
invalidPos.position.position.lon = nan("");
invalidPos.position.position.lat = nan("");
invalidPos.position.reportingSource = Core::PositionReportingSource::SetByOperator; // SetByOperator -> nan is allowed
invalidPos.sampleTime = m_dds->currentPartitionTime();
for (const auto eqNumber : qAsConst(m_participantId2EqId))
{
invalidPos.equipmentNumber(eqNumber);
invalidPos.equipmentNumber = eqNumber;
m_tabDts->publish(invalidPos);
}
}
@@ -148,11 +148,11 @@ void HandlerOcSituationData::removeAllPositions()
void HandlerOcSituationData::setInvalidPositionForParticipant(int participantId)
{
TrainingAreaBase::EquipmentPosition invalidPos;
invalidPos.position().position().lon(nan(""));
invalidPos.position().position().lat(nan(""));
invalidPos.position().reportingSource(Core::PositionReportingSource::SetByOperator); // SetByOperator -> nan is allowed
invalidPos.sampleTime(m_dds->currentPartitionTime());
invalidPos.equipmentNumber(-participantId); // negative -> treat equipNo as participantId
invalidPos.position.position.lon = nan("");
invalidPos.position.position.lat = nan("");
invalidPos.position.reportingSource = Core::PositionReportingSource::SetByOperator; // SetByOperator -> nan is allowed
invalidPos.sampleTime = m_dds->currentPartitionTime();
invalidPos.equipmentNumber = -participantId; // negative -> treat equipNo as participantId
m_tabDts->publish(invalidPos);
}
@@ -187,8 +187,8 @@ bool HandlerOcSituationData::decodeSituationData(const QByteArray &data)
LtsUtils::get1Byte(data, participantOverloaded);
//send overload topic
TrainingAreaBaseOC::ParticipantsOverload participantsOverload;
participantsOverload.id(1);
participantsOverload.hasOverload(participantOverloaded);
participantsOverload.id = 1;
participantsOverload.hasOverload = participantOverloaded;
m_tabocDts->publish(participantsOverload);
DEBUG_LOG(m_logger) << "publish overload: " << participantOverloaded;
@@ -233,7 +233,7 @@ bool HandlerOcSituationData::decodeSituationData(const QByteArray &data)
// position
bool bRet = false;
TrainingAreaBase::EquipmentPosition position;
position.position().reportingSource(Core::PositionReportingSource::Gps); // we don't know better
position.position.reportingSource = Core::PositionReportingSource::Gps; // we don't know better
bRet |= getPosition2D(uncompressed, pos, position, (modifiedFlag & OcSituation::ModificationFlag::ePosition2D) == OcSituation::ModificationFlag::ePosition2D);
bRet |= getPosition3D(uncompressed, pos, position, (modifiedFlag & OcSituation::ModificationFlag::ePosition3D) == OcSituation::ModificationFlag::ePosition3D);
if (bRet)
@@ -274,22 +274,22 @@ bool HandlerOcSituationData::decodeSituationData(const QByteArray &data)
bRet |= getSymbolSidc(uncompressed, pos, participantData, (modifiedFlag & OcSituation::ModificationFlag::eSymbol) == OcSituation::ModificationFlag::eSymbol);
//sanity
bool bInsane = false;
if (bRet && (participantData.partyId() <= 0 || participantData.id() <= 0 || participantData.typeId() <= 0))
if (bRet && (participantData.partyId <= 0 || participantData.id <= 0 || participantData.typeId <= 0))
bInsane = true;
if (bRet && !bInsane)
{
int unitId = Settings::unitOffset() + participantData.partyId();
if (participantData.id() == 0) // if new participant
int unitId = Settings::unitOffset() + participantData.partyId;
if (participantData.id == 0) // if new participant
{
participantData.id(participantId);
participantData.modId(modId++);
participantData.hierarchyNumber(participantId); // it just needs to be unqiue here
participantData.id = participantId;
participantData.modId = modId++;
participantData.hierarchyNumber = participantId; // it just needs to be unqiue here
}
//always set superiorModId! changeing party Id only won't work
participantData.superiorModId(unitId);
participantData.superiorModId = unitId;
participantData.assignState(ParticipantManagement::ParticipantAssignState::HandoutExcon); // set always as we can deduce it anyway //TODO cant reasign EQ nr
participantData.assignState = ParticipantManagement::ParticipantAssignState::HandoutExcon; // set always as we can deduce it anyway //TODO cant reasign EQ nr
if (!m_participantData.contains(unitId)) // Adding Unit to participantData, if not already added
{
@@ -300,14 +300,14 @@ bool HandlerOcSituationData::decodeSituationData(const QByteArray &data)
m_participantData.insert(participantId, participantData);
DEBUG_LOG(m_logger) << "Adding ParticipantData to internal map: " << participantData;
if (participantData.equipmentNumber().is_set())
m_participantId2EqId[participantId] = participantData.equipmentNumber().get();
if (participantData.equipmentNumber.is_set())
m_participantId2EqId[participantId] = participantData.equipmentNumber.get();
else
m_participantId2EqId[participantId] = 0; // so the positions can be removed, see e.g. removeAllPositions()
}
// no position update for ourself. Easier to filter here than in server but a bit overhead in TETRA
if (m_tabocDtc->specificsEquipment(1).equipmentNumber() == m_participantId2EqId.value(participantId))
if (m_tabocDtc->specificsEquipment(1).equipmentNumber == m_participantId2EqId.value(participantId))
m_equipmentPositions.remove(participantId);
}
@@ -344,10 +344,10 @@ void HandlerOcSituationData::publishMap(QMap<int, T> &map)
{
for (auto it = map.begin(); it != map.end();)
{
if (m_participants.value(it.key()).id() > 0) // publishing only for existing participants
if (m_participants.value(it.key()).id > 0) // publishing only for existing participants
{
auto topic = it.value();
topic.equipmentNumber(m_participantId2EqId.value(it.key()));
topic.equipmentNumber = m_participantId2EqId.value(it.key());
m_tabDts->publish(topic);
it = map.erase(it);
}
@@ -382,10 +382,10 @@ bool HandlerOcSituationData::getPosition2D(const QByteArray &buf, size_t &pos, T
// lon, lat, sampleTime
double tmp;
bRet &= LtsUtils::get8Byte(buf, pos, tmp);
position.position().position().lon(tmp);
position.position.position.lon = tmp;
bRet &= LtsUtils::get8Byte(buf, pos, tmp);
position.position().position().lat(tmp);
position.sampleTime(m_dds->currentPartitionTime());
position.position.position.lat = tmp;
position.sampleTime = m_dds->currentPartitionTime();
return bRet;
}
@@ -404,15 +404,15 @@ bool HandlerOcSituationData::getPosition3D(const QByteArray &buf, size_t &pos, T
int buildingId = -1;
bRet &= LtsUtils::get8Byte(buf, pos, tmp);
position.position().position().z(tmp);
position.position.position.z = tmp;
bRet &= LtsUtils::get2Byte(buf, pos, buildingId);
bRet &= LtsUtils::get4Byte(buf, pos, roomId);
if (buildingId > 0 && roomId > 0)
{
position.position().moutRoomId().set(roomId);
position.position().moutObjectId().set(buildingId);
position.position().reportingSource() = (tmp >= 0.0) ? Core::PositionReportingSource::Ops : Core::PositionReportingSource::OpsTunnel;
position.position.moutRoomId.set(roomId);
position.position.moutObjectId.set(buildingId);
position.position.reportingSource = (tmp >= 0.0) ? Core::PositionReportingSource::Ops : Core::PositionReportingSource::OpsTunnel;
}
@@ -429,11 +429,11 @@ bool HandlerOcSituationData::getVBG(const QByteArray &buf, size_t &pos, Training
// vulnerabilityState, vulnerabilityBits, originatorParty, sampleTime
uint64_t tmp;
bRet &= LtsUtils::get1Byte(buf, pos, tmp);
equipmentState.vulnerabilityState(ProjectDataManagement::VulnerabilityState::inner_enum(tmp));
equipmentState.vulnerabilityState = ProjectDataManagement::VulnerabilityState::inner_enum(tmp);
bRet &= LtsUtils::get4Byte(buf, pos, tmp);
equipmentState.vulnerabilityKindId(tmp);
equipmentState.vulnerabilityKindId = tmp;
bRet &= LtsUtils::get2Byte(buf, pos, tmp);
equipmentState.vulnerabilityBits(tmp);
equipmentState.vulnerabilityBits = tmp;
bRet &= LtsUtils::get1Byte(buf, pos, tmp);
if (!m_knownParties.contains(tmp))
{
@@ -443,32 +443,32 @@ bool HandlerOcSituationData::getVBG(const QByteArray &buf, size_t &pos, Training
//Sollte nicht passieren, doch falls ja gibt es goldene Kreuze beim Ausfall
tmp = 1;
}
equipmentState.originatorId(Settings::unitOffset() + tmp);
equipmentState.originatorId = Settings::unitOffset() + tmp;
if (m_bWithVBGTime)
{
bRet &= LtsUtils::get4Byte(buf, pos, tmp);
equipmentState.sampleTime(tmp * 1000UL);
equipmentState.sampleTime = tmp * 1000UL;
}
else
equipmentState.sampleTime(QDateTime::currentMSecsSinceEpoch());
equipmentState.sampleTime = QDateTime::currentMSecsSinceEpoch();
quint8 vitRest;
bRet &= LtsUtils::get1Byte(buf, pos, vitRest);
if (bRet)
{
int vit = (vitRest & 0x0F) * 10;
equipmentState.vitality(vit);
equipmentState.vitality = vit;
TrainingAreaBase::SanitationResult result = static_cast<TrainingAreaBase::SanitationResult_def::type>(vitRest >> 4);
sanitation.sanitationResult(result);
sanitation.proceduresTaken(1);
sanitation.qualification(TrainingAreaBase::Qualification::SANPers);
sanitation.sanitationResult = result;
sanitation.proceduresTaken = 1;
sanitation.qualification = TrainingAreaBase::Qualification::SANPers;
}
qint8 originator = 0;
bRet &= LtsUtils::get1Byte(buf, pos, originator);
if (bRet)
equipmentState.originatorType(ProjectDataManagement::StateChangeOriginator::inner_enum(originator));
equipmentState.originatorType = ProjectDataManagement::StateChangeOriginator::inner_enum(originator);
return bRet;
}
@@ -483,12 +483,12 @@ bool HandlerOcSituationData::getState(const QByteArray &buf, size_t &pos, Traini
int tmp;
bRet &= LtsUtils::get1Byte(buf, pos, tmp);
specialSensorData.sampleTime(m_dds->currentPartitionTime());
specialSensorData.sampleTime = m_dds->currentPartitionTime();
equipmentOperationalState.nbcProtectionActive((tmp & 0x02) || (tmp & 0x04));
equipmentOperationalState.isManipulation(tmp & 0x02);
equipmentOperationalState.nbcProtectionActive = (tmp & 0x02) || (tmp & 0x04);
equipmentOperationalState.isManipulation = tmp & 0x02;
equipmentOperationalState.sampleTime(m_dds->currentPartitionTime());
equipmentOperationalState.sampleTime = m_dds->currentPartitionTime();
return bRet;
}
@@ -502,15 +502,15 @@ bool HandlerOcSituationData::getStructure(const QByteArray &buf, size_t &pos, Pa
// equipmentNumber, typeId, partyId
int tmp;
bRet &= LtsUtils::get2Byte(buf, pos, tmp);
participant.equipmentNumber(dds::core::optional<int32_t>(tmp));
participant.equipmentNumber = dds::core::optional<int32_t>(tmp);
bRet &= LtsUtils::get2Byte(buf, pos, tmp);
participant.typeId(tmp);
participant.typeId = tmp;
bRet &= LtsUtils::get2Byte(buf, pos, tmp);
if (m_knownParties.contains(tmp))
participant.partyId(tmp);
participant.partyId = tmp;
else
{
WARNING_LOG(m_logger) << "Not setting new party: " << tmp << " for participant: " << participant.id() << " as the party is unknown -> do a base download.";
WARNING_LOG(m_logger) << "Not setting new party: " << tmp << " for participant: " << participant.id << " as the party is unknown -> do a base download.";
bRet = false;
}
@@ -540,12 +540,12 @@ bool HandlerOcSituationData::getDesignator(const QByteArray &buf, size_t &pos, P
if ((size_t)buf.size() < pos + len1)
bRet = false;
if (bRet)
participant.designator(buf.mid(pos, len1).toStdString());
participant.designator = buf.mid(pos, len1).toStdString();
pos += len1;
if ((size_t)buf.size() < pos + len2)
bRet = false;
if (bRet)
participant.tacticalIdentifier(buf.mid(pos, len2).toStdString());
participant.tacticalIdentifier = buf.mid(pos, len2).toStdString();
pos += len2;
return bRet;
@@ -562,14 +562,14 @@ bool HandlerOcSituationData::getSymbolSidc(const QByteArray &buf, size_t &pos, P
if (len == 0)
{
// get symbol from type id
const auto type = m_ppmDtc->type(participant.typeId());
participant.symbol(type.symbol());
const auto type = m_ppmDtc->type(participant.typeId);
participant.symbol = type.symbol;
return bRet;
}
if ((size_t)buf.size() < pos + len)
bRet = false;
if (bRet)
participant.symbol(buf.mid(pos, len).toStdString());
participant.symbol = buf.mid(pos, len).toStdString();
pos += len;
return bRet;
@@ -581,10 +581,10 @@ void HandlerOcSituationData::onPartyChanged(const ParticipantManagement::Party &
{
case DataModification::eAdded:
case DataModification::eModified:
m_knownParties.insert(party.id());
m_knownParties.insert(party.id);
break;
case DataModification::eRemoved:
m_knownParties.remove(party.id());
m_knownParties.remove(party.id);
break;
}
}
@@ -595,13 +595,13 @@ void HandlerOcSituationData::onParticipantChanged(const ParticipantManagement::P
{
case DataModification::eAdded:
case DataModification::eModified:
m_participants[participant.id()] = participant;
m_participants[participant.id] = participant;
// if there is a participant but it has (currently) no equipno, remove it from sitmap by setting invalid position
if (!m_participantId2EqId.contains(participant.id()))
setInvalidPositionForParticipant(participant.id());
if (!m_participantId2EqId.contains(participant.id))
setInvalidPositionForParticipant(participant.id);
break;
case DataModification::eRemoved:
m_participants.remove(participant.id());
m_participants.remove(participant.id);
break;
}
}
@@ -23,16 +23,16 @@ QByteArray getByteStreamAesItem(const AreaEffectSimulation::EffectCluster &effec
isPrioritized = false;
addAesType(byteStream, AreaEffectSimulation::AesType::AtExplosionCluster); // we send EffectCluster as ExplosionCluster
addAesItemId(byteStream, effectCluster.id());
addName(byteStream, effectCluster.name());
addEffectStart(byteStream, effectCluster.effectStart().is_set() ? effectCluster.effectStart().get() : -1);
addEffectDuration(byteStream, effectCluster.effectDuration());
addArea(byteStream, effectCluster.area());
addMhpCount(byteStream, static_cast<int32_t>(effectCluster.effectors().size()));
addMhpRotation(byteStream, effectCluster.effectors().size() ? effectCluster.effectors()[0].mhpRotation() : 1);
addImpactCount(byteStream, static_cast<int32_t>(effectCluster.effectors().size()));
addChargeTypeId(byteStream, effectCluster.chargeStruct().chargeTypeId());
addPartyId(byteStream, effectCluster.partyId().is_set() ? effectCluster.partyId().get() : -1);
addAesItemId(byteStream, effectCluster.id);
addName(byteStream, effectCluster.name);
addEffectStart(byteStream, effectCluster.effectStart.is_set() ? effectCluster.effectStart.get() : -1);
addEffectDuration(byteStream, effectCluster.effectDuration);
addArea(byteStream, effectCluster.area);
addMhpCount(byteStream, static_cast<int32_t>(effectCluster.effectors.size()));
addMhpRotation(byteStream, effectCluster.effectors.size() ? effectCluster.effectors[0].mhpRotation : 1);
addImpactCount(byteStream, static_cast<int32_t>(effectCluster.effectors.size()));
addChargeTypeId(byteStream, effectCluster.chargeStruct.chargeTypeId);
addPartyId(byteStream, effectCluster.partyId.is_set() ? effectCluster.partyId.get() : -1);
return byteStream;
}
@@ -44,19 +44,19 @@ QByteArray getByteStreamAesItem(const AreaEffectSimulation::NContamination &nCon
isPrioritized = false;
addAesType(byteStream, AreaEffectSimulation::AesType::AtNContamination);
addAesItemId(byteStream, nContamination.id());
addName(byteStream, nContamination.name());
addEffectStart(byteStream, nContamination.effectStart().is_set() ? nContamination.effectStart().get() : -1);
addEffectDuration(byteStream, nContamination.effectDuration());
addChargeTypeId(byteStream, nContamination.chargeStruct().chargeTypeId());
addImpactPosition(byteStream, nContamination.impactPosition());
addBorderLengthInner(byteStream, nContamination.borderLengthInner());
addBorderLengthOuter(byteStream, nContamination.borderLengthOuter());
addImpactRadius(byteStream, nContamination.impactRadius());
addSpanAngle(byteStream, nContamination.spanAngle());
addRotationAngle(byteStream, nContamination.rotationAngle());
addDetonationValue(byteStream, nContamination.detonationValue());
addPartyId(byteStream, nContamination.partyId().is_set() ? nContamination.partyId().get() : -1);
addAesItemId(byteStream, nContamination.id);
addName(byteStream, nContamination.name);
addEffectStart(byteStream, nContamination.effectStart.is_set() ? nContamination.effectStart.get() : -1);
addEffectDuration(byteStream, nContamination.effectDuration);
addChargeTypeId(byteStream, nContamination.chargeStruct.chargeTypeId);
addImpactPosition(byteStream, nContamination.impactPosition);
addBorderLengthInner(byteStream, nContamination.borderLengthInner);
addBorderLengthOuter(byteStream, nContamination.borderLengthOuter);
addImpactRadius(byteStream, nContamination.impactRadius);
addSpanAngle(byteStream, nContamination.spanAngle);
addRotationAngle(byteStream, nContamination.rotationAngle);
addDetonationValue(byteStream, nContamination.detonationValue);
addPartyId(byteStream, nContamination.partyId.is_set() ? nContamination.partyId.get() : -1);
return byteStream;
}
@@ -68,16 +68,16 @@ QByteArray getByteStreamAesItem(const AreaEffectSimulation::BCContamination &bCC
isPrioritized = false;
addAesType(byteStream, AreaEffectSimulation::AesType::AtBCContamination);
addAesItemId(byteStream, bCContamination.id());
addName(byteStream, bCContamination.name());
addEffectStart(byteStream, bCContamination.effectStart().is_set() ? bCContamination.effectStart().get() : -1);
addEffectDuration(byteStream, bCContamination.effectDuration());
addChargeTypeId(byteStream, bCContamination.chargeStruct().chargeTypeId());
addImpactPosition(byteStream, bCContamination.impactPosition());
addImpactRadius(byteStream, bCContamination.impactRadius());
addPartyId(byteStream, bCContamination.partyId().is_set() ? bCContamination.partyId().get() : -1);
addPropagationDirection(byteStream, bCContamination.propagationDirection());
addWindSpeed(byteStream, bCContamination.windSpeed());
addAesItemId(byteStream, bCContamination.id);
addName(byteStream, bCContamination.name);
addEffectStart(byteStream, bCContamination.effectStart.is_set() ? bCContamination.effectStart.get() : -1);
addEffectDuration(byteStream, bCContamination.effectDuration);
addChargeTypeId(byteStream, bCContamination.chargeStruct.chargeTypeId);
addImpactPosition(byteStream, bCContamination.impactPosition);
addImpactRadius(byteStream, bCContamination.impactRadius);
addPartyId(byteStream, bCContamination.partyId.is_set() ? bCContamination.partyId.get() : -1);
addPropagationDirection(byteStream, bCContamination.propagationDirection);
addWindSpeed(byteStream, bCContamination.windSpeed);
return byteStream;
}
@@ -89,18 +89,18 @@ QByteArray getByteStreamAesItem(const AreaEffectSimulation::ExplosionArea &explo
isPrioritized = false;
addAesType(byteStream, AreaEffectSimulation::AesType::AtExplosionArea);
addAesItemId(byteStream, explosionArea.id());
addName(byteStream, explosionArea.name());
addEffectStart(byteStream, explosionArea.effectStart().is_set() ? explosionArea.effectStart().get() : -1);
addEffectDuration(byteStream, explosionArea.effectDuration());
addChargeTypeId(byteStream, explosionArea.chargeStruct().chargeTypeId());
addArea(byteStream, explosionArea.area());
addPartyId(byteStream, explosionArea.partyId().is_set() ? explosionArea.partyId().get() : -1);
addCannonCount(byteStream, explosionArea.cannonCount());
addCannonRounds(byteStream, explosionArea.cannonRounds());
addFireRequestTime(byteStream, explosionArea.fireRequestTime());
addAltitude(byteStream, explosionArea.altitude());
addPurpose(byteStream, explosionArea.purpose());
addAesItemId(byteStream, explosionArea.id);
addName(byteStream, explosionArea.name);
addEffectStart(byteStream, explosionArea.effectStart.is_set() ? explosionArea.effectStart.get() : -1);
addEffectDuration(byteStream, explosionArea.effectDuration);
addChargeTypeId(byteStream, explosionArea.chargeStruct.chargeTypeId);
addArea(byteStream, explosionArea.area);
addPartyId(byteStream, explosionArea.partyId.is_set() ? explosionArea.partyId.get() : -1);
addCannonCount(byteStream, explosionArea.cannonCount);
addCannonRounds(byteStream, explosionArea.cannonRounds);
addFireRequestTime(byteStream, explosionArea.fireRequestTime);
addAltitude(byteStream, explosionArea.altitude);
addPurpose(byteStream, explosionArea.purpose);
return byteStream;
}
@@ -112,15 +112,15 @@ QByteArray getByteStreamAesItem(const AreaEffectSimulation::ExplosionSingle &exp
isPrioritized = false;
addAesType(byteStream, AreaEffectSimulation::AesType::AtExplosionSingle);
addAesItemId(byteStream, explosionSingle.id());
addName(byteStream, explosionSingle.name());
addEffectStart(byteStream, explosionSingle.effectStart().is_set() ? explosionSingle.effectStart().get() : -1);
addChargeTypeId(byteStream, explosionSingle.chargeStruct().chargeTypeId());
addImpactPosition(byteStream, explosionSingle.impactPosition());
addPartyId(byteStream, explosionSingle.partyId().is_set() ? explosionSingle.partyId().get() : -1);
addFireRequestTime(byteStream, explosionSingle.fireRequestTime());
addAltitude(byteStream, explosionSingle.altitude());
addPurpose(byteStream, explosionSingle.purpose());
addAesItemId(byteStream, explosionSingle.id);
addName(byteStream, explosionSingle.name);
addEffectStart(byteStream, explosionSingle.effectStart.is_set() ? explosionSingle.effectStart.get() : -1);
addChargeTypeId(byteStream, explosionSingle.chargeStruct.chargeTypeId);
addImpactPosition(byteStream, explosionSingle.impactPosition);
addPartyId(byteStream, explosionSingle.partyId.is_set() ? explosionSingle.partyId.get() : -1);
addFireRequestTime(byteStream, explosionSingle.fireRequestTime);
addAltitude(byteStream, explosionSingle.altitude);
addPurpose(byteStream, explosionSingle.purpose);
return byteStream;
}
@@ -132,18 +132,18 @@ QByteArray getByteStreamAesItem(const AreaEffectSimulation::MineArea &mineArea,
isPrioritized = false;
addAesType(byteStream, AreaEffectSimulation::AesType::AtMineArea);
addAesItemId(byteStream, mineArea.id());
addName(byteStream, mineArea.name());
addEffectStart(byteStream, mineArea.effectStart().is_set() ? mineArea.effectStart().get() : -1);
addEffectDuration(byteStream, mineArea.effectDuration());
addDensity(byteStream, mineArea.density());
addWidth(byteStream, mineArea.width());
addChargeTypeId(byteStream, mineArea.chargeStruct().chargeTypeId());
addPartyId(byteStream, mineArea.partyId().is_set() ? mineArea.partyId().get() : -1);
addAesMaLayingProcedureType(byteStream, mineArea.layingProcedureType());
addIsLayedHidden(byteStream, mineArea.isLaidHidden());
addIsCenterLine(byteStream, mineArea.isCenterLine());
addSegments(byteStream, mineArea.segments());
addAesItemId(byteStream, mineArea.id);
addName(byteStream, mineArea.name);
addEffectStart(byteStream, mineArea.effectStart.is_set() ? mineArea.effectStart.get() : -1);
addEffectDuration(byteStream, mineArea.effectDuration);
addDensity(byteStream, mineArea.density);
addWidth(byteStream, mineArea.width);
addChargeTypeId(byteStream, mineArea.chargeStruct.chargeTypeId);
addPartyId(byteStream, mineArea.partyId.is_set() ? mineArea.partyId.get() : -1);
addAesMaLayingProcedureType(byteStream, mineArea.layingProcedureType);
addIsLayedHidden(byteStream, mineArea.isLaidHidden);
addIsCenterLine(byteStream, mineArea.isCenterLine);
addSegments(byteStream, mineArea.segments);
return byteStream;
}
@@ -155,21 +155,21 @@ QByteArray getByteStreamAesItem(const AreaEffectSimulation::FunctionalArea &func
isPrioritized = false;
addAesType(byteStream, AreaEffectSimulation::AesType::AtFunctionalArea);
addAesItemId(byteStream, functionalArea.id());
addName(byteStream, functionalArea.name());
addEffectStart(byteStream, functionalArea.effectStart().is_set() ? functionalArea.effectStart().get() : -1);
addEffectDuration(byteStream, functionalArea.effectDuration());
addChargeTypeId(byteStream, functionalArea.chargeStruct().chargeTypeId());
addArea(byteStream, functionalArea.area());
addPartyId(byteStream, functionalArea.partyId().is_set() ? functionalArea.partyId().get() : -1);
addPointSymbol(byteStream, functionalArea.pointSymbol().is_set() ? functionalArea.pointSymbol().get() : std::string());
addFunctionalAreaTypeId(byteStream, functionalArea.functionalAreaTypeId());
addDeconMode(byteStream, functionalArea.deconMode());
addDeconTime(byteStream, functionalArea.deconTime());
addMaintMode(byteStream, functionalArea.maintMode());
addMaintTime(byteStream, functionalArea.maintTime());
addMedicMode(byteStream, functionalArea.medicMode());
addMedicTime(byteStream, functionalArea.medicTime());
addAesItemId(byteStream, functionalArea.id);
addName(byteStream, functionalArea.name);
addEffectStart(byteStream, functionalArea.effectStart.is_set() ? functionalArea.effectStart.get() : -1);
addEffectDuration(byteStream, functionalArea.effectDuration);
addChargeTypeId(byteStream, functionalArea.chargeStruct.chargeTypeId);
addArea(byteStream, functionalArea.area);
addPartyId(byteStream, functionalArea.partyId.is_set() ? functionalArea.partyId.get() : -1);
addPointSymbol(byteStream, functionalArea.pointSymbol.is_set() ? functionalArea.pointSymbol.get() : std::string());
addFunctionalAreaTypeId(byteStream, functionalArea.functionalAreaTypeId);
addDeconMode(byteStream, functionalArea.deconMode);
addDeconTime(byteStream, functionalArea.deconTime);
addMaintMode(byteStream, functionalArea.maintMode);
addMaintTime(byteStream, functionalArea.maintTime);
addMedicMode(byteStream, functionalArea.medicMode);
addMedicTime(byteStream, functionalArea.medicTime);
return byteStream;
}
@@ -181,17 +181,17 @@ QByteArray getByteStreamAesItem(const AreaEffectSimulation::BoobyTrap &boobyTrap
isPrioritized = false;
addAesType(byteStream, AreaEffectSimulation::AesType::AtBoobyTrap);
addAesItemId(byteStream, boobyTrap.id());
addName(byteStream, boobyTrap.name());
addEffectDuration(byteStream, boobyTrap.effectDuration());
addChargeTypeId(byteStream, boobyTrap.chargeStruct().chargeTypeId());
addImpactPosition(byteStream, boobyTrap.impactPosition());
addImpactRadius(byteStream, boobyTrap.impactRadius());
addTriggerRadius(byteStream, boobyTrap.triggerRadius());
addRotationAngle(byteStream, boobyTrap.rotationAngle().is_set() ? boobyTrap.rotationAngle().get() : -1);
addCentralAngle(byteStream, boobyTrap.centralAngle().is_set() ? boobyTrap.centralAngle().get() : -1);
addEffectStart(byteStream, boobyTrap.effectStart().is_set() ? boobyTrap.effectStart().get() : -1);
addPartyId(byteStream, boobyTrap.partyId().is_set() ? boobyTrap.partyId().get() : -1);
addAesItemId(byteStream, boobyTrap.id);
addName(byteStream, boobyTrap.name);
addEffectDuration(byteStream, boobyTrap.effectDuration);
addChargeTypeId(byteStream, boobyTrap.chargeStruct.chargeTypeId);
addImpactPosition(byteStream, boobyTrap.impactPosition);
addImpactRadius(byteStream, boobyTrap.impactRadius);
addTriggerRadius(byteStream, boobyTrap.triggerRadius);
addRotationAngle(byteStream, boobyTrap.rotationAngle.is_set() ? boobyTrap.rotationAngle.get() : -1);
addCentralAngle(byteStream, boobyTrap.centralAngle.is_set() ? boobyTrap.centralAngle.get() : -1);
addEffectStart(byteStream, boobyTrap.effectStart.is_set() ? boobyTrap.effectStart.get() : -1);
addPartyId(byteStream, boobyTrap.partyId.is_set() ? boobyTrap.partyId.get() : -1);
return byteStream;
}
@@ -203,14 +203,14 @@ QByteArray getByteStreamAesItem(const AreaEffectSimulation::OffRouteMine &offRou
isPrioritized = false;
addAesType(byteStream, AreaEffectSimulation::AesType::AtOffRouteMine);
addAesItemId(byteStream, offRouteMine.id());
addName(byteStream, offRouteMine.name());
addEffectDuration(byteStream, offRouteMine.effectDuration());
addChargeTypeId(byteStream, offRouteMine.chargeStruct().chargeTypeId());
addArea(byteStream, offRouteMine.area());
addImpactRadius(byteStream, offRouteMine.impactRadius().is_set() ? offRouteMine.impactRadius().get() : -1);
addEffectStart(byteStream, offRouteMine.effectStart().is_set() ? offRouteMine.effectStart().get() : -1);
addPartyId(byteStream, offRouteMine.partyId().is_set() ? offRouteMine.partyId().get() : -1);
addAesItemId(byteStream, offRouteMine.id);
addName(byteStream, offRouteMine.name);
addEffectDuration(byteStream, offRouteMine.effectDuration);
addChargeTypeId(byteStream, offRouteMine.chargeStruct.chargeTypeId);
addArea(byteStream, offRouteMine.area);
addImpactRadius(byteStream, offRouteMine.impactRadius.is_set() ? offRouteMine.impactRadius.get() : -1);
addEffectStart(byteStream, offRouteMine.effectStart.is_set() ? offRouteMine.effectStart.get() : -1);
addPartyId(byteStream, offRouteMine.partyId.is_set() ? offRouteMine.partyId.get() : -1);
return byteStream;
}
@@ -220,18 +220,18 @@ QByteArray getByteStreamAesItem(const AreaEffectSimulation::ExplosionCluster &ex
QByteArray byteStream;
addAesType(byteStream, AreaEffectSimulation::AesType::AtExplosionCluster);
addAesItemId(byteStream, explosionCluster.id());
addName(byteStream, explosionCluster.name());
addEffectStart(byteStream, explosionCluster.effectStart().is_set() ? explosionCluster.effectStart().get() : -1);
addEffectDuration(byteStream, explosionCluster.effectDuration());
addArea(byteStream, explosionCluster.area());
addMhpCount(byteStream, static_cast<int32_t>(explosionCluster.mhPoints().size()));
addMhpRotation(byteStream, explosionCluster.mhpRotation());
addImpactCount(byteStream, explosionCluster.impactCount());
addChargeTypeId(byteStream, explosionCluster.chargeStruct().chargeTypeId());
addPartyId(byteStream, explosionCluster.partyId().is_set() ? explosionCluster.partyId().get() : -1);
addAesItemId(byteStream, explosionCluster.id);
addName(byteStream, explosionCluster.name);
addEffectStart(byteStream, explosionCluster.effectStart.is_set() ? explosionCluster.effectStart.get() : -1);
addEffectDuration(byteStream, explosionCluster.effectDuration);
addArea(byteStream, explosionCluster.area);
addMhpCount(byteStream, static_cast<int32_t>(explosionCluster.mhPoints.size()));
addMhpRotation(byteStream, explosionCluster.mhpRotation);
addImpactCount(byteStream, explosionCluster.impactCount);
addChargeTypeId(byteStream, explosionCluster.chargeStruct.chargeTypeId);
addPartyId(byteStream, explosionCluster.partyId.is_set() ? explosionCluster.partyId.get() : -1);
isPrioritized = explosionCluster.impactCount() == 1; // we prioritize every single fire
isPrioritized = explosionCluster.impactCount == 1; // we prioritize every single fire
return byteStream;
}
@@ -251,7 +251,7 @@ void addAesType(QByteArray &buf, const AreaEffectSimulation::AesType &aesType)
using namespace AreaEffectSimulation;
// we treat EffectClusters as ExplosionClusters
addDdsEnumVal(buf, aesType == AesType::inner_enum::AtEffectCluster ? AesType::inner_enum::AtExplosionCluster : aesType);
addDdsEnumVal(buf, aesType == AesType::AtEffectCluster ? AesType::AtExplosionCluster : aesType);
}
void addAltitude(QByteArray &buf, int32_t altitude)
@@ -261,10 +261,10 @@ void addAltitude(QByteArray &buf, int32_t altitude)
void addArea(QByteArray &buf, const AreaEffectSimulation::Area &area)
{
addPosition2D(buf, area.cornerBottomLeft());
LtsUtils::set8Byte(area.width(), buf);
LtsUtils::set8Byte(area.height(), buf);
LtsUtils::set8Byte(area.rotation(), buf);
addPosition2D(buf, area.cornerBottomLeft);
LtsUtils::set8Byte(area.width, buf);
LtsUtils::set8Byte(area.height, buf);
LtsUtils::set8Byte(area.rotation, buf);
}
void addBorderLengthInner(QByteArray &buf, double borderLengthInner)
@@ -305,7 +305,7 @@ void addChargeTypeId(QByteArray &buf, int32_t chargeType)
template<typename T>
void addDdsEnumVal(QByteArray &buf, const T &ddsEnumVal)
{
LtsUtils::set4Byte(static_cast<int32_t>(ddsEnumVal.underlying()), buf);
LtsUtils::set4Byte(static_cast<int32_t>(ddsEnumVal), buf);
}
void addDeconMode(QByteArray &buf, const AreaEffectSimulation::AesOperatingMode &deconMode)
@@ -430,8 +430,8 @@ void addPointSymbol(QByteArray &buf, const std::string &pointSymbol)
void addPosition2D(QByteArray &buf, const Core::GeoPosition2D &position)
{
LtsUtils::set8Byte(position.lon(), buf);
LtsUtils::set8Byte(position.lat(), buf);
LtsUtils::set8Byte(position.lon, buf);
LtsUtils::set8Byte(position.lat, buf);
// no timestamp, as it is set in the client anyway
}
@@ -457,10 +457,10 @@ void addSegments(QByteArray &buf, const std::vector<AreaEffectSimulation::MineSe
for (const AreaEffectSimulation::MineSegment &currentMineSegment : qAsConst(segments))
{
addPosition2D(buf, currentMineSegment.positionStart());
addPosition2D(buf, currentMineSegment.positionStart);
lastSeg = currentMineSegment;
}
addPosition2D(buf, lastSeg.positionEnd());
addPosition2D(buf, lastSeg.positionEnd);
}
void addSpanAngle(QByteArray &buf, double spanAngle)
@@ -46,52 +46,52 @@ void CentralAesDataQueue::addRemoveMessage(int32_t aesItemId, AreaEffectSimulati
void CentralAesDataQueue::addRemoveMessage(const AreaEffectSimulation::EffectCluster &effectCluster)
{
// we treat EffectClusters as ExplosionClusters for the ABT
addRemoveMessage(effectCluster.id(), AreaEffectSimulation::AesType::inner_enum::AtExplosionCluster);
addRemoveMessage(effectCluster.id, AreaEffectSimulation::AesType::AtExplosionCluster);
}
void CentralAesDataQueue::addRemoveMessage(const AreaEffectSimulation::NContamination &nContamination)
{
addRemoveMessage(nContamination.id(), AreaEffectSimulation::AesType::inner_enum::AtNContamination);
addRemoveMessage(nContamination.id, AreaEffectSimulation::AesType::AtNContamination);
}
void CentralAesDataQueue::addRemoveMessage(const AreaEffectSimulation::BCContamination &bCContamination)
{
addRemoveMessage(bCContamination.id(), AreaEffectSimulation::AesType::inner_enum::AtBCContamination);
addRemoveMessage(bCContamination.id, AreaEffectSimulation::AesType::AtBCContamination);
}
void CentralAesDataQueue::addRemoveMessage(const AreaEffectSimulation::ExplosionArea &explosionArea)
{
addRemoveMessage(explosionArea.id(), AreaEffectSimulation::AesType::inner_enum::AtExplosionArea);
addRemoveMessage(explosionArea.id, AreaEffectSimulation::AesType::AtExplosionArea);
}
void CentralAesDataQueue::addRemoveMessage(const AreaEffectSimulation::ExplosionSingle &explosionSingle)
{
addRemoveMessage(explosionSingle.id(), AreaEffectSimulation::AesType::inner_enum::AtExplosionSingle);
addRemoveMessage(explosionSingle.id, AreaEffectSimulation::AesType::AtExplosionSingle);
}
void CentralAesDataQueue::addRemoveMessage(const AreaEffectSimulation::MineArea &mineArea)
{
addRemoveMessage(mineArea.id(), AreaEffectSimulation::AesType::inner_enum::AtMineArea);
addRemoveMessage(mineArea.id, AreaEffectSimulation::AesType::AtMineArea);
}
void CentralAesDataQueue::addRemoveMessage(const AreaEffectSimulation::FunctionalArea &functionalArea)
{
addRemoveMessage(functionalArea.id(), AreaEffectSimulation::AesType::inner_enum::AtFunctionalArea);
addRemoveMessage(functionalArea.id, AreaEffectSimulation::AesType::AtFunctionalArea);
}
void CentralAesDataQueue::addRemoveMessage(const AreaEffectSimulation::BoobyTrap &boobyTrap)
{
addRemoveMessage(boobyTrap.id(), AreaEffectSimulation::AesType::inner_enum::AtBoobyTrap);
addRemoveMessage(boobyTrap.id, AreaEffectSimulation::AesType::AtBoobyTrap);
}
void CentralAesDataQueue::addRemoveMessage(const AreaEffectSimulation::OffRouteMine &offRouteMine)
{
addRemoveMessage(offRouteMine.id(), AreaEffectSimulation::AesType::inner_enum::AtOffRouteMine);
addRemoveMessage(offRouteMine.id, AreaEffectSimulation::AesType::AtOffRouteMine);
}
void CentralAesDataQueue::addRemoveMessage(const AreaEffectSimulation::ExplosionCluster &explosionCluster)
{
addRemoveMessage(explosionCluster.id(), AreaEffectSimulation::AesType::inner_enum::AtExplosionCluster, explosionCluster.impactCount() == 1); // we prioritize every single fire
addRemoveMessage(explosionCluster.id, AreaEffectSimulation::AesType::AtExplosionCluster, explosionCluster.impactCount == 1); // we prioritize every single fire
}
QByteArray CentralAesDataQueue::getSendingData(qint32 size)
@@ -31,15 +31,15 @@ public:
QByteArray data;
bool isPrioritized = false; // we prioritize every single fire
clearSpecificMessage(aesItem.id(), OcSituation::AddMod);
clearSpecificMessage(aesItem.id, OcSituation::AddMod);
DataBuilder::addCentralAesChangeType(data, OcSituation::AddMod);
data.append(DataBuilder::getByteStreamAesItem(aesItem, isPrioritized));
if (isPrioritized)
m_internalPrioritizedQueue.enqueue({aesItem.id(), OcSituation::AddMod, data});
m_internalPrioritizedQueue.enqueue({aesItem.id, OcSituation::AddMod, data});
else
m_internalQueue.enqueue({aesItem.id(), OcSituation::AddMod, data});
m_internalQueue.enqueue({aesItem.id, OcSituation::AddMod, data});
DEBUG_LOG(m_logger) << "New AesItem added. " << m_internalQueue.size() << " normal, "
<< m_internalPrioritizedQueue.size() << " prioritized and "
@@ -34,7 +34,7 @@ bool DdsHandler::init(const QStringList &qosFileList)
m_dtcCore = Core::Interface::Dtc::create(m_ddsConnector);
bool bRet = m_dtcCore->enablePartitionTime();
connect(m_dtcCore.get(), &Core::Interface::Dtc::partitionTimeChanged,
this, [this](const Core::PartitionTime & t) { emit partitionTimeChanged(t.timeStamp());});
this, [this](const Core::PartitionTime & t) { emit partitionTimeChanged(t.timeStamp);});
// Pacemaker
m_pacemaker = std::make_shared<Core::Pacemaker>(m_ddsConnector);
@@ -158,14 +158,14 @@ void HandlerOcAesData::onIedPositionChanged(const GuezIedManagement::IedPosition
if (mod == DataModification::eRemoved)
return;
GuezIedManagement::Ied ied = m_gimDtc->ied(data.id());
if (ied.id() > 0)
GuezIedManagement::Ied ied = m_gimDtc->ied(data.id);
if (ied.id > 0)
{
if (ied.pairingState().underlying() != GuezIedManagement::IedPairingState::NotPaired)
m_iedPositionsToBeSend.insert(data.id(), data);
if (ied.pairingState != GuezIedManagement::IedPairingState::NotPaired)
m_iedPositionsToBeSend.insert(data.id, data);
}
else
ERROR_LOG(m_logger) << "Got ied position for not existing ID: " << data.id();
ERROR_LOG(m_logger) << "Got ied position for not existing ID: " << data.id;
}
void HandlerOcAesData::onCollectionTimeOutDemandDangerAreas()
@@ -189,7 +189,7 @@ void HandlerOcAesData::sendIedPositions()
}
TrainingAreaBase::SendOcDataRequest req;
req.equipmentNumber(0); // ied positions are always send broadcast
req.equipmentNumber = 0; // ied positions are always send broadcast
QByteArray data, payload;
int cnt = 0;
@@ -201,8 +201,8 @@ void HandlerOcAesData::sendIedPositions()
for (const auto &pos : qAsConst(m_iedPositionsToBeSend))
{
LtsUtils::set2Byte(m_gimDtc->ied(pos.id()).equipmentNumber(), data);
const QPointF relCoord(m_positionConverter->relativeFromGeographic(pos.position()));
LtsUtils::set2Byte(m_gimDtc->ied(pos.id).equipmentNumber, data);
const QPointF relCoord(m_positionConverter->relativeFromGeographic(pos.position));
LtsUtils::set3Byte(qRound(relCoord.x()), data);
LtsUtils::set3Byte(qRound(relCoord.y()), data);
@@ -218,7 +218,7 @@ void HandlerOcAesData::sendIedPositions()
DEBUG_LOG(m_logger) << "Uncompressed Data: " << data.toHex(' ');
DEBUG_LOG(m_logger) << "Compressed Data: " << ba.toHex(' ');
payload.append(ba);
req.payload(LtsUtils::convert<std::vector<uint8_t>>(payload));
req.payload = LtsUtils::convert<std::vector<uint8_t>>(payload);
m_tabFtc->sendOcDataRequest(req, this);
cnt = 0;
@@ -237,7 +237,7 @@ void HandlerOcAesData::sendIedPositions()
DEBUG_LOG(m_logger) << "Uncompressed Data: " << data.toHex(' ');
DEBUG_LOG(m_logger) << "Compressed Data: " << qCompress(data).toHex(' ');
payload.append(qCompress(data));
req.payload(LtsUtils::convert<std::vector<uint8_t>>(payload));
req.payload = LtsUtils::convert<std::vector<uint8_t>>(payload);
m_tabFtc->sendOcDataRequest(req, this);
}
@@ -262,7 +262,7 @@ void HandlerOcAesData::collectionTimeout(OcSituation::AesType type, const std::f
void HandlerOcAesData::sendDangerAreasToTab(int eqNumber)
{
TrainingAreaBase::SendOcDataRequest req;
req.equipmentNumber(eqNumber);
req.equipmentNumber = eqNumber;
const QMap<int, AreaEffectSimulation::DangerArea> dangerAreas = m_aesDtc->dangerAreas();
QByteArray data, payload;
@@ -275,18 +275,18 @@ void HandlerOcAesData::sendDangerAreasToTab(int eqNumber)
for (const auto &dangerArea : dangerAreas)
{
if (dangerArea.effectStateId() >= AreaEffectSimulation::AesEffectState::EsCreated) // do not transfer ended or deleted areas
if (dangerArea.effectStateId >= AreaEffectSimulation::AesEffectState::EsCreated) // do not transfer ended or deleted areas
{
LtsUtils::set2Byte(dangerArea.id(), data);
QByteArray name(QByteArray::fromStdString(dangerArea.name()));
LtsUtils::set2Byte(dangerArea.id, data);
QByteArray name(QByteArray::fromStdString(dangerArea.name));
name.resize(8);
data.append(name);
if (dangerArea.effectStart().is_set())
LtsUtils::set4Byte(dangerArea.effectStart().get() / 1000, data);
if (dangerArea.effectStart.is_set())
LtsUtils::set4Byte(dangerArea.effectStart.get() / 1000, data);
else
LtsUtils::set4Byte(0, data);
LtsUtils::set1Byte(dangerArea.segments().size(), data);
for (const auto &segment : dangerArea.segments())
LtsUtils::set1Byte(dangerArea.segments.size(), data);
for (const auto &segment : dangerArea.segments)
{
const QPointF relCoord(m_positionConverter->relativeFromGeographic(segment));
LtsUtils::set3Byte(qRound(relCoord.y()), data);
@@ -304,7 +304,7 @@ void HandlerOcAesData::sendDangerAreasToTab(int eqNumber)
DEBUG_LOG(m_logger) << "Uncompressed Data: " << data.toHex(' ');
DEBUG_LOG(m_logger) << "Compressed Data: " << ba.toHex(' ');
payload.append(ba);
req.payload(LtsUtils::convert<std::vector<uint8_t>>(payload));
req.payload = LtsUtils::convert<std::vector<uint8_t>>(payload);
m_tabFtc->sendOcDataRequest(req, this);
cnt = 0;
@@ -324,7 +324,7 @@ void HandlerOcAesData::sendDangerAreasToTab(int eqNumber)
DEBUG_LOG(m_logger) << "Uncompressed Data: " << data.toHex(' ');
DEBUG_LOG(m_logger) << "Compressed Data: " << qCompress(data).toHex(' ');
payload.append(qCompress(data));
req.payload(LtsUtils::convert<std::vector<uint8_t>>(payload));
req.payload = LtsUtils::convert<std::vector<uint8_t>>(payload);
m_tabFtc->sendOcDataRequest(req, this);
}
}
@@ -332,7 +332,7 @@ void HandlerOcAesData::sendDangerAreasToTab(int eqNumber)
void HandlerOcAesData::sendIedsToTab(int eqNumber)
{
TrainingAreaBase::SendOcDataRequest req;
req.equipmentNumber(eqNumber);
req.equipmentNumber = eqNumber;
const QMap<int, GuezIedManagement::Ied> ieds = m_gimDtc->ieds();
QByteArray data, payload;
@@ -345,20 +345,20 @@ void HandlerOcAesData::sendIedsToTab(int eqNumber)
for (const auto &ied : ieds)
{
LtsUtils::set2Byte(ied.equipmentNumber(), data);
LtsUtils::set1Byte(ied.type().underlying(), data);
uint8_t trigger = (uint8_t(ied.tautWireTrigger()) << 3) |
(uint8_t(ied.lightBarrierTrigger()) << 2) |
(uint8_t(ied.switchTrigger()) << 1) |
(uint8_t(ied.remoteTrigger()));
LtsUtils::set2Byte(ied.equipmentNumber, data);
LtsUtils::set1Byte(ied.type, data);
uint8_t trigger = (uint8_t(ied.tautWireTrigger) << 3) |
(uint8_t(ied.lightBarrierTrigger) << 2) |
(uint8_t(ied.switchTrigger) << 1) |
(uint8_t(ied.remoteTrigger));
LtsUtils::set1Byte(trigger, data);
LtsUtils::set1Byte(ied.explosiveForce(), data);
LtsUtils::set1Byte(ied.partyId(), data);
LtsUtils::set1Byte(ied.tacticalState().underlying(), data);
LtsUtils::set1Byte(ied.explosiveForce, data);
LtsUtils::set1Byte(ied.partyId, data);
LtsUtils::set1Byte(ied.tacticalState, data);
// set an initial position, as only paired ieds are updated concurrently
const auto pos = m_gimDtc->iedPosition(ied.id());
const QPointF relCoord(m_positionConverter->relativeFromGeographic(pos.position()));
const auto pos = m_gimDtc->iedPosition(ied.id);
const QPointF relCoord(m_positionConverter->relativeFromGeographic(pos.position));
LtsUtils::set3Byte(qRound(relCoord.x()), data);
LtsUtils::set3Byte(qRound(relCoord.y()), data);
@@ -374,7 +374,7 @@ void HandlerOcAesData::sendIedsToTab(int eqNumber)
DEBUG_LOG(m_logger) << "Uncompressed Data: " << data.toHex(' ');
DEBUG_LOG(m_logger) << "Compressed Data: " << ba.toHex(' ');
payload.append(ba);
req.payload(LtsUtils::convert<std::vector<uint8_t>>(payload));
req.payload = LtsUtils::convert<std::vector<uint8_t>>(payload);
m_tabFtc->sendOcDataRequest(req, this);
cnt = 0;
@@ -393,7 +393,7 @@ void HandlerOcAesData::sendIedsToTab(int eqNumber)
DEBUG_LOG(m_logger) << "Uncompressed Data: " << data.toHex(' ');
DEBUG_LOG(m_logger) << "Compressed Data: " << qCompress(data).toHex(' ');
payload.append(qCompress(data));
req.payload(LtsUtils::convert<std::vector<uint8_t>>(payload));
req.payload = LtsUtils::convert<std::vector<uint8_t>>(payload);
m_tabFtc->sendOcDataRequest(req, this);
}
}
@@ -149,71 +149,71 @@ HandlerOcCentralAesData::HandlerOcCentralAesData(const std::shared_ptr<DdsHandle
// fetch aes items
m_aesDtc->effectClusters([this](const AreaEffectSimulation::EffectCluster & data)
{
if (data.isCentral())
m_allCentralEffectClusters.insert(data.id(), data);
if (data.isCentral)
m_allCentralEffectClusters.insert(data.id, data);
});
TRACE_LOG(m_logger) << "Got " << m_allCentralEffectClusters.size() << " central EffectClusters on startup.";
m_aesDtc->nContaminations([this](const AreaEffectSimulation::NContamination & data)
{
if (data.isCentral())
m_allCentralNContaminations.insert(data.id(), data);
if (data.isCentral)
m_allCentralNContaminations.insert(data.id, data);
});
TRACE_LOG(m_logger) << "Got " << m_allCentralNContaminations.size() << " central NContaminations on startup.";
m_aesDtc->bCContaminations([this](const AreaEffectSimulation::BCContamination & data)
{
if (data.isCentral())
m_allCentralBCContaminations.insert(data.id(), data);
if (data.isCentral)
m_allCentralBCContaminations.insert(data.id, data);
});
TRACE_LOG(m_logger) << "Got " << m_allCentralBCContaminations.size() << " central BCContaminations on startup.";
m_aesDtc->explosionAreas([this](const AreaEffectSimulation::ExplosionArea & data)
{
if (data.isCentral())
m_allCentralExplosionsArea.insert(data.id(), data);
if (data.isCentral)
m_allCentralExplosionsArea.insert(data.id, data);
});
TRACE_LOG(m_logger) << "Got " << m_allCentralExplosionsArea.size() << " central ExplosionsAreas on startup.";
m_aesDtc->explosionSingles([this](const AreaEffectSimulation::ExplosionSingle & data)
{
if (data.isCentral())
m_allCentralExplosionsSingle.insert(data.id(), data);
if (data.isCentral)
m_allCentralExplosionsSingle.insert(data.id, data);
});
TRACE_LOG(m_logger) << "Got " << m_allCentralExplosionsSingle.size() << " central ExplosionsSingles on startup.";
m_aesDtc->mineAreas([this](const AreaEffectSimulation::MineArea & data)
{
if (data.isCentral())
m_allCentralMineAreas.insert(data.id(), data);
if (data.isCentral)
m_allCentralMineAreas.insert(data.id, data);
});
TRACE_LOG(m_logger) << "Got " << m_allCentralMineAreas.size() << " central MineAreas on startup.";
m_aesDtc->functionalAreas([this](const AreaEffectSimulation::FunctionalArea & data)
{
if (data.isCentral())
m_allCentralFunctionalAreas.insert(data.id(), data);
if (data.isCentral)
m_allCentralFunctionalAreas.insert(data.id, data);
});
TRACE_LOG(m_logger) << "Got " << m_allCentralFunctionalAreas.size() << " central FunctionalAreas on startup.";
m_aesDtc->boobyTraps([this](const AreaEffectSimulation::BoobyTrap & data)
{
if (data.isCentral())
m_allCentralBoobyTraps.insert(data.id(), data);
if (data.isCentral)
m_allCentralBoobyTraps.insert(data.id, data);
});
TRACE_LOG(m_logger) << "Got " << m_allCentralBoobyTraps.size() << " central BoobyTraps on startup.";
m_aesDtc->offRouteMines([this](const AreaEffectSimulation::OffRouteMine & data)
{
if (data.isCentral())
m_allCentralOffRouteMines.insert(data.id(), data);
if (data.isCentral)
m_allCentralOffRouteMines.insert(data.id, data);
});
TRACE_LOG(m_logger) << "Got " << m_allCentralOffRouteMines.size() << " central OffRouteMines on startup.";
m_aesDtc->explosionClusters([this](const AreaEffectSimulation::ExplosionCluster &data)
{
if (data.isCentral())
m_allCentralExplosionClusters.insert(data.id(), data);
if (data.isCentral)
m_allCentralExplosionClusters.insert(data.id, data);
});
TRACE_LOG(m_logger) << "Got " << m_allCentralExplosionClusters.size() << " central ExplosionClusters on startup.";
@@ -221,8 +221,8 @@ HandlerOcCentralAesData::HandlerOcCentralAesData(const std::shared_ptr<DdsHandle
QList<qint32> aesItemIds = allInternalAesItemIds();
m_aesDtc->aesItemViews([this, aesItemIds](const AreaEffectSimulation::AesItemView & data)
{
if (aesItemIds.contains(data.aesItemId()))
m_allCentralAesItemViews.insert(data.aesItemId(), data);
if (aesItemIds.contains(data.aesItemId))
m_allCentralAesItemViews.insert(data.aesItemId, data);
});
TRACE_LOG(m_logger) << "Got " << allInternalAesItemIds().size() << " central AesItems in total on startup. And " << m_allCentralAesItemViews.size() << " AesItemViews.";
@@ -269,7 +269,7 @@ void HandlerOcCentralAesData::setRequestCentralAesData(OcSituation::SituationCen
{
ParticipantManagement::Participant centerParticipant = m_ppmDtc->participant(m_ppmDtc->participantIdByEquipmentNumber(m_centerEquipmentId));
if (centerParticipant.id() <= 0)
if (centerParticipant.id <= 0)
{
ERROR_LOG(m_logger) << "Participant with EqId " << m_centerEquipmentId
<< " as center of the oc situation request does not exist!";
@@ -279,7 +279,7 @@ void HandlerOcCentralAesData::setRequestCentralAesData(OcSituation::SituationCen
{
const ParticipantManagement::ParticipantPosition &partPosition = m_ppmDtc->participantPosition(m_ppmDtc->participantIdByEquipmentNumber(m_centerEquipmentId));
if (partPosition.participantId() == 0)
if (partPosition.participantId == 0)
{
ERROR_LOG(m_logger) << "Participant with EqId " << m_centerEquipmentId
<< " as center of the oc situation request has no position!";
@@ -287,8 +287,8 @@ void HandlerOcCentralAesData::setRequestCentralAesData(OcSituation::SituationCen
}
else
{
m_centerPosition = partPosition.pos();
m_centerParticipantId = centerParticipant.id();
m_centerPosition = partPosition.pos;
m_centerParticipantId = centerParticipant.id;
}
}
if (endThread && ++m_retryCount < 5)
@@ -319,7 +319,7 @@ void HandlerOcCentralAesData::setRequestCentralAesData(OcSituation::SituationCen
endThread = true;
}
}
else if ((centerPosition.lon() == std::nan("")) || (centerPosition.lat() == std::nan("")))
else if ((centerPosition.lon == std::nan("")) || (centerPosition.lat == std::nan("")))
{
DEBUG_LOG(m_logger) << "m_centerParticipantId == 0";
endThread = true;
@@ -348,10 +348,10 @@ void HandlerOcCentralAesData::onParticipantPositionChanged(const ParticipantMana
{
if (modType != DataModification::eModified
|| m_centerType != OcSituation::SituationCenterType::Equipment
|| data.participantId() != m_centerParticipantId)
|| data.participantId != m_centerParticipantId)
return;
m_centerPosition = data.pos();
m_centerPosition = data.pos;
buildSituationCircle();
}
@@ -407,35 +407,35 @@ void HandlerOcCentralAesData::onExplosionClusterChanged(const AreaEffectSimulati
void HandlerOcCentralAesData::onAesItemViewChanged(const AreaEffectSimulation::AesItemView &data, DataModification modType)
{
const QVector<AreaEffectSimulation::AesType> validTypes = {AreaEffectSimulation::AesType::inner_enum::AtEffectCluster,
AreaEffectSimulation::AesType::inner_enum::AtNContamination,
AreaEffectSimulation::AesType::inner_enum::AtBCContamination ,
AreaEffectSimulation::AesType::inner_enum::AtExplosionArea,
AreaEffectSimulation::AesType::inner_enum::AtExplosionSingle,
AreaEffectSimulation::AesType::inner_enum::AtMineArea,
AreaEffectSimulation::AesType::inner_enum::AtFunctionalArea,
AreaEffectSimulation::AesType::inner_enum::AtBoobyTrap,
AreaEffectSimulation::AesType::inner_enum::AtOffRouteMine,
AreaEffectSimulation::AesType::inner_enum::AtExplosionCluster};
const QVector<AreaEffectSimulation::AesType> validTypes = {AreaEffectSimulation::AesType::AtEffectCluster,
AreaEffectSimulation::AesType::AtNContamination,
AreaEffectSimulation::AesType::AtBCContamination ,
AreaEffectSimulation::AesType::AtExplosionArea,
AreaEffectSimulation::AesType::AtExplosionSingle,
AreaEffectSimulation::AesType::AtMineArea,
AreaEffectSimulation::AesType::AtFunctionalArea,
AreaEffectSimulation::AesType::AtBoobyTrap,
AreaEffectSimulation::AesType::AtOffRouteMine,
AreaEffectSimulation::AesType::AtExplosionCluster};
if (!validTypes.contains(data.aesTypeId()))
if (!validTypes.contains(data.aesTypeId))
return;
switch (modType)
{
case DataModification::eAdded:
if (!allInternalAesItemIds().contains(data.aesItemId()))
if (!allInternalAesItemIds().contains(data.aesItemId))
return;
m_allCentralAesItemViews.insert(data.aesItemId(), data);
m_allCentralAesItemViews.insert(data.aesItemId, data);
break;
case DataModification::eModified:
{
if (!m_allCentralAesItemViews.contains(data.aesItemId()))
if (!m_allCentralAesItemViews.contains(data.aesItemId))
return;
m_allCentralAesItemViews[data.aesItemId()] = data;
m_allCentralAesItemViews[data.aesItemId] = data;
break;
}
@@ -521,10 +521,10 @@ void HandlerOcCentralAesData::handleSituation()
payload += m_bWithCompression ? qCompress(sendingData) : sendingData;
TrainingAreaBase::SendOcDataRequest req;
req.equipmentNumber(m_equipmentId);
req.payload(LtsUtils::convert<std::vector<uint8_t>>(payload));
req.equipmentNumber = m_equipmentId;
req.payload = LtsUtils::convert<std::vector<uint8_t>>(payload);
DEBUG_LOG(m_logger) << "Sending " << req.payload().size() << " Bytes payload.";
DEBUG_LOG(m_logger) << "Sending " << req.payload.size() << " Bytes payload.";
emit sendOcData(req);
}
@@ -568,7 +568,7 @@ void HandlerOcCentralAesData::fetchAesItemsInRange()
if (m_centerType == OcSituation::SituationCenterType::Equipment)
INFO_LOG(m_logger) << "Fetching AesItems in radius around equipment " << m_centerEquipmentId
<< " with position " << relCenterPos.x() << "/" << relCenterPos.y() << " and radius: " << m_radius << ", " << m_baseCoordinate.mgrs()
<< ", " << m_centerPosition.lon() << ", " << m_centerPosition.lat();
<< ", " << m_centerPosition.lon << ", " << m_centerPosition.lat;
else
INFO_LOG(m_logger) << "Fetching AesItems in radius of position " << relCenterPos.x() << "/" << relCenterPos.y() << " radius: " << m_radius;
@@ -612,17 +612,17 @@ qint32 HandlerOcCentralAesData::fetchAesItemsInCircle(const QHash<qint32, T> &ae
AreaEffectSimulation::AesItemView aesItemView = m_allCentralAesItemViews.value(it.key());
if (it.value().effectStateId() == AreaEffectSimulation::AesEffectState::inner_enum::EsExpired ||
it.value().effectStateId() == AreaEffectSimulation::AesEffectState::inner_enum::EsRemoved)
if (it.value().effectStateId == AreaEffectSimulation::AesEffectState::EsExpired ||
it.value().effectStateId == AreaEffectSimulation::AesEffectState::EsRemoved)
{
TRACE_LOG(m_logger) << "AesItem of type " << aesItemView.aesTypeId() << ", with id " << it.key() << " is removed or expired --> skipping.";
TRACE_LOG(m_logger) << "AesItem of type " << aesItemView.aesTypeId << ", with id " << it.key() << " is removed or expired --> skipping.";
continue;
}
#if QT_VERSION < QT_VERSION_CHECK(5,10,0)
if (polygonFromForm(aesItemView.form()).intersected(m_situationCircle).size() > 0)
#else
if (polygonFromForm(aesItemView.form()).intersects(m_situationCircle))
if (polygonFromForm(aesItemView.form).intersects(m_situationCircle))
#endif
{
m_aesItemsInRange.insert(it.key());
@@ -639,7 +639,7 @@ QPolygonF HandlerOcCentralAesData::polygonFromForm(const std::vector<Core::GeoPo
result.reserve(form.size());
for (const Core::GeoPosition &currentPosition : qAsConst(form))
result.append(PositionConverter::relativeFromGeographic({currentPosition.lon(), currentPosition.lat()}, m_baseCoordinate));
result.append(PositionConverter::relativeFromGeographic({currentPosition.lon, currentPosition.lat}, m_baseCoordinate));
return result;
}
@@ -698,32 +698,32 @@ void HandlerOcCentralAesData::removeKickedOutAesItems(const QSet<qint32> &aesIte
DEBUG_LOG(m_logger) << "Found " << kickedOutAesItems.size() << " AesItems to kick out.";
AreaEffectSimulation::AesType aesType = AreaEffectSimulation::AesType::inner_enum::AtUnknown;
AreaEffectSimulation::AesType aesType = AreaEffectSimulation::AesType::AtUnknown;
for (qint32 currentAesItemId : qAsConst(kickedOutAesItems))
{
if (m_allCentralAesItemViews.contains(currentAesItemId))
aesType = m_allCentralAesItemViews.value(currentAesItemId).aesTypeId();
aesType = m_allCentralAesItemViews.value(currentAesItemId).aesTypeId;
else if (m_allCentralEffectClusters.contains(currentAesItemId))
aesType = AreaEffectSimulation::AesType::inner_enum::AtEffectCluster;
aesType = AreaEffectSimulation::AesType::AtEffectCluster;
else if (m_allCentralNContaminations.contains(currentAesItemId))
aesType = AreaEffectSimulation::AesType::inner_enum::AtNContamination;
aesType = AreaEffectSimulation::AesType::AtNContamination;
else if (m_allCentralBCContaminations.contains(currentAesItemId))
aesType = AreaEffectSimulation::AesType::inner_enum::AtBCContamination;
aesType = AreaEffectSimulation::AesType::AtBCContamination;
else if (m_allCentralExplosionsArea.contains(currentAesItemId))
aesType = AreaEffectSimulation::AesType::inner_enum::AtExplosionArea;
aesType = AreaEffectSimulation::AesType::AtExplosionArea;
else if (m_allCentralExplosionsSingle.contains(currentAesItemId))
aesType = AreaEffectSimulation::AesType::inner_enum::AtExplosionSingle;
aesType = AreaEffectSimulation::AesType::AtExplosionSingle;
else if (m_allCentralMineAreas.contains(currentAesItemId))
aesType = AreaEffectSimulation::AesType::inner_enum::AtMineArea;
aesType = AreaEffectSimulation::AesType::AtMineArea;
else if (m_allCentralFunctionalAreas.contains(currentAesItemId))
aesType = AreaEffectSimulation::AesType::inner_enum::AtFunctionalArea;
aesType = AreaEffectSimulation::AesType::AtFunctionalArea;
else if (m_allCentralBoobyTraps.contains(currentAesItemId))
aesType = AreaEffectSimulation::AesType::inner_enum::AtBoobyTrap;
aesType = AreaEffectSimulation::AesType::AtBoobyTrap;
else if (m_allCentralOffRouteMines.contains(currentAesItemId))
aesType = AreaEffectSimulation::AesType::inner_enum::AtOffRouteMine;
aesType = AreaEffectSimulation::AesType::AtOffRouteMine;
else if (m_allCentralExplosionClusters.contains(currentAesItemId))
aesType = AreaEffectSimulation::AesType::inner_enum::AtExplosionCluster;
aesType = AreaEffectSimulation::AesType::AtExplosionCluster;
else
{
WARNING_LOG(m_logger) << "Could not remove AesItem with id " << currentAesItemId << ". There is no way to find out its AesType";
@@ -766,7 +766,7 @@ qreal HandlerOcCentralAesData::calculateDistanceToCircleCenter(qint32 aesItemId)
return -1.0;
}
QPolygonF aesItemForm = polygonFromForm(m_allCentralAesItemViews.value(aesItemId).form());
QPolygonF aesItemForm = polygonFromForm(m_allCentralAesItemViews.value(aesItemId).form);
QLineF distanceLine(aesItemForm.boundingRect().center(), m_situationCircle.boundingRect().center());
return distanceLine.length();
@@ -778,20 +778,20 @@ void HandlerOcCentralAesData::onAesItemChanged(QHash<qint32, T> &container, cons
switch (modType)
{
case DataModification::eAdded:
if (!data.isCentral())
if (!data.isCentral)
return;
container.insert(data.id(), data);
container.insert(data.id, data);
return;
case DataModification::eModified:
container[data.id()] = data;
container[data.id] = data;
if (m_aesItemsInRange.contains(data.id()))
if (m_aesItemsInRange.contains(data.id))
{
if (data.effectStateId() == AreaEffectSimulation::AesEffectState::inner_enum::EsExpired
|| data.effectStateId() == AreaEffectSimulation::AesEffectState::inner_enum::EsRemoved)
if (data.effectStateId == AreaEffectSimulation::AesEffectState::EsExpired
|| data.effectStateId == AreaEffectSimulation::AesEffectState::EsRemoved)
{
m_aesItemsInRange.remove(data.id());
m_aesItemsInRange.remove(data.id);
m_dataQueue->addRemoveMessage(data);
}
else
@@ -800,16 +800,16 @@ void HandlerOcCentralAesData::onAesItemChanged(QHash<qint32, T> &container, cons
return;
case DataModification::eRemoved:
container.remove(data.id());
container.remove(data.id);
if (m_allCentralAesItemViews.contains(data.id()))
if (m_allCentralAesItemViews.contains(data.id))
{
AreaEffectSimulation::AesItemView aesItemView = m_allCentralAesItemViews.take(data.id());
AreaEffectSimulation::AesItemView aesItemView = m_allCentralAesItemViews.take(data.id);
if (m_aesItemsInRange.contains(data.id()))
if (m_aesItemsInRange.contains(data.id))
{
m_aesItemsInRange.remove(data.id());
m_dataQueue->addRemoveMessage(data.id(), aesItemView.aesTypeId());
m_aesItemsInRange.remove(data.id);
m_dataQueue->addRemoveMessage(data.id, aesItemView.aesTypeId);
}
}
@@ -143,7 +143,7 @@ private:
AesItemInfo()
: id(-1)
, type(AreaEffectSimulation::AesType::inner_enum::AtUnknown)
, type(AreaEffectSimulation::AesType::AtUnknown)
{}
AesItemInfo(int32_t id, AreaEffectSimulation::AesType type)
@@ -155,8 +155,8 @@ void HandlerOcData::onSendOcDataReply(const Core::FunctionReplyObject &reply)
void HandlerOcData::onRegisterParticipantReply(const ParticipantManagement::RegisterReply &reply)
{
if (reply.errorString().size())
ERROR_LOG(m_logger) << "Modify Participant data could not be send: " << reply.errorString();
if (reply.errorString.size())
ERROR_LOG(m_logger) << "Modify Participant data could not be send: " << reply.errorString;
else
DEBUG_LOG(m_logger) << "Modify Participant data send successfully to ppm!";
}
@@ -166,8 +166,8 @@ void HandlerOcData::onEvaluationSchemaChanged(const Evaluations::EvaluationSchem
if ((modType != DataModification::eAdded) && (modType != DataModification::eModified))
return;
if (data.sendToTa())
m_currentActiveEvaluationSchemaId = data.id();
if (data.sendToTa)
m_currentActiveEvaluationSchemaId = data.id;
}
void HandlerOcData::onOcDataChanged(const TrainingAreaBase::OcData &data, DataModification modType)
@@ -175,10 +175,10 @@ void HandlerOcData::onOcDataChanged(const TrainingAreaBase::OcData &data, DataMo
if ((modType != DataModification::eAdded) && (modType != DataModification::eModified))
return;
if (data.sampleTime() < QDateTime::currentMSecsSinceEpoch() - 1000 * 60 * 10) // older than 10 mins -> ignore
if (data.sampleTime < QDateTime::currentMSecsSinceEpoch() - 1000 * 60 * 10) // older than 10 mins -> ignore
return;
const QByteArray payload = LtsUtils::toQByteArray(data.payload());
const QByteArray payload = LtsUtils::toQByteArray(data.payload);
unsigned int telegramId;
LtsUtils::get1Byte(payload, telegramId);
@@ -195,7 +195,7 @@ void HandlerOcData::onOcDataChanged(const TrainingAreaBase::OcData &data, DataMo
}
case OcSituation::TelegramId::DemandEvaluationSchema:
{
handleDemandEvaluationSchema(payload, data.equipmentNumber());
handleDemandEvaluationSchema(payload, data.equipmentNumber);
break;
}
case OcSituation::TelegramId::Evaluation:
@@ -205,7 +205,7 @@ void HandlerOcData::onOcDataChanged(const TrainingAreaBase::OcData &data, DataMo
}
case OcSituation::TelegramId::DemandSituation:
{
handleDemandSituation(payload, data.equipmentNumber());
handleDemandSituation(payload, data.equipmentNumber);
break;
}
case OcSituation::TelegramId::DemandAesItems:
@@ -213,7 +213,7 @@ void HandlerOcData::onOcDataChanged(const TrainingAreaBase::OcData &data, DataMo
OcSituation::AesType aesType;
size_t pos = 1;
LtsUtils::get1Byte(payload, pos, aesType);
m_handlerOcAesData->demandAesItems(aesType, data.equipmentNumber());
m_handlerOcAesData->demandAesItems(aesType, data.equipmentNumber);
break;
}
case OcSituation::TelegramId::EquipmentErrorRegistration:
@@ -248,7 +248,7 @@ void HandlerOcData::sendStateInformation()
LtsUtils::set2Byte(m_handlerOcAesData->iedResetCnt(), payload);
TrainingAreaBase::SendOcDataRequest out;
out.payload(LtsUtils::convert<std::vector<uint8_t>>(payload));
out.payload = LtsUtils::convert<std::vector<uint8_t>>(payload);
/*!
* \details Only if Tetra is connected, the OcData telegram will be send
* If we not check = A bunch of telegrams will be queued/stored until Tetra is connected, than Tetra is in Overload
@@ -257,9 +257,9 @@ void HandlerOcData::sendStateInformation()
while (conIt.hasNext())
{
conIt.next();
for (TrainingAreaBase::ConnectionState conState : conIt.value().connections())
for (TrainingAreaBase::ConnectionState conState : conIt.value().connections)
{
if (conState.name() == "TETRA" && conState.state() == false)
if (conState.name == "TETRA" && conState.state == false)
return;
}
}
@@ -297,39 +297,39 @@ void HandlerOcData::onSendEquipmentMessageOcRequest(const rti::core::SampleIdent
LtsUtils::set1Byte(OcSituation::TelegramId::Message, preparedPayload);
LtsUtils::set2Byte(0, preparedPayload); // dummy receiverId is individually set for each eqId in list
LtsUtils::set1Byte(Messaging::AddressType::ObserverController, preparedPayload);
LtsUtils::set2Byte(request.sender(), preparedPayload);
LtsUtils::set1Byte(request.senderType().underlying(), preparedPayload);
LtsUtils::set2Byte(request.sender, preparedPayload);
LtsUtils::set1Byte(request.senderType, preparedPayload);
LtsUtils::set2Byte(m_mainHandler->exerciseId(), preparedPayload);
preparedPayload.append(QByteArray::fromStdString(request.subject()));
preparedPayload.append(QByteArray::fromStdString(request.subject));
preparedPayload.append('\n'); // separating subject from message
preparedPayload.append(QByteArray::fromStdString(request.message()));
preparedPayload.append(QByteArray::fromStdString(request.message));
for (const auto equipmentNumber : request.equipmentNumbers())
for (const auto equipmentNumber : request.equipmentNumbers)
{
TrainingAreaBase::SendOcDataRequest out;
out.equipmentNumber(equipmentNumber);
out.equipmentNumber = equipmentNumber;
// replace 2 bytes with current receiver
QByteArray receiverId;
LtsUtils::set2Byte(equipmentNumber, receiverId);
QByteArray payload = preparedPayload.replace(1, 2, receiverId);
out.payload(LtsUtils::convert<std::vector<uint8_t>>(payload));
out.payload = LtsUtils::convert<std::vector<uint8_t>>(payload);
onSendOcData(out);
}
m_fts->sendEquipmentMessageOcReply(cookie, Core::FunctionReplyObject(request.requestId()));
m_fts->sendEquipmentMessageOcReply(cookie, Core::FunctionReplyObject(request.requestId));
}
void HandlerOcData::onEquipmentErrorRequest(const rti::core::SampleIdentity &cookie, const EquipmentErrorRequest &request)
{
ERROR_LOG(m_logger) << "onEquipmentErrorRequest" << request.equipmentNumber();
ERROR_LOG(m_logger) << "onEquipmentErrorRequest" << request.equipmentNumber;
EquipmentErrorRegistration out;
// out.id(request.requestId());
out.sampleTime(QDateTime::currentMSecsSinceEpoch());
out.participant(QString::number(request.equipmentNumber()).toStdString());
out.device(request.device());
out.text(request.text());
out.sampleTime = QDateTime::currentMSecsSinceEpoch();
out.participant = QString::number(request.equipmentNumber).toStdString();
out.device = request.device;
out.text = request.text;
m_dts->publish(out);
m_fts->equipmentErrorReply(cookie, Core::FunctionReplyObject(request.requestId()));
m_fts->equipmentErrorReply(cookie, Core::FunctionReplyObject(request.requestId));
}
void HandlerOcData::handleDemandSituation(const QByteArray &data, int equipmentId)
@@ -337,8 +337,8 @@ void HandlerOcData::handleDemandSituation(const QByteArray &data, int equipmentI
OcSituation::SituationCenterType centerType;
int centerEquipmentId = 0, radius = 0;
Core::GeoPosition2D position;
position.lon(std::nan(""));
position.lat(std::nan(""));
position.lon = std::nan("");
position.lat = std::nan("");
bool initial = false;
size_t pos = 1;
@@ -355,9 +355,9 @@ void HandlerOcData::handleDemandSituation(const QByteArray &data, int equipmentI
{
double tmp;
LtsUtils::get8Byte(data, pos, tmp);
position.lon(tmp);
position.lon = tmp;
LtsUtils::get8Byte(data, pos, tmp);
position.lat(tmp);
position.lat = tmp;
LtsUtils::get2Byte(data, pos, radius);
DEBUG_LOG(m_logger) << "Request from O/C-Laptop-Id: " << equipmentId
@@ -367,7 +367,7 @@ void HandlerOcData::handleDemandSituation(const QByteArray &data, int equipmentI
LtsUtils::get1Byte(data, pos, initial);
LtsUtils::get1Byte(data, pos, filterActive);
QSet<ParticipantManagement::TypeClass::type> typeClassList{};
QSet<ParticipantManagement::TypeClass> typeClassList{};
QSet<int> partyList{};
if (filterActive)
{
@@ -387,7 +387,7 @@ void HandlerOcData::handleDemandSituation(const QByteArray &data, int equipmentI
{
int typClass;
LtsUtils::get1Byte(data, pos, typClass);
typeClassList.insert((ParticipantManagement::TypeClass::type)typClass);
typeClassList.insert((ParticipantManagement::TypeClass)typClass);
}
}
@@ -444,14 +444,14 @@ void HandlerOcData::handleDemandEvaluationSchema(const QByteArray &data, int equ
DEBUG_LOG(m_logger) << "Sending to equipmentnumber: " << equipmentNumber << " evaluation schmema: " << m_currentActiveEvaluationSchemaId;
TrainingAreaBase::SendOcDataRequest out;
out.equipmentNumber(equipmentNumber);
out.equipmentNumber = equipmentNumber;
QByteArray payload;
LtsUtils::set1Byte(OcSituation::TelegramId::EvaluationSchema, payload);
LtsUtils::set2Byte(schema.id(), payload);
QByteArray compressed = qCompress(QByteArray::fromStdString(schema.schemadata()));
LtsUtils::set2Byte(schema.id, payload);
QByteArray compressed = qCompress(QByteArray::fromStdString(schema.schemadata));
payload.append(compressed);
out.payload(LtsUtils::convert<std::vector<uint8_t>>(payload));
out.payload = LtsUtils::convert<std::vector<uint8_t>>(payload);
onSendOcData(out);
}
@@ -464,27 +464,27 @@ void HandlerOcData::handleEvaluation(const QByteArray &data)
// get schema id
LtsUtils::get2Byte(data, pos, tmp);
out.schemaId(tmp);
out.schemaId = tmp;
// get sender operator id
LtsUtils::get4Byte(data, pos, tmp);
out.senderOperatorId(tmp);
out.senderOperatorId = tmp;
// get receiver operator id
LtsUtils::get4Byte(data, pos, tmp);
if (tmp > 0)
out.receiverOperatorId(dds::core::optional<int32_t>(tmp));
out.receiverOperatorId = dds::core::optional<int32_t>(tmp);
// get timeStamp
int64_t timeStamp;
LtsUtils::get8Byte(data, pos, timeStamp);
out.ts(timeStamp);
out.ts = timeStamp;
// get hierarchy string
unsigned int hierarchyLength;
LtsUtils::get2Byte(data, pos, hierarchyLength);
out.hierarchy(QByteArray(data.mid(pos, hierarchyLength)).toStdString());
out.hierarchy = QByteArray(data.mid(pos, hierarchyLength)).toStdString();
pos += hierarchyLength;
// get text string
unsigned int textLength;
LtsUtils::get2Byte(data, pos, textLength);
out.text(QByteArray(data.mid(pos, textLength)).toStdString());
out.text = QByteArray(data.mid(pos, textLength)).toStdString();
DEBUG_LOG(m_logger) << "Got new evl comment: " << out;
@@ -504,9 +504,9 @@ void HandlerOcData::handleMessage(const QByteArray &data)
recipientIds.push_back(tmp);
// get address type
LtsUtils::get1Byte(data, pos, addressType);
out.recipientType(static_cast<Messaging::AddressType::inner_enum>(addressType));
out.recipientType = static_cast<Messaging::AddressType>(addressType);
if (addressType == Messaging::AddressType::ObserverController)
if (addressType == static_cast<int>(Messaging::AddressType::ObserverController))
{
int participantId = m_ppmDtc->participantIdByEquipmentNumber(tmp);
if (participantId > 0)
@@ -517,48 +517,48 @@ void HandlerOcData::handleMessage(const QByteArray &data)
return;
}
}
out.recipientIds(recipientIds);
out.recipientIds = recipientIds;
// get sender
LtsUtils::get2Byte(data, pos, tmp);
LtsUtils::get1Byte(data, pos, addressType);
out.senderType(static_cast<Messaging::AddressType::inner_enum>(addressType));
if (addressType == Messaging::AddressType::ObserverController)
out.senderType = static_cast<Messaging::AddressType>(addressType);
if (addressType == static_cast<int>(Messaging::AddressType::ObserverController))
{
int participantId = m_ppmDtc->participantIdByEquipmentNumber(tmp);
if (participantId > 0)
out.senderId(participantId);
out.senderId = participantId;
else
{
WARNING_LOG(m_logger) << "Sender equipment number: " << tmp << " is unknown. Setting senderId to 0.";
out.senderId(0);
out.senderType(Messaging::AddressType::ObserverController);
out.senderId = 0;
out.senderType = Messaging::AddressType::ObserverController;
}
}
else
{
// no need to check if operator still exists, there is no harm if not
out.senderId(tmp);
out.senderId = tmp;
}
// get exerciseId
LtsUtils::get2Byte(data, pos, tmp);
if (tmp == 0)
WARNING_LOG(m_logger) << "Could'n set ExerciseId" << " " << tmp << " set to 0";
out.exerciseId(tmp);
out.exerciseId = tmp;
// get address type
const QByteArray msg(data.right(data.size() - pos));
int idx = msg.indexOf('\n');
if (idx < 0)
{
out.subject((tr("Message from %1").arg(out.senderId())).toStdString());
out.message(msg.constData());
out.subject = (tr("Message from %1").arg(out.senderId)).toStdString();
out.message = msg.constData();
}
else
{
out.subject(msg.left(idx).constData());
out.message(msg.mid(idx + 1).constData());
out.subject = msg.left(idx).constData();
out.message = msg.mid(idx + 1).constData();
}
DEBUG_LOG(m_logger) << "Got new message: " << out;
@@ -573,19 +573,19 @@ void HandlerOcData::handleEquipmentErrorRegistration(const QByteArray &data)
// equipmentNumber
LtsUtils::get2Byte(data, pos, tmp);
out.equipmentNumber(tmp);
out.equipmentNumber = tmp;
// participant
out.participant(data.mid(pos, 36).toStdString());
out.participant = data.mid(pos, 36).toStdString();
pos += 36;
// device
out.device(data.mid(pos, 36).toStdString());
out.device = data.mid(pos, 36).toStdString();
pos += 36;
// length
LtsUtils::get1Byte(data, pos, tmp);
// text
out.text(data.mid(pos, tmp).toStdString());
out.text = data.mid(pos, tmp).toStdString();
out.sampleTime(QDateTime::currentMSecsSinceEpoch());
out.sampleTime = QDateTime::currentMSecsSinceEpoch();
DEBUG_LOG(m_logger) << "Got new error registration: " << out;
m_dts->publish(out);
@@ -605,28 +605,28 @@ void HandlerOcData::handleEquipmentRegistration(const QByteArray &data)
ParticipantManagement::Participant part = m_ppmDtc->participant(participantId);
if (part.equipmentNumber().is_set() && equipmentNumber > 0)
if (part.equipmentNumber.is_set() && equipmentNumber > 0)
{
// we need a deregistration first!
ParticipantManagement::RegisterParticipantRequest dereq;
dereq.assignState(ParticipantManagement::ParticipantAssignState::NotAssigned);
dereq.equipmentNumber(0);
dereq.participantId(participantId);
dereq.info(part.info());
dereq.identification(part.identification());
dereq.assignState = ParticipantManagement::ParticipantAssignState::NotAssigned;
dereq.equipmentNumber = 0;
dereq.participantId = participantId;
dereq.info = part.info;
dereq.identification = part.identification;
m_ppmFtc->registerParticipantRequest(dereq, this);
}
ParticipantManagement::RegisterParticipantRequest req;
if (equipmentNumber > 0)
req.assignState(ParticipantManagement::ParticipantAssignState::HandoutExcon);
req.assignState = ParticipantManagement::ParticipantAssignState::HandoutExcon;
else
req.assignState(ParticipantManagement::ParticipantAssignState::NotAssigned);
req.equipmentNumber(equipmentNumber);
req.participantId(participantId);
req.info(part.info());
req.identification(part.identification());
DEBUG_LOG(m_logger) << "Try to register part with id: " << req.participantId() << " and eqNumeber " << req.equipmentNumber();
req.assignState = ParticipantManagement::ParticipantAssignState::NotAssigned;
req.equipmentNumber = equipmentNumber;
req.participantId = participantId;
req.info = part.info;
req.identification = part.identification;
DEBUG_LOG(m_logger) << "Try to register part with id: " << req.participantId << " and eqNumeber " << req.equipmentNumber;
m_ppmFtc->registerParticipantRequest(req, this);
}
@@ -27,7 +27,7 @@ ThreadOcSituationData::ThreadOcSituationData(MainHandler *mainHandler,
int radius,
bool filterActive,
QSet<int> partys,
QSet<ParticipantManagement::TypeClass::type> typeClasses)
QSet<ParticipantManagement::TypeClass> typeClasses)
: m_baseCoordinate(mainHandler->positionConverter()->baseCoordinate())
, m_equipmentId(equipmentId)
, m_centerEquipmentId(centerEquipmentId)
@@ -45,7 +45,7 @@ void ThreadOcSituationData::requestOcSituationData(OcSituation::SituationCenterT
int radius,
bool filterActive,
QSet<int> partyList,
QSet<ParticipantManagement::TypeClass::type> typeClassList,
QSet<ParticipantManagement::TypeClass> typeClassList,
bool initial)
{
INFO_LOG(m_logger) << "OC-Situation Request for centerEquipmentId: " << centerEquipmentId
@@ -157,7 +157,7 @@ void HandlerOcSituationData::setRequestOcSituationData(OcSituation::SituationCen
int radius,
bool filterActive,
QSet<int> partys,
QSet<ParticipantManagement::TypeClass::type> typeClasses,
QSet<ParticipantManagement::TypeClass> typeClasses,
bool initial)
{
TRACE_LOG(m_logger) << "Thread " << QThread::currentThreadId() << " function: " << LOGFUNCTION;
@@ -185,14 +185,14 @@ void HandlerOcSituationData::setRequestOcSituationData(OcSituation::SituationCen
ParticipantManagement::Participant centerParticipant;
for (const auto &participant : qAsConst(m_allParticipants))
{
if (participant.equipmentNumber().is_set() && participant.equipmentNumber().get() == m_centerEquipmentId)
if (participant.equipmentNumber.is_set() && participant.equipmentNumber.get() == m_centerEquipmentId)
{
centerParticipant = participant;
break;
}
};
if (centerParticipant.id() <= 0)
if (centerParticipant.id <= 0)
{
ERROR_LOG(m_logger) << "Participant with EqId " << m_centerEquipmentId
<< " as center of the oc situation request does not exist!";
@@ -200,8 +200,8 @@ void HandlerOcSituationData::setRequestOcSituationData(OcSituation::SituationCen
}
else
{
const ParticipantManagement::ParticipantPosition &partPosition = m_allParticipantPositions.value(centerParticipant.id());
if (partPosition.participantId() == 0)
const ParticipantManagement::ParticipantPosition &partPosition = m_allParticipantPositions.value(centerParticipant.id);
if (partPosition.participantId == 0)
{
ERROR_LOG(m_logger) << "Participant with EqId " << m_centerEquipmentId
<< " as center of the oc situation request has no position!";
@@ -209,8 +209,8 @@ void HandlerOcSituationData::setRequestOcSituationData(OcSituation::SituationCen
}
else
{
m_centerPosition = partPosition.pos();
m_centerParticipantId = centerParticipant.id();
m_centerPosition = partPosition.pos;
m_centerParticipantId = centerParticipant.id;
}
}
if (endThread && ++m_retryCount < 5)
@@ -238,7 +238,7 @@ void HandlerOcSituationData::setRequestOcSituationData(OcSituation::SituationCen
if (m_centerParticipantId == 0)
endThread = true;
}
else if ((centerPosition.lon() == std::nan("")) || (centerPosition.lat() == std::nan("")))
else if ((centerPosition.lon == std::nan("")) || (centerPosition.lat == std::nan("")))
endThread = true;
}
@@ -263,7 +263,7 @@ void HandlerOcSituationData::onParticipantChanged(const ParticipantManagement::P
if (modType == DataModification::eRemoved)
return;
const int participantId = data.id();
const int participantId = data.id;
m_allParticipants[participantId] = data;
if (!m_participants.contains(participantId))
@@ -276,16 +276,16 @@ void HandlerOcSituationData::onParticipantChanged(const ParticipantManagement::P
const ParticipantManagement::Participant &oldParticipantData = m_participants[participantId];
// check structure
if (oldParticipantData.equipmentNumber() != data.equipmentNumber() ||
oldParticipantData.superiorId() != data.superiorId() ||
oldParticipantData.symbol() != data.symbol() ||
oldParticipantData.typeId() != data.typeId() ||
oldParticipantData.partyId() != data.partyId())
if (oldParticipantData.equipmentNumber != data.equipmentNumber ||
oldParticipantData.superiorId != data.superiorId ||
oldParticipantData.symbol != data.symbol ||
oldParticipantData.typeId != data.typeId ||
oldParticipantData.partyId != data.partyId)
setModified(participantId, OcSituation::ModificationFlag::eStructure);
// check designator
if (oldParticipantData.designator() != data.designator() ||
oldParticipantData.tacticalIdentifier() != data.tacticalIdentifier())
if (oldParticipantData.designator != data.designator ||
oldParticipantData.tacticalIdentifier != data.tacticalIdentifier)
setModified(participantId, OcSituation::ModificationFlag::eDesignator);
m_participants[participantId] = data;
@@ -303,9 +303,9 @@ static inline int getEquipmentStateBits(const ParticipantManagement::DynamicPart
{
int ret = 0;
ret |= int(data.hasNbcProtectionConfigured()) << 1;
ret |= int(data.hasNbcProtectionActive()) << 2;
ret |= int(data.manipulation().size() > 0) << 7;
ret |= int(data.hasNbcProtectionConfigured) << 1;
ret |= int(data.hasNbcProtectionActive) << 2;
ret |= int(data.manipulation.size() > 0) << 7;
return ret;
}
@@ -316,7 +316,7 @@ void HandlerOcSituationData::onDynamicParticipantDataChanged(const ParticipantMa
if (modType == DataModification::eRemoved)
return;
const int participantId = data.participantId();
const int participantId = data.participantId;
m_allDynamicParticpantData[participantId] = data;
if (!m_participants.contains(participantId))
@@ -329,12 +329,12 @@ void HandlerOcSituationData::onDynamicParticipantDataChanged(const ParticipantMa
const ParticipantManagement::DynamicParticipantData &oldDynamicData = m_dynamicParticpantData[participantId];
// check injury state
ParticipantManagement::StateInformation newYoungestInformation = ParticipantManagement::youngestStateInformation(data.stateHistory());
ParticipantManagement::StateInformation oldYoungestInformation = ParticipantManagement::youngestStateInformation(oldDynamicData.stateHistory());
if (oldYoungestInformation.stateTime() != newYoungestInformation.stateTime() ||
oldYoungestInformation.vulnerabilityState() != newYoungestInformation.vulnerabilityState() ||
oldYoungestInformation.vulnerabilityBits() != newYoungestInformation.vulnerabilityBits() || // TODO: do we really want to send those bit?
m_allParticipants.value(oldYoungestInformation.originatorId()).partyId() != m_allParticipants.value(newYoungestInformation.originatorId()).partyId())
ParticipantManagement::StateInformation newYoungestInformation = ParticipantManagement::youngestStateInformation(data.stateHistory);
ParticipantManagement::StateInformation oldYoungestInformation = ParticipantManagement::youngestStateInformation(oldDynamicData.stateHistory);
if (oldYoungestInformation.stateTime != newYoungestInformation.stateTime ||
oldYoungestInformation.vulnerabilityState != newYoungestInformation.vulnerabilityState ||
oldYoungestInformation.vulnerabilityBits != newYoungestInformation.vulnerabilityBits || // TODO: do we really want to send those bit?
m_allParticipants.value(oldYoungestInformation.originatorId).partyId != m_allParticipants.value(newYoungestInformation.originatorId).partyId)
setModified(participantId, OcSituation::ModificationFlag::eVBG);
// check special bits
@@ -357,13 +357,13 @@ void HandlerOcSituationData::onParticipantPositionChanged(const ParticipantManag
TRACE_LOG(m_logger) << "Thread " << QThread::currentThreadId() << " function: " << LOGFUNCTION;
if (modType == DataModification::eRemoved)
return;
const int participantId = data.participantId();
const int participantId = data.participantId;
m_allParticipantPositions[participantId] = data;
// update current center position when we're following a participant
if (m_centerType == OcSituation::SituationCenterType::Equipment &&
participantId == m_centerParticipantId)
m_centerPosition = data.pos();
m_centerPosition = data.pos;
if (!m_participants.contains(participantId))
{
@@ -375,10 +375,10 @@ void HandlerOcSituationData::onParticipantPositionChanged(const ParticipantManag
const ParticipantManagement::ParticipantPosition &oldPosition = m_participantPositions[participantId];
// check for ePosition / ePosition3D
if (oldPosition.sampleTime() <= data.sampleTime())
if (oldPosition.sampleTime <= data.sampleTime)
{
//bool isNullOld = qFuzzyIsNull(oldPosition.pos().z());
bool isNullNew = qFuzzyIsNull(data.pos().z());
bool isNullNew = qFuzzyIsNull(data.pos.z);
// if (isNullOld && isNullNew)
if (isNullNew)
@@ -419,13 +419,13 @@ void HandlerOcSituationData::onAesItemViewChanged(const AreaEffectSimulation::Ae
{
case DataModification::eAdded:
case DataModification::eModified:
if (data.partyId().is_set())
m_aesId2PartyId[data.id()] = data.partyId().get();
if (data.partyId.is_set())
m_aesId2PartyId[data.id] = data.partyId.get();
else
m_aesId2PartyId.remove(data.id());
m_aesId2PartyId.remove(data.id);
break;
case DataModification::eRemoved:
m_aesId2PartyId.remove(data.id());
m_aesId2PartyId.remove(data.id);
break;
}
}
@@ -435,7 +435,7 @@ void HandlerOcSituationData::onDusMineStateChanged(const AreaEffectSimulation::D
auto copy = m_dynamicParticpantData;
for (const ParticipantManagement::DynamicParticipantData &dynPartData : qAsConst(copy))
{
if (!m_participantWithMaybeMissingPartyId.contains(dynPartData.participantId()))
if (!m_participantWithMaybeMissingPartyId.contains(dynPartData.participantId))
continue;
onDynamicParticipantDataChanged(dynPartData, DataModification::eModified);
}
@@ -474,8 +474,8 @@ void HandlerOcSituationData::handleSituation()
updatePrioOfNotSendParticipants();
TrainingAreaBase::SendOcDataRequest req;
req.equipmentNumber(m_equipmentId);
req.payload(LtsUtils::convert<std::vector<uint8_t>>(payload));
req.equipmentNumber = m_equipmentId;
req.payload = LtsUtils::convert<std::vector<uint8_t>>(payload);
emit sendOcData(req);
}
@@ -519,7 +519,7 @@ void HandlerOcSituationData::fetchParticipantsInRange()
if (m_centerType == OcSituation::SituationCenterType::Equipment)
INFO_LOG(m_logger) << "Fetching participants in radius around equipment " << m_centerEquipmentId
<< " with position " << relCenterPos.x() << "/" << relCenterPos.y() << " and radius: " << m_radius << ", " << m_baseCoordinate.mgrs()
<< ", " << m_centerPosition.lon() << ", " << m_centerPosition.lat();
<< ", " << m_centerPosition.lon << ", " << m_centerPosition.lat;
else
INFO_LOG(m_logger) << "Fetching participants in radius of position " << relCenterPos.x() << "/" << relCenterPos.y() << " radius: " << m_radius;
@@ -530,22 +530,22 @@ void HandlerOcSituationData::fetchParticipantsInRange()
for (const auto &position : qAsConst(m_allParticipantPositions))
{
if (!LtsUtils::isPositionTimeOutdated(m_partitionTime, position.sampleTime())) // only if position is not outdated
if (!LtsUtils::isPositionTimeOutdated(m_partitionTime, position.sampleTime)) // only if position is not outdated
{
ParticipantManagement::Participant participant = m_allParticipants.value(position.participantId());
if (!participant.equipmentNumber().is_set() || participant.partyId() == 0)
ParticipantManagement::Participant participant = m_allParticipants.value(position.participantId);
if (!participant.equipmentNumber.is_set() || participant.partyId == 0)
continue; // no units and participants without equipmentnumber or party: pool
if (m_filterActive)
{
ParticipantManagement::TypeClass typeClass = m_ppmDtc->type(participant.typeId()).typeClass();
if ((m_partyList.count() > 0 && m_partyList.contains(participant.partyId()) == false) ||
(m_typeClassList.count() > 0 && m_typeClassList.contains(typeClass.underlying()) == false))
ParticipantManagement::TypeClass typeClass = m_ppmDtc->type(participant.typeId).typeClass;
if ((m_partyList.count() > 0 && m_partyList.contains(participant.partyId) == false) ||
(m_typeClassList.count() > 0 && m_typeClassList.contains(typeClass) == false))
{
DEBUG_LOG(m_logger) << participant.id() << " filtered out";
DEBUG_LOG(m_logger) << participant.id << " filtered out";
continue;
}
}
const QPointF relPartPos(PositionConverter::relativeFromGeographic(position.pos(), m_baseCoordinate));
const QPointF relPartPos(PositionConverter::relativeFromGeographic(position.pos, m_baseCoordinate));
double x = relCenterPos.x() - relPartPos.x();
double y = relCenterPos.y() - relPartPos.y();
@@ -553,16 +553,16 @@ void HandlerOcSituationData::fetchParticipantsInRange()
if (distanceSqr > rangeSqr)
{
DEBUG_LOG(m_logger) << "Participant NOT in range equipment number: " << participant.equipmentNumber().get()
DEBUG_LOG(m_logger) << "Participant NOT in range equipment number: " << participant.equipmentNumber.get()
<< " pos: " << relPartPos.x() << "/" << relPartPos.y()
<< " distance: " << std::sqrt(distanceSqr) << " distanceSqr: " << distanceSqr;
continue;
}
DEBUG_LOG(m_logger) << "Participant in range equipment number: " << participant.equipmentNumber().get()
DEBUG_LOG(m_logger) << "Participant in range equipment number: " << participant.equipmentNumber.get()
<< " pos: " << relPartPos.x() << "/" << relPartPos.y()
<< " distance: " << std::sqrt(distanceSqr) << " distanceSqr: " << distanceSqr;
curParticipantsInRange.insertMulti(distanceSqr, participant.id());
curParticipantsInRange.insertMulti(distanceSqr, participant.id);
}
}
m_participantOverloaded = quint32(curParticipantsInRange.count()) > Settings::maxParticipantsInSituation();
@@ -583,7 +583,7 @@ void HandlerOcSituationData::fetchParticipantsInRange()
// insert participants, that are now out of range/outdated
for (const auto &oldPart : oldParticipants)
{
const int id = oldPart.id();
const int id = oldPart.id;
if (!curParticipants.contains(id))
{
if (!m_outdatedParticipants.contains(id))
@@ -601,9 +601,9 @@ void HandlerOcSituationData::handleParticipant(const ParticipantManagement::Part
{
TRACE_LOG(m_logger) << "Thread " << QThread::currentThreadId() << " function: " << LOGFUNCTION;
int participantId = participant.id();
if (participant.equipmentNumber().is_set())
m_participantId2EqId[participantId] = participant.equipmentNumber().get();
int participantId = participant.id;
if (participant.equipmentNumber.is_set())
m_participantId2EqId[participantId] = participant.equipmentNumber.get();
else
m_participantId2EqId.remove(participantId);
@@ -653,8 +653,8 @@ QVector<QPair<int, float>> HandlerOcSituationData::createPrioQueue() const
if (!m_participants.contains(participantId))
continue;
const ParticipantManagement::ParticipantPosition &position = m_participantPositions[participantId];
float x = m_centerPosition.lon() - position.pos().lon();
float y = m_centerPosition.lat() - position.pos().lon();
float x = m_centerPosition.lon - position.pos.lon;
float y = m_centerPosition.lat - position.pos.lon;
float r2 = x * x + y * y;
float prio = r2;
int cntNotSendDbg = 0;
@@ -834,8 +834,8 @@ void HandlerOcSituationData::addPosition2D(QByteArray &buf, const ParticipantMan
{
if (!bAdd)
return;
LtsUtils::set8Byte(data.pos().lon(), buf);
LtsUtils::set8Byte(data.pos().lat(), buf);
LtsUtils::set8Byte(data.pos.lon, buf);
LtsUtils::set8Byte(data.pos.lat, buf);
// no timestamp, as it is set in the client anyway
}
@@ -845,9 +845,9 @@ void HandlerOcSituationData::addPosition3D(QByteArray &buf, const ParticipantMan
if (!bAdd)
return;
addPosition2D(buf, data, bAdd);
LtsUtils::set8Byte(data.pos().z(), buf);
LtsUtils::set2Byte(data.buildingId(), buf);
LtsUtils::set4Byte(data.roomId(), buf);
LtsUtils::set8Byte(data.pos.z, buf);
LtsUtils::set2Byte(data.buildingId, buf);
LtsUtils::set4Byte(data.roomId, buf);
}
void HandlerOcSituationData::addVBG(QByteArray &buf, const ParticipantManagement::DynamicParticipantData &data, bool bAdd) const
@@ -855,78 +855,78 @@ void HandlerOcSituationData::addVBG(QByteArray &buf, const ParticipantManagement
if (!bAdd)
return;
const ParticipantManagement::StateInformation &youngestStateInformation = ParticipantManagement::youngestStateInformation(data.stateHistory(), true, false);
const ParticipantManagement::StateInformation &youngestStateInformation = ParticipantManagement::youngestStateInformation(data.stateHistory, true, false);
LtsUtils::set1Byte(youngestStateInformation.vulnerabilityState().underlying(), buf);
LtsUtils::set4Byte(youngestStateInformation.vulnerabilityKindId(), buf);
LtsUtils::set2Byte(youngestStateInformation.vulnerabilityBits(), buf);
LtsUtils::set1Byte(youngestStateInformation.vulnerabilityState, buf);
LtsUtils::set4Byte(youngestStateInformation.vulnerabilityKindId, buf);
LtsUtils::set2Byte(youngestStateInformation.vulnerabilityBits, buf);
int injuryPartyId = 1;
switch (youngestStateInformation.originatorType().underlying())
switch (youngestStateInformation.originatorType)
{
case ProjectDataManagement::StateChangeOriginator_def::Unknown:
case ProjectDataManagement::StateChangeOriginator_def::ExerciseControl:
case ProjectDataManagement::StateChangeOriginator_def::ObserverController:
case ProjectDataManagement::StateChangeOriginator_def::Initialization:
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_Unknown:
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_ExerciseControl:
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_ObserverController:
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_Initialization:
injuryPartyId = 1; // O/C
break;
case ProjectDataManagement::StateChangeOriginator_def::Participant:
injuryPartyId = m_allParticipants.value(youngestStateInformation.originatorId()).partyId();
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_Participant:
injuryPartyId = m_allParticipants.value(youngestStateInformation.originatorId).partyId;
if (injuryPartyId == 0)
injuryPartyId = 1;
break;
case ProjectDataManagement::StateChangeOriginator_def::AreaEffectSimulation:
case ProjectDataManagement::StateChangeOriginator_def::FunctionalArea:
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_AreaEffectSimulation:
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_FunctionalArea:
{
auto it = m_aesId2PartyId.constFind(youngestStateInformation.originatorId());
auto it = m_aesId2PartyId.constFind(youngestStateInformation.originatorId);
if (it != m_aesId2PartyId.constEnd())
injuryPartyId = it.value();
break;
}
case ProjectDataManagement::StateChangeOriginator_def::DusMine:
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_DusMine:
{
int partyId = m_aesDtc->partyForDusMine(youngestStateInformation.originatorId());
int partyId = m_aesDtc->partyForDusMine(youngestStateInformation.originatorId);
if (partyId >= 0)
injuryPartyId = partyId;
if (partyId == -1)
m_participantWithMaybeMissingPartyId.insert(data.participantId());
m_participantWithMaybeMissingPartyId.insert(data.participantId);
else
m_participantWithMaybeMissingPartyId.remove(data.participantId());
m_participantWithMaybeMissingPartyId.remove(data.participantId);
break;
}
case ProjectDataManagement::StateChangeOriginator_def::ImprovisedExplosiveDevice:
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_ImprovisedExplosiveDevice:
{
const auto ied = m_gimDtc->iedForEquipmentNumber(youngestStateInformation.originatorId());
if (ied.equipmentNumber() != 0)
injuryPartyId = ied.partyId();
const auto ied = m_gimDtc->iedForEquipmentNumber(youngestStateInformation.originatorId);
if (ied.equipmentNumber != 0)
injuryPartyId = ied.partyId;
break;
}
case ProjectDataManagement::StateChangeOriginator_def::WoundTreatmentDevice:
case ProjectDataManagement::StateChangeOriginator_def::MaintainanceDevice:
case ProjectDataManagement::StateChangeOriginator_def::Sanitation:
case ProjectDataManagement::StateChangeOriginator_def::MedicalTimeout:
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_WoundTreatmentDevice:
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_MaintainanceDevice:
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_Sanitation:
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_MedicalTimeout:
// not yet used
break;
}
LtsUtils::set1Byte(injuryPartyId, buf);
if (m_bWithVBGTime)
LtsUtils::set4Byte(youngestStateInformation.stateTime() / 1000, buf);
LtsUtils::set4Byte(youngestStateInformation.stateTime / 1000, buf);
//add vitality and sanitation result
// Quick fix: If vitality is
uint8_t vitRes = (youngestStateInformation.vitality() / 10);
uint8_t vitRes = (youngestStateInformation.vitality / 10);
if (vitRes > 10)
{
WARNING_LOG(m_logger) << "Vitality of Participant " << data.participantId() << " is not between 0 and 100%. Putting to 100%";
WARNING_LOG(m_logger) << "Vitality of Participant " << data.participantId << " is not between 0 and 100%. Putting to 100%";
vitRes = 10;
}
vitRes += ((int)youngestStateInformation.sanitationResult().underlying() << 4);
vitRes += ((int)youngestStateInformation.sanitationResult << 4);
LtsUtils::set1Byte(vitRes, buf);
//finall 1 Byte for originator and maybe more
LtsUtils::set1Byte(youngestStateInformation.originatorType().underlying(), buf);
LtsUtils::set1Byte(youngestStateInformation.originatorType, buf);
}
@@ -942,9 +942,9 @@ void HandlerOcSituationData::addStructure(QByteArray &buf, const ParticipantMana
{
if (!bAdd)
return;
LtsUtils::set2Byte(data.equipmentNumber().is_set() ? data.equipmentNumber().get() : 0, buf);
LtsUtils::set2Byte(data.typeId(), buf);
LtsUtils::set2Byte(data.partyId(), buf);
LtsUtils::set2Byte(data.equipmentNumber.is_set() ? data.equipmentNumber.get() : 0, buf);
LtsUtils::set2Byte(data.typeId, buf);
LtsUtils::set2Byte(data.partyId, buf);
#ifndef GUEZ_MODE
LtsUtils::set2Byte(data.superiorId(), buf);
#endif
@@ -954,29 +954,29 @@ void HandlerOcSituationData::addDesignator(QByteArray &buf, const ParticipantMan
{
if (!bAdd)
return;
const size_t len1 = std::min(data.designator().size(), size_t(15));
const size_t len2 = std::min(data.tacticalIdentifier().size(), size_t(15));
const size_t len1 = std::min(data.designator.size(), size_t(15));
const size_t len2 = std::min(data.tacticalIdentifier.size(), size_t(15));
unsigned char len = ((len1 & 0x0F) | ((len2 & 0x0F) << 4));
LtsUtils::set1Byte(len, buf);
buf.append(data.designator().c_str(), len1);
buf.append(data.tacticalIdentifier().c_str(), len2);
buf.append(data.designator.c_str(), len1);
buf.append(data.tacticalIdentifier.c_str(), len2);
}
void HandlerOcSituationData::addSymbolSidc(QByteArray &buf, const ParticipantManagement::Participant &data, bool bAdd) const
{
if (!bAdd)
return;
const auto type = m_ppmDtc->type(data.typeId());
if (type.symbol() == data.symbol())
const auto type = m_ppmDtc->type(data.typeId);
if (type.symbol == data.symbol)
{
LtsUtils::set1Byte(0, buf); // 0 bytes -> marker for not sending the symbol sidc since it can be taken from the type
return;
}
if (data.symbol().size() > 255)
if (data.symbol.size() > 255)
return;
const size_t len1 = std::min(data.symbol().size(), size_t(255));
const size_t len1 = std::min(data.symbol.size(), size_t(255));
LtsUtils::set1Byte(len1, buf);
buf.append(data.symbol().c_str(), len1);
buf.append(data.symbol.c_str(), len1);
}
} // namespace OcSituationServer
@@ -40,7 +40,7 @@ public:
int radius,
bool filterActive,
QSet<int> partys,
QSet<ParticipantManagement::TypeClass::type> typeClasses);
QSet<ParticipantManagement::TypeClass> typeClasses);
public slots:
void requestOcSituationData(OcSituation::SituationCenterType centerType,
@@ -49,7 +49,7 @@ public slots:
int radius,
bool filterActive,
QSet<int> partyList,
QSet<ParticipantManagement::TypeClass::type> typeClassList,
QSet<ParticipantManagement::TypeClass> typeClassList,
bool initial);
signals:
@@ -68,7 +68,7 @@ private:
int m_radius{0}; // observer radius in meter
QSet<int> m_partyList;
bool m_filterActive;
QSet<ParticipantManagement::TypeClass::type> m_typeClassList;
QSet<ParticipantManagement::TypeClass> m_typeClassList;
MainHandler *m_mainHandler{nullptr}; // provides TAB FTC and PPM DTC
HandlerOcSituationData *m_handler{nullptr}; // OC-Thread-Object
@@ -118,7 +118,7 @@ public slots:
const Core::GeoPosition2D &centerPosition,
int radius, bool filterActive,
QSet<int> partys,
QSet<ParticipantManagement::TypeClass::type> typeClasses,
QSet<ParticipantManagement::TypeClass> typeClasses,
bool initial);
private slots:
@@ -175,7 +175,7 @@ private:
QSet<int> m_newlyOutdatedParticipants;
QMap<int, int> m_participantsNotSend; // map <particpant Id, count of not send>
QMap<int, int> m_participantId2EqId; // for debugging purposes
QSet<ParticipantManagement::TypeClass::type> m_typeClassList;
QSet<ParticipantManagement::TypeClass> m_typeClassList;
QSet<int> m_partyList;
bool m_filterActive;
@@ -46,7 +46,7 @@ bool PositionConverter::initCoordConversion()
return false;
}
const auto ex = m_exmDtc->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;
@@ -56,16 +56,16 @@ bool PositionConverter::initCoordConversion()
ERROR_LOG(m_logger) << "Error initializing AssetManagement DTC";
return false;
}
const auto ta = m_asmDtc->trainingArea(ex.trainingAreaId());
if (ta.id() <= 0)
const auto ta = m_asmDtc->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;
}
// calc tetra base point from training area center
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));
// our center point is NNxYY 00000 00000 by definition
// (we can also use current ta center but the it's hard to debug the coordinates in Tetra LogViewer)
@@ -45,7 +45,7 @@ public:
const LtsCoordTrans::UtmCoordinate &baseCoord)
{
// convert lon/lat to utm with the given zone from the center point
const LtsCoordTrans::UtmCoordinate point(LtsCoordTrans::UtmCoordinate::fromGeographic(pos.lon(), pos.lat(), baseCoord.zone));
const LtsCoordTrans::UtmCoordinate point(LtsCoordTrans::UtmCoordinate::fromGeographic(pos.lon, pos.lat, baseCoord.zone));
// now calc distance from point to base point == relative position
return QPointF(point.x - baseCoord.x, point.y - baseCoord.y);
}
@@ -98,11 +98,11 @@ bool DataTopicTests::write(const ServiceManagement::ServiceInformation &data)
{
INFO_LOG(m_logger) << "Publish topic ServiceInformation ";
DEBUG_LOG(m_logger) << "Id: " << data.id()
<< ", Name: " << data.name()
<< ", State: " << data.state()
<< ", Timestamp: " << data.timestamp()
<< ", ErrorString: " << data.errorString()
DEBUG_LOG(m_logger) << "Id: " << data.id
<< ", Name: " << data.name
<< ", State: " << data.state
<< ", Timestamp: " << data.timestamp
<< ", ErrorString: " << data.errorString
;
return m_dtsServiceInformation->write(data);
@@ -116,7 +116,7 @@ bool DataTopicTests::write(const ServiceManagement::GroupInformation &data)
{
QString services;
for(int serviceId : data.services())
for(int serviceId : data.services)
{
services.append(QString::number(serviceId));
services.append(QLatin1Char(','));
@@ -125,12 +125,12 @@ bool DataTopicTests::write(const ServiceManagement::GroupInformation &data)
if(services.endsWith(QLatin1Char(',')))
services.chop(1);
DEBUG_LOG(m_logger) << "Type: " << data.type()
<< ", Domain: " << data.domainId()
<< ", Partition: " << data.exercisePartitionId()
<< ", Partition: " << data.replayPartitionId()
DEBUG_LOG(m_logger) << "Type: " << data.type
<< ", Domain: " << data.domainId
<< ", Partition: " << data.exercisePartitionId
<< ", Partition: " << data.replayPartitionId
<< ", Services: " << services
<< ", Timestamp: " << data.timestamp();
<< ", Timestamp: " << data.timestamp;
}
return m_dtsGroupInformation->write(data);
@@ -151,11 +151,11 @@ void DataTopicTests::processData(const ServiceManagement::ServiceInformation &in
Q_UNUSED(modType);
INFO_LOG(m_logger) << "process Lts_ServiceInformation";
DEBUG_LOG(m_logger) << "Id: " << instance.id();
DEBUG_LOG(m_logger) << "Name: " << instance.name();
DEBUG_LOG(m_logger) << "State: " << instance.state();
DEBUG_LOG(m_logger) << "Timestamp: " << instance.timestamp();
DEBUG_LOG(m_logger) << "ErrorString: " << instance.errorString();
DEBUG_LOG(m_logger) << "Id: " << instance.id;
DEBUG_LOG(m_logger) << "Name: " << instance.name;
DEBUG_LOG(m_logger) << "State: " << instance.state;
DEBUG_LOG(m_logger) << "Timestamp: " << instance.timestamp;
DEBUG_LOG(m_logger) << "ErrorString: " << instance.errorString;
m_receivedServiceInformationData = instance;
@@ -173,7 +173,7 @@ void DataTopicTests::processData(const ServiceManagement::GroupInformation &inst
{
QString services;
for(int serviceId : instance.services())
for(int serviceId : instance.services)
{
services.append(QString::number(serviceId));
services.append(QLatin1Char(','));
@@ -182,12 +182,12 @@ void DataTopicTests::processData(const ServiceManagement::GroupInformation &inst
if(services.endsWith(QLatin1Char(',')))
services.chop(1);
DEBUG_LOG(m_logger) << "Type: " << instance.type();
DEBUG_LOG(m_logger) << "Domain: " << instance.domainId();
DEBUG_LOG(m_logger) << "Partition: " << instance.exercisePartitionId();
DEBUG_LOG(m_logger) << "Replay Partition: " << instance.replayPartitionId();
DEBUG_LOG(m_logger) << "Type: " << instance.type;
DEBUG_LOG(m_logger) << "Domain: " << instance.domainId;
DEBUG_LOG(m_logger) << "Partition: " << instance.exercisePartitionId;
DEBUG_LOG(m_logger) << "Replay Partition: " << instance.replayPartitionId;
DEBUG_LOG(m_logger) << "Services: " << services;
DEBUG_LOG(m_logger) << "Timestamp: " << instance.timestamp();
DEBUG_LOG(m_logger) << "Timestamp: " << instance.timestamp;
}
m_receivedGroupInformationData = instance;
@@ -55,11 +55,11 @@ void DataTopicTestsMain::publishServiceInformationTestCase()
DEBUG_LOG(m_logger) <<"DataTopicTestsMain: publish ServiceInformation data";
// Topic ServiceInformation
m_sentServiceInformationData.id(13);
m_sentServiceInformationData.name("UnitTest dummy Service");
m_sentServiceInformationData.state(Core::RunningState::inner_enum::NotYetStarted);
m_sentServiceInformationData.timestamp(QDateTime::currentMSecsSinceEpoch());
m_sentServiceInformationData.errorString(QStringLiteral("UnitTest dummy Error").toStdString());
m_sentServiceInformationData.id = 13;
m_sentServiceInformationData.name = "UnitTest dummy Service";
m_sentServiceInformationData.state = Core::RunningState::NotYetStarted;
m_sentServiceInformationData.timestamp = QDateTime::currentMSecsSinceEpoch();
m_sentServiceInformationData.errorString = QStringLiteral("UnitTest dummy Error").toStdString();
QVERIFY2(m_dtTest->write(m_sentServiceInformationData), "Publishing Topic ServiceInformation failed");
}
@@ -72,11 +72,11 @@ void DataTopicTestsMain::subscribeServiceInformationTestCase()
ServiceManagement::ServiceInformation recvServiceInformation = m_dtTest->getReceivedServiceInformationData();
QCOMPARE(recvServiceInformation.id(), m_sentServiceInformationData.id());
QCOMPARE(recvServiceInformation.name(), m_sentServiceInformationData.name());
QCOMPARE(recvServiceInformation.state(), m_sentServiceInformationData.state());
QCOMPARE(recvServiceInformation.timestamp(), m_sentServiceInformationData.timestamp());
QCOMPARE(recvServiceInformation.errorString(), m_sentServiceInformationData.errorString());
QCOMPARE(recvServiceInformation.id, m_sentServiceInformationData.id);
QCOMPARE(recvServiceInformation.name, m_sentServiceInformationData.name);
QCOMPARE(recvServiceInformation.state, m_sentServiceInformationData.state);
QCOMPARE(recvServiceInformation.timestamp, m_sentServiceInformationData.timestamp);
QCOMPARE(recvServiceInformation.errorString, m_sentServiceInformationData.errorString);
}
void DataTopicTestsMain::publishGroupInformationTestCase()
@@ -86,11 +86,11 @@ void DataTopicTestsMain::publishGroupInformationTestCase()
std::vector<int> services = {1, 3, 5, 7, 11, 13, 17, 19, 23, 42};
// Topic GroupInformation
m_sentGroupInformationData.type(Core::ServiceGroupType::inner_enum::Master);
m_sentGroupInformationData.exercisePartitionId(113);
m_sentGroupInformationData.domainId(42);
m_sentGroupInformationData.services(services);
m_sentGroupInformationData.timestamp(QDateTime::currentMSecsSinceEpoch());
m_sentGroupInformationData.type = Core::ServiceGroupType::Master;
m_sentGroupInformationData.exercisePartitionId = 113;
m_sentGroupInformationData.domainId = 42;
m_sentGroupInformationData.services = services;
m_sentGroupInformationData.timestamp = QDateTime::currentMSecsSinceEpoch();
QVERIFY2(m_dtTest->write(m_sentGroupInformationData), "Publishing Topic GroupInformation failed");
}
@@ -103,11 +103,11 @@ void DataTopicTestsMain::subscribeGroupInformationTestCase()
ServiceManagement::GroupInformation recvGroupInformation = m_dtTest->getReceivedGroupInformationData();
QCOMPARE(recvGroupInformation.type(), m_sentGroupInformationData.type());
QCOMPARE(recvGroupInformation.exercisePartitionId(), m_sentGroupInformationData.exercisePartitionId());
QCOMPARE(recvGroupInformation.domainId(), m_sentGroupInformationData.domainId());
QCOMPARE(recvGroupInformation.services(), m_sentGroupInformationData.services());
QCOMPARE(recvGroupInformation.timestamp(), m_sentGroupInformationData.timestamp());
QCOMPARE(recvGroupInformation.type, m_sentGroupInformationData.type);
QCOMPARE(recvGroupInformation.exercisePartitionId, m_sentGroupInformationData.exercisePartitionId);
QCOMPARE(recvGroupInformation.domainId, m_sentGroupInformationData.domainId);
QCOMPARE(recvGroupInformation.services, m_sentGroupInformationData.services);
QCOMPARE(recvGroupInformation.timestamp, m_sentGroupInformationData.timestamp);
}
void DataTopicTestsMain::cleanupTestCase()
@@ -59,7 +59,7 @@ LtsWebSocket::ReplyMessage *DataManager::servicesInformation(const QString &uuid
const auto ports = service->ports().get();
for (const auto &port : ports)
serviceInfo.ports.append(ServicePortsInformationMessage::PortInformation({port.number(), port.type().underlying(), QString::fromStdString(port.properties())}));
serviceInfo.ports.append(ServicePortsInformationMessage::PortInformation{port.number, static_cast<int32_t>(port.type), QString::fromStdString(port.properties)});
exerciseInfo.services.append(serviceInfo);
}
@@ -80,13 +80,13 @@ bool Group::setRunningState(Core::RunningState newState)
INFO_LOG(m_logger) << "Setting RunningState of group "
<< m_scheme->groupType
<< " in exercisePartition "
<< m_groupData.exercisePartitionId()
<< m_groupData.exercisePartitionId
<< ", replayPartition "
<< m_groupData.replayPartitionId()
<< m_groupData.replayPartitionId
<< " to "
<< newState;
switch (newState.underlying())
switch (newState)
{
case Core::RunningState::Running:
case Core::RunningState::Starting:
@@ -275,9 +275,9 @@ void Group::onNewServiceInfo()
GroupInformation info(m_groupId,
lastHeartbeatMSec(),
m_scheme->groupType,
m_groupData.domainId(),
m_groupData.exercisePartitionId(),
m_groupData.replayPartitionId(),
m_groupData.domainId,
m_groupData.exercisePartitionId,
m_groupData.replayPartitionId,
serviceIds);
TRACE_LOG(m_logger) << "Publishing new GroupInformation: " << info;
@@ -350,11 +350,11 @@ void Group::onCompleteCoreTick()
QTimer::singleShot(1000, this, &Group::onCompleteCoreTick);
}
ServiceProcess *Group::procFromPid(Q_PID pid)
ServiceProcess *Group::procFromPid(qint64 pid)
{
for (ServiceProcess *proc :qAsConst(m_serviceProcs))
{
if (proc->pid() == pid)
if (proc->processId() == pid)
return proc;
}
DEBUG_LOG(m_logger) << "Searched for not existing process with PID "
@@ -51,9 +51,9 @@ public:
bool allProcsStopped() const;
Core::ServiceGroupType type() const;
int32_t domainId() const { return m_groupData.domainId(); }
int32_t exercisePartitionId() const { return m_groupData.exercisePartitionId(); }
int32_t replayPartitionId() const { return m_groupData.replayPartitionId(); }
int32_t domainId() const { return m_groupData.domainId; }
int32_t exercisePartitionId() const { return m_groupData.exercisePartitionId; }
int32_t replayPartitionId() const { return m_groupData.replayPartitionId; }
int32_t id() const { return m_groupId; }
qint64 lastHeartbeatMSec() const;
@@ -65,7 +65,7 @@ private Q_SLOTS:
private: // methods
void init();
ServiceProcess *procFromPid(Q_PID pid);
ServiceProcess *procFromPid(qint64 pid);
private: // attributes
std::shared_ptr<DdsHandler> m_ddsHandler;
@@ -73,13 +73,13 @@ GroupScheme *GroupHandler::groupSchemeFromType(Core::ServiceGroupType type)
// TODO: make generic ...
QMap<Core::ServiceGroupType, QString> groupNameMapping;
groupNameMapping.insert(Core::ServiceGroupType_def::Master, QLatin1String("Master"));
groupNameMapping.insert(Core::ServiceGroupType_def::Core, QLatin1String("Core"));
groupNameMapping.insert(Core::ServiceGroupType_def::ExercisePreparation, QLatin1String("ExercisePreparation"));
groupNameMapping.insert(Core::ServiceGroupType_def::ExerciseExecution, QLatin1String("ExerciseExecution"));
groupNameMapping.insert(Core::ServiceGroupType_def::ExercisePaused, QLatin1String("ExercisePaused"));
groupNameMapping.insert(Core::ServiceGroupType_def::ExerciseAfterActionReview, QLatin1String("ExerciseAfterActionReview"));
groupNameMapping.insert(Core::ServiceGroupType_def::Playback, QLatin1String("Playback"));
groupNameMapping.insert(Core::ServiceGroupType::Master, QLatin1String("Master"));
groupNameMapping.insert(Core::ServiceGroupType::Core, QLatin1String("Core"));
groupNameMapping.insert(Core::ServiceGroupType::ExercisePreparation, QLatin1String("ExercisePreparation"));
groupNameMapping.insert(Core::ServiceGroupType::ExerciseExecution, QLatin1String("ExerciseExecution"));
groupNameMapping.insert(Core::ServiceGroupType::ExercisePaused, QLatin1String("ExercisePaused"));
groupNameMapping.insert(Core::ServiceGroupType::ExerciseAfterActionReview, QLatin1String("ExerciseAfterActionReview"));
groupNameMapping.insert(Core::ServiceGroupType::Playback, QLatin1String("Playback"));
// if no scheme with type type exists, it will be newly generated and added
GroupScheme *newScheme = new GroupScheme(type, groupNameMapping.value(type));
@@ -92,10 +92,10 @@ Group *GroupHandler::getGroup(const GroupRequest &groupToFind) const
{
for (Group *group : m_groups)
{
if (group->type() == groupToFind.type() &&
group->exercisePartitionId() == groupToFind.exercisePartitionId() &&
group->domainId() == groupToFind.domainId() &&
group->replayPartitionId() == groupToFind.replayPartitionId())
if (group->type() == groupToFind.type &&
group->exercisePartitionId() == groupToFind.exercisePartitionId &&
group->domainId() == groupToFind.domainId &&
group->replayPartitionId() == groupToFind.replayPartitionId)
return group;
}
return nullptr;
@@ -110,7 +110,7 @@ Group *GroupHandler::getSimilarGroup(const GroupRequest &groupToFind) const
bool bSimilar = false;
for (const auto &type : possibleTypes)
{
if (type != groupToFind.type())
if (type != groupToFind.type)
continue;
bSimilar = true;
break;
@@ -121,10 +121,10 @@ Group *GroupHandler::getSimilarGroup(const GroupRequest &groupToFind) const
for(auto type : possibleTypes)
{
// don't find ourself ...
if (type == groupToFind.type())
if (type == groupToFind.type)
continue;
GroupRequest similarGroup(groupToFind);
similarGroup.type(type);
similarGroup.type = type;
Group *groupFound = getGroup(similarGroup);
if (groupFound)
return groupFound;
@@ -147,13 +147,13 @@ bool GroupHandler::startGroupCore(int32_t domainId)
DEBUG_LOG(m_logger) << "Starting core group ...";
GroupRequest groupToSearch;
groupToSearch.type(Core::ServiceGroupType::Core);
groupToSearch.domainId(domainId);
groupToSearch.type = Core::ServiceGroupType::Core;
groupToSearch.domainId = domainId;
Group *coreGroup = getGroup(groupToSearch);
if (coreGroup == nullptr)
{
GroupScheme *coreScheme = groupSchemeFromType(groupToSearch.type());
GroupScheme *coreScheme = groupSchemeFromType(groupToSearch.type);
if (coreScheme == nullptr)
{
@@ -190,15 +190,15 @@ Core::FunctionReplyObject GroupHandler::onStartGroup(const GroupRequest &request
{
DEBUG_LOG(m_logger) << "New StartGroupRequest: " << request;
if (request.domainId() != m_ddsHandler->connector()->getDomainId())
return Core::FunctionReplyObject(request.requestId(),
if (request.domainId != m_ddsHandler->connector()->getDomainId())
return Core::FunctionReplyObject(request.requestId,
tr_lts("dds", "This instance of ServiceManagement only allows to start a group in domain %1. Domain %2 was provided"))
.arg(m_ddsHandler->connector()->getDomainId())
.arg(request.domainId());
.arg(request.domainId);
// special case: request.type == Master, ExerciseId != 0 -> stopp all
if (request.type() == Core::ServiceGroupType::Master && request.exercisePartitionId() != 0)
return onStopAllForExercise(request.domainId(), request.exercisePartitionId());
if (request.type == Core::ServiceGroupType::Master && request.exercisePartitionId != 0)
return onStopAllForExercise(request.domainId, request.exercisePartitionId);
Group *existingGroup = getGroup(request);
// check if it's a Exercise group and search a group with the same exercise/domain -id
@@ -206,10 +206,10 @@ Core::FunctionReplyObject GroupHandler::onStartGroup(const GroupRequest &request
// if the group does not exist, it is newly created (normal case)
if (existingGroup == nullptr)
{
GroupScheme *scheme = groupSchemeFromType(request.type());
GroupScheme *scheme = groupSchemeFromType(request.type);
if (scheme == nullptr)
return Core::FunctionReplyObject(request.requestId(),
tr_lts("dds", "Starting attempt of non existing group: %1")).arg(request.type().underlying());
return Core::FunctionReplyObject(request.requestId,
tr_lts("dds", "Starting attempt of non existing group: %1")).arg(static_cast<int>(request.type));
existingGroup = new Group(m_ddsHandler, m_serviceDonator, request, scheme, this);
m_groups.append(existingGroup);
@@ -230,7 +230,7 @@ Core::FunctionReplyObject GroupHandler::onStartGroup(const GroupRequest &request
existingGroup->start();
return Core::FunctionReplyObject(request.requestId());
return Core::FunctionReplyObject(request.requestId);
}
Core::FunctionReplyObject GroupHandler::onStopAllForExercise(int domainId, int exercisePartitionId)
@@ -286,7 +286,7 @@ Core::FunctionReplyObject GroupHandler::onStopGroup(const GroupRequest &request)
Group *existingGroup = getGroup(request);
if (existingGroup == nullptr)
return Core::FunctionReplyObject(request.requestId(),
return Core::FunctionReplyObject(request.requestId,
tr_lts("dds", "Could not stop Group, because it does not exist"));
existingGroup->stop();
@@ -295,7 +295,7 @@ Core::FunctionReplyObject GroupHandler::onStopGroup(const GroupRequest &request)
m_groups.removeAll(existingGroup);
delete existingGroup;
return Core::FunctionReplyObject(request.requestId());
return Core::FunctionReplyObject(request.requestId);
}
void GroupHandler::onRestartGroupRequest(const rti::core::SampleIdentity &cookie,
@@ -64,9 +64,9 @@ bool LicenceHandler::isServiceLicensed(const QString &licenceName) const
void LicenceHandler::onGetLicenceRequest(const rti::core::SampleIdentity &cookie,
const LicenceRequest &request)
{
INFO_LOG(m_logger) << "Try to getLicence (from DDS) for '" << request.name() << "' ...";
INFO_LOG(m_logger) << "Try to getLicence (from DDS) for '" << request.name << "' ...";
Core::FunctionReplyObject ret = getLicenceInternal(QString::fromStdString(request.name()));
Core::FunctionReplyObject ret = getLicenceInternal(QString::fromStdString(request.name));
m_ddsHandler->fts()->getLicenceReply(cookie, ret);
return;
@@ -76,9 +76,9 @@ void LicenceHandler::onGetLicenceRequest(const rti::core::SampleIdentity &cookie
void LicenceHandler::onFreeLicenceRequest(const rti::core::SampleIdentity &cookie,
const LicenceRequest &request)
{
INFO_LOG(m_logger) << "Try to freeLicence (from DDS) for '" << request.name() << "' ...";
INFO_LOG(m_logger) << "Try to freeLicence (from DDS) for '" << request.name << "' ...";
Core::FunctionReplyObject ret = freeLicenceInternal(QString::fromStdString(request.name()));
Core::FunctionReplyObject ret = freeLicenceInternal(QString::fromStdString(request.name));
m_ddsHandler->fts()->freeLicenceReply(cookie, ret);
return;
@@ -327,12 +327,12 @@ ServiceManagement::LicenceInformation LicenceHandler::toDdsData(const LtsLicence
{
ServiceManagement::LicenceInformation ddsData;
ddsData.name(data.name.toStdString());
ddsData.ignoreMaxCount(data.ignoreMaxCount);
ddsData.maxCount(data.maxCount);
ddsData.ignoreExpiration(data.ignoreExpiration);
ddsData.expiration(data.expiration.toMSecsSinceEpoch());
ddsData.refCount(data.licenceRefCount);
ddsData.name = data.name.toStdString();
ddsData.ignoreMaxCount = data.ignoreMaxCount;
ddsData.maxCount = data.maxCount;
ddsData.ignoreExpiration = data.ignoreExpiration;
ddsData.expiration = data.expiration.toMSecsSinceEpoch();
ddsData.refCount = data.licenceRefCount;
return ddsData;
} // end of toDdsData()
@@ -107,14 +107,14 @@ bool MainHandler::readServices()
int serviceCount = 0;
// TODO: make generic ... will be implemented in a future core library
QMap<QString, Core::ServiceGroupType_def::type> groupNameMapping;
groupNameMapping.insert(QLatin1String("Master"), Core::ServiceGroupType_def::Master);
groupNameMapping.insert(QLatin1String("Core"), Core::ServiceGroupType_def::Core);
groupNameMapping.insert(QLatin1String("ExercisePreparation"), Core::ServiceGroupType_def::ExercisePreparation);
groupNameMapping.insert(QLatin1String("ExerciseExecution"), Core::ServiceGroupType_def::ExerciseExecution);
groupNameMapping.insert(QLatin1String("ExercisePaused"), Core::ServiceGroupType_def::ExercisePaused);
groupNameMapping.insert(QLatin1String("ExerciseAfterActionReview"), Core::ServiceGroupType_def::ExerciseAfterActionReview);
groupNameMapping.insert(QLatin1String("Playback"), Core::ServiceGroupType_def::Playback);
QMap<QString, Core::ServiceGroupType> groupNameMapping;
groupNameMapping.insert(QLatin1String("Master"), Core::ServiceGroupType::Master);
groupNameMapping.insert(QLatin1String("Core"), Core::ServiceGroupType::Core);
groupNameMapping.insert(QLatin1String("ExercisePreparation"), Core::ServiceGroupType::ExercisePreparation);
groupNameMapping.insert(QLatin1String("ExerciseExecution"), Core::ServiceGroupType::ExerciseExecution);
groupNameMapping.insert(QLatin1String("ExercisePaused"), Core::ServiceGroupType::ExercisePaused);
groupNameMapping.insert(QLatin1String("ExerciseAfterActionReview"), Core::ServiceGroupType::ExerciseAfterActionReview);
groupNameMapping.insert(QLatin1String("Playback"), Core::ServiceGroupType::Playback);
while (directoryIterator.hasNext())
{
@@ -80,14 +80,14 @@ void ServiceManagement::ServiceHandler::onRestartServiceRequest(const rti::core:
{
DEBUG_LOG(m_logger) << "onRestartServiceRequest " << request;
ServiceProcess *proc = serviceProcessFromServiceProcId(request.id());
ServiceProcess *proc = serviceProcessFromServiceProcId(request.id);
Core::FunctionReplyObject ret(request.id());
Core::FunctionReplyObject ret(request.id);
if (proc == nullptr)
{
INFO_LOG(m_logger) << "Got restart request for non existing service ID "
<< request.id();
ret.setStr(tr_lts("dds", "There is no ServiceProcess with id %1")).arg(request.id());
<< request.id;
ret.setStr(tr_lts("dds", "There is no ServiceProcess with id %1")).arg(request.id);
m_ddsHandler->fts()->restartServiceReply(cookie, ret);
return;
}
@@ -125,7 +125,7 @@ void ServiceManagement::ServiceHandler::onNewServiceInfoFromProc(const ServiceIn
m_ddsHandler->dts()->publish(info);
m_unknownPidsWarned.remove(info.pid());
m_unknownPidsWarned.remove(info.pid);
}
void ServiceManagement::ServiceHandler::onNewServiceInfoFromDds(const Core::CurrentRunningState &data, DataModification type)
@@ -135,13 +135,13 @@ void ServiceManagement::ServiceHandler::onNewServiceInfoFromDds(const Core::Curr
TRACE_LOG(m_logger) << "Got new CurrentRunningState: " << data;
if (!data.pid())
if (!data.pid)
{
INFO_LOG(m_logger) << "PID 0 is not allowed.";
return;
}
ServiceProcess *proc = serviceProcessFromPid(data.pid());
ServiceProcess *proc = serviceProcessFromPid(data.pid);
Core::CurrentRunningState retData = data;
if (proc == nullptr)
@@ -151,11 +151,11 @@ void ServiceManagement::ServiceHandler::onNewServiceInfoFromDds(const Core::Curr
{
for (ServiceProcess *currentProc : qAsConst(currentService->allProcs()))
{
if (currentProc->remotePid() == data.pid())
if (currentProc->remotePid() == data.pid)
{
DEBUG_LOG(m_logger) << "Found my prog " << data.pid() << " to "<< currentProc->pid() << " " << currentProc->serviceName();
DEBUG_LOG(m_logger) << "Found my prog " << data.pid << " to "<< currentProc->processId() << " " << currentProc->serviceName();
proc = currentProc;
retData.pid() = proc->processId();
retData.pid = proc->processId();
found = true;
break;
}
@@ -168,11 +168,11 @@ void ServiceManagement::ServiceHandler::onNewServiceInfoFromDds(const Core::Curr
if (proc == nullptr)
{
if (!m_unknownPidsWarned.contains(data.pid()))
if (!m_unknownPidsWarned.contains(data.pid))
{
ERROR_LOG(m_logger) << "Got CurrentRunningState for non existing process with PID "
<< data.pid();
m_unknownPidsWarned += data.pid();
<< data.pid;
m_unknownPidsWarned += data.pid;
}
return;
}
@@ -232,7 +232,7 @@ void ServiceManagement::ServiceHandler::onHeartBeatObserverTimerTimeout()
if (currentProc->failedStartingAttempts() > 3)
continue;
const qint64 minAge = (currentProc->runningState() == Core::RunningState_def::Starting)
const qint64 minAge = (currentProc->runningState() == Core::RunningState::Starting)
? minHeartbeatAgeStartup
: minHeartbeatAge;
@@ -36,8 +36,8 @@ ServiceManagement::ServiceProcess::ServiceProcess(const GroupRequest &groupData,
, m_pidProc(new QProcess(this))
, m_logger(getLogger("ServiceProcess"))
{
QStringList args({QStringLiteral("-e"), QString::number(m_groupData.exercisePartitionId()),
QStringLiteral("-d"), QString::number(m_groupData.domainId())});
QStringList args({QStringLiteral("-e"), QString::number(m_groupData.exercisePartitionId),
QStringLiteral("-d"), QString::number(m_groupData.domainId)});
bool isInReplayGroup = false;
for(const QString &currentGroup : parentService->groups())
@@ -50,9 +50,9 @@ ServiceManagement::ServiceProcess::ServiceProcess(const GroupRequest &groupData,
}
if (isInReplayGroup)
args << QStringLiteral("-r") << QString::number(m_groupData.replayPartitionId());
args.reserve(args.size() + m_groupData.additionalStartParameter().size());
for (const std::string &arg : m_groupData.additionalStartParameter())
args << QStringLiteral("-r") << QString::number(m_groupData.replayPartitionId);
args.reserve(args.size() + m_groupData.additionalStartParameter.size());
for (const std::string &arg : m_groupData.additionalStartParameter)
args << QString::fromStdString(arg);
setArguments(args);
@@ -146,8 +146,8 @@ bool ServiceManagement::ServiceProcess::start(OpenMode mode)
m_pidProc->kill();
m_pidProc->setProgram(QStringLiteral("ssh"));
//DEBUG_LOG(m_logger) << sshCmd;
QStringList args({QStringLiteral("-e"), QString::number(m_groupData.exercisePartitionId()),
QStringLiteral("-d"), QString::number(m_groupData.domainId())});
QStringList args({QStringLiteral("-e"), QString::number(m_groupData.exercisePartitionId),
QStringLiteral("-d"), QString::number(m_groupData.domainId)});
setProgram(QStringLiteral("ssh"));
QStringList remoteCommand2;
remoteCommand2.append(Settings::hlaRemoteServer());
@@ -190,8 +190,8 @@ bool ServiceManagement::ServiceProcess::start(OpenMode mode)
m_pidProc->kill();
m_pidProc->setProgram(QStringLiteral("ssh"));
//DEBUG_LOG(m_logger) << sshCmd;
QStringList args({QStringLiteral("-e"), QString::number(m_groupData.exercisePartitionId()),
QStringLiteral("-d"), QString::number(m_groupData.domainId())});
QStringList args({QStringLiteral("-e"), QString::number(m_groupData.exercisePartitionId),
QStringLiteral("-d"), QString::number(m_groupData.domainId)});
setProgram(QStringLiteral("ssh"));
QStringList remoteCommand2;
remoteCommand2.append(Settings::hlaRemoteServer());
@@ -245,15 +245,15 @@ int ServiceManagement::ServiceProcess::serviceProcessId() const
void ServiceManagement::ServiceProcess::setNewStateFromHeartbeat(const Core::CurrentRunningState &data)
{
DEBUG_LOG(m_logger) << "Heartbeat for " << debugInfo() << ", running state: " << data.runningState();
DEBUG_LOG(m_logger) << "Heartbeat for " << debugInfo() << ", running state: " << data.runningState;
m_failedStartAttemptCounter = 0;
m_lastHeartbeatMSec = QDateTime::currentMSecsSinceEpoch();
m_runningState = data.runningState();
m_ports = data.ports();
m_runningState = data.runningState;
m_ports = data.ports;
std::string es;
if (data.errorString().is_set())
es = data.errorString().get();
if (data.errorString.is_set())
es = data.errorString.get();
ServiceInformation info(m_serviceProcessId,
m_lastHeartbeatMSec,
@@ -267,8 +267,8 @@ void ServiceManagement::ServiceProcess::setNewStateFromHeartbeat(const Core::Cur
void ServiceManagement::ServiceProcess::killallRemote()
{
QStringList arg({QStringLiteral("-e"), QString::number(m_groupData.exercisePartitionId()),
QStringLiteral("-d"), QString::number(m_groupData.domainId())});
QStringList arg({QStringLiteral("-e"), QString::number(m_groupData.exercisePartitionId),
QStringLiteral("-d"), QString::number(m_groupData.domainId)});
QProcess sh;
sh.setProgram(QStringLiteral("ssh"));
QStringList args;
@@ -401,7 +401,7 @@ void ServiceManagement::ServiceProcess::setNewStateFromChangeRequest(const Core:
{
if (m_runningState != newState)
{
switch (newState.underlying())
switch (newState)
{
case Core::RunningState::Running:
case Core::RunningState::Starting:
@@ -31,10 +31,10 @@ public:
int serviceProcessId() const;
qint64 lastHeartbeatMSec() const;
void setLastHeartbeatMSec(qint64 lastHeartbeatMSec);
int32_t domainId() const { return m_groupData.domainId(); }
int32_t domainId() const { return m_groupData.domainId; }
int32_t prio() const { return m_prio; }
int32_t exercisePartitionId() const { return m_groupData.exercisePartitionId(); }
int32_t replayPartitionId() const { return m_groupData.replayPartitionId(); }
int32_t exercisePartitionId() const { return m_groupData.exercisePartitionId; }
int32_t replayPartitionId() const { return m_groupData.replayPartitionId; }
QString serviceName() const;
QString abbreviation() const;
dds::core::optional<std::vector<Core::PortInformation>> ports() const;
@@ -46,14 +46,7 @@ public:
void killallRemote();
qint64 usablePid() const
{
#ifdef WIN32
auto myPid = pid();
if (!myPid)
return 0;
return myPid->dwProcessId;
#else
return pid();
#endif
return processId();
}
void restart();