Commit 78f35f52 authored by bliss administrator's avatar bliss administrator Committed by Sebastien Petitdemange
Browse files

removed old Shutter class

parent 58953c17
......@@ -97,49 +97,3 @@ class Actuator:
return "UNKNOWN"
return state
class Shutter:
def __init__(self, open=None, close=None, state=None):
self.__open = open
self.__close = close
self.__state = state
self.__opened = False
self.__closed = False
def open(self,timeout=5):
# this is to know which command was asked for,
# in case we don't have a return
self.__opened = True
self.__closed = False
try:
with gevent.Timeout(timeout):
while True:
self.__open()
if self.state() == 'OPENED':
break
else:
gevent.sleep(0.5)
finally:
dispatcher.send("state", self, self.state())
def close(self, timeout=5):
self.__opened = False
self.__closed = True
try:
with gevent.Timeout(timeout):
while True:
self.__close()
if self.state() == 'CLOSED':
break
else:
gevent.sleep(0.5)
finally:
dispatcher.send("state", self, self.state())
def state(self):
if self.__state is not None:
return self.__state()
else:
if self.__opened:
return "OPENED"
elif self.__closed:
return "CLOSED"
else:
return "UNKNOWN"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment