public bool HasConsumer() { if (outlet != null) return outlet.have_consumers(); return false; }
public bool HasConsumer() { if (outlet != null) { return(outlet.have_consumers()); } return(false); }
/// <summary> /// Run the broadcast async task /// Will spin continuously and write samples in the queue to the LSL outlet /// </summary> async Task RunDataBroadcastAsync(CancellationToken cancelToken) { try { using (var outlet = new liblsl.StreamOutlet(StreamInfo)) { while (!cancelToken.IsCancellationRequested) { await Task.Delay(10); while (!DataToBroadcast.IsEmpty) { try { DataToBroadcast.TryDequeue(out var sample); if (outlet.have_consumers()) { outlet.push_sample(sample.AsRawSample()); } } catch (Exception ex) { Log?.Invoke(this, new LogEventArgs(this, "RunBroadcastServerAsync", ex, LogLevel.ERROR)); } } } } } catch (OperationCanceledException) { } catch (Exception e) { Log?.Invoke(this, new LogEventArgs(this, "RunBroadcastServerAsync", e, LogLevel.ERROR)); } finally { } }