IO板卡系统优化
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Common.Attributes;
|
||||
using DeviceCommand.Base;
|
||||
using Model.Models;
|
||||
using NModbus;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -13,10 +14,10 @@ namespace DeviceCommand.Device
|
||||
[ADPCommand]
|
||||
public class IOBoard : ModbusTcp
|
||||
{
|
||||
//只有两个,八台产品公用两两分组各用一个
|
||||
public IOBoard(string Ip地址, int 端口, int 发送超时, int 接收超时)
|
||||
|
||||
public IOBoard(TcpConfig config) : base(config)
|
||||
{
|
||||
ConfigureDevice(Ip地址, 端口, 发送超时, 接收超时);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user