summaryrefslogtreecommitdiff
path: root/gnuradio-examples/python/digital/receive_path.py
diff options
context:
space:
mode:
authorjcorgan <jcorgan@221aa14e-8319-0410-a670-987f0aec2ac5>2007-09-18 18:59:00 +0000
committerjcorgan <jcorgan@221aa14e-8319-0410-a670-987f0aec2ac5>2007-09-18 18:59:00 +0000
commite692e71305ecd71d3681fe37f3d76f350d67e276 (patch)
treedc320c9261303aa9a92f4d12bdba85f82720d1bf /gnuradio-examples/python/digital/receive_path.py
parent6ad04a094ced626e46c210b9847eae46a1ae8e67 (diff)
Merge r6461:6464 from jcorgan/t162-staging into trunk.
* Final gr.top_block and gr.hier_block2 implementation inside gnuradio-core/src/lib/runtime * Implementation of gr.hier_block2 versions of all the old-style blocks in blks. These live in blks2. * Addition of gr.hier_block2 based versions of gr-wxgui blocks * Conversion of all the example code in gnuradio-examples to use this new code * Conversion of all the gr-utils scripts to use the new code The OFDM examples and related hierarchical blocks have not yet been converted. Code in the rest of the tree that is outside the core and example components has also not yet been converted. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@6466 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gnuradio-examples/python/digital/receive_path.py')
-rw-r--r--gnuradio-examples/python/digital/receive_path.py32
1 files changed, 19 insertions, 13 deletions
diff --git a/gnuradio-examples/python/digital/receive_path.py b/gnuradio-examples/python/digital/receive_path.py
index 5cf4e59eed..29f1f834dd 100644
--- a/gnuradio-examples/python/digital/receive_path.py
+++ b/gnuradio-examples/python/digital/receive_path.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2005,2006 Free Software Foundation, Inc.
+# Copyright 2005,2006,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -20,7 +20,7 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr, gru, blks
+from gnuradio import gr, gru, blks2
from gnuradio import usrp
from gnuradio import eng_notation
import copy
@@ -33,8 +33,12 @@ from pick_bitrate import pick_rx_bitrate
# receive path
# /////////////////////////////////////////////////////////////////////////////
-class receive_path(gr.hier_block):
- def __init__(self, fg, demod_class, rx_callback, options):
+class receive_path(gr.hier_block2):
+ def __init__(self, demod_class, rx_callback, options):
+
+ gr.hier_block2.__init__(self, "receive_path",
+ gr.io_signature(0, 0, 0), # Input signature
+ gr.io_signature(0, 0, 0)) # Output signature
options = copy.copy(options) # make a copy so we can destructively modify
@@ -96,11 +100,10 @@ class receive_path(gr.hier_block):
# receiver
self.packet_receiver = \
- blks.demod_pkts(fg,
- self._demod_class(fg, **demod_kwargs),
- access_code=None,
- callback=self._rx_callback,
- threshold=-1)
+ blks2.demod_pkts(self._demod_class(**demod_kwargs),
+ access_code=None,
+ callback=self._rx_callback,
+ threshold=-1)
# Carrier Sensing Blocks
alpha = 0.001
@@ -109,17 +112,16 @@ class receive_path(gr.hier_block):
if options.log_rx_power == True:
self.probe = gr.probe_avg_mag_sqrd_cf(thresh,alpha)
self.power_sink = gr.file_sink(gr.sizeof_float, "rxpower.dat")
- fg.connect(self.chan_filt, self.probe, self.power_sink)
+ self.connect(self.chan_filt, self.probe, self.power_sink)
else:
self.probe = gr.probe_avg_mag_sqrd_c(thresh,alpha)
- fg.connect(self.chan_filt, self.probe)
+ self.connect(self.chan_filt, self.probe)
# Display some information about the setup
if self._verbose:
self._print_verbage()
- fg.connect(self.u, self.chan_filt, self.packet_receiver)
- gr.hier_block.__init__(self, fg, None, None)
+ self.connect(self.u, self.chan_filt, self.packet_receiver)
def _setup_usrp_source(self):
self.u = usrp.source_c (fusb_block_size=self._fusb_block_size,
@@ -246,6 +248,10 @@ class receive_path(gr.hier_block):
print "decim: %3d" % (self._decim)
print "Rx Frequency: %s" % (eng_notation.num_to_str(self._rx_freq))
# print "Rx Frequency: %f" % (self._rx_freq)
+
+ def __del__(self):
+ # Avoid weak reference error
+ del self.subdev
def add_freq_option(parser):
"""