summaryrefslogtreecommitdiff
path: root/gr-pager/src/pager_utils.py
diff options
context:
space:
mode:
authorjcorgan2009-03-29 16:36:01 +0000
committerjcorgan2009-03-29 16:36:01 +0000
commita811a7f070ae087aceb5443d2021d691398be2a0 (patch)
treecf435a267f00becfd7dba28c4ecd40cf66a063a4 /gr-pager/src/pager_utils.py
parent6d0c3329c2aa5b2a9dbd879350f4beda74b5abfd (diff)
downloadgnuradio-a811a7f070ae087aceb5443d2021d691398be2a0.tar.gz
gnuradio-a811a7f070ae087aceb5443d2021d691398be2a0.tar.bz2
gnuradio-a811a7f070ae087aceb5443d2021d691398be2a0.zip
Reorganize queue runner, some cleanup, fixes ticket:376
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10701 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gr-pager/src/pager_utils.py')
-rw-r--r--gr-pager/src/pager_utils.py25
1 files changed, 19 insertions, 6 deletions
diff --git a/gr-pager/src/pager_utils.py b/gr-pager/src/pager_utils.py
index bbcb633fd..72aac6826 100644
--- a/gr-pager/src/pager_utils.py
+++ b/gr-pager/src/pager_utils.py
@@ -1,5 +1,5 @@
#
-# Copyright 2008 Free Software Foundation, Inc.
+# Copyright 2008,2009 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -18,7 +18,10 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
+from gnuradio import gr
import gnuradio.gr.gr_threading as _threading
+from string import split, join, printable
+import time
def make_trans_table():
table = 256 * ['.']
@@ -34,14 +37,24 @@ _trans_table = make_trans_table()
def make_printable(s):
return s.translate(_trans_table)
-class top_block_runner(_threading.Thread):
- def __init__(self, tb):
+
+class queue_runner(_threading.Thread):
+ def __init__(self, msgq):
_threading.Thread.__init__(self)
- self.setDaemon(1)
- self.tb = tb
+ self.msgq = msgq
self.done = False
self.start()
def run(self):
- self.tb.run()
+ while 1:
+ msg = self.msgq.delete_head() # Blocking read
+ if msg.type() != 0:
+ break
+
+ page = join(split(msg.to_string(), chr(128)), '|')
+ s = make_printable(page)
+ print msg.type(), s
+
+ def end(self):
+ self.msgq.insert_tail(gr.message(1))
self.done = True