discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Insert messages in queues?


From: madengr
Subject: Re: [Discuss-gnuradio] Insert messages in queues?
Date: Mon, 13 Apr 2015 07:41:05 -0700 (MST)

Martin,

Yes, pop them outside the block, but also outside of the flow graph. 
Exactly reverse of the last example "Posting from External Sources" here:

http://gnuradio.org/doc/doxygen/page_msg_passing.html

"The last feature of the message passing architecture to discuss here is how
it can be used to take in messages from an external source. We can call a
block's gr::basic_block::_post method directly and pass it a message. So any
block with an input message port can receive messages from the outside in
this way."

I want to take any block with an output message port and _pull that message
to the outside (of the flow so I can process it in Python).

Presently, with the old queued messaging system, I can use
blocks.message_sink() to take an item into a message queue I can access
outside the flow.  Since this will be deprecated, I'd want to use
blocks.tagged_stream_to_pdu() to generate a message, but don't see a way to
get those messages stored into a FIFO (queue) and access them outside the
flow.

As you suggest, maybe the solution is to develop a block, with an input
message port, that performs the callback and stores those messages in a
FIFO.  From browsing the documentation, it looks like the message_debug
block will store up messages (I haven't attempted to read those messages),
but I'd be worried about overflows.  I guess the ideal was to do it without
developing or modifying any blocks.

Though looking at  line 278 of usrp_spectrum_sense.py, when the message
queues are deprecated, what would you do to get the data out of the flow? I
assume blocks.bin_statistics_f() would have to be re-written to have a
message port output, but then how do you get that message out of the flow?

https://github.com/gnuradio/gnuradio/blob/master/gr-uhd/examples/python/usrp_spectrum_sense.py#L278
 
Thanks,
Lou
  

Martin Braun-2 wrote
> So you want pop messages from outside the block, right? Is the original 
> block written in C++?
> 
> delete_head_block() should work, but this seems unusual. Typically, we 
> have two mechanisms of handling messages: Dedicated message handler 
> callbacks, or we pop the queue ourselves in work() using delete_head().
> 
> If you're popping messages outside of the block, the block itself would 
> never see or use those messages -- which is why I'm surprised. You might 
> be better of writing a mini-Python-block that handles the messages.
> 
> Cheers,
> M





--
View this message in context: 
http://gnuradio.4.n7.nabble.com/Insert-messages-in-queues-tp53272p53279.html
Sent from the GnuRadio mailing list archive at Nabble.com.



reply via email to

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