|
@@ -26,7 +26,7 @@ struct Event
|
|
|
Event(OBJECT_TYPE oid)
|
|
|
:m_oid(oid)
|
|
|
{}
|
|
|
- void handle_alarm_event(EVENT_TYPE et,uint64_t id,double limit_value,double cur_value,bool f);
|
|
|
+ void handle_alarm_event(EVENT_TYPE et,uint64_t id,double limit_value,double cur_value,bool f,const std::string &desc="");
|
|
|
virtual std::shared_ptr<ya_event> on_message(EVENT_TYPE et,uint64_t id,bool f)=0;
|
|
|
std::shared_ptr<ya_event> create_event(std::string obj_id,EVENT_TYPE ev_type);
|
|
|
virtual ~Event(){}
|
|
@@ -73,9 +73,9 @@ void event_tool::make_event_object()
|
|
|
m_map[OT_CARD] = std::make_shared<card_event>();
|
|
|
}
|
|
|
|
|
|
-void event_tool::handle_event(OBJECT_TYPE ot,EVENT_TYPE et,uint64_t id,double limit_value,double cur_value,bool f)
|
|
|
+void event_tool::handle_event(OBJECT_TYPE ot,EVENT_TYPE et,uint64_t id,double limit_value,double cur_value,bool f,const std::string &desc/*=""*/)
|
|
|
{
|
|
|
- m_map[ot]->handle_alarm_event(et,id,limit_value,cur_value,f);
|
|
|
+ m_map[ot]->handle_alarm_event(et,id,limit_value,cur_value,f,desc);
|
|
|
}
|
|
|
|
|
|
std::shared_ptr<ya_event> Event::create_event(std::string obj_id,EVENT_TYPE ev_type)
|
|
@@ -87,7 +87,7 @@ std::shared_ptr<ya_event> Event::create_event(std::string obj_id,EVENT_TYPE ev_t
|
|
|
return ev_ptr;
|
|
|
}
|
|
|
|
|
|
-void Event::handle_alarm_event(EVENT_TYPE et,uint64_t id,double limit_value,double cur_value,bool f)
|
|
|
+void Event::handle_alarm_event(EVENT_TYPE et,uint64_t id,double limit_value,double cur_value,bool f,const std::string &desc/*=""*/)
|
|
|
{
|
|
|
std::shared_ptr<ya_event> ev_ptr = nullptr;
|
|
|
uint64_t eid = event_list::to_list_id(et,m_oid,id);
|
|
@@ -102,9 +102,17 @@ void Event::handle_alarm_event(EVENT_TYPE et,uint64_t id,double limit_value,doub
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- ev_ptr=on_message(et,id,f);
|
|
|
+ uint64_t _id=id;
|
|
|
+ log_info("Create_Event:desc[%s],id:%d,et:%d",desc.c_str(),id,et);
|
|
|
+ if(et == ET_READER_LOCATION_REVERSAL&&!desc.empty())
|
|
|
+ {
|
|
|
+ std::string cardid = desc.substr(0,desc.find_first_of('&'));
|
|
|
+ _id = tool_other::card_id_to_u64(cardid);
|
|
|
+ }
|
|
|
+ ev_ptr=on_message(et,_id,f);
|
|
|
ev_ptr->m_cur_value=cur_value;
|
|
|
ev_ptr->m_limit_value=limit_value;
|
|
|
+ ev_ptr->m_desc=desc;
|
|
|
//保存告警信息
|
|
|
event_list::instance()->add(eid,ev_ptr);
|
|
|
}
|
|
@@ -117,6 +125,7 @@ void Event::handle_alarm_event(EVENT_TYPE et,uint64_t id,double limit_value,doub
|
|
|
event_ptr->m_cur_time = std::chrono::system_clock::now();
|
|
|
event_ptr->m_status = ES_END;
|
|
|
event_ptr->m_cur_value = cur_value;
|
|
|
+ ev_ptr->m_desc=desc;
|
|
|
event_ptr->m_is_sent=false;
|
|
|
ev_ptr=event_ptr;
|
|
|
}
|
|
@@ -200,17 +209,17 @@ std::shared_ptr<ya_event> card_event::on_message(EVENT_TYPE et,uint64_t id,bool
|
|
|
event_ptr->x = card_ptr->x;
|
|
|
event_ptr->y = card_ptr->y;
|
|
|
event_ptr->m_is_display = card_ptr->m_display;
|
|
|
- //const auto lm = card_ptr->getLandmark();
|
|
|
- auto area_info_map = card_ptr->get_area_tool()->m_area_info;
|
|
|
- if(!area_info_map.empty())
|
|
|
- {
|
|
|
- auto lm = area_info_map.begin()->second;
|
|
|
- event_ptr->m_area_id = std::get<0>(lm);
|
|
|
- event_ptr->m_map_id = card_ptr->get_area_tool()->m_mapid;
|
|
|
- event_ptr->m_landmarkid = std::get<1>(lm);
|
|
|
- event_ptr->m_landmarkdist = std::get<3>(lm);
|
|
|
- event_ptr->m_landmarkdirect = std::get<2>(lm);
|
|
|
- }
|
|
|
+
|
|
|
+ auto area_info_map = card_ptr->get_area_tool()->m_area_info;
|
|
|
+ if(!area_info_map.empty())
|
|
|
+ {
|
|
|
+ auto lm = area_info_map.begin()->second;
|
|
|
+ event_ptr->m_area_id = std::get<0>(lm);
|
|
|
+ event_ptr->m_map_id = card_ptr->get_area_tool()->m_mapid;
|
|
|
+ event_ptr->m_landmarkid = std::get<1>(lm);
|
|
|
+ event_ptr->m_landmarkdist = std::get<3>(lm);
|
|
|
+ event_ptr->m_landmarkdirect = std::get<2>(lm);
|
|
|
+ }
|
|
|
}
|
|
|
return event_ptr;
|
|
|
}
|