sys_setting.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. int light_group_count;
  29. // 人车防碰撞参数,三个档位
  30. bool m_enable_anti_coll; // 功能使能
  31. int m_3d_tag; // 三维空间选择,0表示选择Z坐标的正空间,1表示选择Z坐标的负空间
  32. std::map<int, float> mp_anti_collision;
  33. std::map<int, int> mp_sid_solution; // 基站所使用的选解方式
  34. std::map<std::string, int> mp_sids_index; // 某三个TDOA基站组对应的编号
  35. int site_no_position_time; // 基站长时间无定位阈值
  36. SSys_setting()
  37. {
  38. init();
  39. }
  40. bool check_rav(uint8_t type,uint32_t id)
  41. {
  42. bool f = false;
  43. std::string cardid=tool_other::type_id_to_str(type,id);
  44. if(rav_disable.find(cardid) != std::string::npos)
  45. f=true;
  46. return f;
  47. }
  48. void init()
  49. {
  50. over_count_person = 1000;
  51. over_count_vehicle = 100;
  52. over_speed = 30;
  53. over_time_person = 36000;
  54. over_time_vehicle = 18000;
  55. att_endtime_offset_staff = 600;
  56. att_endtime_offset_vehicle = 600;
  57. att_starttime_offset_staff = 900;
  58. att_starttime_offset_vehicle = 600;
  59. att_person_thre_hour = 0;
  60. rear_end_d = 0;
  61. rear_end_t = 0;
  62. geofault_warn_dis = 50;
  63. rav_disable = "";
  64. light_group_count = 1;
  65. m_enable_anti_coll = false;
  66. mp_anti_collision.erase(mp_anti_collision.begin(), mp_anti_collision.end());
  67. site_no_position_time = 60; // 默认60分钟
  68. m_3d_tag = 0;
  69. }
  70. void init_anti_coll_value(const std::string& ctx)
  71. {
  72. std::string c = ctx;
  73. std::vector<std::string> vt;
  74. boost::split(vt, c, boost::is_any_of(","));
  75. for(size_t i = 0;i < vt.size(); ++i)
  76. {
  77. mp_anti_collision.insert(std::make_pair(i, atof(vt[i].c_str())));
  78. }
  79. }
  80. bool del_anti_coll_value()
  81. {
  82. mp_anti_collision.clear();
  83. return mp_anti_collision.empty();
  84. }
  85. };
  86. class CYaSetting
  87. {
  88. public:
  89. /*
  90. * 从数据库的dat_setting表初始化系统阈值,
  91. * 包括:井下人员阈值,井下车辆阈值,人员超时阈值,车辆超时阈值,车辆超速阈值
  92. */
  93. static SSys_setting m_sys_setting;
  94. static bool Init_sys_setting();
  95. private:
  96. static bool Init_map_setting();
  97. };
  98. struct ios_service{
  99. static service_position_ptr m_ios_service;
  100. static void start_service_position(const int& port);
  101. };
  102. #endif