Hi Marcus,

Aha! I saw hints of this in the documentation but couldn't fully connect
the dots.

Would this be the start() function of top_block, or the block in question?
How would the syntax look like then?

Regards

Den tors 23 maj 2019 kl 18:32 skrev Müller, Marcus (CEL) <muel...@kit.edu>:

> Hi Sebastian,
>
> classic one!
>
> You send the messages in the block's constructor in an endless loop.
>
> So, that constructor never finishes.
>
> Thus, the block never can get message-connected. Thus, your messages
> disappear.
>
> You can't publish message in a constructor. Spawn off a thread in the
> `start()` method to do that.
>
> Best regards,
> Marcus
>
> On Thu, 2019-05-23 at 17:42 +0200, Sebastian Sahlin wrote:
> > Hi,
> >
> > For learning purposes I'm trying to replicate the functionality of the
> Message Strobe block in Python, however I'm stumped by what should be a
> very basic function. I'm simply attempting to publish a message every x
> seconds:
> >
> > def __init__(self, period):
> >         gr.basic_block.__init__(self,
> >             name="msg_strobe",
> >             in_sig=None,
> >             out_sig=None)
> >
> >         self.message_port_register_out(pmt.intern('msg_out'))
> >
> >         while(True):
> >             self.send_message('Hello World')
> >             time.sleep(period)
> >
> >     def send_message(self, string):
> >         self.message_port_pub(pmt.intern('msg_out'), pmt.intern(string))
> >
> > However there is no message published to the Message Debug block.
> >
> > _______________________________________________
> > 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

Reply via email to