/// <summary> /// Update the UI when we get status updates from the processor /// </summary> private void OnHatDataProcessorCurrentState(object sender, BrainflowDataProcessing.ProcessorCurrentStateReportEventArgs e) { UpdateExgDataLabel(e); UpdateDataProcessingLabel(e); UpdateAccelerometerLabel(e); UpdateOtherPropertiesLabel(e); }
/// <summary> /// Send an event with the current state of the data /// intended to enable continuous update of UI, including signal that we do not have fresh data /// </summary> void SendCurrentDataEvent() { ProcessorCurrentStateReportEventArgs report = new ProcessorCurrentStateReportEventArgs(); if (UnfilteredData.Count > 0 /*&& DateTimeOffset.UtcNow.ToUnixTimeInDoubleSeconds() - Data.First().TimeStamp < 5*/) { report.CurrentSample = UnfilteredData.First(); report.CurrentDeviation = GenerateDeviationReport(.25); report.CurrentDevMedian = StdDevMedians; foreach (var nextBandPower in BandPowers.GetBandPowers()) { report.BandPowers.Add(nextBandPower.Key, nextBandPower.Value); } } else { report.ValidData = false; report.Details = "Stale Data "; } CurrentDataStateReported?.Invoke(this, report); }