From d94e85b748e62a80c76ce0b2082615980a2942e1 Mon Sep 17 00:00:00 2001 From: Sven Czarnian Date: Sat, 14 Aug 2021 15:03:21 +0200 Subject: [PATCH] start with the interpretation of the position updates of aircrafts --- src/PlugIn.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/PlugIn.cpp b/src/PlugIn.cpp index 86cde32..2e608c7 100644 --- a/src/PlugIn.cpp +++ b/src/PlugIn.cpp @@ -72,5 +72,26 @@ EuroScopePlugIn::CRadarScreen* PlugIn::OnRadarScreenCreated(const char* displayN } void PlugIn::OnRadarTargetPositionUpdate(EuroScopePlugIn::CRadarTarget radarTarget) { + /* ignore invalid targets */ + if (false == radarTarget.IsValid()) + return; + auto flightPlan = radarTarget.GetCorrelatedFlightPlan(); + + /* ignore invalid flightplans */ + if (false == flightPlan.IsValid()) + return; + + /* ignore flights that are not tracked by the current controller */ + if (false == flightPlan.GetTrackingControllerIsMe()) + return; + + /* ignore non-IFR flights */ + if (nullptr == flightPlan.GetFlightPlanData().GetPlanType() || 'I' != *flightPlan.GetFlightPlanData().GetPlanType()) + return; + + /* TODO filter by distance to destination */ + /* TODO filter by airborne identifier */ + /* TODO generate protobuf message */ + /* TODO send aircraft update */ }