public void FillEntryPointsList() { object selItem = lstListEntryPoints.SelectedItem; lstListEntryPoints.Items.Clear(); RegistryKey myConnectionKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Siemens\\SINEC\\LogNames"); if (myConnectionKey != null) { lstListEntryPoints.Items.AddRange(myConnectionKey.GetSubKeyNames()); } lstListEntryPoints.SelectedItem = selItem; EnumListItem tmp = (EnumListItem)lstLIBNODAVEConnectionType.SelectedItem; LibNodaveConnectionTypes connTp = 0; if (tmp != null) { connTp = (LibNodaveConnectionTypes)tmp.Value; } if (lstConnectionList.SelectedIndex >= 0 && connTp == LibNodaveConnectionTypes.Use_Step7_DLL) { EnableDestinationWithEntryPointType(); } }
/// <summary> /// Start an new scann of available and Accesible PLCs /// This method is non blocking, and returns immeadiatly. /// </summary> /// <param name="ConnectionType"></param> public void BeginScan(LibNodaveConnectionTypes ConnectionType) { if (_Scanner.isRunning) { throw new InvalidOperationException("An Scan is still running"); } if (!(ConnectionType == LibNodaveConnectionTypes.ISO_over_TCP) & !(ConnectionType == LibNodaveConnectionTypes.ISO_over_TCP_CP_243)) { throw new NotImplementedException("Only ISO_over_TCP connections are available at the moment"); } List <System.Net.IPEndPoint> AdressList = new List <System.Net.IPEndPoint>(); //Build Adress List to Check foreach (IPAddress IP in GetLocalIPAdressesV4()) { string BaseIP = IP.ToString().Remove(IP.ToString().LastIndexOf(".")); for (int i = 1; i <= 255; i++) { AdressList.Add(new System.Net.IPEndPoint(System.Net.IPAddress.Parse(BaseIP + "." + i), 102)); } } lock (_DiscoveredPLCs) { _DiscoveredPLCs.Clear(); } //Search Adresses _Scanner.BeginScan(AdressList); }
public ReadOnlyCollection <FoundPlc> Scan(LibNodaveConnectionTypes ConnectionType) { BeginScan(ConnectionType); EndScan(); return(DiscoveredPLCs); }