private void Host() { bool isHostConnected = false; this.abortHost = false; while (!isHostConnected) { if (this.abortHost) { this.StopHostTimer(); this.ReloadCheckError(-1002); return; } int status = UsbIPUtil.isHostConnected(); if (status == -1001) { this.ReloadCheckError(status); return; } if (status != -1002 && status == 0) { this.HostConnected(); this.ReConnectControl(); return; } Thread.Sleep(5000); } }
private void ReConnectControl() { Thread.Sleep(5000); if (!UsbIPUtil.isCableLinked()) { this.ReloadCheckError(-3000); return; } int status = UsbIPUtil.ConnectControl(); if (status == 0) { this.ReloadCheckError(0); return; } if (status != -2000) { if (status == -1000) { this.ReloadCheckError(UsbIPUtil.isUSBConnected()); } return; } if (UsbIPUtil.RebootService()) { this.ReConnectControl(); return; } this.ReloadCheckError(-2000); }
private void ConnectControl() { if (!UsbIPUtil.isCableLinked()) { this.CheckControlError(-3000); return; } int status = UsbIPUtil.ForceConnectControl(); if (status == 0) { this.CheckControlError(0); return; } if (status != -2000) { if (status == -1000) { this.CheckControlError(UsbIPUtil.isUSBConnected()); } return; } if (UsbIPUtil.RebootService()) { this.ConnectControl(); return; } this.CheckControlError(-2000); }
private static void StartBackgroundCheckControlThreadStart() { int status = 0; while (LoopCheckModel.isLinked) { status = UsbIPUtil.isUsbLinked(); if (status == 0) { LoopCheckModel.isLinked = true; } else if (status == -1000 || status == -2000) { LoopCheckModel.isLinked = false; break; } Thread.Sleep(5000); } if (status == -1000) { if (ChannelUtil.pingRouterConnect()) { if (UsbIPUtil.isHostLinked()) { if (UsbIPUtil.isCableLinked()) { status = -1000; } else { status = -3000; } } else { status = -1002; } } else { status = -1001; } } else if (status == -2000) { UsbIPUtil.RebootService(); status = -1000; } AnimationModel.ConnectAnimateionPause(); LoopCheckModel.ControlInterrupt(status); }
private void checkDriver() { if (UsbIPUtil.isDriverInstalled()) { if (!UsbIPUtil.isServiceOk()) { BroadcastModel.instance.send(92); Util.showGrayBackground(); new ServerExceptionDialog().ShowDialog(this); return; } } else { BroadcastModel.instance.send(91); Util.showGrayBackground(); new DriverDialog().ShowDialog(this); } }