Initial simple implementation of app.py

This commit is contained in:
2020-03-29 17:39:31 +02:00
parent eaef45cc7d
commit 39113d4b0d
2 changed files with 24 additions and 2 deletions

View File

@@ -19,18 +19,21 @@ class ConsumerLocator:
Manages the list of consumers.
"""
def __init__(self, comm: communicator.Communicator):
def __init__(self):
"""
Initialize class.
"""
self.consumerList = [{"Host": "KnownHost", "State": True, "LastOk": datetime.datetime.now()}]
self.currentConsumer = self.consumerList[0]["Host"]
def initCommunicator(self, comm: communicator.Communicator):
self.communicator = comm
def learnconsumerlist(self):
""""
Learns the list of consumers.
"""
#TODO improve learning
recievedConsumerList = self.communicator.discoveravailableconsumers()
for consumer in recievedConsumerList:
self.consumerList.append({"Host": consumer, "State": True, "LastOk": datetime.datetime.now()})