I was wondering if it's possible to stop a processing graph, swap one of its blocks with another with the same number of input/output channels and data types, and restart it, without tearing down the entire graph? So for example:
MAX = 10000
class my_top_block(gr.top_block):
def __init__(self, peak_hold=80):
gr.top_block.__init__(self)
self.sample_rate = 10e3
self.s = gr.noise_source_f (gr.GR_UNIFORM, MAX)
u = foo.peak_fv (MAX, peak_hold)
self.connect(s, u)
self.v = foo.wait_vv ()
self.connect(u, v)
self.t = gr.null_sink (4 * 1024)
self.connect(v, t)
def set_peak_record(self, record, peak_hold=80):
self.stop()
if record == True:
u = foo.peak_record_fv (MAX, peak_hold)
else:
u = foo.peak_fv (MAX, peak_hold)
self.connect(self.s, u)
self.connect(u, self.v)
self.start()
This is somewhat contrived, but I hope it illustrates my question. Thank you!
It sounds like you need to use the Stream Selector block in gr-basic:
http://lists.gnu.org/archive/html/discuss-gnuradio/2011-11/msg00228.html
In the future, I think you will find the GNURadio mailing list is a better medium for asking for help regarding GNURadio. All of the devs are extremely active on the mailing list, but as far as I'm aware, it's only me and a couple of others that monitor Stack Overflow for GNURadio questions =)
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
Cheers,
Ben