コード例 #1
0
ファイル: CoolitDevice.cs プロジェクト: mpyzhov/CMTest
        private IResponseParser GetParser(CoolitBridgeCommandCode commandCode)
        {
            IResponseParser result = null;

            if (commandCode == CoolitBridgeCommandCode.MODEL)
            {
                result = new ModelParser();
            }

            // TODO: [tm] add more parsers here

            if (result == null)
            {
                result = new NullParser();
            }

            return(result);
        }
コード例 #2
0
ファイル: CoolitDevice.cs プロジェクト: mpyzhov/CMTest
        private IResponseParser GetParser(CoolitModernCommandCode commandCode)
        {
            IResponseParser result = null;

            if (commandCode == CoolitModernCommandCode.FAN_CURRENT_RPM ||
                commandCode == CoolitModernCommandCode.TEMPERATURE_CURRENT_TEMPERATURE)
            {
                result = new WordParser();
            }

            if (commandCode == CoolitModernCommandCode.NUMBER_OF_FANS ||
                commandCode == CoolitModernCommandCode.NUMBER_OF_TEMPERATURES ||
                commandCode == CoolitModernCommandCode.NUMBER_OF_LEDS)
            {
                result = new ByteParser();
            }

            if (commandCode == CoolitModernCommandCode.FAN_MODE_GET)
            {
                result = new ByteParser();
            }

            if (commandCode == CoolitModernCommandCode.FW_VERSION)
            {
                result = new BCDFWVersionParser();
            }

            // TODO: [tm] add more parsers here

            if (result == null)
            {
                result = new NullParser();
            }

            return(result);
        }