Sunday, July 2, 2017

Re: [Discuss-gnuradio] GRC GUI parameters for custom blocks



On Jul 1, 2017 2:18 PM, "Vipin Sharma" <vipinsharma@photonpace.com> wrote:
Hi,

I have a custom block, say CustomBlock, which takes two arguments, arg0 and arg1. My intention is to have these arguments be configured through gui after the custom block is instantiated. I define <param> entries for these arguments in the xml file for the CustomBlock which allows GRC gui to let me configure the arguments interactively.

Hi Vipin.

I had a similar question, and Bastian answered as follows:

If you want to change the parameter while the flow graph is running (through a slider in the GUI, for example), you will have to extend the block with a callback.
You could have a look at the Frame Equalizer block, for example. It allows changing the algorithm during run-time.

To extend the block you have to:
- add the callback function to the XML description of the block:  (see here https://github.com/bastibl/gr-ieee802-11/blob/next/grc/ieee802_11_frame_equalizer.xml#L9)
- implement the callback for the block (note that the callback is a public function that has also to be added to the definition in /include/, and the use of a mutex since 'work' and the callback are called in different thread contexts).


I am trying to understand the relation ship between GRC GUI custom block parameters and the CustomBlock C code's function arguments. How does GRC framework pass GUI parameters to its associated C function which also has the same arguments?

As Bastian said, you can't modify the parameters from the GUI if they don't have a callback function.

Best regards,

Cristian

Vipin
_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

No comments:

Post a Comment