Files
picar/DecisionSystem/CentralisedDecision/ballotvoter.py

21 lines
533 B
Python

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/')