Thursday, September 29, 2011

Re: [Discuss-gnuradio] C++ block that generate extra data

On Thu, Sep 29, 2011 at 04:14:04PM +0200, Mattia Rizzi wrote:
> Hello,
>
> i have a block that takes 3 bytes of data in and output 4bytes of data (3:4).
>
> It's possible to generate, sometimes, extra output?
>
> I mean, sometimes it take 3 bytes and output 5 bytes. It's possible? How i tell
> to the scheduler?

That's possible if you create a gr_block and use the general_work()
function (so don't derive from a sync_interpolator).
The general_work() function lets you manually set how many bytes were
consumed and how many were written to the output buffer. But you *must*
check the output buffer's large enough.

However, you sacrifice some performance and possibly some functionality
of GNU Radio (e.g., IIRC, I don't think you could propagate stream tags
automatically through this kind of block).

Perhaps re-thinking your signal flow is more optimal.

MB
--
Karlsruhe Institute of Technology (KIT)
Communications Engineering Lab (CEL)

Dipl.-Ing. Martin Braun
Research Associate

Kaiserstraße 12
Building 05.01
76131 Karlsruhe

Phone: +49 721 608-43790
Fax: +49 721 608-46071
www.cel.kit.edu

KIT -- University of the State of Baden-Württemberg and
National Laboratory of the Helmholtz Association

No comments:

Post a Comment