Browse Source

把之前的功能移到新框架上,1.井下,区域 超时超员 2.分站掉电 3.禁区进入呼叫
删除之前的文件

chensongchao 6 years ago
parent
commit
ad69fa3744

+ 1 - 3
Makefile.am

@@ -16,9 +16,7 @@ SRC_MAIN= ant.cpp area.cpp base64.cpp bindmorecard.cpp mine_business.cpp card_ar
     	  card.cpp card_message_handle.cpp cardMgr.cpp card_path.cpp card_person.cpp crc.cpp geo_hash.cpp \
 		  landmark.cpp line_fit.cpp loc_point.cpp loc_tool.cpp message.cpp message_file.cpp mine.cpp \
 		  net-service.cpp point.cpp select_tool.cpp site_area.cpp special_area.cpp tdoa_sync.cpp visit.cpp \
-		  web-client.cpp worker.cpp event.cpp znet.cpp ya_setting.cpp area_business.cpp site_message_handle.cpp
-
-SRC_MAIN_EVENT= mine_module/MineCardManager.cpp
+		  web-client.cpp worker.cpp event.cpp znet.cpp ya_setting.cpp area_business.cpp
 
 SRC_SYSTEM_BASIC= system_basic_info/SystemAnalysis.cpp
 

+ 12 - 17
ant.cpp

@@ -18,7 +18,6 @@ site::site(int id)
     ,m_path_empty(true)
 {
 	m_time=time(0);
-    m_powerType = 1;
 }
 
 const algo_config&site::config()const
@@ -331,35 +330,31 @@ void sit_list::read_sit_list(int id)
     }
 }
 
-
 /*
-
    处理分站供电状态,交流供电时,ac_down=false,直流供电时,ac_down=true
 
    目前只有大分站实现了这个功能,并且井下安装时是否接入了该电信号也不确定
    ,所以需要有张表定义某个ID是否需要告警
-
  */
 void site::on_power_status(bool ac_down)//电源状态
 {
-	if(!m_power_check_enable)
-		return;
-	
-	if(ac_down == m_power_ac_down)
-		return;
-	m_power_ac_down=ac_down;
-	if(m_power_ac_down)
+	if(!m_power_check_enable || ac_down == m_power_ac_down)
+	{
+        return;
+    }
+    m_power_ac_down=ac_down;
+    double limitVal = time(NULL);
+	if(m_power_ac_down )
 	{
-		//掉电告警
-	
-	
+        //交流电 变成直流电(掉电),发送警告
+        event_tool::instance()->handle_event(OT_DEVICE_READER,ET_READER_POWER_BY_BATTERY,0,limitVal,ac_down,true);
 	}
 	else
 	{
-		//撤销警告
-	
-	
+        //直流电 变成交流电,取消警告
+        event_tool::instance()->handle_event(OT_DEVICE_READER,ET_READER_POWER_BY_BATTERY,0,limitVal,ac_down,false);
 	}
+    log_info("[event warning: reader power supply by battery] reader_id: Power %d->%d.",id(),!m_power_ac_down,m_power_ac_down);
 }
 
 #if 0

+ 0 - 206
ant.cppbak

@@ -1,206 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-#include "ant.h"
-
-int site::index()const
-{
-	return m_algo+(m_num_dims<<1);
-}
-
-sit_list*sit_list::instance()
-{
-	static sit_list _impl;
-	//_impl.load_from_db();
-	return &_impl;
-}
-site::site(int id)
-	:m_algo(0)
-	,m_num_dims(0)
-    ,m_id(id)
-    ,m_path_empty(true)
-{
-
-}
-const algo_config&site::config()const
-{
-	return g_config[index()];
-}
-
-const site& sit_list::operator[](int id) const
-{
-    return m_list[id];
-} 
-static int str_split(char*s,char**rc)
-{
-	char**o=rc;
-
-	for(;*s;)
-	{
-		*o=strtok_r(s,",",&s);
-		o++;
-	}
-
-	return o-rc;
-}
-
-//1, 101, 1, '101-1', 4727, 75, 0, 0, '2017-08-29 10:21:14'
-void sit_list::read_sit_list(const char*fname)
-{
-	FILE*fp=fopen(fname,"r");
-	char buf[512];
-	int t,id;
-	char* s[20];
-	while(fgets(buf,sizeof(buf),fp))
-	{
-		t=str_split(buf,&s[0]);
-		if(t<8)
-			continue;
-
-		id=atoi(s[1]);
-		if(id>(int)m_list.size())
-			continue;
-
-		int antid=atoi(s[2])-1;
-		if(antid>=2)
-			continue;
-
-		m_list[id].m_id=id;
-		m_list[id].m_ant[antid].set(atof(s[4]),-atof(s[5]));
-	}
-
-	for(auto&sit:m_list)
-	{
-		if(sit.m_id==-1)
-			continue;
-
-		if(sit.m_ant[0]==sit.m_ant[1])
-		{
-			printf("%d分站天线坐标相等.\n",sit.m_id);
-		}
-
-		sit.set( (sit.m_ant[0].x+sit.m_ant[1].x)/2,(sit.m_ant[0].y+sit.m_ant[1].y)/2);
-	}
-
-	fclose(fp);
-}
-void sit_list::read_ant_path(const char*fname)
-{
-	FILE*fp=fopen(fname,"r");
-	char buf[512],*p;
-	int t,id,pid;
-	char* s[20];
-	while((p=fgets(buf,sizeof(buf),fp)))
-	{
-		t=str_split(buf,&s[0]);
-		if(t<9)
-			continue;
-
-		id=atoi(s[0]);
-		if(id>(int)m_list.size())
-			continue;
-
-		pid=atoi(s[1]);
-		if(pid>2)
-          continue;
-
-        point p1(atof(s[2]),-atof(s[3]));
-        point p2(atof(s[5]),-atof(s[6]));
-        
-        if(pid == 0)
-        {
-            line_v l(p1,p2);
-            {
-                point px = l.line::projection(m_list[id]);
-                m_list[id].set(px);
-                for(int i=0;i<2;i++)
-                {
-                    path p;
-                    p.m_slope[0] = atof(s[8]);
-                    p.m_line[0] = line_v(px,l[i]);
-                    m_list[id].m_ant[i].m_path.push_back(p);
-                }
-            }
-        }
-        else 
-        {
-            ant &a = pid<0?m_list[id].m_ant[0]:m_list[id].m_ant[1];
-            if(a.m_path.size()!=0)
-            {
-                path &p = a.m_path[0];
-                p.m_line[abs(pid)-1] = line_v(p1,p2);
-                p.m_slope[abs(pid)-1] = atof(s[8]);
-            }
-            else
-            {
-                path p;
-                p.m_line[abs(pid)-1] = line_v(p1,p2);
-                p.m_slope[abs(pid)-1] = atof(s[8]);
-                a.m_path.push_back(p);
-            }
-            if(abs(pid)==1)
-				 m_list[id].set(p1);
-        }
-	}
-	fclose(fp);
-
-	for(auto&s:m_list)
-	{
-		if(s.m_id==-1)
-			continue;
-        s.swap();
-		if((s.path(0).empty() && s.path(1).empty()))
-			continue;
-        s.m_path_empty=false; 
-
-        for(auto &a:s.m_ant)
-        for(auto &p:a.m_path)
-        {
-            if(!p.m_line[0].empty())
-            {
-                point px = p.m_line[0].line::projection(a);
-                p.m_line[0]=line_v(px,p.m_line[0][1]);
-            }
-        }
-        std_info("%s",s.to_string().c_str());
-        //std_info("%f----%f",s.x,s.y);
-	}
-}
-
-
-
-loc_message::loc_message()
-	 :m_num_ticks(0)
-{
-}
-int loc_message::tool_index()const
-{
-	return m_sit.index();
-}
-
-algo_config site::g_config[]=
-{
-	{ "tof-1",  1, 2, 0.1, 1 },
-	{ "tdoa-1", 2, 2, 0.1, 1 },
-	{ "tof-2",  2, 3, 0.1, 1 },
-	{ "tdoa-2", 3, 3, 0.1, 1 },
-	{ "tof-3",  3, 4, 0.1, 1 },
-	{ "tdoa-3", 4, 4, 0.1, 1 }
-};
-
-template<> std::shared_ptr<sit_list> 
-single_base<sit_list, int, std::shared_ptr<site>>::m_instance=std::make_shared<sit_list>();
-#ifdef _TEST
-int main()
-{
-	log_init("./log.ini");
-    sit_list *sl = sit_list::instance();
-	sl->load("data_reader_antenna.txt","path_tof.txt");
-    (*sl)[219].solving(0,100);
-    (*sl)[219].solving(1,100.5);
-    std_info("---%d",(*sl)[209].m_ant[0].m_path.size());
-    std_info("---%d",(*sl)[209][0].size());
-    std_info("---%s",(*sl)[209][0][0][0].to_string().c_str());
-}
-#endif

+ 2 - 5
ant.h

@@ -139,9 +139,9 @@ struct site:point,std::enable_shared_from_this<site>
 
     unsigned char m_reader_dir;		// 分站方向,对于大小分站适用
     unsigned char m_relay_counts;		// 大小分站经过中继数
-    bool m_needpower_alarm;			//是否需要分站电池供电告警功能
     int  m_tick_count;			    // 分站发生消息的计数器
-    int  m_powerType;               // 分站电源类型 (1 = 直流电)
+    bool m_power_check_enable=false;//该分站是否启用交流掉电检测功能(告警功能)
+    bool m_power_ac_down=false;     //false=交流电供电状态
 
     site(int id=-1);
 
@@ -330,9 +330,6 @@ struct site:point,std::enable_shared_from_this<site>
         m_ant[0].m_path.clear();
         m_ant[1].m_path.clear();
     }
-
-	bool m_power_check_enable=false;//该分站是否启用交流掉电检测功能
-	bool m_power_ac_down=false;//交流电供电状态
 /*
 
 	处理分站供电状态,交流供电时,ac_down=false,直流供电时,ac_down=true

+ 0 - 293
ant.hbak

@@ -1,293 +0,0 @@
-#ifndef _ANT_LIST_HPP_
-#define _ANT_LIST_HPP_
-
-#include <math.h>
-#include <array>
-#include <deque>
-#include <tuple>
-#include <memory>
-#include <algorithm>
-#include <sstream>
-#include "log.h"
-#include "line.h"
-#include "point.h"
-#include "write-copy.h"
-
-struct path
-{
-    std::array<line_v,2>	m_line; 
-    std::array<double,2>    m_slope;
-    path()
-    {
-        for(auto &d:m_slope)
-            d=0;
-    }
-    std::string to_str() const
-    {
-        std::stringstream ss;
-        for(int i=0;i<2;i++)
-        {
-            ss<<"line:" <<m_line[i].to_string()<<"slope:"<<m_slope[i]<< " cos:"<<m_line[i].cos()<<" sin:"<<m_line[i].sin()<<" | ";
-        }
-        return ss.str();
-    }
-    bool vaild() const
-    {
-        return !m_line[0].empty();
-    }
-    line_v & operator[](int i)
-    {
-        return m_line[i];
-    }
-    const line_v & operator[](int i) const 
-    {
-        return m_line[i];
-    }
-   
-};
-//?
-struct algo_config
-{
-	const char*desc;
-	int min_msg_cnt;
-	int best_msg_cnt;
-	double min_wait_time;
-	double max_wait_time;
-};
-//
-struct ant :point
-{
-	std::vector<path> m_path;
-    path & operator[](int i)
-    {
-        return m_path[i];
-    }
-    const path & operator[](int i) const
-    {
-        return m_path[i];
-    }
-    size_t size() const
-    {
-        return m_path.size();
-    }
-    std::vector<point> getsol(const double &dist) const
-    {
-        std::vector<point> v;
-        for(const auto & p : m_path)
-        {
-            double d  = dist;
-            if(p.vaild())
-            {
-                point pt;
-                if(dist <= p.m_line[0].length() || (dist > p.m_line[0].length() && p.m_line[1].empty()))        
-                {
-                    d += d*p.m_slope[0];
-                    pt = point(p.m_line[0][0].x + d*p.m_line[0].cos() , p.m_line[0][0].y + d*p.m_line[0].sin());
-                }
-                else
-                {
-                    d -= p.m_line[0].length();
-                    d += d*p.m_slope[1];
-                    pt = point(p.m_line[1][0].x+d*p.m_line[1].cos(),p.m_line[1][0].y+d*p.m_line[1].sin());
-                }
-                v.push_back(pt);
-                std_info("get_sol:x:%.2f,y:%.2f",pt.x,pt.y);
-            }
-            else
-                std_error("%s","ant::getsol empty path..");
-        }
-        return std::move(v);
-    }
-
-};
-
-struct site:point
-{
-	static algo_config g_config[];
-	int      m_algo;			//TOF:0,TDOA:1
-	int      m_num_dims;	    //1维:0,2维:1,3维:2
-    double  m_scale = 2.0;  // 地图比例尺
-
-	point    m_position;
-	int index()const;
-	const algo_config&config()const;
-
-	site(int id=-1);
-
-	mutable double m_height=1.5;
-	int m_id;
-	bool m_path_empty;
-	std::array<ant,2> m_ant;
-
-	mutable double m_ant_dist=0;
-	mutable double m_ant_dist_sum_new=0;
-	mutable int m_ant_dist_cnt_new=0;
-
-    point get_dstp(const point pt) const 
-    {
-        point tmp;
-        for(const auto & p : m_ant[0].m_path)
-        {
-            for(int i=0;i<2;i++)
-            {
-                if(!p[i].empty())
-                {
-                    if(p[i].contain(pt,0.01))
-                    {
-                        //if(i==0)
-                         // return *this;
-                        //else
-                          tmp = p[i][0];
-                    }
-                }
-            }
-        }
-        return tmp;
-    }
-
-	void count_ant_dist(double dist_tof1, double dist_tof2)const
-	{
-		if(dist_tof1<10 || dist_tof2<10)
-			return;
-		double dist = fabs(dist_tof1 - dist_tof2);
-		if(dist>5)
-			return;
-		m_ant_dist_sum_new += dist;
-		m_ant_dist_cnt_new++;
-		
-		if(m_ant_dist_cnt_new >= 2500)
-		{
-			m_ant_dist = m_ant_dist_sum_new / m_ant_dist_cnt_new;
-			m_ant_dist_sum_new = 0;
-			m_ant_dist_cnt_new = 0;
-		}
-	}
-    void swap()
-    {
-       auto v0 =  m_ant[0].m_path;
-       auto v1 =  m_ant[1].m_path;
-       std::copy (std::begin(v0),std::end(v0),std::back_inserter(m_ant[1].m_path));
-       std::copy (std::begin(v1),std::end(v1),std::back_inserter(m_ant[0].m_path));
-    }
-	double ant_dist()const
-	{
-		return m_ant[0].dist(m_ant[1]);
-	}
-	
-	bool is_path_empty()const
-	{
-        return m_path_empty;
-	}
-
-	bool have_valid_path()const
-	{
-        return m_id != -1 && ant_dist() > 0.1;
-	}
-
-	std::string to_string()const
-	{
-        std::stringstream ss;
-        ss<<"site_id:"<<m_id<<"x:"<<x<<" y: "<<y;
-        for(const auto a:m_ant)
-        {  
-            ss<<"<";
-            for(const auto p:a.m_path)
-            {
-                ss<<"{"<<p.to_str()<<"}";
-            }
-            ss<<">";
-        }
-        return ss.str();
-	}
-
-	const point&path(int i)const
-	{
-        static point p;
-        if(i>=(int)m_ant[0].m_path.size())
-            return p ;
-		return m_ant[0].m_path[i].m_line[0][1];
-	}
-
-    std::vector<point> solving(int ant_id, double dist)const
-	{
-        const ant &a = m_ant[ant_id];
-        if(dist<50 && dist>0)
-		{
-			if(dist<m_height)
-			{
-				m_height=dist;
-				dist=0;				
-			}
-			else
-			{
-				dist=sqrt(dist*dist-m_height*m_height);
-			}
-		}
-        return std::move(a.getsol(dist));
-   	}
-    ant operator[](int i)
-    {
-        return m_ant[i];
-    }
-    const ant operator[](int i) const
-    {
-        return m_ant[i];
-    }
-};
-
-
-struct sit_list:single_base<sit_list,int,std::shared_ptr<site>>
-{
-
-	const site& operator[](int id) const;
-	static void load(const char*ant_file,const char*path_file)
-	{
-		read_sit_list(ant_file);
-		read_ant_path(path_file);
-	}
-
-	static void load_from_db()
-	{
-		load("data_reader_antenna.txt","path_tof.txt");
-	}
-
-	static void read_sit_list(const char*fname);
-	static void read_ant_path(const char*fname);
-};
-
-struct loc_message
-{
-	site     m_sit;
-	uint64_t m_num_ticks; //tof时间片m_tof或tdoa相对root时间
-	uint64_t m_loc_time;
-	uint32_t m_card_id;
-	int32_t	 m_card_ct;
-	int8_t   m_card_type;
-	int8_t   m_ant_id;
-	int16_t  m_rav;
-	int16_t  m_acc;
-	uint16_t m_sync_ct;
-	uint16_t m_rssi;
-
-
-	loc_message();
-	loc_message(site s,uint64_t num_ticks,uint64_t timestamp,
-			uint32_t cardid,int32_t ct,int8_t type,int8_t antid,	
-			int16_t rav,int16_t acc,uint16_t sync_ct,uint16_t rssi)
-		:m_sit(s)
-		 ,m_num_ticks(num_ticks)
-         ,m_loc_time(timestamp)
-        ,m_card_id(cardid)
-        ,m_card_ct(ct)
-        ,m_card_type(type)
-        ,m_ant_id(antid)
-        ,m_rav(rav)
-        ,m_acc(acc)
-        ,m_sync_ct(sync_ct)
-        ,m_rssi(rssi)
-	{}
-	int tool_index()const;
-};
-
-#endif
-

+ 19 - 32
area.cpp

@@ -13,6 +13,7 @@
 #include <boost/algorithm/string/classification.hpp>
 
 #include "area_business.h"
+#include "site_area.h"
 #include"card.h"
 
 template<> std::shared_ptr<area_list> 
@@ -373,8 +374,6 @@ void area_list::init_from_db(int id/*=-1*/)
     init_monkeycar_area(id);
 }
 
-
-#if 0
 //新画禁区功能-给禁区中的卡发送警告及呼叫
 void area_list::CheckAreaType(int area_id,int new_area_type,int old_area_type)
 {
@@ -387,7 +386,7 @@ void area_list::CheckAreaType(int area_id,int new_area_type,int old_area_type)
 }
 void area_list::CheckAreaType( std::shared_ptr<area> pArea,int new_area_type,int old_area_type)
 {
-    if (nullptr == pArea)
+    if (nullptr == pArea && new_area_type == old_area_type)
     {
         return ;
     }
@@ -404,47 +403,36 @@ void area_list::CheckAreaType( std::shared_ptr<area> pArea,int new_area_type,int
         {
             //处理
             point pt(c->x,c->y,c->z);
-            std::shared_ptr<area> point_area = area_list::instance()->get_area(pt);
-            if (point_area == nullptr)
+            int sevid = 0;
+            bool inArea = false;
+            std::vector<std::shared_ptr<area>> point_areas = area_list::instance()->get_area(c->get_site_area()->get_site(),c, pt,sevid);
+            for(std::shared_ptr<area> & p : point_areas)
             {
-                return true;
+                if (p->id() != m_area->id())
+                {
+                    continue;
+                }
+                inArea = true;
+                break;
             }
             //不在区域里
-            if (m_area->m_id != point_area->m_id)
+            if (!inArea)
             {
                 return true;
             }
-
             if (m_area->m_area_type == AREA_TYPE::AREA_TYPE_FORBIDDEN)
             {
                 //发送进入禁区的警告
                 //呼叫
-                std::shared_ptr<area_hover> _area_hover = c->get_area_hover();
-                if (nullptr != _area_hover)
-                {
-                    _area_hover->m_area = m_area;
-                    _area_hover->m_area->on_enter(_area_hover,c);
-                }
+                m_area->on_enter(c->get_area_hover(),c);
             }
-            else
+            if (m_old_area_type == AREA_TYPE::AREA_TYPE_FORBIDDEN)
             {
-                if (m_old_area_type == AREA_TYPE::AREA_TYPE_FORBIDDEN)
-                {
-                    //之前是禁区,改成非禁区
-                    //发送一个离开禁区的警告
-                    //停止呼叫
-                    std::shared_ptr<area_hover> _area_hover = c->get_area_hover();
-                    if (nullptr != _area_hover)
-                    {
-                        _area_hover->m_area->on_leave(_area_hover,c);
-                    }
-                }
-                else
-                {
-                    return  false;
-                }
+                //之前是禁区,改成非禁区
+                //发送一个离开禁区的警告
+                //停止呼叫
+                m_area->on_leave(c->get_area_hover(),c);
             }
-
             return true;
         }
     };
@@ -454,7 +442,6 @@ void area_list::CheckAreaType( std::shared_ptr<area> pArea,int new_area_type,int
     card_list::instance()->accept(lv);
 }
 
-#endif
 std::vector<point> area_list::init_path(std::string &str)
 {
 	if(str.empty())

+ 4 - 2
area.h

@@ -8,6 +8,7 @@
 #include <point.h>
 #include "common.h"
 #include <write-copy.h>
+#include <set>
 
 struct area_hover;
 struct point;
@@ -77,11 +78,11 @@ public:
 	*/
     int m_area_type;
 
-	//人卡超时及超员数量
+	//人卡超时及超员数量(阀值)
     int m_limit_person_second;
     int m_limit_person_count;
 
-	//人卡超时及超员数量
+	//人卡超时及超员数量(阀值)
     int m_limit_vehicle_second;
     int m_limit_vehicle_count;
     double m_scale;
@@ -92,6 +93,7 @@ public:
     ///区域车卡数
     std::atomic<int> m_vehicle_count;
 
+
     //区域速度门限
     double m_over_speed_vehicle;
 };

+ 0 - 3
area_beh.h

@@ -1,3 +0,0 @@
-
-
-

+ 0 - 128
area_business.cpp

@@ -1,134 +1,6 @@
 
 #include <assert.h>
 #include "area_business.h"
-
-#if 0
-#include "area.h"
-#include "card.h"
-#include "ya_event.h"
-#include "module_service/module_call.h"
-/*
-	确定推送人员信息时的区域,每一个明确需要推送的区域,都要推送
-*/
-struct area_business_post_area:area_business
-{
-	virtual int area_business_type()
-	{
-		return 1;
-	}
-	//将推送区域信息加入人员数据
-	virtual void on_enter(const std::shared_ptr<area_hover>&a,const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr){}
-	virtual void on_hover(const std::shared_ptr<area_hover>&a,const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr){}
-	//从人员数据中清除区域信息
-	virtual void on_leave(const std::shared_ptr<area_hover>&a,const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr){}
-};
-
-/*
-	判断车辆超速,确定超速后记录日志、数据库并告警
-	每张卡在每个区域的超速相关的数据信息记录在 area_hover 对象
-	人员&车辆的代码重用,请自行设计
-*/
-struct area_business_speed_checker:area_business
-{
-	struct speed_checker_data:business_data
-	{
-		std::vector<double> speed;
-	};
-
-	virtual int area_business_type()
-	{
-		return 4;
-	
-	}
-
-	//在ptr对象中初始化超速检测所需的对象
-	virtual void on_enter(const std::shared_ptr<area_hover>&a,const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr){}
-	//根据超速检测的策略,进行超速判断,超速时进行告警
-	//建议使用最近M秒内N秒超时进行判断,M=20,N=15,策略数据记录在ptr中..如此:一辆车理想情况下15s才能检测出来。15*4m/s=60mbut.15s内有可能只上来一个超速点。
-	virtual void on_hover(const std::shared_ptr<area_hover>&a,const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr){}
-	//清除超速检测所需的对象
-	virtual void on_leave(const std::shared_ptr<area_hover>&a,const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr){}
-};
-
-
-/*
-	禁区
-*/
-struct area_business_restricted:area_business
-{
-	virtual int area_business_type()
-	{
-
-		return 7;
-	}
-	//记录进入时间等信息,生成告警
-	virtual void on_enter(const std::shared_ptr<area_hover>&a,const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
-	{
-#if 0
-        a->m_enter_point = point(c->x,c->y,c->z);
-        a->m_last_point.set(0,0,0);
-        a->m_last_time = 0;
-        a->m_enter_time = time(nullptr);
-
-        event_ptr evPtr = event_list::instance()->get_event_card(c->m_id,c->m_type,ET_CARD_AREA_FORBIDDEN_PERSON);
-        if (nullptr == evPtr)
-        {
-            event_ptr evPtr = event_list::create_event_card(c->m_id, c->m_type, ET_CARD_AREA_FORBIDDEN_PERSON);
-            event_list::instance()->copy_event(c, evPtr);
-            event_list::instance()->add(evPtr->get_list_id(), evPtr);
-        }
-        evPtr->m_limit_value = 0;
-        evPtr->m_cur_value = 0;
-        evPtr->m_is_display = true;
-        evPtr->m_status = EVENT_STATUS::ES_START ;
-        evPtr->m_cur_time = std::chrono::system_clock::now();
-
-        event_list::save_event(evPtr);
-
-        //呼叫
-        module_call::instance()->system_call_apoint(c->m_id,c->m_type);
-#endif
-
-	}
-	virtual void on_hover(const std::shared_ptr<area_hover>&a,const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr){}
-	//记录退出时间等信息
-	virtual void on_leave(const std::shared_ptr<area_hover>&a,const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
-	{
-#if 0
-        a->m_last_point = point(c->x,c->y,c->z);
-        a->m_last_time = time(nullptr);
-
-        // 发送警告
-        int oldStatus = -1;
-        event_ptr evPtr = event_list::instance()->get_event_card(c->m_id,c->m_type,ET_CARD_AREA_FORBIDDEN_PERSON);
-        if (nullptr == evPtr)
-        {
-            event_ptr evPtr = event_list::create_event_card(c->m_id, c->m_type, ET_CARD_AREA_FORBIDDEN_PERSON);
-            event_list::instance()->copy_event(c, evPtr);
-            event_list::instance()->add(evPtr->get_list_id(), evPtr);
-            oldStatus = EVENT_STATUS::ES_END;
-        } else{
-            if (evPtr->m_status != EVENT_STATUS::ES_END)
-            {
-                oldStatus = EVENT_STATUS::ES_END;
-            }
-        }
-        evPtr->m_limit_value = 0;
-        evPtr->m_cur_value = 0;
-        evPtr->m_is_display = true;
-        evPtr->m_status = EVENT_STATUS::ES_END ;
-        evPtr->m_cur_time = std::chrono::system_clock::now();
-        if (oldStatus != -1)
-        {
-            event_list::save_event(evPtr);
-        }
-        //取消呼叫
-        module_call::instance()->system_cancel_call_apoint(c->m_id,c->m_type);
-#endif
-    }
-};
-#endif
-
 #include "area_business_car_attendance.h"
 #include "area_business_card_enter_or_leave.h"
 #include "area_business_count_checker.h"

+ 0 - 1
card.cpp

@@ -17,7 +17,6 @@
 #include "area.h"
 #include "card.h"
 #include "mine_business.h"
-#include "mine_module/MineCardManager.h"
 
 extern config_file config;
 void card_list::init_staffer(int64_t id64)

+ 1 - 0
event.h

@@ -41,6 +41,7 @@ enum EVENT_TYPE{ // 事件类型
     ET_READER_ERROR = 6,
     ET_CARD_LOW_POWER_SERIOUS = 12, // 电量极低
     ET_CARD_OVER_TIME_PERSON = 13, // 人员井下超时
+    ET_CARD_OVER_TIME_VEHICLE = 14, // 车辆井下超时
     ET_CARD_AREA_OVER_TIME_PERSON = 15, // 人员区域超时
     ET_CARD_AREA_OVER_TIME_VEHICLE = 16, // 车辆区域超时
 

+ 0 - 1
mine.cpp

@@ -1,7 +1,6 @@
 #include "mine.h"
 #include "common_tool.h"
 #include"tool_time.h"
-#include "mine_module/MineCardManager.h"
 
 void mine_tool::on_point(uint32_t card_id, int32_t type, int vehicle_category_id)
 {

+ 0 - 179
mine_module/MineCardManager.cpp

@@ -1,179 +0,0 @@
-#include "MineCardManager.h"
-#include "ya_setting.h"
-#include "common_tool.h"
-#include "mine.h"
-#include "event.h"
-#include "tool_time.h"
-
-CMineCardManager::CMineCardManager()
-{
-    m_minecards = std::make_shared<mine_card_info>();
-}
-
-std::shared_ptr<mine_card_info> CMineCardManager::GetMineCards() 
-{
-    return m_minecards;
-}
-
- /**
- * @brief 获取事件ID
- **/
-bool CMineCardManager::Exist(SET_CARDID &list,uint64_t id)
-{
-    return !(list.end() == list.find(id));
-}
-
-bool CMineCardManager::Exist(SET_CARDID &list,int card_id,int card_type)
-{
-    return Exist(list,tool_other::type_id_to_u64(card_type,card_id));
-}
-/**
- * @brief 人员下井
- * @param card 卡
- **/
-void CMineCardManager::OnPersonDown(std::shared_ptr<card> card,bool bInit/* = false*/)
-{
-    if (nullptr == card)
-    {
-        return ;
-    }
-     //设置卡的状态
-    card->m_is_attendance = EAttendanceState::MineDown;
-   
-    uint64_t key = tool_other::type_id_to_u64(card->m_id,card->m_type);
-    if (this->Exist(m_minecards->m_down_person,key))
-    {
-        return ;
-    }   
-     //移除升井中的状态
-    m_minecards->m_up_person.erase(key);
-    //加入到井下列表中
-    m_minecards->m_down_person.insert(key);
-    if(!bInit)
-    {
-        //井下超员判断
-        this->OnPersonOvercrowdingWarning();
-    }
-}
-    /**
- * @brief 人员升井
- * @param card 卡
- **/
-void CMineCardManager::OnPersonUp(std::shared_ptr<card> card)
-{
-    if (nullptr == card)
-    {
-        return ;
-    }
-    card->m_is_attendance = EAttendanceState::MineUp;
-    uint64_t key = tool_other::type_id_to_u64(card->m_id,card->m_type);
-    if (this->Exist(m_minecards->m_up_person,key))
-    {
-        return ;
-    }   
-     //移除井下列表
-    m_minecards->m_down_person.erase(key);
-    //加入到升井列表中
-    m_minecards->m_up_person.insert(key);
-    
-    int max_person = CYaSetting::m_sys_setting.over_count_person;
-    //井下超员判断--取消
-    if (max_person != 0 && (int)m_minecards->m_down_person.size() < max_person )
-    {
-        event_tool::instance()->handle_event(OT_MINE,EVENT_TYPE::ET_OVER_COUNT_PERSON,0,max_person,(int)m_minecards->m_down_person.size(),false);
-    }
-    
-}
-
-/**
- * @brief 人员超员警告
-**/
-void CMineCardManager::OnPersonOvercrowdingWarning()
-{
-    int max_person = CYaSetting::m_sys_setting.over_count_person;
-    //井下超员判断
-    if (max_person != 0 && (int)m_minecards->m_down_person.size() > max_person )
-    {
-        std::string log = "";
-        for (uint64_t id : m_minecards->m_down_person)
-        {
-            std::shared_ptr<card_location_base> pitcard = card_list::instance()->get(id);
-            if (nullptr != pitcard)
-            {
-                log += tool_other::type_id_to_str(pitcard->m_type,pitcard->m_id);
-                log += "&";
-            }
-        }
-        //打印日志
-        log_info("[lemon mp_card_list_down_person:]:%s",log.c_str());
-        event_tool::instance()->handle_event(OT_MINE,EVENT_TYPE::ET_OVER_COUNT_PERSON,0,max_person,(int)m_minecards->m_down_person.size(),true);
-    }
-}
-
-/**
-* @brief 人员井下超时
-**/
-void CMineCardManager::OnPersonInMineOverTime(int card_id,int card_type)
-{
-    std::shared_ptr<card_location_base> card = card_list::instance()->get(tool_other::type_id_to_u64(card_type, card_id));
-    if (nullptr == card)
-    {
-        return ;
-    }
-
-    std::shared_ptr<mine_tool> mine = card->get_mine_tool();
-    if(nullptr == mine )
-    {
-        return ;
-    }
-    int sec= tool_time::to_ms(std::chrono::system_clock::now()) - mine->get_work_time();
-    if (!mine->m_is_overtime && sec > (int)CYaSetting::m_sys_setting.over_time_person)
-    {
-        //人员超时
-        mine->m_is_overtime = true;
-        mine->m_overtime = std::chrono::system_clock::now();
-    }
-    else if (mine->m_is_overtime && sec < (int)CYaSetting::m_sys_setting.over_time_person)
-    {
-        mine->m_is_overtime = false;
-        mine->m_overtime = std::chrono::system_clock::now();
-    }
-    else
-    {
-        return ;
-    }
-
-    // 发送警告
-    event_tool::instance()->handle_event(OT_MINE,EVENT_TYPE::ET_CARD_OVER_TIME_PERSON,0,0,0, mine->m_is_overtime);
-    log_info("OnPersonInMineOverTime: send Event=ET_CARD_OVER_TIME_PERSON card=id,eventState=%d",card->m_id, mine->m_is_overtime);
-}
-    /**
- * @brief 车下井
- * @param card 卡
- **/
-void CMineCardManager::OnVehicleDown(std::shared_ptr<card> card,bool bInit/* = false*/)
-{
-    if (nullptr == card)
-    {
-        return ;
-    }
-}
-    /**
- * @brief 车升井
- * @param card 卡
- **/
-void CMineCardManager::OnVehicleUp(std::shared_ptr<card> card)
-{
-    if (nullptr == card)
-    {
-        return ;
-    }
-}
-
- /**
- * @brief 车辆超员警告
- **/
-void CMineCardManager::OnVehicleOvercrowdingWarning()
-{
-
-}

+ 0 - 71
mine_module/MineCardManager.h

@@ -1,71 +0,0 @@
-/*
-** 井中卡的数据:人员下井 ,人员升进,车下井升井数据
-** 对应的操作,井下人员超时,井下超员等
-*/
-#ifndef __MINECARDMANAGER_H
-#define __MINECARDMANAGER_H
-
-#include "minestruct.h"
-#include "card.h"
-
-//井下警告类型数量
-#define MAX_MINE_EVENT_NUM 3
-
-class CMineCardManager 
-{
-private:
-    CMineCardManager();
-
-private:
-    std::shared_ptr<mine_card_info> m_minecards;
-
-private:
-    /**
-     * @brief 判断是否已存在
-     **/
-    bool Exist(SET_CARDID &list,uint64_t id);
-    bool Exist(SET_CARDID &list,int card_id,int card_type);
-public:
-    //TODO: 获取信息
-    std::shared_ptr<mine_card_info> GetMineCards() ;
-    /**
-     * @brief 人员下井,超员警告
-     * @param card 卡
-     * @param bInit 是否初始化(程序启动加载井下人员)
-     **/
-    void OnPersonDown(std::shared_ptr<card> card,bool bInit = false);
-     /**
-     * @brief 人员升井,取消超员警告
-     * @param card 卡
-     **/
-    void OnPersonUp(std::shared_ptr<card> card);
-     /**
-     * @brief 人员超员警告
-     **/
-    void OnPersonOvercrowdingWarning();
-
-    /**
-     * @brief 人员井下超时
-     **/
-    void OnPersonInMineOverTime(int card_id,int card_type);
-public:
-     /**
-     * @brief 车下井 ,车辆超员警告
-     * @param card 卡
-     * @param bInit 是否初始化(程序启动加载井下车辆)
-     **/
-    void OnVehicleDown(std::shared_ptr<card> card,bool bInit = false);
-     /**
-     * @brief 车升井,车辆超员警告取消
-     * @param card 卡
-     **/
-    void OnVehicleUp(std::shared_ptr<card> card);
-    /**
-     * @brief 车辆超员警告
-     **/
-    void OnVehicleOvercrowdingWarning();
-
-
-};
-
-#endif //__MINECARDMANAGER_H

+ 0 - 16
mine_module/minestruct.h

@@ -1,16 +0,0 @@
-#pragma once
-
-#include <set>
-#include <stdint.h>
-
-// 卡在card_list的掩码由
-typedef std::set<uint64_t> SET_CARDID;
-
-struct mine_card_info
-{
-    SET_CARDID m_down_vehicle; // 井下车辆
-    SET_CARDID m_up_vehicle; // 升井车辆
-	SET_CARDID m_down_person;  // 井下人员
-	SET_CARDID m_up_person; // 升井人员
-	SET_CARDID m_down_adhoc;   //井下自组网卡
-};

+ 71 - 5
module_service/area_business_count_checker.cpp

@@ -1,6 +1,8 @@
 #include "area.h"
 #include "card_base.h"
-
+#include "common_tool.h"
+#include "log.h"
+#include "event.h"
 #include "area_business_count_checker.h"
 /*
 	判断当前区域a中的人数是否超过设定人数,超过后告警
@@ -11,8 +13,44 @@
 void area_business_count_checker::on_enter(const std::shared_ptr<area_hover>&a,
 						const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data>&ptr)
 {
-
-
+    if (nullptr == a->m_area)
+    {
+        return ;
+    }
+	EVENT_TYPE ev = EVENT_TYPE::ET_OVER_COUNT_PERSON;
+	int limitVal = 0;
+	int curVal = 0;
+	//uint64_t key = tool_other::type_id_to_u64(c->m_id,c->m_type);
+	if (c->is_person())
+	{
+		a->m_area->m_person_count ++ ;
+		limitVal = a->m_area->m_limit_person_count;
+		curVal = a->m_area->m_person_count;
+		ev = a->m_area->is_mine()?EVENT_TYPE::ET_OVER_COUNT_PERSON : EVENT_TYPE::ET_AREA_OVER_COUNT_PERSON ;
+	}
+	else if (c->is_vehicle())
+	{
+		a->m_area->m_vehicle_count ++ ;
+		limitVal = a->m_area->m_limit_vehicle_count;
+		curVal = a->m_area->m_vehicle_count;
+		ev = a->m_area->is_mine()?EVENT_TYPE::ET_OVER_COUNT_VEHICLE : EVENT_TYPE::ET_AREA_OVER_COUNT_VEHICLE ;
+	}
+	if(curVal > limitVal)
+	{
+		// 超员告警
+		/*std::string log = "";
+		for (uint64_t id : a->m_area->m_person_list)
+		{
+			log += tool_other::get_string_cardid(id);
+			log += "&";
+		}
+		//打印日志
+		log_info("[lemon mp_card_list_down_person:]:%s",log.c_str());
+		*/
+		event_tool::instance()->handle_event(a->m_area->is_mine()? OT_MINE : OT_AREA,ev,0,limitVal,curVal,true);
+		log_info("area_business_count_checker::on_enter : Event OVER_COUNT=%d AreaId=%d,Limit=%d,CurNum=%d"
+		            ,ev,a->m_area->id(),limitVal,curVal);
+	}
 }
 
 void area_business_count_checker::on_hover(const std::shared_ptr<area_hover>&a,
@@ -26,7 +64,35 @@ void area_business_count_checker::on_hover(const std::shared_ptr<area_hover>&a,
 void area_business_count_checker::on_leave(const std::shared_ptr<area_hover>&a,
 						const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
 {
-
-
+    if (nullptr == a->m_area)
+    {
+        return ;
+    }
+	int limitVal = 0;
+	int curVal = 0;
+	EVENT_TYPE ev = EVENT_TYPE::ET_OVER_COUNT_PERSON;
+	if (c->is_person())
+	{
+		a->m_area->m_person_count -- ;
+		limitVal = a->m_area->m_limit_person_count;
+		curVal = a->m_area->m_person_count;
+		ev = a->m_area->is_mine()?EVENT_TYPE::ET_OVER_COUNT_PERSON : EVENT_TYPE::ET_AREA_OVER_COUNT_PERSON ;
+	}
+	else if (c->is_vehicle())
+	{
+		a->m_area->m_vehicle_count -- ;
+		limitVal = a->m_area->m_limit_vehicle_count;
+		curVal = a->m_area->m_vehicle_count;
+		ev = a->m_area->is_mine()?EVENT_TYPE::ET_OVER_COUNT_VEHICLE : EVENT_TYPE::ET_AREA_OVER_COUNT_VEHICLE ;
+	}
+	else{
+		return ;
+	}
+	if(curVal + 1 >= limitVal && curVal < limitVal)
+	{
+        log_info("area_business_count_checker::on_leave :Cancel Event OVER_COUNT=%d AreaId=%d,Limit=%d,CurNum=%d"
+        ,ev,a->m_area->id(),limitVal,curVal);
+		event_tool::instance()->handle_event(a->m_area->is_mine()? OT_MINE : OT_AREA,ev,a->m_area->id(),limitVal,curVal,false);
+	}
 }
 

+ 7 - 0
module_service/area_business_forbid.cpp

@@ -5,6 +5,7 @@
 #include"common_tool.h"
 #include"area.h"
 #include "card.h"
+#include "module_call.h"
 
 struct forbid_data:business_data
 {
@@ -29,6 +30,9 @@ void area_business_forbid::on_enter(const std::shared_ptr<area_hover>&a,
 
     uint64_t id = tool_other::type_id_to_u64(card_ptr->m_type, card_ptr->m_id);
     event_tool::instance()->handle_event(OT_CARD, ev_type, id, 0, 0, true);
+
+    //呼叫
+    module_call::instance()->system_call_apoint(card_ptr->m_id,card_ptr->m_type);
 }
 
 void area_business_forbid::on_hover(const std::shared_ptr<area_hover>&a,const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
@@ -48,6 +52,9 @@ void area_business_forbid::on_leave(const std::shared_ptr<area_hover>&a,
 
     uint64_t id = tool_other::type_id_to_u64(card_ptr->m_type, card_ptr->m_id);
     event_tool::instance()->handle_event(OT_CARD, ev_type, id, 0, 0, false);
+
+    //取消呼叫
+    module_call::instance()->system_cancel_call_apoint(card_ptr->m_id,card_ptr->m_type);
 }
 
 

+ 40 - 6
module_service/area_business_person_dwell_checker.cpp

@@ -1,7 +1,9 @@
 
 #include "area.h"
 #include "card_base.h"
-
+#include "event.h"
+#include "tool_time.h"
+#include "common_tool.h"
 #include "area_business_person_dwell_checker.h"
 /*
 	判断当前区域a中的人卡停留时间
@@ -14,8 +16,8 @@
 void area_business_person_dwell_checker::on_enter(const std::shared_ptr<area_hover>&a,
 							const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data>&ptr)
 {
-
-
+	a->m_enter_point.set(c->x,c->y,c->z);
+	a->m_enter_time = tool_time::now_to_ms();
 }
 
 
@@ -23,8 +25,28 @@ void area_business_person_dwell_checker::on_enter(const std::shared_ptr<area_hov
 void area_business_person_dwell_checker::on_hover(const std::shared_ptr<area_hover>&a,
 							const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
 {
-
-
+	double limit_val = 0;
+	double cur_val = (tool_time::now_to_ms() - a->m_enter_time)/1000;
+	EVENT_TYPE evType = EVENT_TYPE::ET_CARD_AREA_OVER_TIME_PERSON;
+	if(c->is_person())
+    {
+	    if (a->m_area->m_limit_person_second > cur_val)
+        {
+	        return;
+        }
+	    evType = a->m_area->is_mine() ? EVENT_TYPE::ET_CARD_OVER_TIME_PERSON : EVENT_TYPE::ET_CARD_AREA_OVER_TIME_PERSON;
+	    limit_val = a->m_area->m_limit_person_second;
+    }
+	else if (c->is_vehicle())
+    {
+	    return ;
+    }
+	else
+    {
+        return;
+    }
+    uint64_t id = tool_other::type_id_to_u64(c->m_type, c->m_id);
+    event_tool::instance()->handle_event(OT_CARD,evType,id,limit_val,cur_val,true);
 }
 
 
@@ -32,7 +54,19 @@ void area_business_person_dwell_checker::on_hover(const std::shared_ptr<area_hov
 void area_business_person_dwell_checker::on_leave(const std::shared_ptr<area_hover>&a,
 							const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
 {
-
+	a->m_enter_point.set(c->x,c->y,c->z);
+	a->m_enter_time = time(nullptr);
+    EVENT_TYPE evType = EVENT_TYPE::ET_CARD_AREA_OVER_TIME_PERSON;
+    if(c->is_person())
+    {
+        evType = a->m_area->is_mine() ? EVENT_TYPE::ET_CARD_OVER_TIME_PERSON : EVENT_TYPE::ET_CARD_AREA_OVER_TIME_PERSON;
+    }
+    else
+    {
+        return ;
+    }
+    uint64_t id = tool_other::type_id_to_u64(c->m_type, c->m_id);
+    event_tool::instance()->handle_event(OT_CARD,evType,id,0,0,true);
 
 }
 

+ 0 - 89
site_message_handle.cpp

@@ -1,89 +0,0 @@
-//
-// Created by Administrator on 2019/1/14.
-//
-
-#include "site_message_handle.h"
-#include "system_basic_info/SystemAnalysis.h"
-#include "common_tool.h"
-#include "ant.h"
-#include "event.h"
-
-site_message_handle::site_message_handle()
-{
-    m_time_last_rec = 0;
-}
-/** 解析 分站发送过来的数据中(分站的信息数据)*/
-void site_message_handle::parse_data_locate_reader(int msgId,const message_siteinfo &loc ,bool bHistroy)
-{
-    LOCATION_SYSTEM_BRANCH(LOCATION_SYSTEM_BRANCH_15);
-
-    std::shared_ptr<site> pSite = sit_list::instance()->get(loc.m_site_id);
-    //bool isErrorReader = false;
-    if(pSite){
-        //add_socket_to_list(dwConnID, reader_id, DEVICE_TYPE::DT_CARD_READER);
-        LOCATION_SYSTEM_BRANCH(LOCATION_SYSTEM_BRANCH_16);
-    }else{
-        pSite = std::make_shared<site>();
-        pSite->m_id = loc.m_site_id;
-        LOCATION_SYSTEM_BRANCH(LOCATION_SYSTEM_BRANCH_17);
-    }
-
-    // 接收数据时间
-    pSite->m_rec_time = time(NULL);
-    m_time_last_rec = pSite->m_rec_time; // 更新最后信号时间
-    // 分站时间戳
-    pSite->m_tick_count = loc.m_time_stamp;
-    // 分站时间
-    // 7字节 从第一个字节开始,分别表示秒、分、时、天、周、月、年
-    struct tm reader_time;
-    reader_time.tm_sec = loc.m_sec;
-    reader_time.tm_min = loc.m_min;
-    reader_time.tm_hour = loc.m_hour;
-    reader_time.tm_mday = loc.m_day;
-    reader_time.tm_wday = loc.m_week;
-    reader_time.tm_mon = loc.m_mon - 1;
-    reader_time.tm_year = loc.m_year + 100;  // + 2000 - 1900
-    pSite->m_time = mktime(&reader_time);
-
-    //改为大小分站信息,最高位第7位表示大小分站,1表示大分站,0表示小分站
-    //高6位表示分站(大或小)在大分站的左侧或右侧,1代表在大分站的左侧,0表示在大分站的右侧
-    //高5位预留位,用于区分是读卡分站还是大小分站
-    uint8_t reader_type = loc.m_site_relation >>7;			//大小分站的区别
-    uint8_t reader_dir = (loc.m_site_relation >>6)&0x01;
-    uint8_t reader_type_locate = (loc.m_site_relation >>5)&0x01;	//大小分站与读卡分站的区别
-    uint8_t relay_counts = loc.m_site_relation&0x0F;
-    pSite->m_reader_dir = reader_dir;
-    pSite->m_relay_counts = relay_counts;
-
-    reader_power_battery_alarm(loc.m_site_id,loc.m_site_power);
-
-    log_info("id:%d, n:%d, %.2d-%.2d-%.2d %.2d:%.2d:%.2d, sta: %d,reader_power: %d"
-             ",reader_type: %d,is_big_reader: %d,is_left: %d, counts: %d",
-                  loc.m_site_id, loc.m_time_stamp, loc.m_year, loc.m_mon, loc.m_day\
-                  , loc.m_hour, loc.m_min,loc.m_sec\
-                  , loc.m_site_state,loc.m_site_power,reader_type_locate,reader_type,reader_dir,relay_counts);/*tep:%d,*/
-
-
-}
-
-void site_message_handle::reader_power_battery_alarm(unsigned int site_id, int powerType)
-{
-    std::shared_ptr<site> pSite = sit_list::instance()->get(site_id);
-    if (pSite == nullptr || !pSite->m_needpower_alarm)
-    {
-        return ;//如果分站不需要电池供电告警,
-    }
-    double limitVal = time(NULL);
-    if (powerType != pSite->m_powerType && pSite->m_powerType == 1)
-    {
-        //交流电 变成直流电(掉电),发送警告
-        event_tool::instance()->handle_event(OT_DEVICE_READER,ET_READER_POWER_BY_BATTERY,0,limitVal,powerType,true);
-    }
-    else if (powerType != pSite->m_powerType && pSite->m_powerType != 1)
-    {
-        //直流电 变成交流电,取消警告
-        event_tool::instance()->handle_event(OT_DEVICE_READER,ET_READER_POWER_BY_BATTERY,0,limitVal,powerType,false);
-    }
-    log_info("[event warning: reader power supply by battery] reader_id: Power %d->%d.",site_id,pSite->m_powerType,powerType);
-    pSite->m_powerType = powerType;
-}

+ 0 - 38
site_message_handle.h

@@ -1,38 +0,0 @@
-//
-// Created by Administrator on 2019/1/14.
-// 分站发生消息到采集服务器的消息处理
-//
-#ifndef WORKSPACE_SITE_MESSAGE_HANDLE_H
-#define WORKSPACE_SITE_MESSAGE_HANDLE_H
-
-#include "module_service/module_singleton_base.h"
-#include "message.h"
-
-class site_message_handle : public singleton_base<site_message_handle>
-{
-private:
-    friend class singleton_base<site_message_handle>;
-
-    site_message_handle();
-
-public:
-    // 最后接收分站消息的时间
-    time_t m_time_last_rec;
-
-public:
-    /** 解析 分站发送过来的数据中(分站的信息数据)
-     * @param msgId      接收消息ID
-     * @param loc        接收数据
-     * @param bHistroy   是否历史数据
-     * @return
-     */
-    void parse_data_locate_reader(int msgId,const message_siteinfo &loc ,bool bHistroy);
-    /**
-     * 分站电源是否已切换直流电,发送警告
-     * @param site_id
-     * @param powerType
-     */
-    void reader_power_battery_alarm(unsigned int site_id, int powerType);
-};
-
-#endif //WORKSPACE_SITE_MESSAGE_HANDLE_H

+ 0 - 1
worker.cpp

@@ -13,7 +13,6 @@
 #include "card_base.h"
 #include "card.h"
 #include "zloop.h"
-#include "site_message_handle.h"
 
 struct hash_thread
 {