Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(metar): Add QFE to pressure monitor messages, QFE query command (#…
…376) * Introduce parsed metars and components * Collection of metars * Components factories * Push event handler * Push event sync * Style * Pull it all together * More style * Query message * Tidy and docs * Style * Format * Remove duplicate method
- Loading branch information
Showing
78 changed files
with
4,997 additions
and
3,307 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Pressure Monitor | ||
|
||
The plugin provides functionality for aerodrome controllers to monitor changes in pressure. This allows controllers to | ||
be notified of important pressure changes so that they can then update pilots. | ||
|
||
## Configuration | ||
|
||
Configuration for the Pressure Monitor is under the "General Settings" option of the `OP` menu. | ||
|
||
## Pressure Update Notifications | ||
|
||
Pressure update notifications are displayed to controllers in the `UKCP_PRESSURE_MONITOR` chat handler. | ||
|
||
These messages will display the QNH/QFE before and after. Messages will not be sent for the first time a pressure is | ||
updated, or if the pressure does not change between METARs. | ||
|
||
## Querying Pressure | ||
|
||
Users may query the plugin to provide the current QNH and QFE at any airfield they wish. | ||
|
||
This is achieved by typing a command into the EuroScope chat box, as follows: | ||
|
||
`.ukcp pressure EGKK` | ||
|
||
The plugin will then respond in the `UKCP_PRESSURE_MONITOR` with the current QNH and QFE at the given airfield. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,45 @@ | ||
#include "pch/pch.h" | ||
#include "bootstrap/EventHandlerCollectionBootstrap.h" | ||
#include "bootstrap/PersistenceContainer.h" | ||
#include "tag/TagItemCollection.h" | ||
#include "command/CommandHandlerCollection.h" | ||
#include "controller/HandoffEventHandlerCollection.h" | ||
#include "controller/ControllerStatusEventHandlerCollection.h" | ||
#include "euroscope/RadarTargetEventHandlerCollection.h" | ||
#include "euroscope/RunwayDialogAwareCollection.h" | ||
#include "euroscope/UserSettingAwareCollection.h" | ||
#include "flightplan/FlightPlanEventHandlerCollection.h" | ||
#include "controller/ControllerStatusEventHandlerCollection.h" | ||
#include "timedevent/TimedEventCollection.h" | ||
#include "plugin/FunctionCallEventHandler.h" | ||
#include "metar/MetarEventHandlerCollection.h" | ||
#include "euroscope/UserSettingAwareCollection.h" | ||
#include "plugin/UKPlugin.h" | ||
#include "command/CommandHandlerCollection.h" | ||
#include "controller/HandoffEventHandlerCollection.h" | ||
#include "tag/TagItemCollection.h" | ||
#include "timedevent/TimedEventCollection.h" | ||
|
||
using UKControllerPlugin::Bootstrap::PersistenceContainer; | ||
using UKControllerPlugin::Tag::TagItemCollection; | ||
using UKControllerPlugin::Command::CommandHandlerCollection; | ||
using UKControllerPlugin::Controller::ControllerStatusEventHandlerCollection; | ||
using UKControllerPlugin::Controller::HandoffEventHandlerCollection; | ||
using UKControllerPlugin::Euroscope::RadarTargetEventHandlerCollection; | ||
using UKControllerPlugin::Euroscope::RunwayDialogAwareCollection; | ||
using UKControllerPlugin::Euroscope::UserSettingAwareCollection; | ||
using UKControllerPlugin::Flightplan::FlightPlanEventHandlerCollection; | ||
using UKControllerPlugin::Controller::ControllerStatusEventHandlerCollection; | ||
using UKControllerPlugin::TimedEvent::TimedEventCollection; | ||
using UKControllerPlugin::Plugin::FunctionCallEventHandler; | ||
using UKControllerPlugin::Metar::MetarEventHandlerCollection; | ||
using UKControllerPlugin::Euroscope::UserSettingAwareCollection; | ||
using UKControllerPlugin::Command::CommandHandlerCollection; | ||
using UKControllerPlugin::Euroscope::RunwayDialogAwareCollection; | ||
using UKControllerPlugin::Controller::HandoffEventHandlerCollection; | ||
using UKControllerPlugin::Tag::TagItemCollection; | ||
using UKControllerPlugin::TimedEvent::TimedEventCollection; | ||
|
||
namespace UKControllerPlugin { | ||
namespace Bootstrap { | ||
namespace UKControllerPlugin::Bootstrap { | ||
|
||
/* | ||
Set up all the event handler collections. | ||
*/ | ||
void EventHandlerCollectionBootstrap::BoostrapPlugin(PersistenceContainer & persistence) | ||
{ | ||
persistence.tagHandler.reset(new TagItemCollection); | ||
persistence.radarTargetHandler.reset(new RadarTargetEventHandlerCollection); | ||
persistence.flightplanHandler.reset(new FlightPlanEventHandlerCollection); | ||
persistence.controllerHandler.reset(new ControllerStatusEventHandlerCollection); | ||
persistence.timedHandler.reset(new TimedEventCollection); | ||
persistence.pluginFunctionHandlers.reset(new FunctionCallEventHandler); | ||
persistence.metarEventHandler.reset(new MetarEventHandlerCollection); | ||
persistence.userSettingHandlers.reset(new UserSettingAwareCollection); | ||
persistence.commandHandlers.reset(new CommandHandlerCollection); | ||
persistence.runwayDialogEventHandlers.reset(new RunwayDialogAwareCollection); | ||
persistence.controllerHandoffHandlers.reset(new HandoffEventHandlerCollection); | ||
} | ||
} // namespace Bootstrap | ||
} // namespace UKControllerPlugin | ||
/* | ||
Set up all the event handler collections. | ||
*/ | ||
void EventHandlerCollectionBootstrap::BoostrapPlugin(PersistenceContainer& persistence) | ||
{ | ||
persistence.tagHandler = std::make_unique<TagItemCollection>(); | ||
persistence.radarTargetHandler = std::make_unique<RadarTargetEventHandlerCollection>(); | ||
persistence.flightplanHandler = std::make_unique<FlightPlanEventHandlerCollection>(); | ||
persistence.controllerHandler = std::make_unique<ControllerStatusEventHandlerCollection>(); | ||
persistence.timedHandler = std::make_unique<TimedEventCollection>(); | ||
persistence.pluginFunctionHandlers = std::make_unique<FunctionCallEventHandler>(); | ||
persistence.userSettingHandlers = std::make_unique<UserSettingAwareCollection>(); | ||
persistence.commandHandlers = std::make_unique<CommandHandlerCollection>(); | ||
persistence.runwayDialogEventHandlers = std::make_unique<RunwayDialogAwareCollection>(); | ||
persistence.controllerHandoffHandlers = std::make_unique<HandoffEventHandlerCollection>(); | ||
} | ||
} // namespace UKControllerPlugin::Bootstrap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#pragma once | ||
|
||
namespace UKControllerPlugin::Metar { | ||
struct MetarComponents; | ||
|
||
/** | ||
* Adds a component of a METAR to the MetarComponents | ||
*/ | ||
class MetarComponentFactoryInterface | ||
{ | ||
public: | ||
virtual ~MetarComponentFactoryInterface() = default; | ||
virtual void FromJson(const nlohmann::json& json, MetarComponents& components) const = 0; | ||
}; | ||
} // namespace UKControllerPlugin::Metar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#pragma once | ||
|
||
namespace UKControllerPlugin::Metar { | ||
class PressureComponent; | ||
|
||
/** | ||
* Struct containing the individual components of the METAR | ||
*/ | ||
using MetarComponents = struct MetarComponents | ||
{ | ||
std::shared_ptr<PressureComponent> pressure; | ||
}; | ||
} // namespace UKControllerPlugin::Metar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include "MetarComponentFactoryInterface.h" | ||
#include "MetarComponents.h" | ||
#include "MetarComponentsFactory.h" | ||
|
||
namespace UKControllerPlugin::Metar { | ||
|
||
MetarComponentsFactory::MetarComponentsFactory(std::set<std::shared_ptr<MetarComponentFactoryInterface>> factories) | ||
: factories(std::move(factories)) | ||
{ | ||
} | ||
|
||
auto MetarComponentsFactory::FromJson(const nlohmann::json& json) const -> std::unique_ptr<MetarComponents> | ||
{ | ||
auto components = std::make_unique<MetarComponents>(); | ||
if (!json.is_object()) { | ||
LogError("Parsed metar json is not object"); | ||
return components; | ||
} | ||
|
||
for (const auto& factory : factories) { | ||
factory->FromJson(json, *components); | ||
} | ||
|
||
return components; | ||
} | ||
} // namespace UKControllerPlugin::Metar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#pragma once | ||
|
||
namespace UKControllerPlugin::Metar { | ||
struct MetarComponents; | ||
class MetarComponentFactoryInterface; | ||
|
||
/** | ||
* Builds the components of a METAR from JSON | ||
*/ | ||
class MetarComponentsFactory | ||
{ | ||
public: | ||
MetarComponentsFactory(std::set<std::shared_ptr<MetarComponentFactoryInterface>> factories); | ||
[[nodiscard]] auto FromJson(const nlohmann::json& json) const -> std::unique_ptr<MetarComponents>; | ||
|
||
private: | ||
// The factories | ||
std::set<std::shared_ptr<MetarComponentFactoryInterface>> factories; | ||
}; | ||
} // namespace UKControllerPlugin::Metar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include "MetarComponentsFactory.h" | ||
#include "MetarComponentsFactoryFactory.h" | ||
#include "MetarComponentFactoryInterface.h" | ||
#include "PressureComponentFactory.h" | ||
|
||
namespace UKControllerPlugin::Metar { | ||
auto BuildComponentsFactory() -> std::shared_ptr<MetarComponentsFactory> | ||
{ | ||
return std::make_shared<MetarComponentsFactory>( | ||
std::set<std::shared_ptr<MetarComponentFactoryInterface>>{std::make_shared<PressureComponentFactory>()}); | ||
} | ||
} // namespace UKControllerPlugin::Metar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#pragma once | ||
|
||
namespace UKControllerPlugin::Metar { | ||
class MetarComponentsFactory; | ||
|
||
[[nodiscard]] auto BuildComponentsFactory() -> std::shared_ptr<MetarComponentsFactory>; | ||
} // namespace UKControllerPlugin::Metar |
Oops, something went wrong.