IO板卡系统优化

This commit is contained in:
hsc
2026-07-13 15:10:49 +08:00
parent b6b767cf0a
commit 3318c720b7
9 changed files with 95 additions and 13 deletions

View File

@@ -1,4 +1,5 @@
using NModbus;
using Model.Models;
using NModbus;
using System;
using System.Net;
using System.Net.Sockets;
@@ -19,7 +20,11 @@ namespace DeviceCommand.Base
public bool IsConnected => _tcpClient?.Connected ?? false;
protected readonly SemaphoreSlim _commLock = new(1, 1);
public ModbusTcp(TcpConfig config) : this()
{
if (config == null) return;
ConfigureDevice(config.IPAddress, config.Port, config.SendTimeout, config.ReceiveTimeout);
}
public ModbusTcp()
{
_tcpClient = new TcpClient();