diff --git a/Modbus.Net/Modbus.Net.Core/Modbus.Net.Core.csproj b/Modbus.Net/Modbus.Net.Core/Modbus.Net.Core.csproj index 37eba7e..eec5ef8 100644 --- a/Modbus.Net/Modbus.Net.Core/Modbus.Net.Core.csproj +++ b/Modbus.Net/Modbus.Net.Core/Modbus.Net.Core.csproj @@ -5,7 +5,7 @@ Modbus.Net.Core Modbus.Net Modbus.Net.Core - 1.3.8-beta2 + 1.3.8-beta3 Modbus.Net Chris L.(Luo Sheng) Hangzhou Delian IoT Science Technology Co.,Ltd. @@ -49,6 +49,7 @@ + diff --git a/Modbus.Net/Modbus.Net/Modbus.Net.csproj b/Modbus.Net/Modbus.Net/Modbus.Net.csproj index ffd5b50..e24f0ac 100644 --- a/Modbus.Net/Modbus.Net/Modbus.Net.csproj +++ b/Modbus.Net/Modbus.Net/Modbus.Net.csproj @@ -5,7 +5,7 @@ Modbus.Net Modbus.Net Modbus.Net - 1.3.8-beta1 + 1.3.8-beta2 Modbus.Net Chris L.(Luo Sheng) Hangzhou Delian IoT Science Technology Co.,Ltd. @@ -48,6 +48,7 @@ + diff --git a/Modbus.Net/src/Base.Common/BaseConnector.cs b/Modbus.Net/src/Base.Common/BaseConnector.cs index 1232ac8..1b2df7b 100644 --- a/Modbus.Net/src/Base.Common/BaseConnector.cs +++ b/Modbus.Net/src/Base.Common/BaseConnector.cs @@ -12,7 +12,7 @@ namespace Modbus.Net /// /// 基础的协议连接类 /// - public abstract class BaseConnector + public abstract class BaseConnector : IConnector { /// /// 标识Connector的连接关键字 diff --git a/Modbus.Net/src/Base.Common/IConnector.cs b/Modbus.Net/src/Base.Common/IConnector.cs new file mode 100644 index 0000000..0a73e86 --- /dev/null +++ b/Modbus.Net/src/Base.Common/IConnector.cs @@ -0,0 +1,66 @@ +using System.Threading.Tasks; + +namespace Modbus.Net +{ + /// + /// Эӽӿ + /// + public interface IConnector + { + /// + /// ʶConnectorӹؼ + /// + string ConnectionToken { get; } + + /// + /// Ƿ״̬ + /// + bool IsConnected { get; } + + /// + /// PLC + /// + /// Ƿӳɹ + bool Connect(); + + /// + /// PLC첽 + /// + /// Ƿӳɹ + Task ConnectAsync(); + + /// + /// ϿPLC + /// + /// ǷϿɹ + bool Disconnect(); + + /// + /// ޷ط + /// + /// Ҫ͵ + /// Ƿͳɹ + bool SendMsgWithoutReturn(TParamIn message); + + /// + /// ޷ط + /// + /// Ҫ͵ + /// Ƿͳɹ + Task SendMsgWithoutReturnAsync(TParamIn message); + + /// + /// ط + /// + /// Ҫ͵ + /// Ƿͳɹ + TParamOut SendMsg(TParamIn message); + + /// + /// ط + /// + /// Ҫ͵ + /// Ƿͳɹ + Task SendMsgAsync(TParamIn message); + } +} \ No newline at end of file diff --git a/Modbus.Net/src/Base.Common/ProtocalLinker.cs b/Modbus.Net/src/Base.Common/ProtocalLinker.cs index 9c9716c..8381e18 100644 --- a/Modbus.Net/src/Base.Common/ProtocalLinker.cs +++ b/Modbus.Net/src/Base.Common/ProtocalLinker.cs @@ -76,7 +76,7 @@ namespace Modbus.Net /// /// 传输连接器 /// - protected BaseConnector BaseConnector; + protected IConnector BaseConnector; /// /// 连接设备