Exemplo n.º 1
0
        internal int ResponseBytesToRead(byte[] frameStart)
        {
            byte functionCode = frameStart[1];

            if (functionCode > Modbus.ExceptionOffset)
            {
                return(1);
            }

            IModbusFunctionService service = ModbusFactory.GetFunctionServiceOrThrow(functionCode);

            return(service.GetRtuResponseBytesToRead(frameStart));
        }
Exemplo n.º 2
0
        internal int ResponseBytesToRead(byte[] frameStart)
        {
            byte functionCode = frameStart[1];

            if (functionCode > Modbus.ExceptionOffset)
            {
                return(1);
            }

            IModbusFunctionService service = _modbusFactory.GetFunctionService(functionCode);

            if (service == null)
            {
                string msg = $"Function code {functionCode} not supported.";
                Logger.Warning(msg);
                throw new NotImplementedException(msg);
            }

            return(service.GetRtuResponseBytesToRead(frameStart));
        }