protected override void InitializeUnique(byte[] frame)
        {
            if (frame.Length < MinimumFrameSize + frame[10])
            {
                throw new FormatException("Message frame does not contain enough bytes.");
            }

            byte[] readFrame  = frame.Slice(2, 4).ToArray();
            byte[] writeFrame = frame.Slice(6, frame.Length - 6).ToArray();
            byte[] header     = { SlaveAddress, FunctionCode };

            _readRequest  = ModbusMessageFactory.CreateModbusMessage <ReadHoldingInputRegistersRequest>(header.Concat(readFrame).ToArray());
            _writeRequest = ModbusMessageFactory.CreateModbusMessage <WriteMultipleRegistersRequest>(header.Concat(writeFrame).ToArray());
        }
 public ReadWriteMultipleRegistersRequest(byte slaveAddress, ushort startReadAddress, ushort numberOfPointsToRead, ushort startWriteAddress, RegisterCollection writeData)
     : base(slaveAddress, Modbus.ReadWriteMultipleRegisters)
 {
     _readRequest  = new ReadHoldingInputRegistersRequest(Modbus.ReadHoldingRegisters, slaveAddress, startReadAddress, numberOfPointsToRead);
     _writeRequest = new WriteMultipleRegistersRequest(slaveAddress, startWriteAddress, writeData);
 }