Example #1
0
        public IBFSample GetBandPower(double band)
        {
            if (BandPowers.ContainsKey(band.BandPowerKey()))
            {
                return(BandPowers[band.BandPowerKey()]);
            }

            return(null);
        }
Example #2
0
        /// <summary>
        /// Start band power monitor task
        /// </summary>
        public async Task StartBandPowerMonitorAsync()
        {
            if (CancelTokenSource == null)
            {
                Log?.Invoke(this, new LogEventArgs(Name, this, "StartSignalFiltering", $"You must start the processor first.", LogLevel.ERROR));
                return;
            }

            await BandPowers.StartMonitorAsync();
        }
Example #3
0
        /// <summary>
        /// Stop the data processor async task, and all component processor tasks
        /// </summary>
        public async Task StopDataProcessorAsync(bool flush = false)
        {
            FlushQueue = flush;

            if (CancelTokenSource != null)
            {
                await StopRealTimeSignalProcessingAsync();

                await BandPowers.StopMonitorAsync();

                CancelTokenSource.Cancel();
                await Task.WhenAll(RawDataQueueProcessorTask, DataMonitorTask, PeriodicProcessorTask);

                CancelTokenSource         = null;
                RawDataQueueProcessorTask = null;
                PeriodicProcessorTask     = null;
                DataMonitorTask           = null;

                Log?.Invoke(this, new LogEventArgs(Name, this, "StopDataProcessor", $"Stopped Brainflow data processor for {Name}.", LogLevel.INFO));
            }
        }
Example #4
0
 /// <summary>
 /// Get current band powers at specified frequency band (in Hz)
 /// </summary>
 public IBFSample GetBandPower(double band)
 {
     return(BandPowers.GetBandPower(band));
 }
Example #5
0
 /// <summary>
 /// Set the band power processor ranges
 /// supply a list of tuples: lowFrequency,highFrequency in each range
 /// </summary>
 /// <param name="rangeList"></param>
 public void SetBandPowerRangeList(List <Tuple <double, double> > rangeList)
 {
     BandPowers.SetBandPowerRangeList(rangeList);
 }
Example #6
0
 /// <summary>
 /// Stop band power monitor task
 /// </summary>
 public async Task StopBandPowerMonitorAsync()
 {
     await BandPowers.StopMonitorAsync();
 }