Remove obsolete, unimplemented classes
This commit is contained in:
@@ -1,5 +0,0 @@
|
|||||||
import voter
|
|
||||||
|
|
||||||
class BallotVoter(Voter):
|
|
||||||
def submit_vote(self):
|
|
||||||
pass
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
import voter
|
|
||||||
|
|
||||||
class VoteReplicator(Voter):
|
|
||||||
def __init__(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
class Executor:
|
|
||||||
pass
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
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, 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.connect()
|
|
||||||
|
|
||||||
def submit_vote(self):
|
|
||||||
|
|
||||||
|
|
||||||
pass
|
|
||||||
|
|
||||||
def set_vote(self, vote):
|
|
||||||
if isinstance(vote, Vote):
|
|
||||||
self._vote = vote
|
|
||||||
return True
|
|
||||||
else:
|
|
||||||
return False
|
|
||||||
|
|
||||||
def get_vote(self):
|
|
||||||
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()
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
import executor
|
|
||||||
|
|
||||||
class TimeoutExecutor(Executor):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
from Messaging.packmessage import PackMessage
|
|
||||||
|
|
||||||
class Vote(PackMessage):
|
|
||||||
def __init__(self, client, vote = None):
|
|
||||||
self._vote = vote
|
|
||||||
self._client = client
|
|
||||||
|
|
||||||
|
|
||||||
@property
|
|
||||||
def vote(self):
|
|
||||||
return self._vote
|
|
||||||
|
|
||||||
@vote.setter
|
|
||||||
def vote(self, value):
|
|
||||||
self._vote = value
|
|
||||||
|
|
||||||
def __eq__(self, other):
|
|
||||||
if not isinstance(other, Vote):
|
|
||||||
return False
|
|
||||||
|
|
||||||
if other.vote == self.vote:
|
|
||||||
return True
|
|
||||||
|
|
||||||
def serialise(self):
|
|
||||||
|
|
||||||
# Still need associated device as well? to know who went the message,
|
|
||||||
# to check that we don't add too many messages in case of multiple
|
|
||||||
# sends.
|
|
||||||
self.message = {"vote": self.vote}
|
|
||||||
|
|
||||||
# Call super method equivalent.
|
|
||||||
super(Vote, self).serialise()
|
|
||||||
|
|
||||||
def deserialise(self):
|
|
||||||
super(Vote, self).deserialise()
|
|
||||||
|
|
||||||
if "vote" in self.message:
|
|
||||||
self.vote = self.message["vote"]
|
|
||||||
else:
|
|
||||||
# Do something.
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
from Messaging.packmessage import PackMessage
|
|
||||||
import umsgpack
|
|
||||||
|
|
||||||
class Voter:
|
|
||||||
def submit_vote(self):
|
|
||||||
raise NotImplementedError()
|
|
||||||
|
|
||||||
def send_connected(self):
|
|
||||||
raise NotImplementedError()
|
|
||||||
Reference in New Issue
Block a user