Implement MqttVoter methods
This commit is contained in:
@@ -1,21 +1,32 @@
|
||||
from voter import Voter
|
||||
from DecisionSystem.voter import Voter
|
||||
import Messaging.mqttsession as ms
|
||||
from Messaging.packmessage import PackMessage
|
||||
from DecisionSystem.vote import Vote
|
||||
|
||||
class MqttVoter(Voter):
|
||||
def __init__(self):
|
||||
def __init__(self, host = "10.0.123.11"):
|
||||
# Should use a factory here to always get the same session.
|
||||
# Just going to use a singleton for now, as there should only be
|
||||
# one session in the program.
|
||||
ms.client = ms.Client()
|
||||
ms.host = "10.0.123.11"
|
||||
ms.connect()
|
||||
|
||||
def submit_vote(self):
|
||||
|
||||
|
||||
pass
|
||||
|
||||
def set_vote(self):
|
||||
pass
|
||||
def set_vote(self, vote):
|
||||
if isinstance(vote, Vote):
|
||||
self._vote = vote
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def get_vote(self):
|
||||
pass
|
||||
return self._vote
|
||||
|
||||
# This is meant to be the mqtt callback... Should've documented this earlier.
|
||||
def request_vote(self, client, userdata, message):
|
||||
# Perhaps do some checking to see what is being voted on...
|
||||
self.submit_vote()
|
||||
Reference in New Issue
Block a user