Esempio n. 1
0
        /// <summary>
        /// Update the data processing label
        /// </summary>
        private void UpdateDataProcessingLabel(ProcessorCurrentStateReportEventArgs e)
        {
            try
            {
                string label = "Not receiving data from the sensor.";
                if (e.ValidData)
                {
                    label  = "";
                    label += $"Network offset time: {LatestOffsetTime.TotalSeconds:N4} s.\n";
                    label += $"Raw data latency: {LatestRawLatency:N4}\n";
                    label += "\n";

                    label += $"Band Power{string.Format("{0,9}", "8Hz")}{string.Format("{0,9}", "10Hz")}{string.Format("{0,9}", "12Hz")}{string.Format("{0,9}", "18Hz")}{string.Format("{0,9}", "20Hz")}{string.Format("{0,9}", "22Hz")}\n";
                    label += $"             {string.Format("{0,9}", "-------")}{string.Format("{0,9}", "-------")}{string.Format("{0,9}", "-------")}{string.Format("{0,9}", "-------")}{string.Format("{0,9}", "-------")}{string.Format("{0,9}", "-------")}\n";

                    for (int i = 0; i < e.CurrentSample.NumberExgChannels; i++)
                    {
                        label += $"Channel {i:D2}:{Math.Log10(e.GetBandPower(8).GetExgDataForChannel(i)),9:N3}{Math.Log10(e.GetBandPower(10).GetExgDataForChannel(i)),9:N3}{Math.Log10(e.GetBandPower(12).GetExgDataForChannel(i)),9:N3}{Math.Log10(e.GetBandPower(18).GetExgDataForChannel(i)),9:N3}{Math.Log10(e.GetBandPower(20).GetExgDataForChannel(i)),9:N3}{Math.Log10(e.GetBandPower(22).GetExgDataForChannel(i)),9:N3}\n";
                    }
                }

                labelDataProcessing.Invoke(new Action(() => { labelDataProcessing.Text = label; }));
            }
            catch (Exception)
            { }
        }
Esempio n. 2
0
        /// <summary>
        /// Update the other properties label
        /// </summary>
        private void UpdateOtherPropertiesLabel(ProcessorCurrentStateReportEventArgs e)
        {
            try
            {
                string label = "Not receiving data from the sensor.";
                if (e.ValidData)
                {
                    label = "";
                    for (int i = 0; i < e.CurrentSample.NumberOtherChannels; i++)
                    {
                        label += $"Other {i:D2}:  {e.CurrentSample.GetOtherDataForChannel(i):N1}\n";
                    }

                    label += "\n";

                    for (int i = 0; i < e.CurrentSample.NumberAnalogChannels; i++)
                    {
                        label += $"Anlg {i:D2}:   {e.CurrentSample.GetAnalogDataForChannel(i):N1}\n";
                    }
                }

                labelOtherData.Invoke(new Action(() => { labelOtherData.Text = label; }));
            }
            catch (Exception)
            { }
        }
Esempio n. 3
0
        /// <summary>
        /// Update the accelerometer label
        /// </summary>
        private void UpdateAccelerometerLabel(ProcessorCurrentStateReportEventArgs e)
        {
            try
            {
                string label = "Not receiving data from the sensor.";
                if (e.ValidData)
                {
                    label  = "";
                    label += $"Acel 0: {e.CurrentSample.GetAccelDataForChannel(0).ToString("N6")}\n";
                    label += $"Acel 1: {e.CurrentSample.GetAccelDataForChannel(1).ToString("N6")}\n";
                    label += $"Acel 2: {e.CurrentSample.GetAccelDataForChannel(2).ToString("N6")}\n";
                }

                labelAcelData.Invoke(new Action(() => { labelAcelData.Text = label; }));
            }
            catch (Exception)
            { }
        }
Esempio n. 4
0
        /// <summary>
        /// Update the EXG data label
        /// </summary>
        private void UpdateExgDataLabel(ProcessorCurrentStateReportEventArgs e)
        {
            try
            {
                string label = "Not receiving data from the sensor.";
                if (e.ValidData)
                {
                    label  = "";
                    label += $"Time stamp: {e.CurrentSample.TimeStamp.ToString("N6")}\n";
                    label += $"Observation time: {DateTimeOffset.FromUnixTimeMilliseconds((long)(e.CurrentSample.TimeStamp * 1000.0)).ToLocalTime().ToString("HH:mm:ss.fff")}\n\n";
                    label += $"     {string.Format("{0,14}", "Read mV")}{string.Format("{0,14}", "Dev uV")}{string.Format("{0,14}", "Noise uV")}\n";
                    label += $"     {string.Format("{0,14}", "-------")}{string.Format("{0,14}", "-------")}{string.Format("{0,14}", "-------")}\n";

                    for (int i = 0; i < e.CurrentSample.NumberExgChannels; i++)
                    {
                        label += $"Exg {i:D2}: {(e.CurrentSample.GetExgDataForChannel(i) / 1000.0),11:N3}{e.CurrentDeviation.GetExgDataForChannel(i),14:N3}{e.CurrentDevMedian.GetExgDataForChannel(i),14:N3}\n";
                    }
                }

                labelExgData.Invoke(new Action(() => { labelExgData.Text = label; }));
            }
            catch (Exception)
            { }
        }