Browse Source

同步主干代码,修改告警文件

chensongchao 6 years ago
parent
commit
f47437887c
7 changed files with 15 additions and 12 deletions
  1. 1 1
      area.h
  2. 1 1
      area_business.cpp
  3. 4 2
      event.h
  4. 0 1
      main_test.h
  5. 2 1
      mine_business.cpp
  6. 4 4
      mine_module/MineCardManager.cpp
  7. 3 2
      site_message_handle.cpp

+ 1 - 1
area.h

@@ -144,7 +144,7 @@ struct area_hover
         landmark_dis=0;
     }
 
-	std::shared_ptr<business_data> get_business_data(int type)
+	std::shared_ptr<business_data> &get_business_data(int type)
 	{
 		if(type>=(int)m_data.size())
 		{

+ 1 - 1
area_business.cpp

@@ -2,7 +2,7 @@
 #include <assert.h>
 #include "area_business.h"
 
-#ifdef 0
+#if 0
 #include "area.h"
 #include "card.h"
 #include "ya_event.h"

+ 4 - 2
event.h

@@ -34,11 +34,13 @@ enum OBJECT_TYPE
 };
 
 enum EVENT_TYPE{ // 事件类型
+    ET_OVER_COUNT_PERSON = 1,       // 井下人员超员
+    ET_OVER_COUNT_VEHICLE = 2,      // 井下车辆超员
     ET_AREA_OVER_COUNT_PERSON = 3,	// 区域人员超员
     ET_AREA_OVER_COUNT_VEHICLE = 4,	// 区域车辆超员
     ET_READER_ERROR = 6,
     ET_CARD_LOW_POWER_SERIOUS = 12, // 电量极低
-
+    ET_CARD_OVER_TIME_PERSON = 13, // 人员井下超时
     ET_CARD_AREA_OVER_TIME_PERSON = 15, // 人员区域超时
     ET_CARD_AREA_OVER_TIME_VEHICLE = 16, // 车辆区域超时
 
@@ -49,7 +51,7 @@ enum EVENT_TYPE{ // 事件类型
     ET_CARD_HELP = 24, // 人员呼救
 
     ET_CARD_MOTIONLESS=32,//静止不动告警
-
+    ET_READER_POWER_BY_BATTERY=33,//分站电池:1为电池供电,0为交流电供电,当电池供电需要告警
     ET_VEHICLE_NEAR_GEOFAULT=38,//靠近断层告警
 
     CARD_EVENT_COUNT_MAX

+ 0 - 1
main_test.h

@@ -1,7 +1,6 @@
 #pragma once 
 
 #include "db_api/CDBSingletonDefine.h"
-#include"module_service/module_area.h"
 #include"module_service/module_mgr.h"
 
 void test_find_path(const point&p1,const point&p2)

+ 2 - 1
mine_business.cpp

@@ -7,12 +7,13 @@
 #include "mine_business.h"
 #include "log.h"
 #include "point.h"
-#include "db/db_api/CDBConnPool.h"
+#include "db/db_api/CDBSingletonDefine.h"
 #include "db/db_tool.h"
 #include "common_tool.h"
 #include "ant.h"
 #include "ya_setting.h"
 #include "card_path.h"
+#include "card.h"
 struct card_sensor
 {
 	card_sensor(int32_t wid,const point &p,const std::string &cid)

+ 4 - 4
mine_module/MineCardManager.cpp

@@ -77,7 +77,8 @@ void CMineCardManager::OnPersonUp(std::shared_ptr<card> card)
     //井下超员判断--取消
     if (max_person != 0 && (int)m_minecards->m_down_person.size() < max_person )
     {
-        this->CancelEvent(EVENT_TYPE::ET_OVER_COUNT_PERSON,(int)m_minecards->m_down_person.size());
+        event_tool::instance()->handle_event(OT_MINE,EVENT_TYPE::ET_OVER_COUNT_PERSON,0,max_person,(int)m_minecards->m_down_person.size(),false);
+        //this->CancelEvent(EVENT_TYPE::ET_OVER_COUNT_PERSON,(int)m_minecards->m_down_person.size());
     }
     
 }
@@ -103,8 +104,7 @@ void CMineCardManager::OnPersonOvercrowdingWarning()
         }
         //打印日志
         log_info("[lemon mp_card_list_down_person:]:%s",log.c_str());
-        event_tool::instance()->handle_event(0,EVENT_TYPE::ET_OVER_COUNT_PERSON,max_person,(double)m_minecards->m_down_person.size(),true);
-        //this->StartEvent(EVENT_TYPE::ET_OVER_COUNT_PERSON,max_person,(int)m_minecards->m_down_person.size());
+        event_tool::instance()->handle_event(OT_MINE,EVENT_TYPE::ET_OVER_COUNT_PERSON,0,max_person,(int)m_minecards->m_down_person.size(),true);
     }
 }
 
@@ -142,7 +142,7 @@ void CMineCardManager::OnPersonInMineOverTime(int card_id,int card_type)
     }
 
     // 发送警告
-    event_tool::instance()->handle_event(0,EVENT_TYPE::ET_CARD_OVER_TIME_PERSON,0,0, mine->m_is_overtime);
+    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);
 }
     /**

+ 3 - 2
site_message_handle.cpp

@@ -73,15 +73,16 @@ void site_message_handle::reader_power_battery_alarm(unsigned int site_id, int p
     {
         return ;//如果分站不需要电池供电告警,
     }
+    double limitVal = time(NULL);
     if (powerType != pSite->m_powerType && pSite->m_powerType == 1)
     {
         //交流电 变成直流电(掉电),发送警告
-        event_tool::instance()->handle_event(site_id,ET_READER_POWER_BY_BATTERY,0,powerType,true);
+        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(site_id,ET_READER_POWER_BY_BATTERY,0,powerType,false);
+        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;