On Thu, Jul 23, 2015 at 6:29 AM, Galiero Casay Gabriele < gabriele.galieroca...@aalto.fi> 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
_______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio