Monday, September 30, 2019

Re: [Discuss-gnuradio] GNU-Radio Companion Python flowgraph - return signal that it is finished?

Thanks Kevin. I ended up calling the python method os.stat.st_size on
the IQ file that the flowgraph will transmit, converted that file size
to a time duration in seconds considering the sample size and rate,
start the flowgraph, then have a sleep function that checks for a flag
every 100 milliseconds to stop the flowgraph if necessary. I always
do a tb.stop() followed by a tb.wait(), because I assume that .stop()
is not blocking but .wait() is blocking and this is the best practice
way to prematurely stop a flowgraph. Or is the .wait() necessary?

Thanks.


On Sat, Sep 28, 2019 at 10:43 PM Kevin Reid <kpreid@switchb.org> wrote:
>
> On Sat, Sep 28, 2019 at 6:34 PM Andrew Payne <wandrewp@gmail.com> wrote:
>>
>> I have a short IQ file that I simply want to play once without repeating, and I want the calling Python code to "know" when it's completed after commanding the GR class instance to start via a call to tb.start(), if tb is the class instance variable.
>
>
> Call
> tb.start()
> tb.wait()
> tb.stop()
> in that order. The call to wait() will block until the flow graph finishes.
>
> If you need to do something else while waiting, you can create another thread from Python (threading.Thread) and either have it call tb.wait() or have it do the other work, whichever suits your application.

_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

No comments:

Post a Comment