add a function to send the sequence to euroscope
This commit is contained in:
@@ -10,6 +10,7 @@ import zmq
|
|||||||
import zmq.auth
|
import zmq.auth
|
||||||
|
|
||||||
from aman.com import AircraftReport_pb2
|
from aman.com import AircraftReport_pb2
|
||||||
|
from aman.com import Communication_pb2
|
||||||
from aman.config.Server import Server
|
from aman.config.Server import Server
|
||||||
from threading import Thread, _active
|
from threading import Thread, _active
|
||||||
|
|
||||||
@@ -121,3 +122,30 @@ class Euroscope:
|
|||||||
self.NotificationSocket = None
|
self.NotificationSocket = None
|
||||||
|
|
||||||
self.Context = 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)
|
||||||
|
|||||||
Reference in New Issue
Block a user