Hier blocks can connect to internal primitive blocks They are removed during flattening and never receive a thread context to handle messages in, creating a simple primitive received basic block to handle messages like you have done is the right thing. If we do add hier block message handling it would likely be some clever wrapper around creating a primitive block underneath which received a thread context like what you have done but with some syntactic sugar. Tim
On Thu, Jan 28, 2016, 8:36 PM Joe K <radi...@gmail.com> wrote: > Kartik, > > As far as I am aware, hierarchical blocks cannot process messages. I ran > into the same issue, because I had a hierarchical block with several child > blocks, and it needed to do some control operations to the child blocks > dependent on a received message, without those blocks "understanding" or > caring about the contents of the message. > > My workaround was to create a new variety of block that did nothing but > receive arbitrary messages, and then routed them back up to the > hierarchical > block by calling a function in the hierarchical block. It is kludgey, but > it works. > > There are definitely use cases for having message handlers in hierarchical > blocks, but I don't know the underlying code well enough to know if it > would > be straightforward to add message handling support to standard hierarchical > blocks. > > Joe > > -----Original Message----- > Sent: Wednesday, January 27, 2016 10:46 AM > To: Discuss-gnuradio@gnu.org > Subject: [Discuss-gnuradio] Message Input port in hierarchical block > > Hi, > > I have a hierarchical block generated via GRC with no input or output > message port. > Now I add a message port by changing python code for some control > functionality using: > > self.message_port_register_hier_in("test") > > Now generally in sync or other blocks we can bind this "test" port to a > handler function like: > > self.set_msg_handler(pmt.intern("test"),self.handler) > > The problem is that there is no such function for hierarchical blocks in > gr.hier_block2 class > So how can I process message data coming in at this port ? > > Please excuse if I have missed something. > > Kartik > > > > > -- > View this message in context: > > http://gnuradio.4.n7.nabble.com/Message-Input-port-in-hierarchical-block-tp5 > 7896.html > <http://gnuradio.4.n7.nabble.com/Message-Input-port-in-hierarchical-block-tp57896.html> > Sent from the GnuRadio mailing list archive at Nabble.com. > > _______________________________________________ > Discuss-gnuradio mailing list > Discuss-gnuradio@gnu.org > https://lists.gnu.org/mailman/listinfo/discuss-gnuradio > > > _______________________________________________ > Discuss-gnuradio mailing list > Discuss-gnuradio@gnu.org > https://lists.gnu.org/mailman/listinfo/discuss-gnuradio >
_______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio