private bool CheckIfHeater(ISerialPort port) { if (!port.IsOpen) { throw new ArgumentException("The serial port has to be open to check if the heater is connected to it.", "port"); } HeaterCommand cmd = HeaterCommand.build(HeaterCommand.commandType.MagicByte); byte[] buff; try { port.Write(cmd.toByte()); buff = port.ReadBytes(1); } catch (TimeoutException) { return false; } return buff[0] == magicResponse; }