discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] Python message ports


From: Roy Thompson
Subject: Re: [Discuss-gnuradio] Python message ports
Date: Tue, 14 May 2013 19:18:32 -0400

What version of GNU Radio are you using?  Message ports with Python blocks are supported as of 3.6.4:

class message_consumer(gr.sync_block):
    def __init__(self):
        gr.sync_block.__init__(
            self,
            name = "message consumer",
            in_sig = None,
            out_sig = None
        )
        self.message_port_register_in(pmt.pmt_intern('in_port'))
        self.set_msg_handler(pmt.pmt_intern('in_port'), self.handle_msg)

    def handle_msg(self, msg):
        # Handle the message here


On Tue, May 14, 2013 at 9:10 AM, Johannes Demel <address@hidden> wrote:
Hi list,

I tried to use message ports with python blocks but I can't find
something like "register_msg_port_in" or similar. And asking google
didn't give me any results as well. So I can't register a message port.
This rises the question if it is possible to use message ports with
python blocks.
In my case it would be very useful as I want to create a block which is
only called a few times.

Also, I wanted to create QA code for my block and tried to use a
"message_sink" block. This block does not use the msg_connect method to
connect to a message queue. It demands a msg_queue object. Is there a
reason for this block not to use the msg_connect method?

GRC uses
self.blocks_message_sink_0=blocks.message_sink(gr.sizeof_gr_complex*1,
blocks_message_sink_0_msgq_out, False)

but this raises another error
NameError: global name 'blocks_message_sink_0_msgq_out' is not defined
That's not surprising as the variable is never declared.

I hope someone can clear things up.

- Johannes

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]