using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; namespace GeneralGommunication { /// /// 通用通讯接口 /// general communication /// public interface IGeneralComm : INotifyPropertyChanged { /// /// IP 地址 and 端口号 /// string Addr { get; set; } /// /// 是否异常 /// bool IsError { get; } /// /// 异常信息 /// string ErrMsg { get; } /// /// 连接成功 /// bool IsConnected { get; } /// /// 运行中 /// bool IsRunning { get; } /// /// 开始 /// void Start(); /// /// 结束 /// void Stop(); /// /// 发送数据 /// /// void Write(IEnumerable buf); /// /// 接收数据 /// event IGeneralCommDataReceivedHandler DataReceived; /// /// 清空输入缓存 /// void DiscardInBuffer(); } public delegate void IGeneralCommDataReceivedHandler(IGeneralComm sender, byte[] buf); }