INetMessage.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. namespace TFT_MelsecMcNet
  2. {
  3. /// <summary>
  4. /// 本系统的消息类,包含了各种解析规则,数据信息提取规则
  5. /// </summary>
  6. public interface INetMessage
  7. {
  8. /// <summary>
  9. /// 消息头的指令长度
  10. /// </summary>
  11. int ProtocolHeadBytesLength { get; }
  12. /// <summary>
  13. /// 从当前的头子节文件中提取出接下来需要接收的数据长度
  14. /// </summary>
  15. /// <returns>返回接下来的数据内容长度</returns>
  16. int GetContentLengthByHeadBytes();
  17. /// <summary>
  18. /// 检查头子节的合法性
  19. /// </summary>
  20. /// <param name="token">特殊的令牌,有些特殊消息的验证</param>
  21. /// <returns>是否成功的结果</returns>
  22. bool CheckHeadBytesLegal(byte[] token);
  23. /// <summary>
  24. /// 获取头子节里的消息标识
  25. /// </summary>
  26. /// <returns>消息标识</returns>
  27. int GetHeadBytesIdentity();
  28. /// <summary>
  29. /// 消息头字节
  30. /// </summary>
  31. byte[] HeadBytes { get; set; }
  32. /// <summary>
  33. /// 消息内容字节
  34. /// </summary>
  35. byte[] ContentBytes { get; set; }
  36. /// <summary>
  37. /// 发送的字节信息
  38. /// </summary>
  39. byte[] SendBytes { get; set; }
  40. }
  41. }