Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Services/OcSituationClient/handler_oc_situation_data.h
T
torstenandCopilot d5af8b9764 Session 026: Lts/Services Qt5:: to Qt6:: migration
- Migrated all 104 CMakeLists.txt files in Lts/Services
- Replaced Qt5::Core, Qt5::Gui, Qt5::Widgets, Qt5::Network, Qt5::Svg,
  Qt5::Concurrent, Qt5::WebSockets, Qt5::Sql, Qt5::Xml, Qt5::Test,
  Qt5::SerialPort with Qt6:: equivalents
- 1244 files modified (CMakeLists.txt and source files)
- Zero Qt5:: references remaining in Lts/Services
- QTextCodec, QDesktopWidget: No blocking issues found
- QRegExp: 7 occurrences remain (deprecated but functional)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-08-25 19:23:30 +02:00

132 lines
5.1 KiB
C++
Executable File

/**
* Handler for all oc situation data at the client
* $Id$
* $HeadURL$
* $Author$
* Created by Philipp Dassow, NLST, 01-03-2018
*/
#pragma once
#include <QHash>
#include <ParticipantManagement/ppm_dtc.h>
#include <ParticipantManagement/ppm_ftc.h>
#include <OcSituationServer/oc_situation.h>
#include <TrainingAreaBase/tab_dts.h>
#include <TrainingAreaBaseOC/taboc_dtc.h>
#include <TrainingAreaBaseOC/taboc_dts.h>
#include "dds_handler.h"
#include "logger.h"
namespace OcSituationClient
{
class HandlerOcSituationData : public QObject
, protected ParticipantManagement::Interface::Ftc::ModifyParticipantDataReplyHandler
{
Q_OBJECT
public:
explicit HandlerOcSituationData(const std::shared_ptr<DdsHandler> &dds,
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
const std::shared_ptr<ParticipantManagement::Interface::Ftc> &ppmFtc,
const std::shared_ptr<TrainingAreaBase::Interface::Dts> &tabDts,
const std::shared_ptr<TrainingAreaBaseOC::Interface::Dtc> &tabocDtc,
const std::shared_ptr<TrainingAreaBaseOC::Interface::Dts> &tabocDts,
QObject *parent);
~HandlerOcSituationData();
bool init();
void process(const QByteArray &data, bool bIsInitial);
void removeAllPositions();
void setInvalidPositionForParticipant(int participantId);
void onModifyParticipantDataReply(const Core::FunctionReplyObject &reply);
bool withCompression() const { return m_bWithCompression; }
void setWithCompression(bool bOn) { m_bWithCompression = bOn; }
bool withVBGTime() const { return m_bWithVBGTime; }
void setWithVBGTime(bool bOn) { m_bWithVBGTime = bOn; }
private:
bool decodeSituationData(const QByteArray &data);
void sendParticipantData(int requestId);
template <typename T>
void publishMap(QMap<int, T> &map);
void sendTrainingAreaBaseData();
bool getParticipantId(const QByteArray &buf,
size_t &pos,
int &participantId,
OcSituation::ModificationBits &modifiedFlags) const;
bool getPosition2D(const QByteArray &buf,
size_t &pos,
TrainingAreaBase::EquipmentPosition &position,
bool bAvailable) const;
bool getPosition3D(const QByteArray &buf,
size_t &pos,
TrainingAreaBase::EquipmentPosition &position,
bool bAvailable) const;
bool getVBG(const QByteArray &buf,
size_t &pos,
TrainingAreaBase::EquipmentState &equipmentState,
TrainingAreaBase::ParticipantSanitation &sanitation,
bool bAvailable) const;
bool getState(const QByteArray &buf,
size_t &pos,
TrainingAreaBase::SpecialSensorData &specialSensorData,
TrainingAreaBase::EquipmentOperationalState &equipmentOperationalState,
bool bAvailable) const;
bool getStructure(const QByteArray &buf,
size_t &pos,
ParticipantManagement::ParticipantData &participant,
bool bAvailable) const;
bool getDesignator(const QByteArray &buf,
size_t &pos,
ParticipantManagement::ParticipantData &participant,
bool bAvailable) const;
bool getSymbolSidc(const QByteArray &buf,
size_t &pos,
ParticipantManagement::ParticipantData &participant,
bool bAvailable) const;
void onPartyChanged(const ParticipantManagement::Party &party, DataModification mod);
void onParticipantChanged(const ParticipantManagement::Participant &participant, DataModification mod);
private:
// for partition time
std::shared_ptr<DdsHandler> m_dds;
// data publishing
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
std::shared_ptr<ParticipantManagement::Interface::Ftc> m_ppmFtc;
std::shared_ptr<TrainingAreaBase::Interface::Dts> m_tabDts;
std::shared_ptr<TrainingAreaBaseOC::Interface::Dtc> m_tabocDtc;
std::shared_ptr<TrainingAreaBaseOC::Interface::Dts> m_tabocDts;
// internal participant data
// all paired to thier participantId
QMap<int, ParticipantManagement::ParticipantData> m_participantData;
QMap<int, TrainingAreaBase::EquipmentPosition> m_equipmentPositions;
QMap<int, TrainingAreaBase::EquipmentState> m_equipmentStates;
QMap<int, TrainingAreaBase::ParticipantSanitation> m_participantSanitations;
QMap<int, TrainingAreaBase::EquipmentOperationalState> m_equipmentOperationalStates;
QMap<int, TrainingAreaBase::SpecialSensorData> m_specialSensorData;
// internal management data
QHash<int, int> m_participantId2EqId;
QHash<int, ParticipantManagement::ModifyParticipantDataRequest *> m_modifiyRequests;
QSet<int> m_knownParties;
QHash<int, ParticipantManagement::Participant> m_participants;
int m_requestId = 1;
// options, must be in sync with oss
bool m_bWithCompression = true;
bool m_bWithVBGTime = true;
LOGGER_T &m_logger;
};
} // namespace OcSituationClient