public void GetDeviceInfo_ThreadPoolCallback(Object threadContext) { this.mDoneEvent.Reset(); this.mConnected = false; this.mNonCompatible = false; this.mDevice = null; try { HS1XX mDeviceManager = new HS1XX(this.mIP, mConnectionTimeOut, mSendTimeOut, mReceiveTimeOut); this.mDevice = mDeviceManager.GetDeviceInfo(); this.mConnected = true; this.mNonCompatible = false; } catch (Exception ex) { this.mNonCompatible = (ex.GetType() == typeof(NonCompatibleDeviceException)); this.mConnected = (ex.GetType() != typeof(ConnectionErrorException));; this.mDevice = null; } finally { this.mDoneEvent.Set(); } }
public HS1XX(HS100Config cfg, out bool isOnLine, int pConnectionTimeOut = 1000, int pSendCommandTimeOut = 1000, int pReceiveCommandTimeOut = 1000) { this.mIP = IPAddress.Parse(cfg.IpAddr); isOnLine = HS1XX.PingDevice(this.mIP); this.DeviceId = cfg.DeviceId; this.mConnectionTimeOut = pConnectionTimeOut; this.mSendCommandTimeOut = pSendCommandTimeOut; this.mReceiveCommandTimeOut = pReceiveCommandTimeOut; }