site_area.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 site_id() const
  32. {
  33. return m_site_id;
  34. }
  35. bool is_invalid() const
  36. {
  37. return -1==m_site_id;
  38. }
  39. std::shared_ptr<site> get_site();
  40. };
  41. #endif