From 5e3a763d047ecfef28aca389ad7cbba6403d34a5 Mon Sep 17 00:00:00 2001 From: lichuanyang <1176537920@qq.com> Date: Fri, 20 Dec 2024 16:33:26 +0800 Subject: [PATCH] =?UTF-8?q?BC-5120=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deviceAnalysis.cs | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/deviceAnalysis.cs b/deviceAnalysis.cs index 93aac82..deaa6a8 100644 --- a/deviceAnalysis.cs +++ b/deviceAnalysis.cs @@ -2986,12 +2986,8 @@ namespace FlyDockTool IPAddress ipAddress = IPAddress.Parse(tcp_ip); // IPAddress ipAddress = IPAddress.Any; //// 创建一个监听Socket - if (listener == null) - { - listener = new Socket(ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp); - listener.Bind(new IPEndPoint(ipAddress, int.Parse(tcp_port))); - listener.Listen(10000); - } + clientSocket = new Socket(ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp); + clientSocket.Connect(ipAddress, int.Parse(tcp_port)); _tcpResult.Change(0, 10);//开始tcp数据接收,10毫秒频率 } @@ -3204,7 +3200,16 @@ namespace FlyDockTool } if (apiOptions.CurrentDevice == "BC-5120")//BC-5120 { - _tResult.Change(5000, 5000);// 数据处理:延迟5秒开始 5秒计时 + if (tempData.Contains(@"OBR|1||Background|")) + { + tempData = string.Empty; + } + else + { + string tempData_temp = tempData; + tempData = string.Empty; + deviceAnalysisOption(tempData_temp); + } } if (apiOptions.CurrentDevice == "BS-460")//生化BS-460 { @@ -3256,7 +3261,9 @@ namespace FlyDockTool void tcpResultTick() { byte[] data = new byte[40048]; - if (apiOptions.CurrentDevice != "BC-5130")//如果设备是 apiOptions.CurrentDevice=== "BC-5130" 这个设备在 启动时就已经主动连上了 "BC-5130" 设备,这里就无需初始化连接 直接跳过 + //如果设备是BC-5130这类的,则表示这个设备在启动时就已经主动连上了。BC-5130设备,这里就无需初始化连接直接跳过 + List ConnectDevices = new List(new string[] { "BC-5130", "BC-5120" }); + if (!ConnectDevices.Contains(apiOptions.CurrentDevice)) { if (clientSocket == null) clientSocket = listener.Accept(); //一旦接受连接,创建一个客户端