Trouble posting messages to block's message port

I’m trying to create a block that accepts messages and prints them out.
I created a block that extends gr_block and it has no stream ports: I’m
using gr_io_signature(0,0,0) for input and output. I am following the
guidance of this page:

http://gnuradio.org/doc/doxygen/page_msg_passing.html

From a test Python script I instantiate a top_block /tb/ and then
connect my stream-port-less block with tb.connect(block_instance). I
follow the lead of the page above to post a message, but the bound
handler function never gets called (I inserted a line to print “I’m
here!!” to stdout when the function gets called).

Am I having issues because my block doesn’t have any stream inputs or
outputs?

Thanks,

Sean

Hi Sean,
have you tried using tb.msg_connect(src, “out_port_id”, dst,
“in_port_id”) instead of tb.connect?

Cheers
Marcus
Am 03.05.2013 00:35, schrieb Sean Nowlan:

On 05/03/2013 01:26 PM, Marcus M. wrote:

Hi Sean,
have you tried using tb.msg_connect(src, “out_port_id”, dst,
“in_port_id”) instead of tb.connect?

Cheers
Marcus

I’m trying to post a message to a port from top_block as opposed to
connecting the output port of one block to the input of “dst”. The
documentation indicates this can be done using
“dst.to_basic_block()._post(port, msg)”.Unfortunately this is not
working for me.

http://gnuradio.org/doc/doxygen/page_msg_passing.html

–sean

On 05/03/2013 01:41 PM, Sean Nowlan wrote:

documentation indicates this can be done using
“dst.to_basic_block()._post(port, msg)”.Unfortunately this is not
working for me.

http://gnuradio.org/doc/doxygen/page_msg_passing.html

More precisely, posting the message doesn’t fail, so I guess it
worked. However the handler function is not called. I used the
boost::bind call to bind the message handler function following the lead
of the example code.

–sean


From: discuss-gnuradio-bounces+sean.nowlan=removed_email_address@domain.invalid
[discuss-gnuradio-bounces+sean.nowlan=removed_email_address@domain.invalid] on behalf
of Martin L. [[email protected]]
Sent: Friday, May 03, 2013 7:59 PM
To: [email protected]
Subject: Re: [Discuss-gnuradio] Trouble posting messages to block’s
message port

I had this issue once and if I remember correctly, connecting the block
to the flowgraph (i.e. connect any block to your message port, even if
that port will never send messages) will make your message handler react
to messages from your python code.

Hope this helps
Martin

I had this issue once and if I remember correctly, connecting the block
to the flowgraph (i.e. connect any block to your message port, even if
that port will never send messages) will make your message handler react
to messages from your python code.

Hope this helps
Martin

Am 03.05.2013 19:46, schrieb Sean Nowlan: