sccn / lsl_archived

Multi-modal time-synched data transmission over local network
242 stars 134 forks source link

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

Open iidodson opened 6 years ago

iidodson commented 6 years ago

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!

cboulay commented 6 years ago

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.

iidodson commented 6 years ago

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!