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

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