Friday, July 10, 2015

[Discuss-gnuradio] _post to message port with python handler

This is a follow-up to a prior question I asked under the title 'message passing: _post or strobe' that didn't get much attention.

I was trying to use basic_block._post from python to send messages to a python block in my flowgraph. As a sanity check I also tried using a message_strobe block, connecting the message_strobe output message port to my python block's input message port. The message_strobe block uses basic_block::message_port_pub which indirectly calls basic_block::_post.

Running my fg in gdb I was able to verify that basic_block::_post was being called in both instances and that the which_port and msg arguments were correct. However, I could not determine why my message handler was called only when triggered with message_port_pub (via the message_strobe block) and not when I used _post directly (from python).

The workaround was to have my python block also register an output port, connect it to its input message port, and use blk.message_port_pub from within my python script. It seems some state must be set using msg_connect and/or message_port_pub that is required for _post to work. I was unable to determine that but at least I have found some way to get it to work.

I appreciate anyone's comments or suggestions.

Jared.
------------------------------------------------------
Jared Dulmage
Engineering Specialist
Digital Comm. and Implementation Dept.
Aerospace Corporation
310-336-3140

_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

No comments:

Post a Comment