Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,159 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HlaDispatcher for AdlerJson Plugin
|
||||
* $Id: hla_dispatcher.h 62304 2024-03-21 08:17:45Z ewert_j $
|
||||
* $HeadURL: svn://slssvn/TDS/branches/product/features/ufom/Lts/Proxies/TrainingAreaBase/Plugins/AdlerJson/hla_dispatcher.h $
|
||||
* $Author: ewert_j $
|
||||
* Created by Julius Ewert, ESIM, 2024-03-20
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QHash>
|
||||
#include <QObject>
|
||||
#include <QVector>
|
||||
#include <QWebSocket>
|
||||
#include <DDS/Core/function_reply_object.h> // tr_lts
|
||||
#include <TrainingAreaBase/tab_plugin_interface.h>
|
||||
// #include "logger.h"
|
||||
#include "aes_handler.h"
|
||||
#include "asm_handler.h"
|
||||
#include "flm_handler.h"
|
||||
#include "pdm_handler.h"
|
||||
#include "ppm_handler.h"
|
||||
#include "saa_interface.h"
|
||||
#include "telegrams.h"
|
||||
#include "ws_interface.h"
|
||||
|
||||
// #include <NotificationManagement/nom_ftc.h>
|
||||
#include <NotificationManagement/nom_enums.hpp>
|
||||
// #include <TrainingAreaBase/tab_dts.h>
|
||||
// #include <TrainingAreaBase/tab_fts.h>
|
||||
|
||||
class QTimer;
|
||||
namespace AdlerJson
|
||||
{
|
||||
using namespace TrainingAreaBase;
|
||||
class JsonHandlerRx;
|
||||
class JsonHandlerTx;
|
||||
class DdsHandler;
|
||||
// class EXStatus;
|
||||
|
||||
struct TrajectoryIdentifier
|
||||
{
|
||||
int aesItemId;
|
||||
int explosionId;
|
||||
};
|
||||
|
||||
class JsonDispatcher final
|
||||
: public TrainingAreaBase::Plugin::Interface
|
||||
, protected TrainingAreaBase::Interface::Fts::AdlerCalculateTrajectoryRequestHandler
|
||||
, protected NotificationManagement::Interface::Ftc::CreateNotificationReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
JsonDispatcher(TrainingAreaBase::Plugin::DataProvider *pdp,
|
||||
const std::shared_ptr<TrainingAreaBase::RecvFromTab> &recvFromTabCb,
|
||||
const std::shared_ptr<TrainingAreaBase::TxMixin> &sendToTabCb,
|
||||
NGL::Settings *settings,
|
||||
std::shared_ptr<TrainingAreaBase::DdsHandler> &ddsHandler,
|
||||
std::shared_ptr<FlmHandler> &flmHandler,
|
||||
MainDispatcher *mainDispatcher);
|
||||
|
||||
public Q_SLOTS:
|
||||
bool init() override;
|
||||
|
||||
public:
|
||||
std::shared_ptr<TrainingAreaBase::SendToTab> sendToTab() override;
|
||||
bool isDebugInterface() const override { return false; }
|
||||
bool canSendData() const override;
|
||||
void exerciseChanged() override { return; }
|
||||
const char *name() const override { return tr_lts("dds", "APHLA"); }
|
||||
std::shared_ptr<SAAInterface> getSAAByParty(const int partyId);
|
||||
std::shared_ptr<SAAInterface> getSAAByWs(const int wsId);
|
||||
QString getSender() { return QStringLiteral("EXCON@GUEZ.DE"); }
|
||||
// SendToTele
|
||||
bool sendExFeuerbereit(const ExFeuerbereit &exFBDataIn, const int partyId);
|
||||
bool sendExAbgefeuert(const ExAbgefeuert &exAFDataIn, int partyId);
|
||||
bool sendExMqManuelleQuittung(const ExMqManuelleQuittung &exMQDataIn, int partyId);
|
||||
bool sendExTqTechnischeQuittung(const ExTqTechnischeQuittung &exTQDataIn, int partyId);
|
||||
bool sendExVollzugsmeldung(const ExVollzugsmeldung &exVZDataIn, int partyId);
|
||||
void onAdlerCalculateTrajectoryRequest(const rti::core::SampleIdentity &cookie, const TrainingAreaBase::AdlerCalculateTrajectoryRequest &request) override;
|
||||
int getAssetId(const QString &saaName) const;
|
||||
// misc
|
||||
void cleanupSaaInterfaces(const QString &saaName, int wsId, int partyId);
|
||||
void getCreateNotificationRequestData(const int wsId,
|
||||
const QString &title,
|
||||
NotificationManagement::CreateNotification &data,
|
||||
const QString &content = {},
|
||||
const QStringList &contentArgs = {});
|
||||
void createNotificationRequest(const int wsId, const QString &title, const NotificationManagement::MessageType messageType, const NotificationManagement::NotificationType notificationType, const QString &content = {}, const QStringList &contentArgs = {});
|
||||
|
||||
public Q_SLOTS:
|
||||
void onSAARegistration(const int wsId, const int partyId, const QString &saaName, const QString &szenarName, bool isVerbund, const QString &uuid);
|
||||
void onSAADeregistration(const int wsId, const int partyId);
|
||||
void onSAAConnectionTest(const int wsId, const QString &uuid);
|
||||
void onSAAStatus(const int wsId, const EXStatus &status);
|
||||
void onSAAExceptionStatus(const int wsId, const TechnischeDaten &exceptionStatus);
|
||||
void onSAASQWS(const int wsId, const Waffensystemdaten &exSQWS);
|
||||
void onSAASQFS(const int wsId, const Feuerstellungsdaten &exSQFS);
|
||||
void onSAASQLP(const int wsId, const Ladeplatzdaten &exSQLP);
|
||||
void onSAAHXGuidingLines(const int wsId, const Koordinierungsdaten &koordinierungsdaten);
|
||||
void onSAAHXGuidingLinesAndBoundaries(const int wsId, const Fuehrungsdaten &fuehrungsdaten);
|
||||
void onSSAEXFIREHALT(const int wsId, const FeuerHaltDaten &feuerhaltdaten);
|
||||
void onSAATrajectoryData(const int wsId, const Flugbahndaten &exFlugbahndaten, const QString referenceUuid);
|
||||
|
||||
void onWebSocketConnected();
|
||||
void onNewWebsocketConnected(const int wsId, const QString &address, qint16 port);
|
||||
void onWSDisconnected(const int wsId);
|
||||
void onWebsocketExternalConnectionStateChanged(bool bConnected);
|
||||
void onWebSocketError();
|
||||
void onRecivedTelegram(int wsId, const QJsonObject &telegramData);
|
||||
void onTextMessageReceived(const QByteArray &message);
|
||||
void connectWebsocket();
|
||||
void reallyConnectWebsocket() { connectWebsocket(); }
|
||||
|
||||
void onKeepAliveTimerTimeout();
|
||||
void onCreateNotificationReply(const Core::FunctionReplyObject &replyObject);
|
||||
Q_SIGNALS:
|
||||
void broadcastTelegramsRequest(const int equipmentNumber, const int broadcastIndex, const int resetCounter);
|
||||
void jsonTelegramReceived(const TrainingAreaBase::TetraIcd::TrainingAreaTelegram *tele);
|
||||
void websocketConnected(quint16 port);
|
||||
|
||||
private:
|
||||
QUrl webSocketUrl() const;
|
||||
bool isConnectionTest(QJsonDocument &doc);
|
||||
QString getParticipantInfoLink(const QString &verein, const int partyId, const bool isVerbund);
|
||||
|
||||
std::shared_ptr<SAAInterface> getSAAByName(const QString &saaName);
|
||||
|
||||
private:
|
||||
std::shared_ptr<TrainingAreaBase::RecvFromTab> m_recvFromTabCb;
|
||||
std::shared_ptr<JsonHandlerRx> m_recvFromWebsocket;
|
||||
std::shared_ptr<JsonHandlerTx> m_sendToWebsocket;
|
||||
// DDS
|
||||
MainDispatcher *m_mainDispatcher;
|
||||
std::shared_ptr<FlmHandler> m_flmHandler;
|
||||
std::shared_ptr<PpmHandler> m_ppmHandler;
|
||||
|
||||
std::shared_ptr<TrainingAreaBase::Interface::Fts> m_ftsTab;
|
||||
std::shared_ptr<TrainingAreaBase::Interface::Dts> m_dtsTab;
|
||||
std::shared_ptr<NotificationManagement::Interface::Ftc> m_ftcNom;
|
||||
|
||||
QVector<std::shared_ptr<SAAInterface>> m_saaInterfaces;
|
||||
QMap<int, QTimer *> m_connectionKeepaliveTimer;
|
||||
|
||||
QHash<QString, TrajectoryIdentifier> m_trajectoryIdentifier; // key = exFlugbahnberechnung.uuid
|
||||
QHash<QString, Core::GeoPosition> m_positionsLaunch; // key = exFlugbahnberechnung.uuid
|
||||
|
||||
NGL::Settings *m_settings;
|
||||
QWebSocket *m_webSocket;
|
||||
std::shared_ptr<TrainingAreaBase::WebSocketInterface> m_webSocketInterface;
|
||||
QTimer *m_webSocketReconnectTimer;
|
||||
bool m_bWarnedOnce;
|
||||
rti::core::SampleIdentity m_cookieCalculateTrajectoryAdler;
|
||||
int m_explosionIndex;
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
|
||||
} // namespace AdlerJson
|
||||
Reference in new issue
Block a user