card_base.h 3.0 KB

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