/* * @brief Defines the EuroScope plug-in * @file src/PlugIn.h * @author Sven Czarnian * @copyright Copyright 2021 Sven Czarnian * @license This project is published under the GNU General Public License v3 (GPLv3) */ #pragma once #include #pragma warning(push, 0) #include #pragma warning(pop) #include #pragma warning(push, 0) #include #include #include #pragma warning(pop) #include "RadarScreen.h" namespace aman { /** * @brief Defines the EuroScope plug-in * @ingroup euroscope */ class PlugIn : public EuroScopePlugIn::CPlugIn { public: /** * @brief Defines the different internal and external tag functions */ enum class TagItemFunction { ForceToBackend = 0, }; private: enum class TagItemElement { }; void validateBackendData(); aman::Aircraft* generateAircraftMessage(EuroScopePlugIn::CRadarTarget& target); void generateAircraftReportMessage(EuroScopePlugIn::CRadarTarget& radarTarget, aman::AircraftReport* report); Communication m_configuration; std::shared_ptr m_screen; std::mutex m_updateQueueLock; std::map> m_updateQueue; std::list m_forcedToBackendCallsigns; bool m_compatible; public: /** * @brief Creates a new plug-in */ PlugIn(); /** * @brief Destroys all internal strcutures */ ~PlugIn() noexcept; PlugIn(const PlugIn&) = delete; PlugIn(PlugIn&&) = delete; PlugIn& operator=(const PlugIn&) = delete; PlugIn& operator=(PlugIn&&) = delete; /** * @brief Called as soon as a new RADAR screen needs to be created * @param[in] displayName The display's name * @param[in] needsRadarContent True of the screen needs RADAR content * @param[in] geoReferenced True if the positions are geo referenced * @param[in] canBeSaved True if the configurations can be saved * @param[in] canBeCreated True if the configuration can be created * @return The created RADAR screen */ EuroScopePlugIn::CRadarScreen* OnRadarScreenCreated(const char* displayName, bool needsRadarContent, bool geoReferenced, bool canBeSaved, bool canBeCreated) override; /** * @brief Called as soon as a controller writes down a command * @param[in] cmdline The commandline * @return True if the command was parsed, else false */ bool OnCompileCommand(const char* cmdline) override; /** * @brief Called as soon as a function is triggered * @param[in] functionId The triggered ID * @param[in] itemString The content of the message * @param[in] pt The click position * @param[in] area The clicked area */ void OnFunctionCall(int functionId, const char* itemString, POINT pt, RECT area) override; /** * @brief Called every second * @param[in] counter The counter that indicates the seconds */ void OnTimer(int counter) override; /** * @brief Called as soon as a radar target position is updated * @param[in] radarTarget The updated radar target */ void OnRadarTargetPositionUpdate(EuroScopePlugIn::CRadarTarget radarTarget) override; /** * @brief Called as soon as a flight plan is offline * @param[in] flightPlan The disconnected flight plan */ void OnFlightPlanDisconnect(EuroScopePlugIn::CFlightPlan flightPlan) override; }; }