Browse Source

增加卡的相关成员变量 和 枚举类

daiyueteng 6 years ago
parent
commit
6eb6531547
1 changed files with 118 additions and 28 deletions
  1. 118 28
      card.h

+ 118 - 28
card.h

@@ -6,6 +6,9 @@
 #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;
@@ -14,55 +17,142 @@ struct smooth_tool;
 enum STA_TYPE
 {
     STATUS_HELP=0,
-    STATUS_LOW_POWER, 
+    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_is_attendance(0)
-		,m_stat(0)
-	{}
-	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;			//运动静止状态
+    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;
+    std::unique_ptr <card_message_handle> m_message_handle;
     ev::dynamic_loop * m_loop = nullptr;
-	ev::timer m_timer;
+    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 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 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();
+    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(){}
+    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