#ifndef _CARD_HPP_ #define _CARD_HPP_ #include #include #include "point.h" #include "ant.h" #include "write-copy.h" #include "websocket/ws_common.h" struct task; template struct zloop; struct select_tool; struct smooth_tool; struct monkey_person; struct card_message_handle; enum STA_TYPE { STATUS_HELP=0, STATUS_LOW_POWER, }; /** * @brief 0初始状态 1 没在考勤 2 考勤 */ enum ATTENDANCE_STATUS { ///初始状态 AS_INIT=0, ///没在考勤 AS_NOT_ATTENDANCE=1, ///考勤 AS_ATTENDANCE=2, }; /** * @brief 卡类型 人卡 车卡 */ enum CARD_TYPE { ///卡类型 人卡 CT_PERSON=1, ///卡类型 车卡 CT_VEHICLE=2, }; struct card:point { card(uint32_t id,uint16_t dis,int16_t type,int32_t deptid) :m_id(id) ,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) {} uint32_t m_id; //卡号 int16_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; //时间戳 int32_t m_deptid; //部门编号 }; struct card_location_base:card { std::unique_ptr m_sel_tool; std::unique_ptr m_smo_tool; card_message_handle *m_message_handle=nullptr; ev::dynamic_loop * m_loop = nullptr; ev::timer m_timer; card_location_base()=default; card_location_base(std::string type,uint32_t id,uint16_t dis,int16_t t,int32_t ); virtual void do_business(const point &pt)=0; virtual void set(ev::dynamic_loop * loop)=0; virtual void reset(std::shared_ptr mp){} void on_message(zloop * loop,const message_locinfo&loc,bool is_history); void on_location(const std::vector&vp,const std::vector &lm ); void do_status(STA_TYPE st) { if(STATUS_HELP==st) { //module_call_help::ins } } void upt_card_pos(YA::_CARD_POS_ &,const point &pt); virtual ~card_location_base(); }; struct card_list:single_base> { void init_staffer(); void init_vehicle(); uint64_t getId(uint32_t cardid,uint64_t); void on_message(zloop *loop,const message_locinfo&loc,bool is_history); void init_card_from_db(); ~card_list(){} }; #endif