public WriteResult WriteSingleRegister(ushort value, ushort index, Database database) { if (database.UpdateHoldingRegister(index, value)) { return(WriteResult.CreateSuccess()); } else { return(WriteResult.CreateException(rodbus.Exception.IllegalDataAddress)); } }
public WriteResult WriteMultipleRegisters(ushort start, ICollection <Register> it, Database database) { foreach (var bit in it) { if (!database.UpdateHoldingRegister(bit.Index, bit.Value)) { return(WriteResult.CreateException(rodbus.Exception.IllegalDataAddress)); } } return(WriteResult.CreateSuccess()); }