Resolves 17 conflicts against legacy Qt5 semantics; validates with BUILD_RTI=ON BUILD_GRANTLEE=ON.
112 lines
5.2 KiB
C++
Executable File
112 lines
5.2 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* PpmHandler for AdlerJson Plugin
|
|
* $Id: ppm_handler.h 62899 2024-05-29 11:08:50Z ewert_j $
|
|
* $HeadURL: svn://slssvn/TDS/branches/product/features/ufom/Lts/Proxies/TrainingAreaBase/Plugins/AdlerJson/ppm_handler.h $
|
|
* $Author: ewert_j $
|
|
* Created by Julius Ewert, ESIM, 2024-03-20
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "Core/core.hpp"
|
|
#include "main_dispatcher.h"
|
|
#include "logger.h"
|
|
#include <ParticipantManagement/ppm.hpp>
|
|
#include <ParticipantManagement/ppm.hpp>
|
|
#include <ParticipantManagement/ppm_ftc.h>
|
|
#include <LtsUtils/LtsUtilsCore/data_modification_enum.h>
|
|
#include <QtCore/QTimer>
|
|
#include <QtCore/QObject>
|
|
#include <QtCore/QHash>
|
|
#include <QtCore/QUrl>
|
|
#include <QtCore/QDateTime>
|
|
#include <telegrams.h>
|
|
|
|
namespace AdlerJson
|
|
{
|
|
|
|
class MainDispatcher;
|
|
class PpmHandler
|
|
: public QObject
|
|
, protected ParticipantManagement::Interface::Ftc::ModifyParticipantDataReplyHandler
|
|
, protected ParticipantManagement::Interface::Ftc::ModifyPartyDataReplyHandler
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit PpmHandler(QObject *parent = nullptr);
|
|
bool init(MainDispatcher* mainDispatcher);
|
|
void getParticipants();
|
|
bool isEqNumberInExercise(const int equipmentNumber) const;
|
|
|
|
|
|
std::shared_ptr<ParticipantManagement::Interface::Dtc> getDtc() { return m_dtcPpm; }
|
|
std::shared_ptr<ParticipantManagement::Interface::Ftc> getFtc() { return m_ftcPpm; }
|
|
|
|
void onCreateParticipant();
|
|
|
|
// ModifyParticipantDataRequestHandler interface
|
|
void onModifyParticipantDataReply(const Core::FunctionReply &reply);
|
|
void onModifyPartyDataReply(const Core::FunctionReply &reply);
|
|
void modifyPartyAdlerProperties(const int wsId, const int assetId, const int partyId, const QString &saaName, const QString &szenarName,
|
|
const ParticipantManagement::ConnectState &connectState, const bool isVerbund);
|
|
|
|
//parse functions that trigger other services
|
|
void parseSQFS(const Feuerstellungsdaten &exSQFS, const int wsId);
|
|
void parseSQWS(const Waffensystemdaten &exSQWS, const int wsId);
|
|
void parseSQLP(const Ladeplatzdaten &exSQLP, const int wsId);
|
|
|
|
void removeAllSAAParticipants(const int partyId);
|
|
ParticipantManagement::Participant findParticipantByInternalName(const QString &internalName, const int partyId, const bool isVerbund);
|
|
|
|
signals:
|
|
void participantChanged(const QJsonObject &jsonObj);
|
|
void participantUnmount(const QJsonObject &jsonObj);
|
|
void participantMount(const QJsonObject &jsonObj);
|
|
|
|
private slots:
|
|
void onPartyChanged(const ParticipantManagement::Party &data, DataModification modType);
|
|
void onParticipantChanged(const ParticipantManagement::Participant &data, DataModification modType);
|
|
void onParticipantPositionChanged(const ParticipantManagement::ParticipantPosition &data, DataModification modType);
|
|
void onDynamicParticipantDataChanged(const ParticipantManagement::DynamicParticipantData &data, DataModification modType);
|
|
void onSendParticipantDataTimeout();
|
|
private:
|
|
void handleParticipantPositionChangedExternal(const ParticipantManagement::ParticipantPosition &position);
|
|
void handleParticipantPositionChangedInternal(const ParticipantManagement::ParticipantPosition &position);
|
|
|
|
void sendParticipantMount(const ParticipantManagement::Participant &part, const ParticipantManagement::Participant &partToBeMounted);
|
|
void sendParticipantUnmount(const ParticipantManagement::Participant &participant);
|
|
void sendParticipantPositionChanged(const ParticipantManagement::ParticipantPosition &position);
|
|
void onModifyParticipantDataReply(const Core::FunctionReplyObject &reply) override;
|
|
void onModifyPartyDataReply(const Core::FunctionReplyObject &reply) override;
|
|
|
|
QList<ParticipantManagement::Participant> findAllSAAParticipants(const int partyId);
|
|
ParticipantManagement::ParticipantData findParticipantDataByInternalName(int &randomNumberInOut, const QString &internalName, const bool isVerbund);
|
|
ParticipantManagement::ParticipantData findRootUnit(const int partyId);
|
|
|
|
void sendPositionFromTempMap(int rndNmbr, const int partyId, const bool isVerbund);
|
|
void sendChargesFromTempMap(const int rndNmbr, const int partyId, const bool isVerbund);
|
|
void sendReadyMessageFromTempMap(int rndNmbr, const int partyId, const bool isVerbund);
|
|
int convertStatus_L28(const ProjectDataManagement::L28_Status &status);
|
|
|
|
QVector<AdlerJson::Geschoss> sumUpAnzahlForSameGeschoss(const QVector<AdlerJson::Geschoss> &geschosse) const;
|
|
private:
|
|
MainDispatcher *m_mainDispatcher;
|
|
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_dtcPpm;
|
|
std::shared_ptr<ParticipantManagement::Interface::Ftc> m_ftcPpm;
|
|
QHash<int, int> m_participantIdsByEqNo; // eqNo, partId
|
|
QHash<int, int> m_mountedParticipants;// participantId of passanger, participantId of Vehicle
|
|
QTimer *m_sendParticipantDataTimer;
|
|
QVector<int> m_randomNumbers;
|
|
//maps
|
|
QMap<ProjectDataManagement::L19_Oi, KoordinateMitHoehe> m_mapLocationToPosition;
|
|
QMap<int, QMap<QString,KoordinateMitHoehe>> m_tempPositionMap;
|
|
QMap<int, QVector<QString>> m_tempinternalNameMap;
|
|
QMap<int, QMap<QString,QVector<Geschoss>>> m_tempChargesMap;
|
|
QMap<int, std::vector<ParticipantManagement::ParticipantData>> m_tempPartDataList;
|
|
QMap<int, QMap<QString,ProjectDataManagement::L28_Status>> m_tempReadyMessage;
|
|
|
|
};
|
|
|
|
} // namespace AdlerJson
|