Exemplo n.º 1
0
 public WriteResult WriteSingleRegister(ushort value, ushort index, Database database)
 {
     if (database.UpdateHoldingRegister(index, value))
     {
         return(WriteResult.CreateSuccess());
     }
     else
     {
         return(WriteResult.CreateException(rodbus.Exception.IllegalDataAddress));
     }
 }
Exemplo n.º 2
0
        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());
        }