コード例 #1
0
 public void CopyData(EnIPRemoteDevice newset)
 {
     DataLength           = newset.DataLength;
     EncapsulationVersion = newset.EncapsulationVersion;
     SocketAddress        = newset.SocketAddress;
     VendorId             = newset.VendorId;
     DeviceType           = newset.DeviceType;
     ProductCode          = newset.ProductCode;
     _Revision            = newset._Revision;
     Status       = newset.Status;
     SerialNumber = newset.SerialNumber;
     ProductName  = newset.ProductName;
     State        = newset.State;
 }
コード例 #2
0
        private void FromListIdentityResponse(byte[] DataArray, ref int Offset)
        {
            Offset += 2; // 0x000C

            DataLength = BitConverter.ToUInt16(DataArray, Offset);
            Offset    += 2;

            EncapsulationVersion = BitConverter.ToUInt16(DataArray, Offset);
            Offset += 2;

            // Maybe it should be used in place of the ep
            // if a host embbed more than one device, sure it sends different tcp/udp port ?
            // FIXME if you know.
            SocketAddress = new EnIPSocketAddress(DataArray, ref Offset);

            VendorId = BitConverter.ToUInt16(DataArray, Offset);
            Offset  += 2;

            DeviceType = BitConverter.ToUInt16(DataArray, Offset);
            Offset    += 2;

            ProductCode = BitConverter.ToUInt16(DataArray, Offset);
            Offset     += 2;

            _Revision[0] = DataArray[Offset];
            Offset++;

            _Revision[1] = DataArray[Offset];
            Offset++;

            Status  = BitConverter.ToInt16(DataArray, Offset);
            Offset += 2;

            SerialNumber = BitConverter.ToUInt32(DataArray, Offset);
            Offset      += 4;

            int strSize = DataArray[Offset];

            Offset += 1;

            ProductName = System.Text.ASCIIEncoding.ASCII.GetString(DataArray, Offset, strSize);
            Offset     += strSize;

            State = (IdentityObjectState)DataArray[Offset];

            Offset += 1;
        }