From f0e894f9d5506fd40e8768dfeeedd54df19a6231 Mon Sep 17 00:00:00 2001 From: zqm Date: Wed, 29 Oct 2025 17:05:34 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4DeviceManager=E4=B8=AD?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E7=BC=96=E8=AF=91=E9=94=99=E8=AF=AF=E7=9A=84?= =?UTF-8?q?=E5=8F=AA=E8=AF=BB=E5=AD=97=E6=AE=B5=EF=BC=8C=E4=BF=9D=E7=95=99?= =?UTF-8?q?=5FlockObject=E5=92=8CdeviceInstances=E7=9A=84readonly=E5=85=B3?= =?UTF-8?q?=E9=94=AE=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CS/Framework4.0/Toprie/Toprie/DeviceManager.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Windows/CS/Framework4.0/Toprie/Toprie/DeviceManager.cs b/Windows/CS/Framework4.0/Toprie/Toprie/DeviceManager.cs index d51ce5f..43da737 100644 --- a/Windows/CS/Framework4.0/Toprie/Toprie/DeviceManager.cs +++ b/Windows/CS/Framework4.0/Toprie/Toprie/DeviceManager.cs @@ -169,9 +169,9 @@ namespace JoyD.Windows.CS.Toprie // 当前设备ID private int _currentDeviceId = -1; // 默认设备IP - private readonly string _deviceIp = "192.168.100.2"; + private string _deviceIp = "192.168.100.2"; // 设备端口 - private readonly int _devicePort = 8080; + private int _devicePort = 8080; // 设备连接状态 private ConnectionStatus _connectionStatus = ConnectionStatus.Disconnected; // 是否已初始化 @@ -179,7 +179,7 @@ namespace JoyD.Windows.CS.Toprie // 是否已释放 private bool _isDisposed = false; // 图像模式 - private readonly ImageMode _currentImageMode = ImageMode.Infrared; + private ImageMode _currentImageMode = ImageMode.Infrared; // 当前色彩模式 private PaletteType _currentPaletteType = PaletteType.WhiteHot; // 当前视频模式 @@ -195,15 +195,15 @@ namespace JoyD.Windows.CS.Toprie // 最大重连尝试次数 public static int MaxReconnectAttempts = 5; // 连接检查定时器 - private readonly System.Threading.Timer _connectionCheckTimer; + private System.Threading.Timer _connectionCheckTimer; // 心跳定时器 - private readonly System.Threading.Timer _heartbeatTimer; + private System.Threading.Timer _heartbeatTimer; // 连接超时时间(毫秒) private const int ConnectionTimeout = 5000; // 连接检查间隔(毫秒) private const int ConnectionCheckInterval = 5000; // 心跳间隔(毫秒) - private readonly int _heartbeatInterval = 5000; + private int _heartbeatInterval = 5000; // 最后接收数据时间戳 private DateTime _lastDataReceivedTime = DateTime.MinValue; // 数据接收超时时间(毫秒) @@ -212,7 +212,7 @@ namespace JoyD.Windows.CS.Toprie // 该变量已在文件上方定义,删除重复实现 // 停止请求事件 - private readonly ManualResetEvent _stopRequested = new ManualResetEvent(false); + private ManualResetEvent _stopRequested = new ManualResetEvent(false); // 缓冲区 private byte[] _imageBuffer = new byte[4096]; // 图像数据累积缓冲区