site_area.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifndef __SITE_AREA_HOVER_HPP__
  2. #define __SITE_AREA_HOVER_HPP__
  3. #include <point.h>
  4. #include <memory>
  5. #include <chrono>
  6. #include "common.h"
  7. //每张卡包含这样一个对象,保存最后一个分站区域;只有tof一维有这个需求
  8. //1、记录卡进出分站的时间,地点
  9. //2、用于考勤
  10. class site;
  11. struct site_area_hover
  12. {
  13. site_area_hover()
  14. :m_site_id(-1)
  15. ,m_enter_time(0)
  16. ,m_last_time(0)
  17. {
  18. }
  19. //调用时机:
  20. //1、tof一维收到第一个数据点时,以pt=0调用
  21. //2、数据点解析完毕之后调用
  22. void on_point(uint32_t card_id,int site_id,const point*pt,int32_t type);
  23. private:
  24. void enter_site(uint32_t card_id,int enter_site,int32_t type);
  25. void leave_site(uint32_t card_id,int enter_site,int32_t type);
  26. private:
  27. int m_site_id;
  28. time_t m_enter_time,m_last_time;
  29. point m_enter_point,m_last_point;
  30. public:
  31. int get_att_type() const;
  32. int site_id() const
  33. {
  34. return m_site_id;
  35. }
  36. bool is_invalid() const
  37. {
  38. return -1==m_site_id;
  39. }
  40. std::shared_ptr<site> get_site();
  41. };
  42. #endif