lsl_archived icon indicating copy to clipboard operation
lsl_archived copied to clipboard

How to know when data is no longer being received by a StreamInlet instance?

Open iidodson opened this issue 7 years ago • 2 comments

Hello!

I'm using LSL in python. I'm using the RecieveData.py example and I'm getting the data fine but I'd like to know how to check if StreamInlet is no longer receiving data. I tried to print out the return values of the methods like channel_count or sample_type to check if they become null once the stream has ended but they are not. They just stop printing. When the stream stops it seems StreamInlet has no return value but is not null.

How would I check set up a base block to check whether or not data is being received by a StreamInlet? Or am I even taking the right approach to this. I'm also new to python so any help is appreciated. Thanks!

iidodson avatar Feb 07 '18 21:02 iidodson

LSL provides the ability to automatically recover from lost connections. The default assumption is that the inlet will be able to fetch data whenever the stream becomes available again. Do you have a specific use case where this doesn't work?

If, for example, you want the inlet-containing application to respond to the end of something, then the better way to do that would be to use a parallel markers (event) stream, and have an inlet parse the markers for a 'shutdown' or similar event and respond to that instead.

cboulay avatar Feb 07 '18 22:02 cboulay

Hi and thanks for the reply. I'm trying to build an application that terminates a process when the connection is lost. Since the same code provided runs while True, the process is never able o terminate. I'm not familiar with a parallel markers (event) stream. Could you give an example? I'm looking online and haven't been able to find any examples of that. Also, I'm new to Python. Thanks!

iidodson avatar Mar 20 '18 18:03 iidodson