sort the received aircraft reports into the corresponding worker thread
This commit is contained in:
14
aman/AMAN.py
14
aman/AMAN.py
@@ -4,6 +4,7 @@ import glob
|
||||
import os
|
||||
import sys
|
||||
|
||||
from aman.com import AircraftReport_pb2
|
||||
from aman.com.Euroscope import Euroscope
|
||||
from aman.config.AircraftPerformance import AircraftPerformance
|
||||
from aman.config.Airport import Airport
|
||||
@@ -29,6 +30,7 @@ class AMAN:
|
||||
self.aircraftPerformance = None
|
||||
self.receiver = None
|
||||
self.workers = []
|
||||
self.inbounds = {}
|
||||
|
||||
configPath = AMAN.findConfigPath()
|
||||
|
||||
@@ -59,7 +61,7 @@ class AMAN:
|
||||
print('Starter worker for ' + icao)
|
||||
|
||||
# create the EuroScope receiver
|
||||
self.receiver = Euroscope(configPath, self.systemConfig.Server)
|
||||
self.receiver = Euroscope(configPath, self.systemConfig.Server, self)
|
||||
|
||||
def __del__(self):
|
||||
if None != self.receiver:
|
||||
@@ -68,3 +70,13 @@ class AMAN:
|
||||
|
||||
for worker in self.workers:
|
||||
worker.stop()
|
||||
|
||||
def updateAircraftReport(self, report : AircraftReport_pb2.AircraftReport):
|
||||
# find the correct worker for the inbound
|
||||
for worker in self.workers:
|
||||
if worker.icao == report.destination:
|
||||
print('Updated ' + report.aircraft.callsign + ' for ' + worker.icao)
|
||||
worker.acquire()
|
||||
worker.reportQueue[report.aircraft.callsign] = report
|
||||
worker.release()
|
||||
break
|
||||
Reference in New Issue
Block a user