def toggle_tuner_plot(self): if 'tuner' not in self.sinks: sink = tuner_sink_f(plot_name=("Ch:%s" % self.name), chan=self.msgq_id) self.sinks['tuner'] = (sink, self.toggle_tuner_plot) self.set_plot_destination('tuner') self.tb.lock() self.demod.connect_fm_demod() # add fm demod to flowgraph if not already present self.demod.connect_bb_tuner('symbol_filter', sink) self.tb.unlock() else: (sink, fn) = self.sinks.pop('tuner') self.tb.lock() self.demod.disconnect_bb_tuner(sink) self.demod.disconnect_fm_demod() # remove fm demod from flowgraph if no longer needed self.tb.unlock() sink.kill()
def toggle_tuner(self): if (self.tuner_sink is None): self.tuner_sink = tuner_sink_f() self.add_plot_sink(self.tuner_sink) self.lock() self.demod.connect_fm_demod() # make sure fm demod exists in flowgraph self.demod.connect_bb_tuner('symbol_filter', self.tuner_sink) self.unlock() elif (self.tuner_sink is not None): self.lock() self.demod.disconnect_bb_tuner(self.tuner_sink) self.demod.disconnect_fm_demod() # attempt to remove fm demod if not needed self.unlock() self.tuner_sink.kill() self.remove_plot_sink(self.tuner_sink) self.tuner_sink = None