123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- #ifndef _CARD_HPP_
- #define _CARD_HPP_
- #include <message.h>
- #include <ev++.h>
- #include "point.h"
- #include "ant.h"
- #include "write-copy.h"
- #include "atomic"
- #include "area.h"
- //#include "module_service/module_call_help.h"
- struct task;
- template<typename T> struct zloop;
- struct select_tool;
- struct smooth_tool;
- 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_message_handle;
- struct card:point
- {
- card(uint32_t id,uint16_t dis,int16_t type)
- :m_id(id)
- ,m_type(type)
- ,m_display(dis)
- ,m_speed(0)
- ,m_stat_attendance(0)
- ,m_stat(0)
- {}
- ///卡号
- uint32_t m_id;
- ///类型 CARD_TYPE
- int16_t m_type;
- ///1显示0不显示,往前端推送
- uint16_t m_display;
- ///速度
- double m_speed;
- ///考勤状态 0初始状态 1 没在考勤 2 考勤;参看ATTENDANCE_STATUS
- std::atomic<int> m_stat_attendance;
- ///考勤开始时间
- std::chrono::system_clock::time_point m_attendance_start_time;
- ///运动静止状态
- int m_stat;
- ///
- std::shared_ptr<area_hover> m_area_hover;
- ///分站id
- int m_site_id;
- /// 天线号
- int m_antenna_id;
- /// 分站发送数据的计数次数
- int m_reader_tickcount;
- /// 飞行时间
- int64_t flying_time;
- /// 天线角度
- double m_antenna_angle;
- /// 距离
- double m_distance;
- /// 飞行时间
- int64_t m_flying_time;
- // 分站接收到卡时的时间
- std::string m_str_his_time;
- // 采集程序接收到数据的时间
- std::string m_str_rec_time;
- /// 定位时间戳
- unsigned short m_time_stamp;
- /// 报文类型 tof,tdoa
- int m_ranging_type;
- // 加速度
- int m_accelerate_state;
- /// 电量
- int m_power_state;
- /// 上一次加速度状态
- int m_accelerate_state_last;
- ///呼救状态:事件开始(0),呼救已处理状态(1),事件结束(100);参看EVENT_STATUS
- std::atomic<int> m_stat_call_help;
- ///最后处理时间
- std::chrono::system_clock::time_point m_deal_time;
- /// 地标信息
- int m_landmarkid;
- /// 与地标的距离
- double m_landmarkdist;
- /// 所处地标的方向
- int m_landmarkdirect;
- };
- 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;
- 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);
- void set(ev::dynamic_loop * loop);
- void on_timer();
- 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(STA_TYPE st)
- {
- if(STATUS_HELP==st)
- {
- //module_call_help::ins
- }
- }
- virtual ~card_location_base();
- };
- struct card_list:single_base<card_list,uint64_t,std::shared_ptr<card_location_base>>
- {
- void init_staffer();
- void init_vehicle();
- uint64_t getId(uint32_t cardid,uint64_t);
- void on_message(zloop<task*> *loop,const message_locinfo&loc,bool is_history);
- void init_card_from_db();
- ~card_list(){}
- };
- #endif
|