123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- #ifndef _CARD_BASE_HPP_
- #define _CARD_BASE_HPP_
- #include <vector>
- #include <memory>
- #include "point.h"
- #define CARD_LOST_TIME_OUT (30*1000)
- struct task;
- template<typename T> struct zloop;
- struct select_tool;
- struct smooth_tool;
- struct monkey_person;
- struct card_message_handle;
- struct card_location_base;
- struct message_locinfo;
- struct loc_message;
- struct mine_tool;
- struct location_card;
- struct card_pos;
- struct area_hover;
- struct site_area_hover;
- namespace YA{struct _CARD_POS_;}
- //m_is_attendance 井上井下状态 0初始状态 1 井上 2 井下
- enum EAttendanceState
- {
- Init = 0, //0初始状态
- MineUp = 1, //井上
- MineDown = 2 //井下
- };
- struct card:point
- {
- card(uint32_t id,uint16_t dis,uint64_t type,int32_t deptid,int32_t level_id,uint32_t cid)
- :m_id(id)
- ,m_cid(cid)
- ,m_type(type)
- ,m_display(dis)
- ,m_speed(0)
- ,m_is_attendance(0)
- ,m_stat(0)
- ,m_ct(0)
- ,m_time(0)
- ,m_deptid(deptid)
- ,m_level_id(level_id)
- {}
- uint64_t type_(){return m_type;}
- uint64_t time_(){return m_time;}
- uint32_t m_id; //卡号
- uint32_t m_cid; //标识id 人staff_id 车 vehicle_id
- uint64_t m_type; //类型
- uint16_t m_display; //1显示0不显示,往前端推送
- double m_speed; //速度
- int m_is_attendance; //井上井下状态 0初始状态 1 井上 2 井下
- int m_stat; //运动静止状态
- uint16_t m_ct; //ct
- uint64_t m_time; //时间戳 ms
- int32_t m_deptid; //部门编号
- int32_t m_level_id; //部门级别
- };
- struct card_location_base:card
- {
- std::unique_ptr<select_tool> m_sel_tool;
- std::unique_ptr<smooth_tool> m_smo_tool;
- std::unique_ptr<card_message_handle> m_message_handle;
- std::unique_ptr<location_card> m_his_location_card;
- card_location_base()=default;
- card_location_base(std::string type,uint32_t id,uint16_t dis,int16_t t,int32_t,int32_t,uint32_t );
- virtual void do_business(const point &pt,double acc)=0;
- virtual void on_timer()=0;
- virtual void site_hover(int sid)=0;
- virtual std::shared_ptr<area_hover> get_area_hover()=0;
- virtual std::shared_ptr<mine_tool> get_mine_tool()=0;
- virtual std::shared_ptr<site_area_hover> get_site_area()=0;
- virtual void clear();
- virtual void reset(std::shared_ptr<monkey_person> mp){}
- virtual int get_vehicle_type_id(){return 0;}
- virtual std::tuple<time_t,time_t,int,int,int,int,double> getLandmark()=0;
- void on_message(zloop<task*> * loop,const message_locinfo&loc,bool is_history);
- void on_location(const std::vector<point>&vp,const std::vector<loc_message> &lm );
- void do_status(int st);
- void upt_card_pos(YA::_CARD_POS_&cp, const point &pt);
- void del_card_pos();
- int get_stat();
- void put_three_rates(card_pos &);
- bool is_person() const;
- bool is_vehicle() const;
- virtual ~card_location_base();
- static std::shared_ptr<card_location_base> make_person(const std::string&type,uint32_t cardid,uint16_t needdisplay,int16_t t,
- int32_t deptid,int32_t level_id,uint32_t cid,int wl,const std::string & sname,const std::string & dname);
- static std::shared_ptr<card_location_base> make_car(const std::string&type,uint32_t cardid,uint16_t needdisplay,int16_t t,
- int32_t deptid, int32_t categoryid, int type_id,int32_t level_id,uint32_t cid);
- };
- #endif
|