Forum: GNU Radio callbacks from gr block into python for reconfiguration

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Jorg L. (Guest)
on 2008-11-06 19:18
(Received via mailing list)
Hi,

I would like to know if it is possible with GNU Radio to have callbacks
from a processing block into python to trigger a reconfiguration. A
possible scenario is a radio which changes its receiver frequency when a
the signal was lost (due to a change in the transmitter frequency). For
example, if no frames are detected within a certain window, the deframer
should be able to notify Python that this has happened, so that the
appropriate reconfigurations can be performed.

What would be the way to do this in GNU Radio?

Thanks,
Jorg
Eric B. (Guest)
on 2008-11-06 19:42
(Received via mailing list)
On Thu, Nov 06, 2008 at 05:06:28PM +0000, Jorg L. wrote:
> What would be the way to do this in GNU Radio?
>
> Thanks,
> Jorg

Callbacks are generally a bad idea in a multithreaded system.
You can accomplish your goal by creating a message queue that listened
to by python and having the GR block post a message to it when some
condition occurs.

Take a look at gnuradio-examples/python/usrp/digital.  The python code
receives messages when the C++ code has demodulated bits.  The basic
pattern is the same.

Eric
This topic is locked and can not be replied to.