discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Type-selectable OOT Block C++


From: Tom Rondeau
Subject: Re: [Discuss-gnuradio] Type-selectable OOT Block C++
Date: Thu, 23 Jul 2015 09:21:34 -0400

On Thu, Jul 23, 2015 at 6:29 AM, Galiero Casay Gabriele <address@hidden> wrote:
Hello all,

I was building my own block in C++ and I have one doubt about it. Some times my block has to work with float streams and sometimes with complex streams. There is one single input and output.
I have implemented separately: sync_ff_impl.cc and sync_cc_impl.cc each one with its respective xml file to use it in gnuradio-companion. Now I wanted to have only one xml so that the block is type-selectable. Is there any template or way to make it? I have been checking the code from other type-selectable blocks but it did not help much.

If there is some interest about what the block does, it basically adds a predefined preamble to the incoming packets, so that in reception the receiver is able to know when the packet starts.

Thanks before hand.
Best regards,

Gabriele Galiero

Hi Gabriele,

There are tons of examples in the GNU Radio source tree for how to do this. Look for any block that has a _xx or _vxx ending on it in the grc directories and you'll see it. A good example is blocks_multiply_const_vxx.xml:

        <make>blocks.multiply_const_v$(type.fcn)($const)</make>
        ....
<param>
<name>IO Type</name>
<key>type</key>
<type>enum</type>
<option>
<name>Complex</name>
<key>complex</key>
<opt>const_type:complex_vector</opt>
<opt>fcn:cc</opt>
</option>
<option>
<name>Float</name>
<key>float</key>
<opt>const_type:real_vector</opt>
<opt>fcn:ff</opt>
</option>
<option>
<name>Int</name>
<key>int</key>
<opt>const_type:int_vector</opt>
<opt>fcn:ii</opt>
</option>
<option>
<name>Short</name>
<key>short</key>
<opt>const_type:int_vector</opt>
<opt>fcn:ss</opt>
</option>
</param>

So the $(type.fcn) is filled in with the "opt" parameter of the type selected.

Tom


reply via email to

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