123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- #ifndef module_traffic_light_common_h
- #define module_traffic_light_common_h
- #include <string>
- #include <list>
- #include "point.h"
- enum device_type{
- DT_BIG_READER = 1,
- DT_SMALL_READER = 2,
- DT_CARD_READER = 3,
- DT_CTRL_READER = 4,
- DT_LIGHT = 5,
- DT_SPEAKER = 6,
- DT_TURNOUT = 7,
- DT_LED = 8,
- };
- enum light_shape{
- init_shape = 0,
- red_circle_solid = 1,
- red_circle = 2,
- red_cross = 3,
- green_up = 4,
- green_down = 5,
- green_left = 6,
- green_right = 7,
- red_spark = 8,
- green_spark = 9,
- green_all_on = 10,
- green_all_off = 11,
- red_all_on = 12,
- red_all_off = 13
- };
- enum priority{
- priority_init = 0,
- priority_crossing = 1,
- priority_avoidance = 2,
- priority_manual_ctrl = 3,
- };
- enum light_color{
- init = 1,
- red,
- green,
- spark
- };
- enum light_cmd{
- cmd_reload = 0,
- cmd_manual_ctrl,
- cmd_card_data,
- };
- enum move_stream{
- unknown = 0,
- up_stream,
- down_stream,
- };
- struct pos_data: point{
- uint64_t m_card_id;
- uint8_t m_type;
- bool m_bigger;
- int32_t m_area_id;
- double m_speed;
- int m_site_id;
- std::list<int> m_light_group;
- pos_data(): m_card_id(0), m_type(0), m_bigger(false), m_area_id(0), m_speed(0.0), m_site_id(0)
- {
- m_light_group.clear();
- }
- pos_data operator=(const pos_data& p)
- {
- this->m_card_id = p.m_card_id;
- this->m_type = p.m_type;
- this->m_bigger = p.m_bigger;
- this->m_area_id = p.m_area_id;
- this->m_speed = p.m_speed;
- this->m_site_id = p.m_site_id;
- this->m_light_group = p.m_light_group;
- return *this;
- }
- };
- struct light_message{
- uint16_t m_cmd;
- int m_group_id;
- int m_light_id;
- int m_light_state;
- std::string m_ctrl_name;
- pos_data m_pos;
- light_message(): m_cmd(0), m_group_id(0), m_light_id(0), m_light_state(0), m_ctrl_name("")
- {}
- 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_state(ls), m_ctrl_name(name), m_pos(p)
- {}
- };
- const double g_max_scope = 100.0;
- const double g_mid_vehicle_length_group = 30.0;
- #endif
|