RS232DecodeEvent.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // // ******************************************************************
  2. // // /\ /| @File RS232DecodeEvent.h
  3. // // \ V/ @Brief
  4. // // | "") @Author lijinwen, ghz005@uni-trend.com.cn
  5. // // / | @Creation 2024-05-16
  6. // // / \\ @Modified 2024-06-05
  7. // // *(__\_\
  8. // // ******************************************************************
  9. #pragma once
  10. #include <vector>
  11. #include "ProtocolRS232Enums.h"
  12. #include "../DecodeEvent.h"
  13. namespace Protocol
  14. {
  15. struct RS232DecodeEventUnit
  16. {
  17. int64_t StartIndex; //开始帧
  18. int64_t Length; //长度
  19. uint8_t Data; //数据
  20. RS232Enums::RS232DecodeEventType EventType; //事件类型 None, Start, Data,Parity,
  21. // //事件相等判断
  22. // bool Equals(const RS232DecodeEventUint eventData) const
  23. // {
  24. // return Data == eventData.Data;
  25. // }
  26. };
  27. struct RS232DecodeEvent : DecodeBaseEvent
  28. {
  29. int8_t ParityResult; //校验结果
  30. RS232DecodeEventUnit* EventData; //事件数据指针
  31. int64_t EventDataCount; //事件数据长度
  32. //事件相等判断
  33. // bool Equals(const RS232DecodeEvent decodeEvent)
  34. // {
  35. // if (decodeEvent.EventDataCount != EventDataCount)
  36. // {
  37. // return false;
  38. // }
  39. // const int64_t size = decodeEvent.EventDataCount;
  40. // for (int64_t i = 0; i < size; i++)
  41. // {
  42. // if (!decodeEvent.EventData[i].Equals(EventData[i]))
  43. // {
  44. // return false;
  45. // }
  46. // }
  47. // return true;
  48. // }
  49. };
  50. }