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:
30 files changed
+1000
-1007
No files matched your search
+105
-105
@@ -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
|
||||
Reference in new issue
Block a user