Sunday, April 12, 2015

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

On 12.04.2015 15:22, madengr wrote:
> Thanks Martin. Looking at the gr-blocks/examples/msg_passing, the tutorial
> link, and qa_msg, I only find examples of posting messages. Those make
> sense, but is there an equivalent to _post method that pulls messages?
>
> http://gnuradio.org/doc/doxygen/classgr_1_1basic__block.html#a8501714cb14c1a08b4ff55761600f3a5
>
> From the above docs, I see the delete_head_blocking, which is maybe what I
> want. If I have a tagged stream to PDU like below, how do I pull the
> message?
>
> sink=blocks.tagged_stream_to_pdu(blocks.float_t, "packet_len")
> sink.to_basic_block.???????

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

>
> Lou
>
>
> Martin Braun-2 wrote
>>
>> Hey Louis,
>>
>> Yes, there are two ways, and they're completely different. The old
>> message queues will be deprecated soon, so anything with gr.msg_queue()
>> in there will, at one point in the future, stop working.
>>
>> Look at the Python output of some of the message examples we provide,
>> also check out this manual page:
>> http://gnuradio.org/doc/doxygen/page_msg_passing.html
>>
>> M
>>
>> _______________________________________________
>> Discuss-gnuradio mailing list
>
>> Discuss-gnuradio@
>
>> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>
>
>
>
>
> --
> View this message in context: http://gnuradio.4.n7.nabble.com/Insert-messages-in-queues-tp53272p53277.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

1 comment:

  1. Hi All

    I just ran across this, after searching for the last couple of days on how to get information out of a flowgraph without using the deprecated message sinks (or a filesystem FIFO or some other hack). I also discovered the delete_block_head() function, but I get

    AttributeError: 'basic_block_sptr' object has no attribute 'delete_head_block'

    I'm missing something about how this is supposed to work. I know gnuradio is focused on things working within the block/flowgraph scheme, but it seems like there must be some folks out there that just want to run a flowgraph within a larger application and pull data from it. In this scenario, we don't necessarily care at all about the messages, we just want the stream data.

    ReplyDelete