struct_def.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. // struct and constant
  2. #ifndef STRUCT_DEF_H
  3. #define STRUCT_DEF_H
  4. #include <functional>
  5. typedef std::function<void(const int, const int, uint64_t, double, double, bool)> SendCallBack;
  6. struct init_para
  7. {
  8. std::function<void(uint32_t,bool,uint32_t)> send_pt;
  9. SendCallBack driving_face_alarm;
  10. bool m_restart;
  11. int m_shutdown_timeout; //超时关机时间阈值(读取配置数据)
  12. init_para()
  13. {
  14. m_restart = false;
  15. m_shutdown_timeout = 0;
  16. send_pt = nullptr;
  17. driving_face_alarm = nullptr;
  18. }
  19. void set_alarm_callback(const SendCallBack &cb)
  20. {
  21. driving_face_alarm = move(cb);
  22. }
  23. };
  24. struct card_pos
  25. {
  26. card_pos()
  27. {
  28. work_line=0; //1.一线工人 2.二线工人等
  29. rec_time=0;
  30. running_stat=-1;
  31. biz_stat=-1;
  32. vibration=0;map_id=-1;//enter_time=0;leave_time=0;
  33. x=y=z=0;type=id=identifier_id=dpt_id=0;
  34. final_v = 0.0;
  35. work_type_id =reader_id = 0;
  36. reader_x = 0.0;
  37. reader_y = 0.0;
  38. }
  39. void copy(const card_pos & pos)
  40. {
  41. *this = pos;
  42. }
  43. int work_line; // work level
  44. uint64_t rec_time; // receive time
  45. int running_stat; // sport status
  46. int biz_stat; // business status
  47. int vibration; // vibration for coalface and drivingface machine
  48. // int area_id; // current area id
  49. int map_id; // map sacle id
  50. // uint64_t enter_time; // time of enter aera
  51. // uint64_t leave_time; // time of leave area
  52. double x; // located x
  53. double y; // located y
  54. double z; // located z
  55. uint64_t type; // card type
  56. uint32_t id; // card id
  57. uint32_t identifier_id; // staff id
  58. uint32_t dpt_id; //部门ID
  59. int work_type_id;
  60. int reader_id; //分站ID
  61. double reader_x; //分站X
  62. double reader_y; //分站Y
  63. double final_v;
  64. };
  65. struct area_data
  66. {
  67. area_data()
  68. {
  69. is_work_area=false;
  70. area_id=0;
  71. area_type=0;
  72. enter_time=0;
  73. leave_time=0;
  74. }
  75. bool is_work_area; // whether it is a work area
  76. int area_id; // current area id
  77. int area_type; // area type
  78. uint64_t enter_time; // time of enter aera
  79. uint64_t leave_time; // time of leave area
  80. };
  81. struct db_para
  82. {
  83. std::string Host;//数据库主机地址
  84. std::string User;//用户名
  85. std::string PWD;//密码
  86. std::string DBName;//数据库名
  87. std::string CharSet;//字符集
  88. int TimeOut;
  89. int PoolSize;
  90. int Port; //端口
  91. };
  92. struct map_info{
  93. int m_map_id;
  94. double m_map_scale;
  95. map_info():m_map_id(0),m_map_scale(0.0){}
  96. };
  97. #endif