summaryrefslogtreecommitdiff
path: root/gnuradio-examples/python/digital/receive_path.py
diff options
context:
space:
mode:
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):
"""