diff --git a/DecisionSystem/commander.py b/DecisionSystem/commander.py deleted file mode 100644 index c9258b8..0000000 --- a/DecisionSystem/commander.py +++ /dev/null @@ -1,35 +0,0 @@ -import Messaging.mqttsession as ms -import time -import umsgpack - -class Commander: - - def __init__(self, timeout = 60): - self.timeout = timeout - self._votes = [] - ms.Client() - - def on_message(client, userdata, message): - self._votes.append(umsgpack.unpackb(message.payload)) - - ms.client.subscribe("FakeSwarm/FirstTest", on_message) - - ms.client.loop_start() - - def make_decision(self): - votes = self._votes - - for vote in votes: - continue - - def get_votes(self, topic, message, qos=0): - # Publish a message that votes are needed. - ms.client.publish(topic, message, qos) - time.sleep(self.timeout) - self.make_decision() - - def add_subscription(self, topic, callback=None, qos=0): - ms.client.subscribe(topic) - - if callback is not None: - ms.client.message_callback_add(topic, callback) \ No newline at end of file