site_area.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #ifndef __SITE_AREA_HOVER_HPP__
  2. #define __SITE_AREA_HOVER_HPP__
  3. #include <point.h>
  4. #include<chrono>
  5. #include "common.h"
  6. //每张卡包含这样一个对象,保存最后一个分站区域;只有tof一维有这个需求
  7. //1、记录卡进出分站的时间,地点
  8. //2、用于考勤
  9. struct site_area_hover
  10. {
  11. site_area_hover()
  12. :m_site_id(-1)
  13. ,m_enter_time(0)
  14. ,m_last_time(0)
  15. ,m_stat_attendance(AS_INIT)
  16. ,m_attendance_start_time(std::chrono::seconds(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. ///考勤状态 0初始状态 1 没在考勤 2 考勤;参看ATTENDANCE_STATUS
  32. int m_stat_attendance;
  33. ///考勤开始时间
  34. std::chrono::system_clock::time_point m_attendance_start_time;
  35. public:
  36. int site_id() const
  37. {
  38. return m_site_id;
  39. }
  40. bool is_invalid()
  41. {
  42. return -1==m_site_id;
  43. }
  44. bool is_attendance()
  45. {
  46. return AS_ATTENDANCE == m_stat_attendance;
  47. }
  48. };
  49. #endif