discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] question developing a new block


From: Marcus Müller
Subject: Re: [Discuss-gnuradio] question developing a new block
Date: Thu, 04 Jun 2015 23:34:15 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

Dear Andreas,
> How is it possible to fill a python grc variable block with data from
another block C++ variable.
not really. GRC variables are a concept that doesn't exist in the flow
graph or, really, in the python file that GRC generates. They just are
python variables used when setting up the block, and if they are used in
a field for which the block specified a callback method, that method
will be included in a python function that gets called by blocks that
GRC knows can change variables (e.g. GUI input elements); this mechanism
of calling the callbacks doesn't really work without special glue; if
you really really want, you can use he gr::feval magic to call python
code from C++ which might then call python methods the same way that the
code would do that GRC creates. It's been over 5 years since I used
feval, and I don't recommend doing that.

I heartily invite you to do this the "GNU Radio way": Using message
passing as the way to exchange information between blocks inherently
solves the multithreading problems that otherwise would arise (for
example, assume you'd be able to change the taps of a FIR whilst that
FIR's work() function is working; what's the correct behaviour? How do
you avoid segmentation faults when the new taps are shorter than the old
ones?). Also, it lets users understand where data/commands flow rather
than hiding that behind a variable name.

Best regards,
Marcus


On 06/04/2015 10:43 PM, Andreas Ladanyi wrote:
> Hi,
>
> i read some tutorials about creating new blocks.
>
> Iam asking my self a simple question and i think i couldnt find the
> answer:
>
> How is it possible to fill a python grc variable block with data from
> another block C++ variable.
>
> I know between C++ and python is the SWIG Framework. What to program
> in the C++ file and what to program in the xml file.  The way of the
> C++ variable through the swig to the python workflow is not clear to me.
>
> I know that the grc editor creates a variable section from variables
> of all grc blocks in the workflow in the project .py file.
>
> Andy
>
>
>
>
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio




reply via email to

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