# Block taking in message, outputting items

**URL:** <https://www.ruby-forum.com/t/block-taking-in-message-outputting-items/232582>\
**Category:** GNU Radio\
**Created:** [October 16, 2014, 4:31pm UTC](https://www.ruby-forum.com/t/block-taking-in-message-outputting-items/232582 "2014-10-16T16:31:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [October 16, 2014, 4:31pm UTC](https://www.ruby-forum.com/t/block-taking-in-message-outputting-items/232582/1 "2014-10-16T16:31:57Z")

</div>

Dear All,

How can I create a block like ‘Random PDU Generator’, but that outputs  
items rather than PDUs over a message port?

Hopefully its easy but I am not clear if I need a work function or not,  
and if I don’t have one then how do I pass the items out, as one does in  
a normal block?

Perhaps there are already blocks that do what I am trying to achieve?

Thanks for your help!!

Regards,

David

* * *

David Halls Ph.D.  
Research Engineer  
Toshiba Research Europe Limited  
32 Queen Square, Bristol, BS1 4ND, UK  
Tel: +44 (0) 117 906 0790

* * *

NOTE: The information in this email and any attachments may be  
confidential and/or legally privileged. This message may be read, copied  
and used only by the intended recipient. If you are not the intended  
recipient, please destroy this message, delete any copies held on your  
system and notify the sender immediately.

Toshiba Research Europe Limited, registered in England and Wales  
(2519556). Registered Office 208 Cambridge Science Park, Milton Road,  
Cambridge CB4 0GZ, England. Web: www.toshiba.eu/research/trl

---

<div class="post-metadata">

**Author:** ![divotdave](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/bbe5ce/32.png) [@divotdave](https://www.ruby-forum.com/u/divotdave)\
**Post date:** [October 16, 2014, 5:38pm UTC](https://www.ruby-forum.com/t/block-taking-in-message-outputting-items/232582/2 "2014-10-16T17:38:38Z")

</div>

Hi David,

“items” is a output/input buffer stream term in GNU Radio.  
You can just put whatever data type you’d want (ok, a lot of data types)  
into PMTs, and send them around; for sample vectors, PMT uniform vectors  
are the way to go.  
If you just use message passing, you don’t need to implement a  
meaningfull work() function – you don’t even have to actually use a  
subclass of gr::block (but I recommend doing that for the sake of  
getting loads of functionality for free).

Most probably there are blocks that do what you want, maybe you want  
something like  
random source --\> throttle [1] --\> message sink?

Greetings,  
Marcus

[1] this is one of the _very_ few times I’d recommend using throttle.  
Otherwise, the source will just run at maximum speed and roast the  
message passing system to a fine crisp.
