public ComPortController(ControlSystem cs) { myComPorts = cs.ComPorts; for (uint i = 1; i <= 2; i++) { myComPorts[i].SerialDataReceived += new ComPortDataReceivedEvent(ControlSystem_SerialDataReceived); if (myComPorts[i].Register() != eDeviceRegistrationUnRegistrationResponse.Success) { ErrorLog.Error("Error registering comport {0}", myComPorts[i].DeviceRegistrationFailureReason); } else { myComPorts[i].SetComPortSpec(ComPort.eComBaudRates.ComspecBaudRate19200, ComPort.eComDataBits.ComspecDataBits8, ComPort.eComParityType.ComspecParityNone, ComPort.eComStopBits.ComspecStopBits1, ComPort.eComProtocolType.ComspecProtocolRS232, ComPort.eComHardwareHandshakeType.ComspecHardwareHandshakeNone, ComPort.eComSoftwareHandshakeType.ComspecSoftwareHandshakeNone, false); } } }