From 96582b3657ec92a8022bc191b359daeaf57d1356 Mon Sep 17 00:00:00 2001 From: Michael Pivato Date: Tue, 15 Jan 2019 09:29:24 +1030 Subject: [PATCH] Add required methods for decentralised consensus --- .../DecentralisedActivityFusion/voter.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/DecisionSystem/DecentralisedActivityFusion/voter.py b/DecisionSystem/DecentralisedActivityFusion/voter.py index ebf3593..39b00a9 100644 --- a/DecisionSystem/DecentralisedActivityFusion/voter.py +++ b/DecisionSystem/DecentralisedActivityFusion/voter.py @@ -1,3 +1,6 @@ +import paho.mqtt.client as mqtt +import time + class Voter: ''' This class acts to replicate sensor information with the network to come to a consensus @@ -19,8 +22,21 @@ class Voter: on_vote: Callback to get the required vote to broadcast. ''' self.on_vote = on_vote + self.client = mqtt.Client() def submit_vote(self): + # Publish to swarm where all other voters will receive a vote. + + + # Wait a certain amount of time for responses, then fuse the information. + self.fuse_algorithm() + + # Need the error and number of timestamps since voting started to finalise the consensus. + + def fuse_algorithm(self): pass - def \ No newline at end of file + def on_message(self, client, userdata, message): + pass + + \ No newline at end of file