[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] GNU-Radio Companion Python flowgraph - return sig
From: |
Andrew Payne |
Subject: |
Re: [Discuss-gnuradio] GNU-Radio Companion Python flowgraph - return signal that it is finished? |
Date: |
Mon, 30 Sep 2019 11:02:09 -0400 |
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 <address@hidden> wrote:
>
> On Sat, Sep 28, 2019 at 6:34 PM Andrew Payne <address@hidden> 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.