Files
qt5-legatus-legacy/Lts/Services/CentralEffectSimulation/Plugins/ArtillerySound/handler_artillerie_sound.h
T
2026-08-13 18:33:10 +02:00

68 lines
2.3 KiB
C++
Executable File

/**
* Handler for Blocked Areas
* $Id$
* $HeadURL$
* $Author$
* Created by gr, SLSE, 2018-07-02
*/
#pragma once
#include <CentralEffectSimulation/logger.h>
#include <CentralEffectSimulation/dds_handler.h>
#include <CentralEffectSimulation/handler_participant.h>
#include <CentralEffectSimulation/handler_building_data.h>
#include <AreaEffectSimulation/aes_dtc.h>
#include <ParticipantManagement/ppm_dtc.h>
#include <TrainingAreaBase/tab_ftc.h>
#include <QtCore/QObject>
// HTTP Request
#include <QNetworkAccessManager>
namespace CesArtillerySound
{
class HandlerArtillerieSound final
: public QObject
{
Q_OBJECT
public:
explicit HandlerArtillerieSound(const std::shared_ptr<CentralEffectSimulation::DdsHandler> &ddsHandler,
const std::shared_ptr<CentralEffectSimulation::HandlerBuildingData> &buildingDataHandler,
QObject *parent);
~HandlerArtillerieSound();
bool init();
private Q_SLOTS:
void onExplosionSingleChanged(const AreaEffectSimulation::ExplosionSingle &data, DataModification modType);
void onTechnicalAreaChanged(const AreaEffectSimulation::TechnicalArea &data, DataModification modType);
void httpFinished();
private:
void playSound(QString &user, QString &passwd, const QString &host, int &sound, qreal &volume);
void startRequest(const QUrl &requestedUrl);
private: // attributes
std::shared_ptr<CentralEffectSimulation::DdsHandler> m_ddsHandler; ///< Pointer to DDS handler
std::shared_ptr<CentralEffectSimulation::HandlerBuildingData> m_handlerBuildingData;
QHash<int, AreaEffectSimulation::AesEffectState> m_explosionSingleState; // key = id, value = state
QHash<int, AreaEffectSimulation::TechnicalArea> m_technicalAreas;
QHash<int, QPointF> m_centerSoundArea; // key: TechnicalAreaId, value Center of SoundArea
QHash<int, QPointF> m_egcus;
QHash<int, QPointF> m_ogcus;
QNetworkAccessManager m_qnam;
bool m_httpRequestAborted = false;
CentralEffectSimulation::LOGGER_T &m_logger; ///< Interface to the Logging-Facility
};
} // namespace CesArtillerySound