using System; using System.Threading.Tasks; using Team.Communicate.EventArg; namespace Team.Communicate.Interfaces { 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); /// /// 发送成功事件 /// event EventHandler SendEventHandler; /// /// 发送失败事件 /// event EventHandler> SendExceptionEventHandler; /// /// 连接成功事件 /// event EventHandler ConnectedEventHandler; /// /// 连接失败事件 /// event EventHandler> ConnectExceptionEventHandler; /// /// 接收成功事件 /// event EventHandler ReceiveEventHandler; /// /// 接收失败事件 /// event EventHandler> ReceiveExceptionEventHandler; event EventHandler DisConnectEvent; event EventHandler> DisConnectFailEvent; } }