public EnIPClass(EnIPRemoteDevice RemoteDevice, ushort Id, Type DecoderClass = null) { this.Id = Id; this.RemoteDevice = RemoteDevice; Status = EnIPNetworkStatus.OffLine; if (DecoderClass != null) { this.DecoderClass = DecoderClass; if (!DecoderClass.IsSubclassOf(typeof(CIPObject))) { throw new ArgumentException("Wrong Decoder class, not subclass of CIPObject", "DecoderClass"); } } }
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; }
void on_MessageReceived(object sender, byte[] packet, Encapsulation_Packet EncapPacket, int offset, int msg_length, System.Net.IPEndPoint remote_address) { // ListIdentity response if ((EncapPacket.Command == EncapsulationCommands.ListIdentity) && (EncapPacket.Length != 0) && EncapPacket.IsOK) { if (DeviceArrival != null) { int NbDevices = BitConverter.ToUInt16(packet, offset); offset += 2; for (int i = 0; i < NbDevices; i++) { EnIPRemoteDevice device = new EnIPRemoteDevice(remote_address, TcpTimeout, packet, ref offset); DeviceArrival(device); } } } }
// Certainly here if SocketAddress is fullfil it could be the // value to test // FIXME if you know. public bool Equals(EnIPRemoteDevice other) { return(ep.Equals(other.ep)); }