private bool OpenSerialPort() { if (Output == "SerialPortMock") { m_serialport = MockSerialPort.Instance; } else { m_serialport = (ISerialPort) new CSerialPort(); } bool opened = m_serialport.Open(Output, Rate); if (m_serialport.HasError()) { Util.LogError($"{Name}: {m_serialport.GetError()}"); if (opened) { Util.Log($"{Name}: {Output} had a non fatal error, it might still work, continuing"); } } m_serialport.PrintToStdOut(m_debug); //print serial data to stdout when debug mode is on return(opened); }