Add centralised folder and initial implementations for decision system.

This commit is contained in:
DSTO\pivatom
2019-01-10 14:54:06 +10:30
parent 1e0c5b575f
commit c12c57bfcf
2 changed files with 74 additions and 0 deletions

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