Dear all,

While experimenting with hier_block2 I noticed that connecting an input
message port appears to disconnect an unrelated stream output port. I've
attached a simple example Python script to show what I mean.

Basically, the example script creates a hier_block2 with a null source and
throttle block. The hier_block2 is then connected to a null sink.
Furthermore, it has an input message_port for control messages. The script
runs fine when the input  message_port is not connected. However, when
connecting the message_port, the following error is returned:

RuntimeError: hier_block_test(2): insufficient connected output ports (1
needed, 0 connected)

Am I missing something or might this be a bug? If I change the hier_block2
to have 0 stream outputs (in the output signature), the error goes away,
but in my use case I need to have one stream output and one control message
input.


Kind regards,
Pieter Robyns
#!/usr/bin/env python2
import weakref

from gnuradio import blocks, gr
from time import sleep
import pmt

class hier_block_test(gr.hier_block2):
    def __init__(self):
        gr.hier_block2.__init__(self,
            "hier_block_test",
            gr.io_signature(0, 0, 0),  # Input signature
            gr.io_signature(1, 1, gr.sizeof_gr_complex))  # Output signature

        nsrc = blocks.null_source(gr.sizeof_gr_complex)
        throttle = blocks.throttle(gr.sizeof_gr_complex, 20000, True)

        self.connect((nsrc, 0), (throttle, 0))
        self.connect((throttle, 0), (weakref.proxy(self), 0))

        self.message_port_register_hier_in("test")

if __name__ == "__main__":
    tb = gr.top_block()

    message_strobe = blocks.message_strobe(pmt.intern("debugmsg"), 1000)
    hier = hier_block_test()
    nsnk = blocks.null_sink(gr.sizeof_gr_complex)
    tb.connect((hier, 0), (nsnk, 0))

    introduce_bug = True
    if introduce_bug:
        tb.msg_connect((message_strobe, "strobe"), (hier, "test"))

    tb.start()
    sleep(10)
    tb.stop()
_______________________________________________
Discuss-gnuradio mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to