discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Creating a gr_sync_block subclass in python?


From: Josh Blum
Subject: Re: [Discuss-gnuradio] Creating a gr_sync_block subclass in python?
Date: Mon, 10 Jan 2011 11:35:39 -0800
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Lightning/1.0b2 Thunderbird/3.1.7


On 01/08/2011 01:10 PM, Holger Freyther wrote:
> Hi,
> 
> I would like to convert symbols (1 float) into two bytes. I thought I want to
> use a gr_sync_block for that (1:1 mapping). Now I would like to do this in
> python. After looking around, trying things and reading an old thread from
> october 2006 I come to the conclusion that it is not possible to create a
> gr_sync_block and have ''work'' called in python?
> 

You cant make functions in python and pass them into C++. I think the
swig docs say something about this. Basically, the python functions are
just objects, they are not functions to be called when you get into the
c++ level. Maybe it can be done, but its outside the scope of what swig
covers, or at least its not simple or obvious.

> The reason to use python would be to avoid having the user compile stuff
> and being faster in prototyping a solution. Is there any way to do some
> processing in python?
> 

Yes, make a generic hier block class that has message queues in and out,
and a thread to read data, call a work function, write the data. Now you
can override this block with your own work function and io signature and
plug it into any generic python flowgraph.

-josh



reply via email to

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