|
From: | Mostafa Alizadeh |
Subject: | Re: [Discuss-gnuradio] I have a trouble with new types in python! |
Date: | Wed, 7 May 2014 19:04:05 +0430 |
- also, you can generate XML files to represent blocks in GRC. Again, this will only be used to generate python code! If you want to define things so that you can not only use them in python, generate XML. This is covered in the "writing out of tree modules" tutorial.- When you create a block, and set up everything accordingly (which gr_modtool will do for you), then SWIG will generate wrapper code to make these classes (which are types!) available as blocks in python- As you noticed, there is not always a direct matching between C++ and python types. This is an inherent problem caused by the fact that they are different internally.- GRC is but a graphical interface to python code, which itself offers access GNU Radio blocks, partly written in python, mostly written in C++ and wrapped to python. It's always important to remember that GRC != GRHi Mostafa,this question is far more complex than you'd expect. I'll try to explain:
- there is a difference between sample streams and variables: a variable in GRC is usually used to configure parameters of a block. I don't really see a reason not to use a standard integer value here; ok, you're wasting dozens of bits. But honestly, you do that once, it doesn't matter.
- for streams, there is a byte type. Internally, neither python, nor GNU Radio care about the type; they just care about the item size, so defining things like "bit", packed in "byte" does never make a difference.Hope that was a little helpful,
Marcus MüllerOn Wed, May 7, 2014 at 3:01 PM, Mostafa Alizadeh <address@hidden> wrote:
_______________________________________________Hello everybody,I have a new type in my gnuradio blocks which are defined in c++. However, the GRC don't know them.The first question is how I could make GRC of such blocks?I think if I could be able to define them in python I could add new types to the GRC of the block.Although I'm not so familiar with python, I want to define new type as it was previously defined in c++ as :typedef unsigned char bit;how could I define such variable in python!!!? (may it helps me to make my GRC block)Thank,
Discuss-gnuradio mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
[Prev in Thread] | Current Thread | [Next in Thread] |