area_business_motionless_persion.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #ifndef AREA_BUSINESS_MOTIONLESS_PERSION
  2. #define AREA_BUSINESS_MOTIONLESS_PERSION
  3. /**
  4. * @brief 简要说明
  5. * @author 戴月腾
  6. * @date 2019-01-12
  7. */
  8. //#include"module_singleton_base.h"
  9. //#include"module_i_thread.h"
  10. //#include"card.h"
  11. #include"area_business.h"
  12. #include"config_file.h"
  13. /**
  14. * @brief 一、硬件输出的状态
  15. 当完全静止时人卡会连续发送 30 次定位数据,在该定位数据中的加速度状态为 0;发送
  16. 完这一系列的定位数据之后进入休眠状态,不再发送任何定位数据。
  17. 当人卡从静止切换到运动状态会在毫秒级完成。然后 2 秒后把定位数据发上来,此时加
  18. 速度状态为 1(运动状态)。
  19. 二、处理逻辑
  20. 当连续收到 X(X 可以配置,X 建议不小于 10)次静止状态定位数据之后才认为完全静止。
  21. 经过 Y(Y 可以配置)秒之后开始告警,只要收到运动状态的定位数据就认为非静止立刻取消
  22. 告警
  23. */
  24. class area_business_motionless_persion : public area_business// : public i_thread, public singleton_base<module_motionless_persion>
  25. {
  26. // void run()
  27. // {
  28. // auto cardlist = card_list::instance()->m_map;
  29. // auto iter_m_map=cardlist.begin();
  30. // for(;iter_m_map!=cardlist.end();++iter_m_map)
  31. // {
  32. // deal_alarm(iter_m_map->second);
  33. // }
  34. // }
  35. // void deal_alarm(std::shared_ptr<card_location_base>& card_ptr);
  36. private:
  37. static int _acc_0count_limit;
  38. public:
  39. int area_business_type()
  40. {
  41. return 5;
  42. }
  43. static void init(config_file& config)
  44. {
  45. // sleep_ms = std::stoi(config.get("service.motionless_thread_sleep_ms","5000"));
  46. _acc_0count_limit = std::stoi(config.get("service.motionless_acc_0count_limit","40"));
  47. // _acc_seconds_limit = std::stoi(config.get("service.motionless_acc_seconds_limit","120"));
  48. }
  49. void on_enter(const std::shared_ptr<area_hover>&a,const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data>&ptr);
  50. void on_hover(const std::shared_ptr<area_hover>&a,const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr);
  51. void on_leave(const std::shared_ptr<area_hover>&a,const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr);
  52. };
  53. #endif // MODULE_MOTIONLESS_PERSION_H