ya_setting.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #ifndef _YASL_SETTINS_H
  2. #define _YASL_SETTINS_H
  3. #include <time.h>
  4. #include <map>
  5. #include <boost/algorithm/string/split.hpp>
  6. #include <boost/algorithm/string/classification.hpp>
  7. #include "common_tool.h"
  8. #include "service_position.h"
  9. // 系统设置,,读取DB.dat_setting
  10. struct SSys_setting // system_limit_setting
  11. {
  12. unsigned int over_count_person; // 井下人员超员
  13. unsigned int over_count_vehicle; // 井下车辆超员
  14. unsigned int over_time_person; // 井下人员超时
  15. unsigned int over_time_vehicle; // 井下车辆超时
  16. double over_speed; // 井下车辆超速
  17. // 考勤偏移时间
  18. int att_starttime_offset_staff;
  19. int att_endtime_offset_staff;
  20. int att_starttime_offset_vehicle;
  21. int att_endtime_offset_vehicle;
  22. uint64_t att_person_thre_hour;
  23. //车辆防追尾配置数据
  24. double rear_end_d;
  25. time_t rear_end_t;
  26. double geofault_warn_dis;
  27. std::string rav_disable;
  28. std::map<int, float> mp_anti_collision;
  29. SSys_setting()
  30. {
  31. init();
  32. }
  33. bool check_rav(uint8_t type,uint32_t id)
  34. {
  35. bool f = false;
  36. std::string cardid=tool_other::type_id_to_str(type,id);
  37. if(rav_disable.find(cardid) != std::string::npos)
  38. f=true;
  39. return f;
  40. }
  41. void init()
  42. {
  43. over_count_person = 1000;
  44. over_count_vehicle = 100;
  45. over_speed = 30;
  46. over_time_person = 36000;
  47. over_time_vehicle = 18000;
  48. att_endtime_offset_staff = 600;
  49. att_endtime_offset_vehicle = 600;
  50. att_starttime_offset_staff = 900;
  51. att_starttime_offset_vehicle = 600;
  52. att_person_thre_hour = 0;
  53. rear_end_d = 0;
  54. rear_end_t = 0;
  55. geofault_warn_dis=50;
  56. }
  57. void init_anti_coll_value(const std::string& ctx)
  58. {
  59. std::string c = ctx;
  60. std::vector<std::string> vt;
  61. boost::split(vt, c, boost::is_any_of(","));
  62. for(size_t i = 0;i < vt.size(); ++i)
  63. {
  64. mp_anti_collision.insert(std::make_pair(i, atof(vt[i].c_str())));
  65. }
  66. }
  67. bool del_anti_coll_value()
  68. {
  69. mp_anti_collision.clear();
  70. return mp_anti_collision.empty();
  71. }
  72. };
  73. class CYaSetting
  74. {
  75. public:
  76. /*
  77. * 从数据库的dat_setting表初始化系统阈值,
  78. * 包括:井下人员阈值,井下车辆阈值,人员超时阈值,车辆超时阈值,车辆超速阈值
  79. */
  80. static SSys_setting m_sys_setting;
  81. static bool Init_sys_setting();
  82. };
  83. struct ios_service{
  84. static service_position_ptr m_ios_service;
  85. static void start_service_position(const int& port);
  86. };
  87. #endif