/// <summary>
        /// Constructor: Creates the Form, sets the inputsensors and contains the setup of both charts
        /// </summary>
        /// <param name="hrSensor">The hart rate input that is set manualy or through a sensor</param>
        /// <param name="gsrSensor">The GSR input that is set manualy or through a sensor</param>
        public SensorViewController(HRSensor hrSensor, GSRSensor gsrSensor)
        {
            View = new SensorView(this);
            startTime = DateTime.Now;

            View.formClosingHandler += new SensorView.EventHandler(formClosing);
            View.sensorViewFormShownHandler += new SensorView.EventHandler(shown);

            this.hrSensor = hrSensor;
            this.gsrSensor = gsrSensor;
        }
Esempio n. 2
0
 /// <summary>
 /// Reloads the HRSensor with another one. Do not call HRSensor.startMeasuring() on the
 /// passed sensor as this method will already do this.
 /// </summary>
 /// <param name="hrSensor">The HRSensor to replace with</param>
 public void reloadWithHRSensor(HRSensor hrSensor)
 {
     this.hrSensor.stopMeasuring();
     this.hrSensor = hrSensor;
     this.hrSensor.startMeasuring();
 }
        /// <summary>
        /// Action when the heart rate sensor type is being changed
        /// </summary>
        public void HRSensorTypeChanged(object sender, EventArgs e)
        {
            RadioButton radioButton = (RadioButton)sender;

            if (radioButton.Checked)
            {
                if (radioButton == View.hrSensorTypeRadioButton1)
                {
                    HRSensor hrSensor = new HRSensor(HRSensor.Type.ManualInput);
                    hrSensor.sensorValue = View.hrTrackBar.Value;
                    fuzzyModel.reloadWithHRSensor(hrSensor);

                    View.hrTrackBar.Enabled = true;
                    hrMinusButton.Enabled = true;
                    hrPlusButton.Enabled = true;
                    View.HRSensorComboBox.Enabled = false;
                }
                else if (radioButton == View.hrSensorTypeRadioButton2)
                {
                    HRSensor hrSensor = new HRSensor(HRSensor.Type.BluetoothZephyr);
                    if (View.HRSensorComboBox.SelectedIndex != 0)
                    {
                        hrSensor.serialPortName = View.HRSensorComboBox.Text;
                    }
                    fuzzyModel.reloadWithHRSensor(hrSensor);

                    View.hrTrackBar.Enabled = false;
                    hrMinusButton.Enabled = false;
                    hrPlusButton.Enabled = false;
                    View.HRSensorComboBox.Enabled = true;
                }
            }
        }
 /// <summary>
 /// Action method for when the value for the dropdown box with available
 /// serialports for the bluetooth heart rate monitor is changed.
 /// </summary>
 public void HRSensorComboBoxChanged()
 {
     // Index 0 contains the filler text
     if (View.HRSensorComboBox.SelectedIndex != 0)
     {
         HRSensor hrSensor = new HRSensor(HRSensor.Type.BluetoothZephyr);
         hrSensor.serialPortName = View.HRSensorComboBox.Text;
         fuzzyModel.reloadWithHRSensor(hrSensor); //replace the sensor in FuzzyModel
     }
 }