181 lines
8.5 KiB
C++
Executable File
181 lines
8.5 KiB
C++
Executable File
/**
|
|
* Handle incoming Function Topic Requests (and send them to Tetra)
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Christian Ehrlicher, SLSE, 2016-04-14
|
|
*/
|
|
#pragma once
|
|
|
|
#include <TrainingAreaBase/tab_fts.h>
|
|
#include "logger.h"
|
|
#include "training_area_telegrams.h"
|
|
#include "send_to_tab.h"
|
|
|
|
#include <QMap>
|
|
|
|
namespace TrainingAreaBase
|
|
{
|
|
class DdsHandler;
|
|
class MainHandler;
|
|
class RecvFromDdsFts final : protected Interface::Fts::DemandBiteRequestHandler
|
|
, protected Interface::Fts::DemandInitRequestHandler
|
|
, protected Interface::Fts::SendSetVulnerabilityModelRequestHandler
|
|
, protected Interface::Fts::DemandConfigurationReportRequestHandler
|
|
, protected Interface::Fts::DemandVulnerabilityStateChangeRequestHandler
|
|
, protected Interface::Fts::SendLanguageSelectionRequestHandler
|
|
, protected Interface::Fts::SendEquipmentMessageRequestHandler
|
|
, protected Interface::Fts::SendOcDataRequestHandler
|
|
, protected Interface::Fts::SendFireSmokeMarkerDataRequestHandler
|
|
, protected Interface::Fts::SendGeopairingDataRequestHandler
|
|
, protected Interface::Fts::SendTargetDataRequestHandler
|
|
, protected Interface::Fts::SendCesHitInformationRequestHandler
|
|
, protected Interface::Fts::SendCesHitRequestHandler
|
|
, protected Interface::Fts::SendParticipantSwVerionsRequestHandler
|
|
, protected Interface::Fts::SendParticipantModeRequestHandler
|
|
, protected Interface::Fts::DemandParticipantModeRequestHandler
|
|
, protected Interface::Fts::SendParticipantConfigurationRequestHandler
|
|
, protected Interface::Fts::DemandParticipantConfigurationRequestHandler
|
|
, protected Interface::Fts::SendParticipantBlockedAreaRequestHandler
|
|
, protected Interface::Fts::SendParticipantBeStillWarningRequestHandler
|
|
, protected Interface::Fts::SendSetSanitationRequestHandler
|
|
, protected Interface::Fts::SendResetAllDusMinesRequestHandler
|
|
, protected Interface::Fts::SendSelectiveReammunitionRequestHandler
|
|
, protected Interface::Fts::SetDevicePowerRequestHandler
|
|
, protected Interface::Fts::AdlerCalculateTrajectoryRequestHandler
|
|
, protected Interface::Fts::SendOcCommandRequestHandler
|
|
, protected Interface::Fts::SendUasWaypointRequestHandler
|
|
, protected Interface::Fts::SendModifyUasStateRequestHandler
|
|
, protected Interface::Fts::SendExFireReadinessRequestHandler
|
|
, protected Interface::Fts::SendExFiredReportRequestHandler
|
|
, protected Interface::Fts::SendExConfirmationReportRequestHandler
|
|
|
|
{
|
|
|
|
struct RemainEffectStruct
|
|
{
|
|
enum Category
|
|
{
|
|
RE_NONE = 0,
|
|
RE_LIGHT,
|
|
RE_LIGHT_MEDIUM,
|
|
RE_MEDIUM,
|
|
RE_MEDIUM_HEAVY,
|
|
RE_HEAVY
|
|
};
|
|
|
|
int remainEffectMax = 0;
|
|
Category category = RE_NONE;
|
|
|
|
RemainEffectStruct(int rem, Category categoryId)
|
|
: remainEffectMax(rem)
|
|
, category(categoryId)
|
|
{}
|
|
|
|
RemainEffectStruct()
|
|
: remainEffectMax(100)
|
|
, category(RE_NONE)
|
|
{}
|
|
|
|
int chargeTypeId(bool isOsag = true) const
|
|
{
|
|
// OSAG:
|
|
// 48, 49, 68, 69, 70
|
|
// ULEIS:
|
|
// ?, ?, 2170, 2171, 2172
|
|
if (isOsag)
|
|
{
|
|
switch (category)
|
|
{
|
|
case RE_NONE:
|
|
return 0;
|
|
case RE_LIGHT:
|
|
return 48;
|
|
case RE_LIGHT_MEDIUM:
|
|
return 49;
|
|
case RE_MEDIUM:
|
|
return 68;
|
|
case RE_MEDIUM_HEAVY:
|
|
return 69;
|
|
case RE_HEAVY:
|
|
return 70;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
switch (category)
|
|
{
|
|
case RE_NONE:
|
|
return 0;
|
|
case RE_LIGHT:
|
|
return 0;
|
|
case RE_LIGHT_MEDIUM:
|
|
return 0;
|
|
case RE_MEDIUM:
|
|
return 2170;
|
|
case RE_MEDIUM_HEAVY:
|
|
return 2171;
|
|
case RE_HEAVY:
|
|
return 2172;
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
};
|
|
|
|
public:
|
|
RecvFromDdsFts(MainHandler *mainHandler,
|
|
const std::shared_ptr<Interface::Fts> &ftsTab,
|
|
const std::shared_ptr<SendToTab> &txCallback);
|
|
|
|
void onDemandBiteRequest(const rti::core::SampleIdentity &cookie, const DemandBiteRequest &request) override;
|
|
void onDemandInitRequest(const rti::core::SampleIdentity &cookie, const DemandInitRequest &request) override;
|
|
void onSendSetVulnerabilityModelRequest(const rti::core::SampleIdentity &cookie, const SendSetVulnerabilityModelRequest &request) override;
|
|
void onDemandConfigurationReportRequest(const rti::core::SampleIdentity &cookie, const DemandConfigurationReportRequest &request) override;
|
|
void onDemandVulnerabilityStateChangeRequest(const rti::core::SampleIdentity &cookie, const DemandVulnerabilityStateChangeRequest &request) override;
|
|
void onSendLanguageSelectionRequest(const rti::core::SampleIdentity &cookie, const SendLanguageSelectionRequest &request) override;
|
|
void onSendEquipmentMessageRequest(const rti::core::SampleIdentity &cookie, const SendEquipmentMessageRequest &request) override;
|
|
void onSendOcDataRequest(const rti::core::SampleIdentity &cookie, const SendOcDataRequest &request) override;
|
|
void onSendFireSmokeMarkerDataRequest(const rti::core::SampleIdentity &cookie, const SendFireSmokeMarkerDataRequest &request) override;
|
|
void onSendGeopairingDataRequest(const rti::core::SampleIdentity &cookie, const SendGeopairingDataRequest &request) override;
|
|
void onSendTargetDataRequest(const rti::core::SampleIdentity &cookie, const SendTargetDataRequest &request) override;
|
|
void onSendCesHitInformationRequest(const rti::core::SampleIdentity &cookie, const SendCesHitInformation &request) override;
|
|
void onSendCesHitRequest(const rti::core::SampleIdentity &cookie, const SendCesHitRequest &request) override;
|
|
void onSendParticipantSwVerionsRequest(const rti::core::SampleIdentity &cookie, const SendParticipantSwVerionsRequest &request) override;
|
|
void onSendParticipantModeRequest(const rti::core::SampleIdentity &cookie, const SendParticipantModeRequest &request) override;
|
|
void onDemandParticipantModeRequest(const rti::core::SampleIdentity &cookie, const DemandParticipantModeRequest & request) override;
|
|
void onSendParticipantConfigurationRequest(const rti::core::SampleIdentity &cookie, const SendParticipantConfigurationRequest &request) override;
|
|
void onDemandParticipantConfigurationRequest(const rti::core::SampleIdentity &cookie, const DemandParticipantConfigurationRequest &request) override;
|
|
void onSendParticipantBlockedAreaRequest(const rti::core::SampleIdentity &cookie, const SendParticipantBlockedAreaRequest &request) override;
|
|
void onSendParticipantBeStillWarningRequest(const rti::core::SampleIdentity &cookie, const SendParticipantBeStillWarningRequest &request) override;
|
|
void onSendSetSanitationRequest(const rti::core::SampleIdentity &cookie, const SendSetSanitationRequest &request) override;
|
|
void onSendResetAllDusMinesRequest(const rti::core::SampleIdentity &cookie, const SendResetAllDusMinesRequest &request) override;
|
|
void onSendSelectiveReammunitionRequest(const rti::core::SampleIdentity &cookie, const SendSelectiveReammunitionRequest &request) override;
|
|
void onSetDevicePowerRequest(const rti::core::SampleIdentity &cookie, const SetDevicePowerRequest &request) override;
|
|
void onAdlerCalculateTrajectoryRequest(const rti::core::SampleIdentity &cookie, const AdlerCalculateTrajectoryRequest &request) override;
|
|
void onSendOcCommandRequest(const rti::core::SampleIdentity &cookie, const SendOcCommandRequest &request) override;
|
|
void onSendUasWaypointRequest(const rti::core::SampleIdentity &cookie, const SendUasWaypointRequest &request) override;
|
|
void onSendModifyUasStateRequest(const rti::core::SampleIdentity &cookie, const SendModifyUasStateRequest &request) override;
|
|
void onSendExFireReadinessRequest(const rti::core::SampleIdentity &cookie, const SendExFireReadinessRequest &request) override;
|
|
void onSendExFiredReportRequest(const rti::core::SampleIdentity &cookie, const SendExFiredReportRequest &request) override;
|
|
void onSendExConfirmationReportRequest(const rti::core::SampleIdentity &cookie, const SendExConfirmationReportRequest &request) override;
|
|
|
|
private:
|
|
static Core::FunctionReplyObject fillFro(int participantId, bool bSuccess);
|
|
int calculateRemainEffectTasCode(int chargeTypeIdBase, int remainEffectPercent) const;
|
|
uint32_t getVulnerabilityVitalityIndexFromVitalityAndVba(uint32_t vulnerabilityKind, uint32_t vitality);
|
|
int getDestructiveCategorie(const int destructiveFactor) const;
|
|
QMap<int, QVector<RemainEffectStruct> > loadRemainEffectStructMap();
|
|
|
|
private:
|
|
|
|
MainHandler *m_mainHandler;
|
|
std::shared_ptr<Interface::Fts> m_ftsTab;
|
|
std::shared_ptr<SendToTab> m_txCallback;
|
|
QMap<int, QVector<RemainEffectStruct>> m_categorieData;
|
|
LOGGER_T m_logger;
|
|
|
|
|
|
};
|
|
}
|