# Passing a message from one block to other

**URL:** <https://www.ruby-forum.com/t/passing-a-message-from-one-block-to-other/201680>\
**Category:** GNU Radio\
**Created:** [January 12, 2011, 8:49pm UTC](https://www.ruby-forum.com/t/passing-a-message-from-one-block-to-other/201680 "2011-01-12T20:49:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [January 12, 2011, 8:49pm UTC](https://www.ruby-forum.com/t/passing-a-message-from-one-block-to-other/201680/1 "2011-01-12T20:49:14Z")

</div>

Hi,  
Suppose I have two gnuradio blocks called gr\_ACQUISITION and gr\_TRACKING  
where, gr\_TRACKING is dependent upon some result derived from gr\_ACQ  
block.  
Is it possible to pass certain messages to gr\_TRACK in order to change  
its  
state while the flowgraph is running? One way to do is to have an output  
line in gr\_ACQUISITION that carries this info to the block gr\_TRACKING  
but  
this doesn’t seem like an attractive option to me.

Thanks,  
John.

---

<div class="post-metadata">

**Author:** ![john-anes](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/22d042/32.png) [@john-anes](https://www.ruby-forum.com/u/john-anes)\
**Post date:** [January 12, 2011, 9:04pm UTC](https://www.ruby-forum.com/t/passing-a-message-from-one-block-to-other/201680/2 "2011-01-12T21:04:19Z")

</div>

On Wed, 2011-01-12 at 13:43 -0600, John A. wrote:

> Hi,  
> Suppose I have two gnuradio blocks called gr\_ACQUISITION and  
> gr\_TRACKING where, gr\_TRACKING is dependent upon some result derived  
> from gr\_ACQ block. Is it possible to pass certain messages to gr\_TRACK  
> in order to change its state while the flowgraph is running? One way  
> to do is to have an output line in gr\_ACQUISITION that carries this  
> info to the block gr\_TRACKING but this doesn’t seem like an attractive  
> option to me.

This is what the message queues are for. You can see examples of its use  
in the gr-pager code.

–n

---

<div class="post-metadata">

**Author:** ![john-anes](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/22d042/32.png) [@john-anes](https://www.ruby-forum.com/u/john-anes)\
**Post date:** [January 14, 2011, 12:13am UTC](https://www.ruby-forum.com/t/passing-a-message-from-one-block-to-other/201680/3 "2011-01-14T00:13:54Z")

</div>

On Wed, Jan 12, 2011 at 2:43 PM, John A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Hi,  
> Suppose I have two gnuradio blocks called gr\_ACQUISITION and gr\_TRACKING  
> where, gr\_TRACKING is dependent upon some result derived from gr\_ACQ block.  
> Is it possible to pass certain messages to gr\_TRACK in order to change its  
> state while the flowgraph is running? One way to do is to have an output  
> line in gr\_ACQUISITION that carries this info to the block gr\_TRACKING but  
> this doesn’t seem like an attractive option to me.
> 
> Thanks,  
> John.

We have recently introduced the concept of stream tags into GNU Radio  
that might be what you want. They are not currently well-documented,  
but you can find some information in my presentations from this years  
SDR conference (specifically Tues and Weds):  
[http://gnuradio.org/redmine/wiki/gnuradio/SDR2010](http://gnuradio.org/redmine/wiki/gnuradio/SDR2010)

You can also see a simple example in the code source (you’ll have to  
be on the next branch in git right now):  
gnuradio-examples/python/tags

I will hopefully soon find time to write more examples and document it  
better. But hopefully, the examples will be enough to show you how to  
add a tag to an output stream from one block and receive it in another  
block.

If you manage to get it working, I’d be very interested to hear about  
your experiences. What you are looking to do sounds like it could be a  
perfect case study for the use of the tags that others could well  
benefit from.

Tom

---

<div class="post-metadata">

**Author:** ![john-anes](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/22d042/32.png) [@john-anes](https://www.ruby-forum.com/u/john-anes)\
**Post date:** [January 15, 2011, 7:46pm UTC](https://www.ruby-forum.com/t/passing-a-message-from-one-block-to-other/201680/4 "2011-01-15T19:46:16Z")

</div>

Thanks Tom, I will definitely take a look at it and keep you informed.

Thanks,  
John
