module_traffic_light_common.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #ifndef module_traffic_light_common_h
  2. #define module_traffic_light_common_h
  3. #include <string>
  4. #include <list>
  5. #include "point.h"
  6. enum device_type{
  7. DT_BIG_READER = 1, // 大分站
  8. DT_SMALL_READER = 2, // 小分站
  9. DT_CARD_READER = 3, // 读卡分站
  10. DT_CTRL_READER = 4, // 通信分站
  11. DT_LIGHT = 5, // 红绿灯
  12. DT_SPEAKER = 6, // 告警器
  13. DT_TURNOUT = 7, // 道岔
  14. DT_LED = 8, // 显示屏
  15. };
  16. // 灯的颜色和形状表
  17. enum light_shape{
  18. init_shape = 0,
  19. red_circle_solid = 1, // 红色实心圆
  20. red_circle = 2, // 红色空心圆
  21. red_cross = 3, // 红色叉型
  22. green_up = 4, // 绿色上箭头
  23. green_down = 5, // 绿色下箭头
  24. green_left = 6, // 绿色左箭头
  25. green_right = 7, // 绿色右箭头
  26. red_spark = 8, // 红色闪烁
  27. green_spark = 9, // 绿色闪烁
  28. green_all_on = 10, // 绿色全亮
  29. green_all_off = 11, // 绿色全灭
  30. red_all_on = 12, // 红色全亮
  31. red_all_off = 13 // 红色全灭
  32. };
  33. //优先级
  34. enum priority{
  35. priority_init = 0, // 初始值
  36. priority_crossing = 1, // 路口控制
  37. priority_avoidance = 2, // 避让控制
  38. priority_manual_ctrl = 3, // 手动控制
  39. };
  40. //web对应的
  41. enum light_color{
  42. init = 1, // 初始值
  43. red, // 红灯
  44. green, // 绿灯
  45. spark // 闪烁
  46. };
  47. enum light_cmd{
  48. cmd_reload = 0, // 重新加载红绿灯信息
  49. cmd_manual_ctrl, // 手动控制红绿灯信息
  50. cmd_card_data, // 卡数据
  51. };
  52. struct pos_data: point{
  53. uint64_t m_card_id; // 卡id
  54. uint8_t m_type; // 1-add,2-del,3-update
  55. bool m_bigger; // 大小车标记
  56. int32_t m_area_id; // 区域id
  57. double m_speed; // 速度
  58. std::list<int> m_light_group; // 红绿灯id
  59. pos_data(): m_card_id(0), m_type(0), m_bigger(false), m_area_id(0), m_speed(0.0)
  60. {
  61. m_light_group.clear();
  62. }
  63. };
  64. struct light_message{
  65. uint16_t m_cmd; // 命令
  66. int m_group_id; // 信号灯组id
  67. int m_light_id; // 信号灯id
  68. int m_light_status; // 信号灯形状
  69. std::string m_ctrl_name; // 控制用户
  70. pos_data m_pos; // 卡数据
  71. light_message(): m_cmd(0), m_group_id(0), m_light_id(0), m_light_status(0), m_ctrl_name("")
  72. {}
  73. light_message(const uint16_t cmd, const int gid, const int lid, const int ls, const std::string name, const pos_data& p): m_cmd(cmd), m_group_id(gid), m_light_id(lid), m_light_status(ls), m_ctrl_name(name), m_pos(p)
  74. {}
  75. };
  76. const double g_max_scope = 100.0;
  77. const double g_mid_vehicle_length_group = 30.0;
  78. #endif