예제 #1
0
        public MainForm()
        {
            InitializeComponent();
            InitializeWaveOut();
            double lat, lng;

            GetLatLong(out lat, out lng);
            if (lat == -1 && lng == -1)
            {
                gMap.Enabled = false;
                return;
            }
            deviceGeoLocation = new PointLatLng(lat, lng);
            SqlServerTypes.Utilities.LoadNativeAssemblies(AppDomain.CurrentDomain.BaseDirectory);
            dbUpdater = new DBUpdater(deviceGeoLocation);
            InitializeGMap();
            recording     = new Recording.Recording(4);
            timeAveraging = new Averaging.TimeAveraging(lblLavgValue, lblTWAValue, lblDoseValue);
            comboBoxTimeWeight.SelectedIndex = 0;
            recording.OnDataAvaliable       += UpdateTimeDomain;
            recording.OnDataAvaliable       += UpdateVUMeter;
            recording.OnDataAvaliable       += timeAveraging.GatherNewData;

            CalibrationParams = new CalibrationParams
            {
                Sample = (short)Properties.Settings.Default["calibration_sample"],
                Noise  = (double)Properties.Settings.Default["calibration_noise"]
            };

            freqDomain.ChartAreas[0].AxisX.ScaleView.Zoomable       = true;
            freqDomain.ChartAreas[0].CursorX.AutoScroll             = true;
            freqDomain.ChartAreas[0].CursorX.IsUserSelectionEnabled = true;

            octaveFreqDomain.ChartAreas[0].AxisX.ScaleView.Zoomable       = true;
            octaveFreqDomain.ChartAreas[0].CursorX.AutoScroll             = true;
            octaveFreqDomain.ChartAreas[0].CursorX.IsUserSelectionEnabled = true;

            octavesVisualisation.ChartAreas[0].AxisX.ScaleView.Zoomable       = true;
            octavesVisualisation.ChartAreas[0].CursorX.AutoScroll             = true;
            octavesVisualisation.ChartAreas[0].CursorX.IsUserSelectionEnabled = true;

            timeDomain.ChartAreas[0].AxisY.Maximum     = short.MaxValue;
            timeDomain.ChartAreas[0].AxisY.Minimum     = short.MinValue;
            sensorReadings.ChartAreas[0].AxisY.Maximum = 140;
            sensorReadings.ChartAreas[0].AxisY.Minimum = 0;

            AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
            recording.IsRecording = true;
        }
예제 #2
0
        public CalibrationForm(int bits, short sample, double noise, Recording.Recording recording)
        {
            InitializeComponent();
            InitializeWaveOut();

            this.bits      = bits;
            this.recording = recording;

            switch (bits)
            {
            case 16:
                textBoxMaxAmp.Text = short.MaxValue.ToString();
                break;

            default:
                throw new NotSupportedException();
            }

            textBoxAmp.Text     = sample.ToString();
            textBoxDecibel.Text = noise.ToString();
            rmsSamples          = new List <double>();
        }