On Sat, Nov 23, 2019 at 6:57 PM Richard Bell <richard.be...@gmail.com>
wrote:

> I'm trying to transmit and receive small chunks of data in between data
> processing steps. I can only get the first chunk of data across, after
> that, calling tx.start() and rx.start() does not seems to work. The
> flowgraphs I'm starting have head() blocks in them that are responsible for
> calling tx.stop() and rx.stop(). So the series of call would look something
> like this:
>

gr::blocks::head, does *not* call stop(). It signals WORK_DONE (return -1)
which GR's scheduler recognizes and lets the downstream blocks finish their
processing. A flow graph in this state is merely idle, not stopped. You
need to call stop() yourself (after wait()) in order to reuse the top block.


> When the head blocks call tx.stop() and rx.stop() internally, does that
> make the flowgraphs unrecoverable for the next tx/rx.start()? If this is
> the case, how would we implement what I'm describing?
>

Besides the missing stop(), the other problem is the head block itself — it
counts the number of items it's passed on, independent of any starts and
stops. Call reset() on it to tell it to pass some more items.

When you're wondering about the exact behavior, I recommend consulting the
source code of the blocks. You don't have to know everything about how
blocks work to get some clues about what they do or don't support, or what
happens in a particular condition.

https://github.com/gnuradio/gnuradio/blob/master/gr-blocks/include/gnuradio/blocks/head.h
https://github.com/gnuradio/gnuradio/blob/master/gr-blocks/lib/head_impl.cc

Reply via email to