using System; using System.Threading.Tasks; using Team.Communicate.EventArg; using Team.Communicate.Interfaces; namespace Team.Communicate.Client { /// /// 基础的协议连接类 /// public abstract class BaseConnector : BaseConnector { } /// /// 基础的协议连接类 /// public abstract class BaseConnector : IConnector { /// /// 标识Connector的连接关键字 /// public abstract string ConnectionToken { get; } /// /// 是否处于连接状态 /// public abstract bool IsConnected { get; } /// /// 连接PLC /// /// 是否连接成功 public abstract bool Connect(); /// /// 连接PLC,异步 /// /// 是否连接成功 public abstract Task ConnectAsync(); /// /// 断开PLC /// /// 是否断开成功 public abstract bool Disconnect(); /// /// 无返回发送数据 /// /// 需要发送的数据 /// 是否发送成功 public abstract bool SendMsgWithoutReturn(TParamIn message); /// /// 无返回发送数据 /// /// 需要发送的数据 /// 是否发送成功 public abstract Task SendMsgWithoutReturnAsync(TParamIn message); /// /// 带返回发送数据 /// /// 需要发送的数据 /// 是否发送成功 public abstract TParamOut SendMsg(TParamIn message); /// /// 带返回发送数据 /// /// 需要发送的数据 /// 是否发送成功 public abstract Task SendMsgAsync(TParamIn message); public abstract event EventHandler SendEventHandler; public abstract event EventHandler> SendExceptionEventHandler; public abstract event EventHandler ConnectedEventHandler; public abstract event EventHandler> ConnectExceptionEventHandler; public abstract event EventHandler ReceiveEventHandler; public abstract event EventHandler> ReceiveExceptionEventHandler; public abstract event EventHandler DisConnectEvent; public abstract event EventHandler> DisConnectFailEvent; } }