/// <summary> /// Sets the PLX serial port, and begins reading data. /// </summary> public void SetPlxSerialPort(string portName) { if (portName == NullSerialPortName) { Trace.WriteLine("ExternalSensors.SetPlxSerialPort: releasing port."); if (this.plxSensors != null) { this.plxSensors.Close(); this.plxSensors = null; } } else { Trace.WriteLine("ExternalSensors.SetPlxSerialPort: creating with port: " + portName); this.plxSensors = PlxSensors.GetInstance(portName); } }
/// <summary> /// Add columns for external sensors. /// </summary> private void StoreExternalSensorValues() { PlxSensors plxSensors = ExternalSensors.GetInstance().PlxSensors; if (plxSensors == null) { return; } foreach (LogColumn column in this.logEventArgs.Row.Columns) { PlxParameter parameter = column.Parameter as PlxParameter; if (parameter != null) { PlxSensorId id = (PlxSensorId)parameter.SensorId; double rawValue = plxSensors.GetValue(id, PlxSensorUnits.Raw); InternalLogProfile.ConvertAndStoreValue(column.Parameter, rawValue, column.Conversion, column); } } }
public static PlxSensors GetInstance(string port) { PlxSensors sensors = new PlxSensors(port); return(sensors); }