[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] Implementing callbacks in custom blocks

From: jsam45
Subject: [Discuss-gnuradio] Implementing callbacks in custom blocks
Date: Sat, 19 Jul 2014 22:58:49 -0700 (PDT)

Using gr_modtool, I am trying to make a simple Gain block (called var_gain)
which multiplies the input with a constant. I have a private variable called
d_gain in the var_gain_impl class and a public function set_gain(float gain)
which sets the value of d_gain to the argument. I modified the xml file by
adding the line 
after the <make> line.

During execution, gain value does not change even after changing it through
a WX Slider. If I run it from terminal, I am getting the following error -
Traceback (most recent call last):
"/usr/local/lib/python2.7/dist-packages/gnuradio/wxgui/forms/forms.py", line
180, in _handle
    def _handle(self, event): self[INT_KEY] = self._slider.GetValue()
  File "/usr/local/lib/python2.7/dist-packages/gnuradio/gr/pubsub.py", line
52, in __setitem__
"/usr/local/lib/python2.7/dist-packages/gnuradio/wxgui/forms/forms.py", line
138, in _translate_internal_to_external
    if self._callback: self._callback(self[EXT_KEY])
  File "top_block.py", line 102, in set_gg
AttributeError: 'var_gain_sptr' object has no attribute 'set_gain'

I tried looking at some in-built blocks to see how callback is implemented.
Then I saw that the in-built blocks have pure virtual functions in the
include/module_name/var_gain.h header file. I tried implementing that but
the result is still the same. What am I missing here?

View this message in context: 
Sent from the GnuRadio mailing list archive at Nabble.com.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]