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

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