diff --git a/aman/com/WebUI.py b/aman/com/WebUI.py new file mode 100644 index 0000000..6b24f8b --- /dev/null +++ b/aman/com/WebUI.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python + +import json + +from aman.config.Server import Server +from aman.types.Inbound import Inbound + +class WebUI: + def __init__(self): + self.Config = None + self.Aman = None + + def __del__(self): + self.release() + + def acquire(self, config : Server, aman): + self.Config = config + self.Aman = aman + + def release(self): + return + + def sendSequence(self, airport, inbounds): + sequence = [] + + for inbound in inbounds: + sequence.append(str(inbound.toJSON())) + + # TODO send to the server + #print(json.dumps({ 'airport': airport, 'sequence': sequence }, ensure_ascii=True)) diff --git a/aman/config/Server.py b/aman/config/Server.py index 46567f1..cf422c4 100644 --- a/aman/config/Server.py +++ b/aman/config/Server.py @@ -8,6 +8,9 @@ class Server(): self.Address = None self.PortReceiver = None self.PortNotification = None + self.WebUiUrl = None + self.WebUiSequenceNotification = None + self.WebUiConfigurationReceiver = None # search the required sections for key in config: @@ -17,6 +20,12 @@ class Server(): self.PortReceiver = int(config['portreceiver']) elif 'portnotification' == key: self.PortNotification = int(config['portnotification']) + elif 'webuiurl' == key: + self.WebUiUrl = config['webuiurl'] + elif 'sequencenotification' == key: + self.WebUiSequenceNotification = config['sequencenotification'] + elif 'configurationreceiver' == key: + self.WebUiConfigurationReceiver = config['configurationreceiver'] if self.Address is None: sys.stderr.write('No server-address configuration found!') @@ -27,3 +36,12 @@ class Server(): if self.PortNotification is None: sys.stderr.write('No server-port-notification configuration found!') sys.exit(-1) + if self.WebUiUrl is None: + sys.stderr.write('No Web-UI URL configuration found!') + sys.exit(-1) + if self.WebUiSequenceNotification is None: + sys.stderr.write('No Web-UI sequence notification configuration found!') + sys.exit(-1) + if self.WebUiConfigurationReceiver is None: + sys.stderr.write('No Web-UI configuration receiver configuration found!') + sys.exit(-1)