On Tue, Sep 27, 2011 at 11:14 AM, Josh Blum <[email protected]> wrote:

>
> >>
> >> I want to support proper message passing. I noticed that I can register
> >> a message handler to receive messages. Can you point me to how messages
> >> are produced?
> >>
> >
> > So you basically need to create a callback function and set it as the
> > message handler. So you call:
> >
> >      template <typename T> void set_msg_handler(T msg_handler){
> >       d_msg_handler = msg_handler_t(msg_handler);
> >     }
> >
> > Where d_msg_handler is of type:
> >
> >     typedef boost::function<void(pmt::pmt_t)> msg_handler_t;
> >
> > You then use gruel::send (in msg_passing.h) to a block that has a message
> > acceptor handler defined (or not; if there is no handler, nothing
> happens).
> > You can see gnuradio-core/src/lib/runtime/qa_set_msg_handler.cc  for an
> > example of this.
> >
>
> I did my own digging last night, and found that gr_block inherits
> gr_basic_block inherits gr_msg_accepter which has post(). So the
> gruel::send is just a function to call this post() method.
>
> So, there is nothing here that really deals with message propagation.
> Message sending exists at the block level but not at the flow graph
> level. Or am I am misunderstanding.
>
> -Josh
>

You are correct, sir.

The messages are handled, on the other hand, in the flowgraph. You can find
it in gr_block_executor, if you are so inclined. But that's purposefully
behind the scenes, so you shouldn't have to worry about that at all.

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

Reply via email to