C++ block that generate extra data

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?
Thank you

On Thu, Sep 29, 2011 at 04:14:04PM +0200, Mattia R. 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 B.
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

Thank you for the reply.
How can i reallocate the output buffer if is too small?
Let’s assume that my block has an input itemsize of 3 byte and an output
itemsize of 4 byte. Forecast with 1:1.
If the scheduler keeps to give to my block only 4 bytes for output, how
can
i force to give me more?
Thanks

-----Messaggio originale-----
From: Martin B.
Sent: Thursday, September 29, 2011 4:20 PM
To: [email protected]
Subject: Re: [Discuss-gnuradio] C++ block that generate extra data


Discuss-gnuradio mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

I think you should tell it in the constructor.
like this:

#define NR_OF_WORDS_ADDITIONALLY_NEEDED 4

my_usrp_rx_tx::my_usrp_rx_tx(void) : gr_block(“my_usrp_rx_tx”,
gr_make_io_signature(1, 1, sizeof(short)),
gr_make_io_signature(1, 1, sizeof(short)))
{
set_output_multiple(NR_OF_WORDS_ADDITIONALLY_NEEDED);
}

Then in general work function, for example, you can increment “manually”
4
words before your out buffer will say “bang”.

Patrik

----- Original Message -----
From: “Mattia R.” [email protected]
To: “gnu radio” [email protected]
Sent: Thursday, September 29, 2011 19:04
Subject: Re: [Discuss-gnuradio] C++ block that generate extra data

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs