|
@@ -11,9 +11,11 @@
|
|
#include "config_file.h"
|
|
#include "config_file.h"
|
|
#include "db_api/CDBConnPool.h"
|
|
#include "db_api/CDBConnPool.h"
|
|
#include "websocket/wsTimerThread.h"
|
|
#include "websocket/wsTimerThread.h"
|
|
|
|
+#include "websocket/wsClientMgr.h"
|
|
#include "timestamp.h"
|
|
#include "timestamp.h"
|
|
#include "monkey_car/monkeycar_area.h"
|
|
#include "monkey_car/monkeycar_area.h"
|
|
#include "monkey_car/monkeycar_person.h"
|
|
#include "monkey_car/monkeycar_person.h"
|
|
|
|
+#include "special_area.h"
|
|
|
|
|
|
extern config_file config;
|
|
extern config_file config;
|
|
//一张卡一个ct的所有不同天线的信息
|
|
//一张卡一个ct的所有不同天线的信息
|
|
@@ -153,14 +155,16 @@ struct card_message_handle
|
|
log_warn("%s","当前代码没有处理历史消息记录。");
|
|
log_warn("%s","当前代码没有处理历史消息记录。");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ //
|
|
|
|
+ m_card->site_hover(loc.m_site_id);
|
|
|
|
|
|
if(loc.m_batty_status == 2)
|
|
if(loc.m_batty_status == 2)
|
|
{
|
|
{
|
|
- m_card->do_status(STA_TYPE::STATUS_LOW_POWER);
|
|
|
|
|
|
+ m_card->do_status(STA_TYPE::STATUS_LOW_POWER_);
|
|
}
|
|
}
|
|
else if(loc.m_callinfo == 0x80)
|
|
else if(loc.m_callinfo == 0x80)
|
|
{
|
|
{
|
|
- m_card->do_status(STA_TYPE::STATUS_HELP);
|
|
|
|
|
|
+ m_card->do_status(STA_TYPE::STATUS_HELP_);
|
|
}
|
|
}
|
|
|
|
|
|
m_ct_list[loc.m_card_ct&(m_ct_list.size()-1)]->on_message(loop,loc);
|
|
m_ct_list[loc.m_card_ct&(m_ct_list.size()-1)]->on_message(loop,loc);
|
|
@@ -192,16 +196,21 @@ struct person:card_location_base,private card_area
|
|
{
|
|
{
|
|
m_message_handle->on_message(loop,loc,is_history);
|
|
m_message_handle->on_message(loop,loc,is_history);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ virtual void site_hover(int sid)
|
|
|
|
+ {
|
|
|
|
+ m_site_area->on_point(m_id,sid,0);
|
|
|
|
+ }
|
|
virtual void do_business(const point &pt)
|
|
virtual void do_business(const point &pt)
|
|
{
|
|
{
|
|
//区域
|
|
//区域
|
|
m_area_tool->on_point(m_id,pt,m_speed,m_type);
|
|
m_area_tool->on_point(m_id,pt,m_speed,m_type);
|
|
//考勤
|
|
//考勤
|
|
-
|
|
|
|
|
|
+ m_site_area->on_point(m_id,0,this);
|
|
//
|
|
//
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ //人卡升井后该线程要停掉
|
|
|
|
+ //手动升级需要补全区域得同时,需要进区域走区域业务
|
|
void set(ev::dynamic_loop * loop)
|
|
void set(ev::dynamic_loop * loop)
|
|
{
|
|
{
|
|
log_info("cardid_id %d",m_id);
|
|
log_info("cardid_id %d",m_id);
|
|
@@ -229,8 +238,19 @@ private:
|
|
cp.landmark_id = std::get<4>(lm);
|
|
cp.landmark_id = std::get<4>(lm);
|
|
cp.lm_direction = std::get<5>(lm);
|
|
cp.lm_direction = std::get<5>(lm);
|
|
cp.landmark_dis=std::get<6>(lm);
|
|
cp.landmark_dis=std::get<6>(lm);
|
|
|
|
+
|
|
|
|
+ cp.biz_stat = state();
|
|
upt_card_pos(cp,pt);
|
|
upt_card_pos(cp,pt);
|
|
}
|
|
}
|
|
|
|
+ int state()
|
|
|
|
+ {
|
|
|
|
+ int status = get_stat();
|
|
|
|
+ if(status == STATUS_NORMAL)
|
|
|
|
+ {
|
|
|
|
+ //超时
|
|
|
|
+ }
|
|
|
|
+ return status;
|
|
|
|
+ }
|
|
point getSmoothPoint()
|
|
point getSmoothPoint()
|
|
{
|
|
{
|
|
point pt;
|
|
point pt;
|
|
@@ -253,15 +273,23 @@ private:
|
|
|
|
|
|
struct car:card_location_base,private card_area
|
|
struct car:card_location_base,private card_area
|
|
{
|
|
{
|
|
- car(std::string type,uint32_t cardid,uint16_t needdisplay,int16_t t,int32_t deptid)
|
|
|
|
|
|
+ int m_vehicle_category_id=0;
|
|
|
|
+ car(std::string type,uint32_t cardid,uint16_t needdisplay,int16_t t,int32_t deptid,int32_t categoryid)
|
|
:card_location_base(type,cardid,needdisplay,t,deptid)
|
|
:card_location_base(type,cardid,needdisplay,t,deptid)
|
|
|
|
+ ,m_vehicle_category_id(categoryid)
|
|
{
|
|
{
|
|
m_message_handle=new card_message_handle(this);
|
|
m_message_handle=new card_message_handle(this);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ virtual void site_hover(int sid)
|
|
|
|
+ {
|
|
|
|
+ m_site_area->on_point(m_id,sid,0);
|
|
|
|
+ }
|
|
|
|
+
|
|
virtual void do_business(const point &pt)
|
|
virtual void do_business(const point &pt)
|
|
{
|
|
{
|
|
m_area_tool->on_point(m_id,pt,m_speed,m_type);
|
|
m_area_tool->on_point(m_id,pt,m_speed,m_type);
|
|
|
|
+ m_site_area->on_point(m_id,0,this);
|
|
}
|
|
}
|
|
|
|
|
|
void set(ev::dynamic_loop * loop)
|
|
void set(ev::dynamic_loop * loop)
|
|
@@ -277,6 +305,33 @@ struct car:card_location_base,private card_area
|
|
private:
|
|
private:
|
|
void on_timer()
|
|
void on_timer()
|
|
{
|
|
{
|
|
|
|
+ make_package();
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ int statbiz(int32_t special_id)
|
|
|
|
+ {
|
|
|
|
+ int status = get_stat();
|
|
|
|
+ if(status==STATUS_NORMAL)
|
|
|
|
+ {
|
|
|
|
+ //超速
|
|
|
|
+ //超时
|
|
|
|
+ //顺序不能变
|
|
|
|
+ }
|
|
|
|
+ if(status == STATUS_LOST)
|
|
|
|
+ {
|
|
|
|
+ if(!m_area_tool->special_area())
|
|
|
|
+ {
|
|
|
|
+ special_id = special_area_list::instance()->get_special_id(m_id,*this,m_vehicle_category_id);
|
|
|
|
+ log_info("enter_special_area:%.2f,%2.f,id:%d,special_area_id:%d",x,y,m_id,special_id);
|
|
|
|
+ if(special_id != -1)
|
|
|
|
+ m_area_tool->change_area(m_id,m_speed,m_type,special_id);//自动拖车
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return status;
|
|
|
|
+ }
|
|
|
|
+ void make_package()
|
|
|
|
+ {
|
|
|
|
+ int32_t special_id=-1;
|
|
YA::_CARD_POS_ cp;
|
|
YA::_CARD_POS_ cp;
|
|
point pt = getSmoothPoint();
|
|
point pt = getSmoothPoint();
|
|
|
|
|
|
@@ -288,12 +343,21 @@ private:
|
|
cp.landmark_id = std::get<4>(lm);
|
|
cp.landmark_id = std::get<4>(lm);
|
|
cp.lm_direction = std::get<5>(lm);
|
|
cp.lm_direction = std::get<5>(lm);
|
|
cp.landmark_dis=std::get<6>(lm);
|
|
cp.landmark_dis=std::get<6>(lm);
|
|
-
|
|
|
|
|
|
+ int32_t biz_stat=statbiz(special_id);
|
|
|
|
+ cp.biz_stat=biz_stat;
|
|
|
|
+ //cp.down_time
|
|
|
|
+ //cp.work_time;
|
|
|
|
+ //cp.level_id;
|
|
//for now
|
|
//for now
|
|
cp.is_on_duty=1;
|
|
cp.is_on_duty=1;
|
|
upt_card_pos(cp,pt);
|
|
upt_card_pos(cp,pt);
|
|
- }
|
|
|
|
|
|
|
|
|
|
+ if(biz_stat==STATUS_LOST && special_id != -1 && m_display==1)
|
|
|
|
+ {
|
|
|
|
+ cp.area_id = special_id;
|
|
|
|
+ swsClientMgr.SendSpecialAreaProcess(cp);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
point getSmoothPoint()
|
|
point getSmoothPoint()
|
|
{
|
|
{
|
|
loc_point lp = m_smo_tool->smooth_strategy();
|
|
loc_point lp = m_smo_tool->smooth_strategy();
|
|
@@ -378,9 +442,9 @@ void card_list::init_vehicle()
|
|
//for now
|
|
//for now
|
|
vehicle_id = vsid;
|
|
vehicle_id = vsid;
|
|
|
|
|
|
- std::shared_ptr<card_location_base> clb = std::make_shared<car>(strategy,vehicle_id,need_display,card_type_id,dept_id);
|
|
|
|
|
|
+ std::shared_ptr<card_location_base> clb = std::make_shared<car>(strategy,vehicle_id,need_display,card_type_id,dept_id,vehicle_category_id);
|
|
uint64_t cardid = getId(vehicle_id,2);
|
|
uint64_t cardid = getId(vehicle_id,2);
|
|
- log_info("cardId:%llu,vehicle_id:%d dept_id:%d,need_display:%d---cardid:%s",cardid,vehicle_id,dept_id,need_display,card_id.c_str());
|
|
|
|
|
|
+ log_info("cardId:%llu,vehicle_id:%d dept_id:%d,need_display:%d---cardid:%s,categoryid:%d",cardid,vehicle_id,dept_id,need_display,card_id.c_str(),vehicle_category_id);
|
|
map.insert({cardid,clb});
|
|
map.insert({cardid,clb});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -500,7 +564,7 @@ void card_location_base::on_message(zloop<task*> * loop,const message_locinfo&lo
|
|
m_message_handle->on_message(loop,loc,is_history);
|
|
m_message_handle->on_message(loop,loc,is_history);
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
+//前端推送位置函数
|
|
void card_location_base::upt_card_pos(YA::_CARD_POS_ &cp,const point &pt)
|
|
void card_location_base::upt_card_pos(YA::_CARD_POS_ &cp,const point &pt)
|
|
{
|
|
{
|
|
cp.x = pt.x;
|
|
cp.x = pt.x;
|
|
@@ -512,11 +576,23 @@ void card_location_base::upt_card_pos(YA::_CARD_POS_ &cp,const point &pt)
|
|
cp.running_stat = m_stat;
|
|
cp.running_stat = m_stat;
|
|
cp.dept_id = m_deptid;
|
|
cp.dept_id = m_deptid;
|
|
cp.display=m_display;
|
|
cp.display=m_display;
|
|
|
|
+ cp.rec_time=m_time;
|
|
|
|
|
|
swsTimerThrd.upt_card_pos(cp);
|
|
swsTimerThrd.upt_card_pos(cp);
|
|
-
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+int card_location_base::get_stat()
|
|
|
|
+{
|
|
|
|
+ //盲区>呼救>呼叫>超时>超速>正常
|
|
|
|
+ int status=STATUS_NORMAL;
|
|
|
|
+ if(false)
|
|
|
|
+ status = STATUS_CALL;
|
|
|
|
+ if(false)
|
|
|
|
+ status = STATUS_HELP;
|
|
|
|
+
|
|
|
|
+ uint64_t now = time(0)*1000;
|
|
|
|
+ status=(now-m_time>CARD_LOST_TIME_OUT)?STATUS_LOST:STATUS_NORMAL;
|
|
|
|
+ return status;
|
|
|
|
+}
|
|
card_location_base::~card_location_base()
|
|
card_location_base::~card_location_base()
|
|
{
|
|
{
|
|
}
|
|
}
|