Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,27 @@
|
||||
#
|
||||
# monitoring of the target areas
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
#
|
||||
|
||||
SET(SRCS
|
||||
plugin.cpp
|
||||
plugin.h
|
||||
handler_nbc.cpp
|
||||
handler_nbc.h
|
||||
)
|
||||
|
||||
NGL_ADD_LIBRARY(AAR SV cesPluginCES_NBC MODULE ${SRCS})
|
||||
NGL_TARGET_LINK_LIBRARIES(cesPluginCES_NBC
|
||||
PUBLIC
|
||||
Qt5::Network
|
||||
Qt5::Widgets
|
||||
cesPluginInterface
|
||||
ngldb
|
||||
svcCesDDSCommon
|
||||
svcBldClient
|
||||
# ProjectConfig
|
||||
)
|
||||
NGL_INSTALL_TARGET(cesPluginCES_NBC)
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,153 @@
|
||||
/**
|
||||
* Handler for player data
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by gr, SLSE, 2017-02-20
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <CentralEffectSimulation/logger.h>
|
||||
|
||||
|
||||
#include <Buildings/bld_dtc.h>
|
||||
#include <CentralEffectSimulation/dds_handler.h>
|
||||
#include <CentralEffectSimulation/aes_item_view_utm.h>
|
||||
#include <CentralEffectSimulation/handler_participant.h>
|
||||
#include <CentralEffectSimulation/handler_building_data.h>
|
||||
|
||||
#include <QtCore/QHash>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QQueue>
|
||||
#include <QtCore/QPointF>
|
||||
#include <QtGui/QPolygonF>
|
||||
|
||||
// AES-Handling for participants
|
||||
namespace CES_NBC
|
||||
{
|
||||
enum class EffectType
|
||||
{
|
||||
Unknown = 0,
|
||||
EffectiveMineRangeEnter = 0xf0000 | 1, // AtMineAreaSingleMines = 15 = 0xf
|
||||
EffectiveMineRangeLeave = 0xf0000 | 2, // AtMineAreaSingleMines = 15 = 0xf
|
||||
NContaminationLeave = 0x10000 | 0, // AtNContamination = 1
|
||||
NContaminationEnterArea1 = 0x10000 | 1,
|
||||
NContaminationEnterArea2 = 0x10000 | 2,
|
||||
NContaminationDetonation = 0x10000 | 255,
|
||||
FunctionalAreaLeave = 0xc0000 | 0, // AtReconArea = 12 = 0xc
|
||||
FunctionalAreaEnter = 0xc0000 | 1,
|
||||
ExplosionArea = 0x30000 | 2, // AtExplosionArea = 3
|
||||
ExplosionSingle = 0x40000 | 3, // AtExplosionSingle = 4
|
||||
BCContaminationLeave = 0x20000 | 0, // AtBCContamination = 2
|
||||
BCContaminationEnterFloating = 0x20000 | 1,
|
||||
BCContaminationEnterResident = 0x20000 | 2,
|
||||
BCContaminationEnterFloatingArea = 0x20000 | 3,
|
||||
BeStillWarning = 11,
|
||||
};
|
||||
QString toString(EffectType et);
|
||||
|
||||
struct ParticipantDistance
|
||||
{
|
||||
double squareDistance = 0;
|
||||
CentralEffectSimulation::HandlerParticipant::CesParticipantData participantPosition;
|
||||
};
|
||||
|
||||
class HandlerNBC : public QObject
|
||||
, protected TrainingAreaBase::Interface::Ftc::SendCesHitReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit HandlerNBC(const std::shared_ptr<CentralEffectSimulation::DdsHandler> &ddsHandler,
|
||||
const std::shared_ptr<CentralEffectSimulation::HandlerParticipant> &participantHandler,
|
||||
QObject *parent = nullptr);
|
||||
|
||||
~HandlerNBC();
|
||||
|
||||
/**
|
||||
* Initialize the handler to manage information from player management
|
||||
*/
|
||||
bool init();
|
||||
|
||||
protected:
|
||||
void onSendCesHitReply(const Core::FunctionReplyObject &replyObject) override final;
|
||||
|
||||
private Q_SLOTS:
|
||||
/**
|
||||
* Handle the signals from 'AES'
|
||||
*/
|
||||
void onAesItemViewChanged(const AreaEffectSimulation::AesItemView &data, DataModification modType);
|
||||
void onBCContaminationChanged(const AreaEffectSimulation::BCContamination &data, DataModification modType);
|
||||
void onNContaminationChanged(const AreaEffectSimulation::NContamination &data, DataModification modType);
|
||||
void onBuildingStateChanged(const Buildings::BuildingState &data, DataModification modType);
|
||||
|
||||
private: // methoden
|
||||
void calculateBcContamination(const CentralEffectSimulation::AesItemViewUtm &itemView);
|
||||
void calculateDangerArea(const CentralEffectSimulation::AesItemViewUtm &itemView);
|
||||
void deleteDangerArea(const int aesItemId);
|
||||
void onNewOutdoorParticipantPosition(const CentralEffectSimulation::HandlerParticipant::CesParticipantData &participantData);
|
||||
void onNewIndoorParticipantPosition(const CentralEffectSimulation::HandlerParticipant::CesParticipantData &participantData);
|
||||
void onParticipantDecontaminated(const int participantId);
|
||||
void onRestoreRadioReadinessChanged(const int participantId);
|
||||
|
||||
bool inCircle(const QPointF ¢erUtm, const double radius, const QPointF &pointUtm);
|
||||
bool inBoundingBoxCheck(const CentralEffectSimulation::AesItemViewUtm &itemView, const CentralEffectSimulation::HandlerParticipant::CesParticipantData &participantData);
|
||||
void sendEnterEvent(const int aesItemId, const AreaEffectSimulation::AesType aesTypeId, const CentralEffectSimulation::HandlerParticipant::CesParticipantData &participantData, bool isIndoor = false);
|
||||
void sendLeaveEvent(const int aesItemId, const CentralEffectSimulation::HandlerParticipant::CesParticipantData &participantData);
|
||||
bool inFormCheck(const CentralEffectSimulation::AesItemViewUtm &itemView, const CentralEffectSimulation::HandlerParticipant::CesParticipantData &participantData);
|
||||
void sendCesHitRequest(const CentralEffectSimulation::AesItemViewUtm &itemView,
|
||||
const CentralEffectSimulation::HandlerParticipant::CesParticipantData &participantData,
|
||||
qint64 effectTime,
|
||||
int remaining,
|
||||
int mineFieldBitIndex = 0);
|
||||
void sendCesHitRequest(const int aesItemId,
|
||||
const CentralEffectSimulation::HandlerParticipant::CesParticipantData &participantData,
|
||||
qint64 effectTime,
|
||||
int remaining,
|
||||
int mineFieldBitIndex = 0,
|
||||
EffectType effectType = CES_NBC::EffectType::Unknown);
|
||||
void sendParticipantEvent(const int aesItemId,
|
||||
const CentralEffectSimulation::HandlerParticipant::CesParticipantData &participantData,
|
||||
const ProjectDataManagement::EventType eventType);
|
||||
void sendEffectTypeEvent(const int aesItemId,
|
||||
const CentralEffectSimulation::HandlerParticipant::CesParticipantData &participantData,
|
||||
EffectType effectType);
|
||||
|
||||
bool eventMustBeSend(int aesItemId,
|
||||
int participantId,
|
||||
const ProjectDataManagement::EventType eventType);
|
||||
|
||||
bool effectTypeMustBeSend(int aesItemId,
|
||||
int participantId,
|
||||
EffectType effectType);
|
||||
|
||||
ProjectDataManagement::EventType leaveEventTypeForAesType(AreaEffectSimulation::AesType aesTypeId);
|
||||
EffectType leaveEffectTypeForAesType(AreaEffectSimulation::AesType aesTypeId);
|
||||
EffectType effectTypeForNContaminationArea(const CentralEffectSimulation::AesItemViewUtm &itemView, const QPointF &participantPosUtmPoint, qint64 partPosSampleTime, const bool isIndoor);
|
||||
EffectType effectTypeForBCContaminationArea(const CentralEffectSimulation::AesItemViewUtm &itemView, const QPointF &participantPosUtmPoint);
|
||||
|
||||
void aesItemViewRemoved(int aesItemId);
|
||||
int getContaminationFromBuildingRoom(const int buildingId, const int roomId) const;
|
||||
|
||||
private: // attributes
|
||||
|
||||
std::shared_ptr<CentralEffectSimulation::DdsHandler> m_ddsHandler; ///< Pointer to VOM DDS handler
|
||||
std::shared_ptr<CentralEffectSimulation::HandlerParticipant> m_handlerParticipant;
|
||||
std::shared_ptr<CentralEffectSimulation::HandlerBuildingData> m_handlerBuildingData;
|
||||
QHash<int32_t, int> m_aesItemId2partIdMap;
|
||||
|
||||
|
||||
// AES-Values
|
||||
QHash<int, CentralEffectSimulation::AesItemViewUtm> m_aesItemViews; // key = aesItemId
|
||||
QQueue<TrainingAreaBase::SendCesHitRequest> m_sendCesHitRequestQueue;
|
||||
QHash<int, AreaEffectSimulation::AesEffectState> m_explosionSingleStates; // key = id value = state
|
||||
QHash<int, QHash<int, QSet<ProjectDataManagement::EventType>>> m_eventStates; // QHash<aesItemId, QHash<participantId, QSet<EventType>>>
|
||||
QHash<int, QHash<int, QSet<EffectType>>> m_effectTypeStates; // QHash<aesItemId, QHash<participantId, QSet<effectStates>>>
|
||||
QHash<int, QHash<int, bool>> m_participantAes; // key = ParticipantId key in value = aesId
|
||||
QHash<int, int> m_isInContaminatedRoom; // key = ParticipantId value = aesId
|
||||
QHash<int, int> m_lastRoomId; // key = ParticipantId value = RoomId from last position
|
||||
|
||||
CentralEffectSimulation::LOGGER_T &m_logger; ///< Interface to the Logging-Facility
|
||||
};
|
||||
} // namespace CES_NBC
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
/**
|
||||
* Plugin NBC
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Gerlinde Rudolphus, SLTE, 2016-04-14
|
||||
*/
|
||||
|
||||
#include "plugin.h"
|
||||
#include "settings.h"
|
||||
|
||||
namespace CES_NBC
|
||||
{
|
||||
|
||||
|
||||
std::shared_ptr<CentralEffectSimulation::Plugin::Interface> CentralEffectSimulationNBCPlugin::createInterface(CentralEffectSimulation::Plugin::DataProvider *pdp,
|
||||
const std::shared_ptr<DDSConnector::DdsConnector> &dDSConnector,
|
||||
NGL::Settings *settings,
|
||||
CentralEffectSimulation::MainHandler *mainHandler)
|
||||
{
|
||||
return std::make_shared<CES_NBCInterfaceImpl>(pdp, dDSConnector, settings, mainHandler);
|
||||
}
|
||||
|
||||
|
||||
CES_NBCInterfaceImpl::CES_NBCInterfaceImpl(CentralEffectSimulation::Plugin::DataProvider *pdp,
|
||||
const std::shared_ptr<DDSConnector::DdsConnector> &dDSConnector,
|
||||
NGL::Settings *settings,
|
||||
CentralEffectSimulation::MainHandler *mainHandler)
|
||||
: m_pdp(pdp)
|
||||
, m_ddsConnector(dDSConnector)
|
||||
, m_mainHandler(mainHandler)
|
||||
, m_ddsHandler(m_mainHandler->dds())
|
||||
, m_db(m_mainHandler->db())
|
||||
, m_handlerParticipant(m_mainHandler->handlerParticipant())
|
||||
, m_logger(CentralEffectSimulation::getLogger("Plugin.NBC.CES_NBCInterfaceImpl"))
|
||||
{
|
||||
Q_UNUSED(settings)
|
||||
}
|
||||
|
||||
CES_NBCInterfaceImpl::~CES_NBCInterfaceImpl()
|
||||
{
|
||||
m_handlerNBC.reset();
|
||||
}
|
||||
|
||||
|
||||
bool CES_NBCInterfaceImpl::init(int domainId, int exerciseId)
|
||||
{
|
||||
|
||||
m_domainId = domainId;
|
||||
m_exerciseId = exerciseId;
|
||||
INFO_LOG(m_logger) << "CES_NBCInterfaceImpl::init()"
|
||||
<< " m_domainId=" << m_domainId
|
||||
<< " m_exerciseId=" << m_exerciseId;
|
||||
|
||||
|
||||
|
||||
// initialize handlerNBC
|
||||
m_handlerNBC = std::make_shared<HandlerNBC>(m_ddsHandler,
|
||||
m_handlerParticipant,
|
||||
this);
|
||||
|
||||
if (!m_handlerNBC->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation m_handlerNBC failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
INFO_LOG(m_logger) << "CES_NBCInterfaceImpl::init() return true";
|
||||
return true;
|
||||
}
|
||||
|
||||
QString CES_NBCInterfaceImpl::echo(const QString &message)
|
||||
{
|
||||
|
||||
QString ret(QStringLiteral("<<<< %1 >>>> CES_NBCInterfaceImpl::echo").arg(message));
|
||||
INFO_LOG(m_logger) << "CES_NBCInterfaceImpl::echo return:" << ret;
|
||||
DEBUG_LOG(m_logger) << "DEBUG: CES_NBCInterfaceImpl::echo return:" << ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
} //namespace CES_NBC
|
||||
@@ -0,0 +1,75 @@
|
||||
/**
|
||||
* Plugin NBC
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Gerlinde Rudolphus, SLTE, 2016-04-14
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "handler_nbc.h"
|
||||
|
||||
#include <DDS/DDSConnector/dds_connector.h>
|
||||
#include <CentralEffectSimulation/ces_plugin_interface.h>
|
||||
#include <CentralEffectSimulation/main_handler.h>
|
||||
#include <CentralEffectSimulation/dds_handler.h>
|
||||
|
||||
#include <QObject>
|
||||
|
||||
|
||||
namespace CES_NBC
|
||||
{
|
||||
|
||||
class CentralEffectSimulationNBCPlugin : public QObject, public CentralEffectSimulation::Plugin::Plugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "special:3:ces.CentralEffectSimulationNBCPlugin")
|
||||
Q_INTERFACES(CentralEffectSimulation::Plugin::Plugin)
|
||||
|
||||
public:
|
||||
CentralEffectSimulationNBCPlugin() = default;
|
||||
~CentralEffectSimulationNBCPlugin() = default;
|
||||
std::shared_ptr<CentralEffectSimulation::Plugin::Interface> createInterface(CentralEffectSimulation::Plugin::DataProvider *pdp,
|
||||
const std::shared_ptr<DDSConnector::DdsConnector> &dDSConnector,
|
||||
NGL::Settings *settings,
|
||||
CentralEffectSimulation::MainHandler *mainHandler) override;
|
||||
|
||||
};
|
||||
|
||||
|
||||
class CES_NBCInterfaceImpl final : public CentralEffectSimulation::Plugin::Interface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CES_NBCInterfaceImpl(CentralEffectSimulation::Plugin::DataProvider *pdp,
|
||||
const std::shared_ptr<DDSConnector::DdsConnector> &dDSConnector,
|
||||
NGL::Settings *settings,
|
||||
CentralEffectSimulation::MainHandler *mainHandler);
|
||||
~CES_NBCInterfaceImpl();
|
||||
//bool init();
|
||||
const char *name() const override { return "CentralEffectSimulationNBC"; }
|
||||
QString echo(const QString &message) override;
|
||||
|
||||
private Q_SLOTS:
|
||||
bool init(int domainId, int exerciseId) override;
|
||||
private:
|
||||
|
||||
private:
|
||||
CentralEffectSimulation::Plugin::DataProvider *m_pdp{nullptr};
|
||||
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
|
||||
CentralEffectSimulation::MainHandler *m_mainHandler{nullptr};
|
||||
|
||||
std::shared_ptr<CentralEffectSimulation::DdsHandler> m_ddsHandler;
|
||||
std::shared_ptr<CentralEffectSimulation::DatabaseInterface> m_db;
|
||||
std::shared_ptr<CentralEffectSimulation::HandlerParticipant> m_handlerParticipant; ///< Pointer to handler for all participants
|
||||
|
||||
std::shared_ptr<HandlerNBC> m_handlerNBC; ///< Pointer to handler for participant outside from Buildings
|
||||
|
||||
|
||||
CentralEffectSimulation::LOGGER_T &m_logger; ///< Interface to the Logging-Facility
|
||||
int m_domainId = 0;
|
||||
int m_exerciseId = 0;
|
||||
};
|
||||
|
||||
} // namespace CES_NBC
|
||||
Reference in new issue
Block a user