示例#1
0
        public static async Task <List <IcpDeviceModel> > ScanIcpDevicesAsync(ComReader comReader)
        {
            await TaskEx.Run(() =>
            {
                List <IcpDeviceModel> icpDevices = new List <IcpDeviceModel>();
                for (int i = 1; i < 10; i++)
                {
                    if (!IcpDcom.PingDevice(i, comReader))
                    {
                        continue;
                    }

                    IcpDeviceModel devInfo = GetFullInfo(comReader, i);
                    icpDevices.Add(devInfo);
                }
                return(icpDevices);
            });

            return(null);
        }
示例#2
0
 private bool PingIcpDevice(int addr)
 {
     return(IcpDcom.PingDevice(addr, ComReader));
 }