From d1536804a475e979ddd551ff6e9d19aa256d637d Mon Sep 17 00:00:00 2001 From: Sven Czarnian Date: Fri, 12 Nov 2021 20:11:53 +0100 Subject: [PATCH] add a function to send the sequence to euroscope --- aman/com/Euroscope.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/aman/com/Euroscope.py b/aman/com/Euroscope.py index c49e8a8..0fceb4c 100644 --- a/aman/com/Euroscope.py +++ b/aman/com/Euroscope.py @@ -10,6 +10,7 @@ import zmq import zmq.auth from aman.com import AircraftReport_pb2 +from aman.com import Communication_pb2 from aman.config.Server import Server from threading import Thread, _active @@ -121,3 +122,30 @@ class Euroscope: self.NotificationSocket = None self.Context = None + + def sendSequence(self, airport : str, inbounds): + if None == self.NotificationSocket: + return + + sequence = Communication_pb2.AircraftSequence() + sequence.airport = airport + + for inbound in inbounds: + entry = sequence.sequence.add() + entry.callsign = inbound.Callsign + entry.arrivalRoute = inbound.PlannedStar.Name + entry.arrivalRunway = inbound.PlannedRunway.Name + + for waypoint in inbound.PlannedArrivalRoute: + wp = entry.waypoints.add() + wp.name = waypoint.Waypoint.Name + + pta = str(waypoint.PTA) + delimiter = pta.find('.') + if -1 == delimiter: + delimiter = pta.find('+') + + wp.pta = pta[0:delimiter] + + message = sequence.SerializeToString() + self.NotificationSocket.send(message)