public static IOamIeDataset GetOemDeviceIdDataSet(IEthernetDiscoverNode discoverNode) { byte[] buffer = new byte[32]; IOamMacAddress macAddress = GetMacAddress(discoverNode); return((discoverNode.Configuration.Network as IOamNetworkIe).Dataset.Create(2, 8, macAddress, buffer, true)); }
private static void SetIpAddress(this ICoreObject onlineCore, DiagServiceProvider DiagServiceProvider, int addressType, byte[] ipAddress, byte[] subnetMask, byte[] router) { IEthernetDiscoverNode ethernetDiscoverNode = DiagServiceProvider.PELifelistService.GetOamNode(onlineCore.GetParent().GetParent()) as IEthernetDiscoverNode; if (ethernetDiscoverNode == null) { return; } IPAddress ipAddress1 = new IPAddress(ethernetDiscoverNode.IpStationParams.LocalIpParam.InternetProtocolAddress.GetAddressBytes()); IPAddress ipAddress2 = new IPAddress(ethernetDiscoverNode.IpStationParams.LocalIpParam.LocalIpv4SubnetMask.GetAddressBytes()); IPAddress ipAddress3 = new IPAddress(ethernetDiscoverNode.IpStationParams.LocalIpParam.LocalDefaultRouter.GetAddressBytes()); if (ethernetDiscoverNode.Configuration.ProtocolType != OamProtocolType.Ethernet && ethernetDiscoverNode.Configuration.ProtocolType != OamProtocolType.InternetProtocol && ethernetDiscoverNode.Configuration.ProtocolType != OamProtocolType.Auto) { throw new OnlineException(4, 240); } if (ipAddress == null) { throw new OnlineException(7, 240); } IPAddress ipAddress4 = new IPAddress(ipAddress); ethernetDiscoverNode.IpStationParams.LocalIpParam.InternetProtocolAddress = ipAddress4; if (subnetMask != null) { ethernetDiscoverNode.IpStationParams.LocalIpParam.LocalIpv4SubnetMask = new IPAddress(subnetMask); } if (router != null) { if (1 == addressType) { IPAddress ipAddress5 = new IPAddress(router); ethernetDiscoverNode.IpStationParams.LocalIpParam.LocalDefaultRouter = ipAddress5; } else { ethernetDiscoverNode.IpStationParams.LocalIpParam.LocalDefaultRouter = ipAddress4; } } ethernetDiscoverNode.IpStationParams.LocalIpParam.IpActive = 1; ethernetDiscoverNode.IpStationParams.PermanentStorage = true; int errorCode = ethernetDiscoverNode.IpStationParams.Write(); if (errorCode != 0) { int serviceId = DiagServiceProvider.OnlineSessionDlc.OnlineAccess.ErrorHandler.ServiceId; ethernetDiscoverNode.IpStationParams.LocalIpParam.InternetProtocolAddress = ipAddress1; ethernetDiscoverNode.IpStationParams.LocalIpParam.LocalIpv4SubnetMask = ipAddress2; ethernetDiscoverNode.IpStationParams.LocalIpParam.LocalDefaultRouter = ipAddress3; ethernetDiscoverNode.IpStationParams.Write(); throw new OnlineException(errorCode, serviceId, string.Empty); } }
public static int GetProfinetDeviceId(this IEthernetDiscoverNode ethDiscoverNode) { int num = 0; if (ethDiscoverNode != null && ethDiscoverNode.DetailedTypeOfStation != 0) { num = ethDiscoverNode.DetailedTypeOfStationData[2] << 8 | ethDiscoverNode.DetailedTypeOfStationData[3]; } return(num); }
public static void GetStandardVendorAndDevice(IEthernetDiscoverNode discoverNode, out int vendor, out int deviceID) { vendor = discoverNode.DetailedTypeOfStationData[0] << 8 | discoverNode.DetailedTypeOfStationData[1]; deviceID = discoverNode.DetailedTypeOfStationData[2] << 8 | discoverNode.DetailedTypeOfStationData[3]; }
public static IOamMacAddress GetMacAddress(IEthernetDiscoverNode discoverNode) { return((discoverNode.Address as IEthernetDiscoverAddress).RemoteStationAddress); }
private static bool GetOemVendorAndDevice(IEthernetDiscoverNode discoverNode, out int vendor, out int deviceID) { return(ReadOemValues(GetOemDeviceIdDataSet(discoverNode), out vendor, out deviceID)); }