rs232_decode_event.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // // ******************************************************************
  2. // // /\ /| @File rs232_decode_event.h
  3. // // \ V/ @Brief
  4. // // | "") @Author lijinwen, ghz005@uni-trend.com.cn
  5. // // / | @Creation 2024-06-26
  6. // // / \\ @Modified 2024-07-16
  7. // // *(__\_\
  8. // // ******************************************************************
  9. #pragma once
  10. #include <vector>
  11. #include "protocol_rs232_enums.h"
  12. #include "../decode_event.h"
  13. namespace Protocol
  14. {
  15. struct Rs232DecodeEventUnit
  16. {
  17. int64_t start_index; //开始帧
  18. int64_t length; //长度
  19. uint8_t data; //数据
  20. Rs232Enums::Rs232DecodeEventType event_type; //事件类型 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 parity_result; //校验结果
  30. Rs232DecodeEventUnit* event_data; //事件数据指针
  31. int64_t event_data_count; //事件数据长度
  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. }