[Top][All Lists]

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

Re: [Discuss-gnuradio] Updating variable by passing message

From: Marcus Müller
Subject: Re: [Discuss-gnuradio] Updating variable by passing message
Date: Sat, 12 Aug 2017 12:35:39 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

Hi Mohammad,

this sounds like a wise architecture, using a message to update settings.

To answer your question:

> how i can update a variable block value in python code , is that
possible at all ?

As you noticed, yes, that's possible, because the GUI sliders etc. do that!
However, it only works because these are actually living directly in the
top_block python code.

What you **can** do is write a python block, which, as a parameter,
takes a reference to the top_block (or hier block) which it "lives" in,
and stores it in a class member.

Then you can call .set_variablename(value) on that in your message handler.

I do **not** recommend that, however. It breaks the inherent thread
safety of message passing, makes a large detour through python that will
cost a lot of copies and unnecessary type conversions "under the hood"...

Instead, better simply go and improve the FFT Filter! Add a message port
that accepts new taps! I think we'd all love to see that becoming a
feature, so if you can, please make that change and contribute it to GNU
Radio! Also, it's less work than writing the python block that I
mentioned above.

Best regards,

On 12.08.2017 11:51, mohammad nejati wrote:
> Hi ,
> I want to update taps in "FFT FILTER" block in run time , i have a
> block that can send this taps as a message every 1 secound . i write
> an python block witch get this message what i want to do is get this
> message and update value of a variable block wich is used in FFT
> FILTER . but i dont know how i can update a variable block value in
> python code , is that possible at all ?
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

reply via email to

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