package com.ycl.api.YS.discovery; import com.ycl.api.YS.NetDemo; import com.ycl.api.YS.util.Common; import javax.swing.*; import java.util.ArrayList; import java.util.List; import java.util.Vector; import java.util.stream.Collectors; /** * * @introduction discover equipment * @description Support IPC/NVR/VMS */ public class Discovery { /** * * @introduction discover equipment * @description Calling the interface of NETDEV_SetDiscoveryCallBack */ public static void discoverEquipment() { NetDemo.DiscoveryTableModel.setRowCount(0); String strBeginIP = NetDemo.jTextFieldStartIP.getText(); String strEndIP = NetDemo.jTextFieldEndIP.getText(); if(strBeginIP.isEmpty() && strEndIP.isEmpty()) { NetDemo.netdevsdk.NETDEV_SetDiscoveryCallBack(NetDemo.cbDiscoveryCallBack, null); NetDemo.netdevsdk.NETDEV_Discovery("0.0.0.0", "0.0.0.0"); NetDemo.jButtonCheckSameDevice.doClick(); } /* Determine IP address format */ else if(Common.isIP(strBeginIP) && Common.isIP(strEndIP)) { NetDemo.netdevsdk.NETDEV_SetDiscoveryCallBack(NetDemo.cbDiscoveryCallBack, null); boolean bRet = NetDemo.netdevsdk.NETDEV_Discovery(strBeginIP, strEndIP); if(!bRet) { JOptionPane.showMessageDialog(null, "Discovery failed. Please check the entered IP address."); }else { NetDemo.jButtonCheckSameDevice.doClick(); } }else { JOptionPane.showMessageDialog(null, "Please enter the correct start and end addresses, or do not enter."); } } /** * * @introduction Check the same device * @description */ public static void checkSameDevice() { List list=new ArrayList(); Vector deviceDetail=null; /* Record the parameters of the equipment */ for(int s=0;s