Esempio n. 1
0
 public int WriteUInts(DeviceAddress deviceAddress, uint[] datas)
 {
     lock (_async)
     {
         _handler = _handler++ >= 65535 ? 0 : _handler;
         var source = createWriteHeader(deviceAddress, _handler, UnsafeNetConvert.UIntsToBytes(datas, ByteOrder.BigEndian));
         return(writedata(deviceAddress, source));
     }
 }
Esempio n. 2
0
        public int WriteUInts(DeviceAddress deviceAddress, uint[] datas)
        {
            ushort startAddress;

            if (Function.EnableWriteRegister(deviceAddress.Address, out startAddress))
            {
                var valueBytes = (deviceAddress.ByteOrder == ByteOrder.BigEndian) ? UnsafeNetConvert.UIntsToBytes(datas, deviceAddress.ByteOrder)
                    : UnsafeNetConvert.BytesPerversion(UnsafeNetConvert.UIntsToBytes(datas, deviceAddress.ByteOrder));
                byte[] sendBytes = getWriteMulRegisterHeader((byte)deviceAddress.SalveId, startAddress, valueBytes);
                return(writeBytes(sendBytes));
            }
            else
            {
                return(-1);
            }
        }