Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+551
@@ -0,0 +1,551 @@
|
||||
/**
|
||||
* Handler for player data
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by gr, SLSE, 2017-02-20
|
||||
*/
|
||||
|
||||
#include "handler_target_areas.h"
|
||||
#include <CentralEffectSimulation/point_helpers.h>
|
||||
#include <ParticipantManagement/ppm_common.h>
|
||||
|
||||
#include <LtsCoordTrans/lts_coord_trans.h>
|
||||
#include <QLineF>
|
||||
#include <QDateTime>
|
||||
|
||||
|
||||
namespace TargetAreas
|
||||
{
|
||||
|
||||
HandlerTargetAreas::HandlerTargetAreas(const std::shared_ptr<DdsHandlerTargetAreas> &ddsHandler,
|
||||
QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_ddsHandler(ddsHandler)
|
||||
, m_logger(getLogger("HandlerTargetAreas"))
|
||||
{
|
||||
} // end of ctor()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
HandlerTargetAreas::~HandlerTargetAreas()
|
||||
{
|
||||
} // end of dtor()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
bool HandlerTargetAreas::init()
|
||||
{
|
||||
auto dtcPpm = m_ddsHandler->dtcPpm();
|
||||
|
||||
connect(dtcPpm.get(), &ParticipantManagement::Interface::Dtc::participantPositionChanged,
|
||||
this, &HandlerTargetAreas::onParticipantPositionChanged);
|
||||
connect(dtcPpm.get(), &ParticipantManagement::Interface::Dtc::participantChanged,
|
||||
this, &HandlerTargetAreas::onParticipantChanged);
|
||||
connect(dtcPpm.get(), &ParticipantManagement::Interface::Dtc::typeChanged,
|
||||
this, &HandlerTargetAreas::onTypeChanged);
|
||||
connect(dtcPpm.get(), &ParticipantManagement::Interface::Dtc::targetInformationChanged,
|
||||
this, &HandlerTargetAreas::onTargetInformationChanged);
|
||||
|
||||
{
|
||||
auto cb = [this](const ParticipantManagement::Type & data)
|
||||
{
|
||||
onTypeChanged(data, DataModification::eAdded);
|
||||
};
|
||||
dtcPpm->types(cb);
|
||||
}
|
||||
|
||||
{
|
||||
auto cb = [this](const ParticipantManagement::Participant & data)
|
||||
{
|
||||
onParticipantChanged(data, DataModification::eAdded);
|
||||
};
|
||||
dtcPpm->participants(cb);
|
||||
}
|
||||
|
||||
{
|
||||
auto cb = [this](const ParticipantManagement::ParticipantPosition & data)
|
||||
{
|
||||
onParticipantPositionChanged(data, DataModification::eAdded);
|
||||
};
|
||||
dtcPpm->participantPositions(cb);
|
||||
}
|
||||
|
||||
{
|
||||
auto cb = [this](const ParticipantManagement::TargetInformation & data)
|
||||
{
|
||||
onTargetInformationChanged(data, DataModification::eAdded);
|
||||
};
|
||||
dtcPpm->targetInformations(cb);
|
||||
}
|
||||
INFO_LOG(m_logger) << "HandlerTargetAreas::init() finished. "
|
||||
<< " m_positionsMap.size(): " << m_positionsMap.size();
|
||||
return true;
|
||||
} // end of init()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void HandlerTargetAreas::onParticipantPositionChanged(const ParticipantManagement::ParticipantPosition &data, DataModification modType)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onParticipantPositionChanged: " << data;
|
||||
if (modType == DataModification::eRemoved)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "m_participantsOutsideMap.remove participantId: " << data.participantId();
|
||||
//m_participantsOutsideMap.remove(data.participantId());
|
||||
}
|
||||
else
|
||||
{
|
||||
ParticipantPosition partPos(data);
|
||||
auto it = m_positionsMap.find(partPos.participantId());
|
||||
if (it != m_positionsMap.end())
|
||||
{
|
||||
const ParticipantPosition &partPosOld = *it;
|
||||
|
||||
partPos.vulnerabilityState = partPosOld.vulnerabilityState;
|
||||
partPos.lastGeoPosition = partPosOld.pos(); // save previous position
|
||||
// replace
|
||||
*it = partPos;
|
||||
DEBUG_LOG(m_logger) << "m_positionsMap.replace=" << data.participantId();
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "m_positionsMap.insert=" << data.participantId();
|
||||
m_positionsMap.insert(data.participantId(), partPos);
|
||||
}
|
||||
|
||||
int equipmentNumber = m_ddsHandler->participantId2EquipNo(data.participantId());
|
||||
if (equipmentNumber > 0)
|
||||
checkShootbackAreaPosition(data);
|
||||
else
|
||||
INFO_LOG(m_logger) << "Teilnehmer hat keine Ausstattungsnummer";
|
||||
|
||||
INFO_LOG(m_logger) << "onParticipantPositionChanged()"
|
||||
<< " participantId; " << data.participantId()
|
||||
<< " participantTypeId: " << data.participantTypeId()
|
||||
<< " partyId: " << data.partyId()
|
||||
<< " vulnerabilityState: " << partPos.vulnerabilityState;
|
||||
}
|
||||
} // end of onParticipantPositionChanged()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
void HandlerTargetAreas::onParticipantChanged(const ParticipantManagement::Participant &data, DataModification modType)
|
||||
{
|
||||
// Remove Participant:
|
||||
if (modType == DataModification::eRemoved || data.isDeleted())
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onParticipantChanged m_positionsMap.remove id=" << data.id();
|
||||
m_participantData.remove(data.id());
|
||||
m_positionsMap.remove(data.id());
|
||||
return;
|
||||
}
|
||||
|
||||
// No OC in CES
|
||||
ParticipantManagement::TypeClass typeClass = typeClassFromTypeId(data.typeId());
|
||||
if (typeClass == ParticipantManagement::TypeClass_def::SupportEntity
|
||||
|| typeClass == ParticipantManagement::TypeClass_def::SupportUnit
|
||||
|| typeClass == ParticipantManagement::TypeClass_def::Unit)
|
||||
return;
|
||||
m_participantData[data.id()] = data;
|
||||
|
||||
ParticipantPosition &pos = m_positionsMap[data.id()];
|
||||
pos.partyId(data.partyId());
|
||||
pos.participantId(data.id());
|
||||
pos.participantTypeId(data.typeId());
|
||||
DEBUG_LOG(m_logger) << "onParticipantChanged"
|
||||
<< " id=" << data.id()
|
||||
<< " typeId=" << data.typeId()
|
||||
<< " designator=" << data.designator();
|
||||
if (typeClass == ParticipantManagement::TypeClass_def::Target)
|
||||
DEBUG_LOG(m_logger) << "Typeclass = Target";
|
||||
}
|
||||
|
||||
void HandlerTargetAreas::onTypeChanged(const ParticipantManagement::Type &data, DataModification modType)
|
||||
{
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
m_typeMap.insert(data.id(), data.typeClass());
|
||||
DEBUG_LOG(m_logger) << "m_typeMap.size()" << m_typeMap.size()
|
||||
<< " equipmentTypeId=" << data.id()
|
||||
<< " typeClass=" << data.typeClass();
|
||||
}
|
||||
|
||||
void HandlerTargetAreas::onTargetInformationChanged(const ParticipantManagement::TargetInformation &data, DataModification modType)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onTargetInformationChanged"
|
||||
<< " participantId=" << data.participantId()
|
||||
<< " data.shootbackAreas().size()=" << data.shootbackAreas().size();
|
||||
|
||||
if (modType == DataModification::eRemoved)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "m_participantsOutsideMap.remove participantId: " << data.participantId();
|
||||
m_shootbackTargets.remove(data.participantId());
|
||||
return;
|
||||
}
|
||||
ShootbackTarget shootbackTarget;
|
||||
shootbackTarget.participantId = data.participantId();
|
||||
if (m_shootbackTargets.contains(data.participantId()))
|
||||
{
|
||||
shootbackTarget = m_shootbackTargets[data.participantId()];
|
||||
shootbackTarget.shootbackAreasUtm.clear();
|
||||
}
|
||||
shootbackTarget.targetInformation = data;
|
||||
// assign shootbackAreasUtm
|
||||
for (unsigned int i = 0; i < data.shootbackAreas().size(); i++)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << " shootbackAreas i=" << i;
|
||||
ParticipantManagement::ShootbackArea shootbackArea = data.shootbackAreas().at(i);
|
||||
QPolygonF shootbackAreaUtm;
|
||||
|
||||
for (unsigned int i = 0; i < shootbackArea.area().size(); i++)
|
||||
{
|
||||
QPointF pointfUtm1;
|
||||
pointfUtm1 = CentralEffectSimulation::geographic2Utm(shootbackArea.area().at(i), &m_zone);
|
||||
shootbackAreaUtm.push_back(pointfUtm1);
|
||||
}
|
||||
|
||||
for (int i = 0; i < shootbackAreaUtm.size(); i++)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "i=" << i
|
||||
<< " x=" << shootbackAreaUtm[i].x()
|
||||
<< " y=" << shootbackAreaUtm[i].y()
|
||||
<< " zone=" << m_zone;
|
||||
}
|
||||
shootbackTarget.shootbackAreasUtm.append(shootbackAreaUtm);
|
||||
}
|
||||
|
||||
m_shootbackTargets.insert(data.participantId(), shootbackTarget);
|
||||
DEBUG_LOG(m_logger) << "newShootbackTarget participantId=" << data.participantId()
|
||||
<< " shootbackTarget.participantId=" << shootbackTarget.participantId
|
||||
<< " shootbackTarget.targetInformation.participantId()=" << shootbackTarget.targetInformation.participantId()
|
||||
<< " shootbackTarget.targetInformation.prewarningInterval()=" << shootbackTarget.targetInformation.prewarningInterval()
|
||||
<< " data.shootbackAreas().size()=" << data.shootbackAreas().size()
|
||||
<< " prewarningEffect=" << shootbackTarget.targetInformation.prewarningEffect()
|
||||
<< " takedownEffect=" << shootbackTarget.targetInformation.takedownEffect();
|
||||
printShootbackAreas();
|
||||
}
|
||||
|
||||
int HandlerTargetAreas::getParticipantId(int equipentNumber)
|
||||
{
|
||||
// QHash<int, ParticipantManagement::Participant> m_participantData;
|
||||
|
||||
QHashIterator<int, ParticipantManagement::Participant> i(m_participantData);
|
||||
while (i.hasNext())
|
||||
{
|
||||
i.next();
|
||||
if (i.value().equipmentNumber() == equipentNumber)
|
||||
return i.value().id();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void HandlerTargetAreas::printQPolygon(const QPolygonF polygon)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "printQPolygon polygon.size()=" << polygon.size();
|
||||
for (int i = 0; i < polygon.size(); i++)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "printQPolygon i=" << i
|
||||
<< " x=" << polygon[i].x()
|
||||
<< " y=" << polygon[i].y();
|
||||
}
|
||||
}
|
||||
|
||||
void HandlerTargetAreas::printShootbackTarget(const ShootbackTarget &shootbackTarget)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "ShootbackTarget "
|
||||
<< ", targetParticipantId=" << shootbackTarget.participantId
|
||||
<< ", shootbackAreasUtm.size=" << shootbackTarget.shootbackAreasUtm.size();
|
||||
for (int i = 0; i < shootbackTarget.shootbackAreasUtm.size(); i++)
|
||||
{
|
||||
// Punkte des Poygons ausgeben
|
||||
printQPolygon(shootbackTarget.shootbackAreasUtm.at(i));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void HandlerTargetAreas::printShootbackAreas()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "printShootbackAreas--------------------";
|
||||
QHashIterator<int, ShootbackTarget> it(m_shootbackTargets);
|
||||
while (it.hasNext())
|
||||
{
|
||||
it.next();
|
||||
ShootbackTarget shootbackTarget = it.value();
|
||||
printShootbackTarget(shootbackTarget);
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "ENDE printShootbackAreas--------------------";
|
||||
}
|
||||
|
||||
bool HandlerTargetAreas::checkPosInShootbackTarget(const ShootbackTarget &shootbackTarget,
|
||||
const QPointF &participantPosUtm)
|
||||
{
|
||||
bool inside = false;
|
||||
DEBUG_LOG(m_logger) << "checkPosInShootbackTarget ShootbackTarget "
|
||||
<< ", targetParticipantId=" << shootbackTarget.participantId
|
||||
<< ", shootbackAreasUtm.size=" << shootbackTarget.shootbackAreasUtm.size();
|
||||
for (int i = 0; i < shootbackTarget.shootbackAreasUtm.size(); i++)
|
||||
{
|
||||
// Punkte des Poygons ausgeben
|
||||
printQPolygon(shootbackTarget.shootbackAreasUtm.at(i));
|
||||
if (shootbackTarget.shootbackAreasUtm.at(i).containsPoint(participantPosUtm, Qt::OddEvenFill))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "inside = true";
|
||||
inside = true;
|
||||
}
|
||||
}
|
||||
return inside;
|
||||
}
|
||||
|
||||
void HandlerTargetAreas::checkShootbackAreaPosition(const ParticipantManagement::ParticipantPosition &data)
|
||||
{
|
||||
int participantId = data.participantId();
|
||||
int equipmentNumber = m_ddsHandler->participantId2EquipNo(data.participantId());
|
||||
DEBUG_LOG(m_logger) << "checkShootbackAreaPosition id= " << data.participantId()
|
||||
<< ", equipmentNumber=" << equipmentNumber
|
||||
<< ", sampleTime=" << data.sampleTime()
|
||||
<< ", time difference = " << QDateTime::currentMSecsSinceEpoch() - data.sampleTime();
|
||||
ParticipantPosition posActual = m_positionsMap[data.participantId()];
|
||||
// ParticipantManagement::TypeClass typeClass = m_typeMap[data.participantId()];
|
||||
|
||||
QPointF participantPosUtm;
|
||||
participantPosUtm = CentralEffectSimulation::geographic2Utm(posActual.pos(), &m_zone);
|
||||
|
||||
printShootbackAreas();
|
||||
|
||||
DEBUG_LOG(m_logger) << "Participant pos=" << posActual.pos().lat() << "/" << posActual.pos().lon()
|
||||
<< ", Utm=" << participantPosUtm.x() << "/" << participantPosUtm.y()
|
||||
<< " m_zone=" << m_zone;
|
||||
|
||||
QHashIterator<int, ShootbackTarget> it(m_shootbackTargets);
|
||||
while (it.hasNext())
|
||||
{
|
||||
it.next();
|
||||
ShootbackTarget shootbackTarget = it.value();
|
||||
if (data.participantId() == shootbackTarget.participantId)
|
||||
continue;
|
||||
int targetPreWarningInterval = shootbackTarget.targetInformation.prewarningInterval() * 1000;
|
||||
int targetTimeToEffectInterval = shootbackTarget.targetInformation.takedownInterval() * 1000;
|
||||
|
||||
DEBUG_LOG(m_logger) << "ShootbackArea ParticipantID=" << shootbackTarget.participantId
|
||||
<< " shootbackTarget.shootbackAreasUtm.size()=" << shootbackTarget.shootbackAreasUtm.size()
|
||||
<< " size= " << it.value().shootbackAreasUtm.size();
|
||||
printShootbackTarget(shootbackTarget);
|
||||
if (checkPosInShootbackTarget(shootbackTarget, participantPosUtm))
|
||||
{
|
||||
// START TARGET TIMER
|
||||
DEBUG_LOG(m_logger) << "Participant ist in ShootbackArea"
|
||||
<< ", ParticipantId= " << participantId
|
||||
<< ", ShootbackTargetId=" << shootbackTarget.participantId;
|
||||
if (m_targetTimers.contains(participantId))
|
||||
if (m_targetTimers.value(participantId)->getTimerState() != TargetTimer::TimerState::NOT_ACTIVE)
|
||||
return;
|
||||
DEBUG_LOG(m_logger) << "START TIMER PARTICIPANT_ID=" << participantId
|
||||
<< " targetPreWarningInterval=" << targetPreWarningInterval
|
||||
<< " targetTimeToEffectInterval=" << targetTimeToEffectInterval
|
||||
<< " m_targetTimers.insert(" << participantId << ")";
|
||||
TargetTimer *targetTimer = new TargetTimer(participantId,
|
||||
shootbackTarget.participantId,
|
||||
targetPreWarningInterval,
|
||||
targetTimeToEffectInterval);
|
||||
targetTimer->startTimer();
|
||||
m_targetTimers.insert(participantId, targetTimer);
|
||||
QObject::connect(targetTimer, &TargetTimer::preWarningTimeout,
|
||||
this, &HandlerTargetAreas::on_preWarningIntervalFinished);
|
||||
QObject::connect(targetTimer, &TargetTimer::timeToEffectTimeout,
|
||||
this, &HandlerTargetAreas::on_TimeToEffectFinished);
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// STOP TARGET TIMER
|
||||
DEBUG_LOG(m_logger) << "Participant ist nicht in ShootbackArea"
|
||||
<< ", ParticipantId= " << data.participantId()
|
||||
<< ", ShootbackTargetId=" << shootbackTarget.participantId
|
||||
<< ", m_targetTimers.size=" << m_targetTimers.size()
|
||||
<< ", m_targetTimers.contains(participantId)=" << m_targetTimers.contains(participantId);
|
||||
if (!m_targetTimers.contains(participantId))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "continue";
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
TargetTimer *targetTimer = m_targetTimers.value(participantId);
|
||||
if (targetTimer->getTargetParticipantId() == shootbackTarget.participantId)
|
||||
{
|
||||
targetTimer->deleteLater();
|
||||
m_targetTimers.remove(participantId);
|
||||
DEBUG_LOG(m_logger) << "STOP TIMER PARTICIPANT_ID=" << participantId
|
||||
<< " m_targetTimers.remove(" << participantId << ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HandlerTargetAreas::onSendControlDataReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
//if (replyObject.error())
|
||||
// WARNING_LOG(m_logger) << "Can not send hit on participant to training area: " << replyObject();
|
||||
//else
|
||||
DEBUG_LOG(m_logger) << "onSendControlDataReply for id " << replyObject.id() << " success";
|
||||
}
|
||||
|
||||
void HandlerTargetAreas::onSendCesHitInformationReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
//if (replyObject.error())
|
||||
// WARNING_LOG(m_logger) << "Can not send hit on participant to training area: " << replyObject();
|
||||
//else
|
||||
DEBUG_LOG(m_logger) << "onSendCesHitInformationReply for id " << replyObject.id() << " success";
|
||||
}
|
||||
|
||||
|
||||
void HandlerTargetAreas::sendRequestsToTab(int participantId,
|
||||
int targetParticipantId,
|
||||
int countBlink,
|
||||
int effectPercent)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "MainWindow::on_Timer1finished participantId=" << participantId
|
||||
<< " targetParticipantId =" << targetParticipantId;
|
||||
ParticipantManagement::Participant participant = m_participantData.value(participantId);
|
||||
//ShootbackTarget shootbackTarget = m_shootbackTargets.value(participantId);
|
||||
auto ftcTab = m_ddsHandler->ftcTab();
|
||||
|
||||
|
||||
// SEND ControlDataRequest TO TARGET
|
||||
|
||||
int32_t participantIdFt = participantId;
|
||||
int32_t equipmentNumberFt = m_ddsHandler->participantId2EquipNo(participantId);
|
||||
int32_t targetParticipantIdFt = targetParticipantId;
|
||||
int32_t targetEquipmentNumberFt = m_ddsHandler->participantId2EquipNo(targetParticipantId);
|
||||
int32_t chargeTypeIdFt = 1;
|
||||
int32_t directionDegreeFt = 0;
|
||||
int32_t distanceToOrignatorFt = 0;
|
||||
int32_t countBlinkFt = countBlink;
|
||||
int32_t effectPercentFt = effectPercent;
|
||||
rti::core::int64 effectTimeFt = m_ddsHandler->currentPartitionTime();
|
||||
|
||||
TrainingAreaBase::ControlDataCode controlCodeFt = TrainingAreaBase::ControlDataCode_def::Flashing;
|
||||
std::vector< uint8_t > controlDataFt;
|
||||
|
||||
|
||||
controlDataFt.resize(1);
|
||||
controlDataFt[0] = countBlinkFt;
|
||||
|
||||
TrainingAreaBase::SendControlDataRequest sendControlDataRequest(
|
||||
targetEquipmentNumberFt,
|
||||
targetParticipantIdFt,
|
||||
controlCodeFt,
|
||||
controlDataFt
|
||||
);
|
||||
ftcTab->sendControlDataRequest(sendControlDataRequest, this);
|
||||
|
||||
// SEND HitInformation to participant
|
||||
TrainingAreaBase::SendCesHitInformation sendCesHitInformationRequest(
|
||||
equipmentNumberFt,
|
||||
participantIdFt,
|
||||
targetEquipmentNumberFt,
|
||||
targetParticipantIdFt,
|
||||
chargeTypeIdFt,
|
||||
directionDegreeFt,
|
||||
distanceToOrignatorFt,
|
||||
effectPercentFt,
|
||||
effectTimeFt
|
||||
);
|
||||
ftcTab->sendCesHitInformationRequest(sendCesHitInformationRequest, this);
|
||||
|
||||
TrainingAreaBase::SendCesHitRequest hr;
|
||||
hr.aesId(1);
|
||||
|
||||
INFO_LOG(m_logger) << "sendCesHitRequest: " << hr;
|
||||
ftcTab->sendCesHitRequest(hr, this);
|
||||
|
||||
}
|
||||
|
||||
void HandlerTargetAreas::on_preWarningIntervalFinished(int participantId, int targetParticipantId)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "MainWindow::on_Timer1finished participantId=" << participantId
|
||||
<< " targetParticipantId =" << targetParticipantId;
|
||||
ParticipantManagement::Participant participant = m_participantData.value(participantId);
|
||||
ShootbackTarget shootbackTarget = m_shootbackTargets.value(targetParticipantId);
|
||||
uint8_t countBlink = 1;
|
||||
int32_t effectPercent = 0;
|
||||
|
||||
switch (shootbackTarget.targetInformation.prewarningEffect().underlying())
|
||||
{
|
||||
case ProjectDataManagement::VulnerabilityState_def::NoChange:
|
||||
countBlink = 1;
|
||||
effectPercent = 0;
|
||||
break;
|
||||
case ProjectDataManagement::VulnerabilityState_def::MobilityKill:
|
||||
effectPercent = 30;
|
||||
countBlink = 2;
|
||||
break;
|
||||
case ProjectDataManagement::VulnerabilityState_def::NearMiss:
|
||||
countBlink = 3;
|
||||
effectPercent = 60;
|
||||
break;
|
||||
case ProjectDataManagement::VulnerabilityState_def::CatastrophicKill:
|
||||
countBlink = 4;
|
||||
effectPercent = 100;
|
||||
break;
|
||||
default:
|
||||
effectPercent = 11;
|
||||
countBlink = 0;
|
||||
}
|
||||
|
||||
sendRequestsToTab(participantId,
|
||||
targetParticipantId,
|
||||
countBlink,
|
||||
effectPercent);
|
||||
}
|
||||
|
||||
|
||||
void HandlerTargetAreas::on_TimeToEffectFinished(int participantId, int targetParticipantId)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "HandlerTargetAreas::on_TimeToEffectFinished participantId=" << participantId
|
||||
<< " targetParticipantId=" << targetParticipantId;
|
||||
|
||||
DEBUG_LOG(m_logger) << "MainWindow::on_Timer1finished participantId=" << participantId
|
||||
<< " targetParticipantId =" << targetParticipantId;
|
||||
ParticipantManagement::Participant participant = m_participantData.value(participantId);
|
||||
ShootbackTarget shootbackTarget = m_shootbackTargets.value(targetParticipantId);
|
||||
uint8_t countBlink = 1;
|
||||
int32_t effectPercent = 0;
|
||||
|
||||
DEBUG_LOG(m_logger) << " shootbackTarget.participantId=" << shootbackTarget.participantId
|
||||
<< " shootbackTarget.targetInformation.participantId()=" << shootbackTarget.targetInformation.participantId()
|
||||
<< " shootbackTarget.targetInformation.prewarningInterval()=" << shootbackTarget.targetInformation.prewarningInterval()
|
||||
<< " prewarningEffect=" << shootbackTarget.targetInformation.prewarningEffect()
|
||||
<< " takedownEffect=" << shootbackTarget.targetInformation.takedownEffect();
|
||||
|
||||
|
||||
switch (shootbackTarget.targetInformation.takedownEffect().underlying())
|
||||
{
|
||||
case ProjectDataManagement::VulnerabilityState_def::MobilityKill:
|
||||
effectPercent = 50;
|
||||
countBlink = 5;
|
||||
break;
|
||||
case ProjectDataManagement::VulnerabilityState_def::CatastrophicKill:
|
||||
countBlink = 6;
|
||||
effectPercent = 100;
|
||||
break;
|
||||
default:
|
||||
effectPercent = 12;
|
||||
countBlink = 0;
|
||||
}
|
||||
|
||||
sendRequestsToTab(participantId,
|
||||
targetParticipantId,
|
||||
countBlink,
|
||||
effectPercent);
|
||||
}
|
||||
|
||||
void HandlerTargetAreas::onSendCesHitReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
INFO_LOG(m_logger) << "HandlerTargetAreas::onSendCesHitReply";
|
||||
//if (replyObject.error())
|
||||
// WARNING_LOG(m_logger) << "Can not send hit on participant to training area: " << replyObject();
|
||||
//else
|
||||
DEBUG_LOG(m_logger) << "onSendCesHitReply for id " << replyObject.id() << " success";
|
||||
}
|
||||
|
||||
} // namespace TargetAreas
|
||||
Reference in new issue
Block a user