ProtocolEnums.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. // // ******************************************************************
  2. // // /\ /| @File ProtocolEnums.h
  3. // // \ V/ @Brief
  4. // // | "") @Author lijinwen, ghz005@uni-trend.com.cn
  5. // // / | @Creation 2024-05-16
  6. // // / \\ @Modified 2024-05-16
  7. // // *(__\_\
  8. // // ******************************************************************
  9. #pragma once
  10. #include <iostream>
  11. #include <unordered_map>
  12. namespace Protocol
  13. {
  14. // 公共枚举,表示解码的状态
  15. enum class ProtocolStatus: int32_t
  16. {
  17. Success,
  18. QuantizeFailure,
  19. QuantizeInProgress,
  20. DecodeFailure,
  21. DecodeInProgress,
  22. Canceled
  23. };
  24. enum class Edge: int32_t
  25. {
  26. None,
  27. Falling,
  28. Rise,
  29. };
  30. enum class ProtocolClass: int32_t
  31. {
  32. Other,
  33. Serial,
  34. Parallel,
  35. };
  36. enum class SignalType: int32_t
  37. {
  38. SingleEnded,
  39. Diff
  40. };
  41. enum class MSBOrLSB: int32_t
  42. {
  43. MSB,
  44. LSB
  45. };
  46. enum class Polarity: int32_t
  47. {
  48. None,
  49. Pos,
  50. Neg
  51. };
  52. // 枚举类,定义了支持的串行通信协议类型。
  53. enum class SerialProtocolType : int32_t
  54. {
  55. Close = 0,
  56. // 表示没有协议
  57. RS232,
  58. // RS232 协议
  59. I2C,
  60. // I2C 协议
  61. SPI,
  62. // SPI 协议
  63. CAN,
  64. // CAN 协议
  65. CAN_FD,
  66. // CAN with Flexible Data-Rate 协议
  67. LIN,
  68. // LIN 协议
  69. FlexRay,
  70. // FlexRay 通信协议
  71. AudioBus,
  72. // 音频总线协议
  73. MIL,
  74. // MIL-STD-1553 协议
  75. ARINC429,
  76. // ARINC429 航空电子协议
  77. USB,
  78. // USB 通用串行总线协议
  79. SENT,
  80. // 单边电流传输协议
  81. SPMI,
  82. // 串行外围设备多路传输接口
  83. Ethernet,
  84. // 以太网协议
  85. CXPI,
  86. // CXPI 协议
  87. NFC,
  88. // 近场通信协议
  89. PD,
  90. // 电力传输协议
  91. NRZ,
  92. // 非归零编码
  93. Manchester,
  94. // 曼彻斯特编码
  95. DigRF_3G,
  96. // 数字射频3G协议
  97. DigRF_V4,
  98. // 数字射频V4协议
  99. Common_8b10b,
  100. // 8b/10b编码
  101. JTAG,
  102. // 联合测试行动组协议
  103. SATA,
  104. // 串行ATA接口
  105. PCIe,
  106. // 外围设备互连高速扩展协议
  107. // 如果有新的协议类型,可以继续添加如下:
  108. // NewProtocolTypeX, // 新的协议类型X
  109. // ...
  110. };
  111. //
  112. // std::unordered_map<SerialProtocolType, std::string> protocolTypeAliases = {
  113. // {SerialProtocolType::Close, "Close"},
  114. // {SerialProtocolType::RS232, "RS232"},
  115. // {SerialProtocolType::I2C, "I2C"},
  116. // {SerialProtocolType::SPI, "SPI"},
  117. // {SerialProtocolType::CAN, "CAN"},
  118. // {SerialProtocolType::CAN_FD, "CAN-FD"},
  119. // {SerialProtocolType::LIN, "LIN"},
  120. // {SerialProtocolType::FlexRay, "FlexRay"},
  121. // {SerialProtocolType::AudioBus, "AudioBus"},
  122. // {SerialProtocolType::MIL, "MIL-STD-1553"},
  123. // {SerialProtocolType::ARINC429, "ARINC429"},
  124. // {SerialProtocolType::USB, "USB"},
  125. // {SerialProtocolType::SENT, "SENT"},
  126. // {SerialProtocolType::SPMI, "SPMI"},
  127. // {SerialProtocolType::Ethernet, "Ethernet"},
  128. // {SerialProtocolType::CXPI, "CXPI"},
  129. // {SerialProtocolType::NFC, "NFC"},
  130. // {SerialProtocolType::PD, "PD"},
  131. // {SerialProtocolType::NRZ, "NRZ"},
  132. // {SerialProtocolType::Manchester, "Manchester"},
  133. // {SerialProtocolType::DigRF_3G, "DigRF-3G"},
  134. // {SerialProtocolType::DigRF_V4, "DigRF-V4"},
  135. // {SerialProtocolType::Common_8b10b, "Common-8b10b"},
  136. // {SerialProtocolType::JTAG, "JTAG"},
  137. // {SerialProtocolType::SATA, "SATA"},
  138. // {SerialProtocolType::PCIe, "PCIe"}
  139. // };
  140. }