I'm trying to implement an OOT Python module in GNURadio 3.7 that should update a parameter (boolean) from the QT GUI while it is running. So far, I have included the callback function in the .xml file:
<?xml version="1.0"?>
<block>
<name>Synchronous Frequency Sweep</name>
<key>PLOP_sync_sweep</key>
<category>[PLOP]</category>
<import>import PLOP</import>
<make>PLOP.sync_sweep($samp_rate, $sweep_range, $sweep_speed, $sweep_bool)</make>
<callback>set_sweepBool($sweep_bool)</callback>
<param>
<name>Enable Sweep</name>
<key>sweep_bool</key>
<value>True</value>
<type>bool</type>
<option>
<name>Enabled</name>
<key>True</key>
</option>
<option>
<name>Disabled</name>
<key>False</key>
</option>
</param>
I also declared the callback function in the python file:
class sync_sweep(gr.sync_block):
"""
docstring for block sync_sweep
"""
def __init__(self,
samp_rate,
sweep_range,
sweep_speed,
sweep_bool):
self.set_sweepBool(sweep_bool)
gr.sync_block.__init__(self,
name="sync_sweep",
in_sig=None,
out_sig=[numpy.float32])
self.d_samp_rate = samp_rate
self.d_sweep_range = sweep_range
self.d_sweep_speed = sweep_speed
self.d_sweep_bool = sweep_bool
And then I call it in the work function without success :(
def work(self, input_items, output_items):
out = output_items[0]
self.set_sweepBool(self.d_sweep_bool)
Any suggestions why the callback is not updating the boolean value when changing it from the QT GUI?
Thanks beforehand,
Joaquin.
set_sweepBool
is attached to the top block, whileself
refers to the instance of thesync_sweep
block?