summaryrefslogtreecommitdiff
path: root/gr-uhd/apps/uhd_rx_nogui.py
diff options
context:
space:
mode:
authorTom Rondeau2012-02-01 17:20:29 -0500
committerTom Rondeau2012-02-01 17:20:29 -0500
commit00518cacb2620a18f3d473b8b7adcc21547034e6 (patch)
tree99cafa44317fc30f6524f4f1678fe94fffe06492 /gr-uhd/apps/uhd_rx_nogui.py
parentba6fee9bc18efd2f84547f653de986bdf485472c (diff)
parent29aa72d4499361e661886dbfe7833bcc2c6f3746 (diff)
downloadgnuradio-00518cacb2620a18f3d473b8b7adcc21547034e6.tar.gz
gnuradio-00518cacb2620a18f3d473b8b7adcc21547034e6.tar.bz2
gnuradio-00518cacb2620a18f3d473b8b7adcc21547034e6.zip
Merge branch 'master' of gnuradio.org:gnuradio
Diffstat (limited to 'gr-uhd/apps/uhd_rx_nogui.py')
-rwxr-xr-xgr-uhd/apps/uhd_rx_nogui.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/gr-uhd/apps/uhd_rx_nogui.py b/gr-uhd/apps/uhd_rx_nogui.py
index e692e6ea3..bcb52c619 100755
--- a/gr-uhd/apps/uhd_rx_nogui.py
+++ b/gr-uhd/apps/uhd_rx_nogui.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2006,2007,2011 Free Software Foundation, Inc.
+# Copyright 2006,2007,2011,2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -190,6 +190,17 @@ class app_top_block(gr.top_block):
AUDIO = audio.sink(int(options.output_rate),
options.audio_output)
self.connect(tail, AUDIO)
+
+ # Direct asynchronous notifications to callback function
+ if self.options.show_async_msg:
+ self.async_msgq = gr.msg_queue(0)
+ self.async_src = uhd.amsg_source("", self.async_msgq)
+ self.async_rcv = gru.msgq_runner(self.async_msgq, self.async_callback)
+
+ def async_callback(self, msg):
+ md = self.async_src.msg_to_async_metadata_t(msg)
+ print "Channel: %i Time: %f Event: %i" % (md.channel, md.time_spec.get_real_secs(), md.event_code)
+
def main():
parser = OptionParser(option_class=eng_option)
@@ -222,6 +233,8 @@ def main():
help="set CTCSS squelch to FREQ [default=%default]")
parser.add_option("-O", "--audio-output", type="string", default="",
help="pcm device name. E.g., hw:0,0 or surround51 or /dev/dsp")
+ parser.add_option("", "--show-async-msg", action="store_true", default=False,
+ help="Show asynchronous message notifications from UHD [default=%default]")
(options, args) = parser.parse_args()
if options.frequency is None: