add a function to send the sequence to euroscope

This commit is contained in:
Sven Czarnian
2021-11-12 20:11:53 +01:00
parent 92d992f92c
commit d1536804a4

View File

@@ -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)