card_base.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #ifndef _CARD_BASE_HPP_
  2. #define _CARD_BASE_HPP_
  3. #include <vector>
  4. #include <memory>
  5. #include "point.h"
  6. #define CARD_LOST_TIME_OUT (30*1000)
  7. struct task;
  8. template<typename T> struct zloop;
  9. struct select_tool;
  10. struct smooth_tool;
  11. struct monkey_person;
  12. struct card_message_handle;
  13. struct card_location_base;
  14. struct message_locinfo;
  15. struct loc_message;
  16. struct mine_tool;
  17. struct location_card;
  18. struct card_pos;
  19. struct area_hover;
  20. struct site_area_hover;
  21. struct site;
  22. namespace YA{struct _CARD_POS_;}
  23. //m_is_attendance 井上井下状态 0初始状态 1 井上 2 井下
  24. enum EAttendanceState
  25. {
  26. Init = 0, //0初始状态
  27. MineUp = 1, //井上
  28. MineDown = 2 //井下
  29. };
  30. struct card:point
  31. {
  32. card(uint32_t id,uint16_t dis,uint64_t type,int32_t deptid,int32_t level_id,uint32_t cid)
  33. :m_id(id)
  34. ,m_cid(cid)
  35. ,m_type(type)
  36. ,m_display(dis)
  37. ,m_speed(0)
  38. ,m_is_attendance(0)
  39. ,m_stat(0)
  40. ,m_ct(0)
  41. ,m_time(0)
  42. ,m_deptid(deptid)
  43. ,m_level_id(level_id)
  44. {}
  45. uint64_t type_(){return m_type;}
  46. uint64_t time_(){return m_time;}
  47. uint32_t m_id; //卡号
  48. uint32_t m_cid; //标识id 人staff_id 车 vehicle_id
  49. uint64_t m_type; //类型
  50. uint16_t m_display; //1显示0不显示,往前端推送
  51. double m_speed; //速度
  52. int m_is_attendance; //井上井下状态 0初始状态 1 井上 2 井下
  53. int m_stat; //运动静止状态
  54. uint16_t m_ct; //ct
  55. uint64_t m_time; //时间戳 ms
  56. int32_t m_deptid; //部门编号
  57. int32_t m_level_id; //部门级别
  58. };
  59. struct card_location_base:card,std::enable_shared_from_this<card_location_base>
  60. {
  61. std::unique_ptr<select_tool> m_sel_tool;
  62. std::unique_ptr<smooth_tool> m_smo_tool;
  63. std::unique_ptr<card_message_handle> m_message_handle;
  64. std::unique_ptr<location_card> m_his_location_card;
  65. card_location_base()=default;
  66. card_location_base(std::string type,uint32_t id,uint16_t dis,int16_t t,int32_t,int32_t,uint32_t );
  67. virtual void do_business(const std::shared_ptr<site>&,const point &pt,double acc)=0;
  68. virtual void on_timer()=0;
  69. virtual void site_hover(int sid)=0;
  70. virtual std::shared_ptr<area_hover> get_area_hover()=0;
  71. virtual std::shared_ptr<mine_tool> get_mine_tool()=0;
  72. virtual std::shared_ptr<site_area_hover> get_site_area()=0;
  73. virtual void clear();
  74. virtual void reset(std::shared_ptr<monkey_person> mp){}
  75. virtual int get_vehicle_type_id(){return 0;}
  76. virtual std::tuple<time_t,time_t,int,int,int,int,double> getLandmark()=0;
  77. void on_message(zloop<task*> * loop,const message_locinfo&loc,bool is_history);
  78. void on_location(const std::vector<point>&vp,const std::vector<loc_message> &lm );
  79. void do_status(int st);
  80. void upt_card_pos(YA::_CARD_POS_&cp, const point &pt);
  81. void del_card_pos();
  82. int get_stat();
  83. void put_three_rates(card_pos &);
  84. bool is_person() const;
  85. bool is_vehicle() const;
  86. virtual ~card_location_base();
  87. static std::shared_ptr<card_location_base> make_person(const std::string&type,uint32_t cardid,uint16_t needdisplay,int16_t t,
  88. int32_t deptid,int32_t level_id,uint32_t cid,int wl,const std::string & sname,const std::string & dname);
  89. static std::shared_ptr<card_location_base> make_car(const std::string&type,uint32_t cardid,uint16_t needdisplay,int16_t t,
  90. int32_t deptid, int32_t categoryid, int type_id,int32_t level_id,uint32_t cid);
  91. };
  92. #endif