Add centralised folder and initial implementations for decision system.
This commit is contained in:
21
DecisionSystem/CentralisedDecision/ballotvoter.py
Normal file
21
DecisionSystem/CentralisedDecision/ballotvoter.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import paho.mqtt.client as mqtt
|
||||
|
||||
class BallotVoter:
|
||||
def __init__(self):
|
||||
self.client = mqtt.Client()
|
||||
self.client.connect('172.16.43.2')
|
||||
|
||||
def on_connect(self, client, userdata, flags, rc):
|
||||
print("Connected with result code " + str(rc))
|
||||
if rc == 0:
|
||||
global connected
|
||||
connected = True
|
||||
|
||||
self.client.subscribe('swarm1/voters', qos=1)
|
||||
|
||||
def on_message(self, client, userdata, message):
|
||||
|
||||
|
||||
def submit_vote(self):
|
||||
self.client.publish('swarm1/')
|
||||
|
||||
Reference in New Issue
Block a user