IConnectable.cs 620 B

123456789101112131415161718192021222324252627282930
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace MECF.Framework.Common.Communications
  7. {
  8. public interface IConnectable
  9. {
  10. //连接上之后的通讯错误
  11. event Action<string> OnCommunicationError;
  12. event Action<string> OnAsciiDataReceived;
  13. event Action<byte[]> OnBinaryDataReceived;
  14. bool Connect(out string reason);
  15. bool Disconnect(out string reason);
  16. bool CheckIsConnected();
  17. bool SendBinaryData(byte[] data);
  18. bool SendAsciiData(string data);
  19. }
  20. }