summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tascam_fw_console/console.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/tascam_fw_console/console.py b/tascam_fw_console/console.py
index e13615d..858ee17 100644
--- a/tascam_fw_console/console.py
+++ b/tascam_fw_console/console.py
@@ -57,27 +57,34 @@ class ConsoleStatus():
class RunningStatusThread():
def __init__(self, console, interval=0.1):
- """ Constructor
- :type interval: int
- :param interval: Check interval, in seconds
+ """ Background thread that will poll the console status data and
+ pass it to all objects in the callbacks set. If the callback set
+ is empty, polling doesn't happen.
+ Objects added to the callback set must have a status_callback()
+ method, a status_quadlet attribute containing the index of the
+ quadlet of interest, and a status_bits attribute containing a 2 member
+ iterable with the start and end bits of the quadlet of interest.
+
+ :param console: Console object
+ :type interval: float
+ :param interval: Poll interval, in seconds
"""
self.console = console
self.interval = interval
self.callbacks = set()
- self.last_status = []
thread = threading.Thread(target=self.run)
thread.daemon = True # Daemonize thread
thread.start() # Start the execution
def add_callback(self, obj):
+
self.callbacks.add(obj)
def remove_callback(self, obj):
self.callbacks.remove(obj)
def run(self):
- """ Method that runs forever """
while True:
for obj in self.callbacks:
value = self.console.status.field(obj.status_quadlet,