Quellcode durchsuchen

fix anti-coll event

zhuyf vor 3 Jahren
Ursprung
Commit
c377125495

+ 4 - 3
card_car.cpp

@@ -113,9 +113,10 @@ void car::handle_anti_coll(const point& pt, const int& sid)
     }
 
     std::string desc = "";
-    if(cards.size() == 0){
+	uint64_t id = tool_other::type_id_to_u64(m_type, m_id);
+ 	if(cards.size() == 0){
         // delete event from event_list
-        event_tool::instance()->handle_event(OT_CARD, ET_PERSON_VEHICLE_ANTI_COLLISION, m_id, 0, 0, false);
+        event_tool::instance()->handle_event(OT_CARD, ET_PERSON_VEHICLE_ANTI_COLLISION, id, 0, 0, false);
     }else{
         size_t i = 0;
         for(auto c : cd)
@@ -130,7 +131,7 @@ void car::handle_anti_coll(const point& pt, const int& sid)
             ++i;
         }
         log_info("[anti_coll] the distance's list between person and vehicle : %s", desc.c_str());
-        event_tool::instance()->handle_event(OT_CARD, ET_PERSON_VEHICLE_ANTI_COLLISION, m_id, min_d, cur_v, true, DT_COMMON, desc);
+		event_tool::instance()->handle_event(OT_CARD, ET_PERSON_VEHICLE_ANTI_COLLISION, id, min_d, cur_v, true, DT_COMMON, desc);
     }
 
     if(cards.size() > 0){

+ 5 - 2
module_service/module_call.cpp

@@ -91,11 +91,14 @@ void module_call::run()
     //转发给web
     //swsClientMgr.send(JSON_CMD_VALUE_PUSH, to_call_card_list_json(arr));
 
-    std::string ac = get_json_anti_collision();
+	// 获得pv_anti_collision告警json
+    /*
+	std::string ac = get_json_anti_collision();
     if(!ac.empty()){
         log_info("send2web: %s", ac.c_str());
         swsClientMgr.send(JSON_CMD_VALUE_PUSH, ac);
     }
+	*/
 
     //将呼叫命令发送给标识卡终端
     call_site_map site_map;
@@ -822,7 +825,7 @@ void module_call::send_anti_collision(const std::map<int, call_card>& cards)
 
     call_site_map site_map;
     get_site_map(vt_cards, site_map);
-    log_info("[anti_coll] site's size = %d", site_map.size());
+    //log_info("[anti_coll] site's size = %d", site_map.size());
     if(!site_map.empty()){
         send_to_sites(site_map);
     }

+ 6 - 1
module_service/module_other_alarm.cpp

@@ -13,7 +13,12 @@
  * */
 void module_other_alarm::power_lower_serious(std::shared_ptr<card_location_base> card_ptr)
 {
-    uint64_t id = tool_other::type_id_to_u64(card_ptr->m_type, card_ptr->m_id);
+    //如果车辆,不提供电量极低报警
+	if(card_ptr->m_type == CT_VEHICLE){
+		return;
+	}
+
+	uint64_t id = tool_other::type_id_to_u64(card_ptr->m_type, card_ptr->m_id);
     event_tool::instance()->handle_event(OT_CARD, ET_CARD_LOW_POWER_SERIOUS, id, 0, 0, true);
 }
 

+ 2 - 2
module_service/module_web.cpp

@@ -120,10 +120,10 @@ void module_web::response_login()
     }*/
 
     // 防碰撞告警
-    str = module_call::instance()->get_json_anti_collision();
+    /*str = module_call::instance()->get_json_anti_collision();
     if(!str.empty()){
         tool_json::push_back(nodes, str, allocator);
-    }
+    }*/
 
     if(nodes.Size()>0)
     {