Page 1 of 1

begin a stream transfer synchronously?

Posted: Fri Apr 14, 2017 12:04 pm
by reesebo
Hello,

I would like to use the stream interface, but would like to start the stream based on a timestamp. Is there a way to do this? I can't use the synchronous interface since it blocks; I need to be able to interrupt a transfer and my file size is large.

Thanks,

Reese

Re: begin a stream transfer synchronously?

Posted: Sun Apr 16, 2017 1:54 am
by jump
Why don't you start the synchronous transfer in a dedicated thread so that it doesn't block your program? Then based on the timestamp, you can choose to discard the samples if you don't need them or write them to a file or to whatever destination you need :)

Re: begin a stream transfer synchronously?

Posted: Fri May 19, 2017 7:43 am
by reesebo
Hi, thanks for the reply. Is it possible to gracefully interrupt a streaming transmit after it starts? I had some difficulty with this, so I went with the manual setup.

Thanks
Reese

Re: begin a stream transfer synchronously?

Posted: Sat Jun 10, 2017 12:27 am
by jump
Sorry for the late reply.

The trickiest part is when you want to change the sample rate on the fly. You may run into buffer overflow issues.

To stop the streaming, I simply used a boolean value shared between the threads (main thread sets it and the thread responsible of streaming only reads it). In the synchronous loop I check the value of the boolean and stop the streaming. The main thread joins the thread to ensure it exited properly.
I'm pretty sure this should be part of the examples in the github of bladeRF so may find C code to start with.