|
@@ -45,35 +45,31 @@ struct area_business_factory
|
|
|
};
|
|
|
|
|
|
/*
|
|
|
- 确定需要推送人员
|
|
|
- 人员推送哪个区域,存储在card_localtion_base上,每次调用前清空,该类只将优先级最高的区域设定给该值即可
|
|
|
+ 确定推送人员信息时的区域,每一个明确需要推送的区域,都要推送
|
|
|
*/
|
|
|
-
|
|
|
struct area_business_post_area:area_business
|
|
|
{
|
|
|
virtual int area_business_type()
|
|
|
{
|
|
|
return 1;
|
|
|
}
|
|
|
- //记录所在区域
|
|
|
- virtual void on_enter(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data>*ptr)
|
|
|
+ //将推送区域信息加入人员数据
|
|
|
+ virtual void on_enter(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
- //根据超速检测的策略,进行超速判断,超速时进行告警
|
|
|
- //建议使用最近M秒内N秒超时进行判断,M=20,N=15,策略数据记录在area_hove中
|
|
|
- virtual void on_hover(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
|
|
|
+ //从人员数据中清除区域信息
|
|
|
+ virtual void on_leave(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
|
|
|
{
|
|
|
-
|
|
|
}
|
|
|
};
|
|
|
+
|
|
|
/*
|
|
|
判断车辆超速,确定超速后记录日志、数据库并告警
|
|
|
每张卡在每个区域的超速相关的数据信息记录在 area_hover 对象
|
|
|
人员&车辆的代码重用,请自行设计
|
|
|
*/
|
|
|
-
|
|
|
struct area_business_speed_checker:area_business
|
|
|
{
|
|
|
virtual int area_business_type()
|
|
@@ -81,14 +77,15 @@ struct area_business_speed_checker:area_business
|
|
|
return 4;
|
|
|
|
|
|
}
|
|
|
- //在area_hover对象中初始化超速检测所需的对象
|
|
|
- virtual void on_enter(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data>*ptr)
|
|
|
+
|
|
|
+ //在ptr对象中初始化超速检测所需的对象
|
|
|
+ virtual void on_enter(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
//根据超速检测的策略,进行超速判断,超速时进行告警
|
|
|
- //建议使用最近M秒内N秒超时进行判断,M=20,N=15,策略数据记录在area_hove中
|
|
|
+ //建议使用最近M秒内N秒超时进行判断,M=20,N=15,策略数据记录在ptr中
|
|
|
virtual void on_hover(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
|
|
|
{
|
|
|
|
|
@@ -111,19 +108,14 @@ struct area_business_restricted:area_business
|
|
|
|
|
|
return 7;
|
|
|
}
|
|
|
- //记录进入时间等信息
|
|
|
- virtual void on_enter(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data>*ptr)
|
|
|
+ //记录进入时间等信息,生成告警
|
|
|
+ virtual void on_enter(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> )
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
- //卡在猴车区域移动
|
|
|
- virtual void on_hover(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- virtual void on_leave(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
|
|
|
+ //记录退出时间等信息
|
|
|
+ virtual void on_leave(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> )
|
|
|
{
|
|
|
}
|
|
|
};
|
|
@@ -138,13 +130,17 @@ struct area_business_monkey_area:area_business
|
|
|
|
|
|
return 8;
|
|
|
}
|
|
|
- //记录进入时间等信息,开始考勤
|
|
|
- virtual void on_enter(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data>*ptr)
|
|
|
+
|
|
|
+ virtual void on_enter(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ virtual void on_hover(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
- //记录离开考勤区域信息,结束考勤
|
|
|
virtual void on_leave(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
|
|
|
{
|
|
|
}
|
|
@@ -153,7 +149,6 @@ struct area_business_monkey_area:area_business
|
|
|
/*
|
|
|
车辆考勤
|
|
|
*/
|
|
|
-
|
|
|
struct area_business_car_attendance:area_business
|
|
|
{
|
|
|
virtual int area_business_type()
|
|
@@ -161,13 +156,13 @@ struct area_business_car_attendance:area_business
|
|
|
return 6;
|
|
|
|
|
|
}
|
|
|
- //记录进入时间等信息,开始考勤
|
|
|
- virtual void on_enter(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data>*ptr)
|
|
|
+ //记录进入时间等信息,结束考勤,根据离开的时间和距离,判断是否记录一条新的考勤记录
|
|
|
+ virtual void on_enter(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
- //记录离开考勤区域信息,结束考勤
|
|
|
+ //记录离开考勤区域信息,开始考勤
|
|
|
virtual void on_leave(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
|
|
|
{
|
|
|
}
|
|
@@ -176,7 +171,6 @@ struct area_business_car_attendance:area_business
|
|
|
/*
|
|
|
人员考勤
|
|
|
*/
|
|
|
-
|
|
|
struct area_business_person_attendance:area_business
|
|
|
{
|
|
|
virtual int area_business_type()
|
|
@@ -185,7 +179,7 @@ struct area_business_person_attendance:area_business
|
|
|
|
|
|
}
|
|
|
//记录进入时间等信息,开始考勤
|
|
|
- virtual void on_enter(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data>*ptr)
|
|
|
+ virtual void on_enter(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
|
|
|
{
|
|
|
|
|
|
}
|
|
@@ -199,6 +193,7 @@ struct area_business_person_attendance:area_business
|
|
|
/*
|
|
|
判断当前区域a中的人数是否超过设定人数,超过后告警
|
|
|
区域内实时人数存储在area对象中,在当前类on_enter/on_leave中进行更新
|
|
|
+ 整个井下的超员和某个区域的超员都使用这个代码
|
|
|
*/
|
|
|
struct area_business_count_checker:area_business
|
|
|
{
|
|
@@ -208,7 +203,7 @@ struct area_business_count_checker:area_business
|
|
|
|
|
|
}
|
|
|
//增加计数,并进行判断
|
|
|
- virtual void on_enter(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data>*ptr)
|
|
|
+ virtual void on_enter(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
|
|
|
{
|
|
|
|
|
|
}
|
|
@@ -220,26 +215,26 @@ struct area_business_count_checker:area_business
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+
|
|
|
/*
|
|
|
判断当前区域a中的人卡停留时间
|
|
|
人员进入区域时间存储在area_hover对象中,在当前类on_enter/on_leave中进行更新
|
|
|
人员&车辆的代码重用,请自行设计
|
|
|
*/
|
|
|
-
|
|
|
struct area_business_person_dwell_checker:area_business
|
|
|
{
|
|
|
virtual int area_business_type()
|
|
|
{
|
|
|
return 2;
|
|
|
}
|
|
|
- //初始化 area_hover 的相关数据项
|
|
|
- virtual void on_enter(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data>*ptr)
|
|
|
+ //初始化 ptr 的相关数据项
|
|
|
+ virtual void on_enter(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
- //更新 area_hover 的相关数据项,并进行超时判断
|
|
|
- virtual void on_hover(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data>*ptr)
|
|
|
+ //更新 ptr 的相关数据项,并进行超时判断
|
|
|
+ virtual void on_hover(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
|
|
|
{
|
|
|
|
|
|
}
|