card_message_handle.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674
  1. #include <vector>
  2. #include <ev++.h>
  3. #include "card_base.h"
  4. #include "loc_tool.h"
  5. #include "message.h"
  6. #include "zloop.h"
  7. #include "card_message_handle.h"
  8. #include "loc_common.h"
  9. //一张卡一个ct的所有不同天线的信息,包括tof,tdoa,pdoa等数据处理
  10. struct one_ct_message_handle
  11. {
  12. static loc_tool_main m_loc_tool;
  13. ev::timer m_min_timer, m_max_timer; // 开启两个定时器
  14. ev::timer m_pdoa_min_timer, m_pdoa_max_timer;
  15. ev::timer m_tdoa_min_timer, m_tdoa_max_timer;
  16. std::vector<loc_message> m_msg_list; // 定位消息缓存区,用于tof,pdoa
  17. msg_deque m_msg_deque; // 定位消息缓存区,用于tdoa, pdoa(主要是存在一个数据包内多个ct的卡数据)
  18. card_location_base* m_card;
  19. const algo_config* m_ac = nullptr; // 配置文件参数
  20. int m_ct;
  21. bool m_min_timeout = false;
  22. bool m_min_timeout_pdoa = false;
  23. bool m_min_timeout_tdoa = false;
  24. ev::dynamic_loop * m_loop = nullptr;
  25. one_ct_message_handle(card_location_base* card)
  26. {
  27. m_card = card;
  28. m_ct = -1;
  29. }
  30. void reset()
  31. {
  32. m_ct = -1;
  33. m_min_timeout = false;
  34. m_min_timeout_pdoa = false;
  35. m_min_timeout_tdoa = false;
  36. m_msg_list.clear();
  37. }
  38. void on_min_timer()
  39. {
  40. m_min_timer.stop();
  41. if((int)m_msg_list.size()>=m_ac->best_msg_cnt)
  42. {
  43. m_max_timer.stop();
  44. calc_location();
  45. return;
  46. }
  47. m_min_timeout=true;
  48. }
  49. void on_max_timer()
  50. {
  51. m_max_timer.stop();
  52. calc_location();
  53. }
  54. void on_pdoa_min_timer()
  55. {
  56. m_pdoa_min_timer.stop();
  57. if((int)(m_msg_list.size()) >= 2){
  58. m_pdoa_max_timer.stop();
  59. calc_pdoa_location();
  60. return;
  61. }
  62. m_min_timeout_pdoa = true;
  63. }
  64. void on_pdoa_max_timer()
  65. {
  66. m_pdoa_max_timer.stop();
  67. calc_pdoa_location();
  68. }
  69. void on_tdoa_min_timer()
  70. {
  71. m_tdoa_min_timer.stop();
  72. if((int)(m_msg_list.size()) >= 2){
  73. m_tdoa_max_timer.stop();
  74. calc_tdoa_location();
  75. return;
  76. }
  77. m_min_timeout_tdoa = true;
  78. }
  79. void on_tdoa_max_timer()
  80. {
  81. m_tdoa_max_timer.stop();
  82. calc_tdoa_location();
  83. }
  84. void set(ev::dynamic_loop * loop)
  85. {
  86. m_loop = loop;
  87. // tof
  88. m_min_timer.set(*m_loop);
  89. m_min_timer.set<one_ct_message_handle,&one_ct_message_handle::on_min_timer>(this);
  90. m_max_timer.set(*m_loop);
  91. m_max_timer.set<one_ct_message_handle,&one_ct_message_handle::on_max_timer>(this);
  92. // pdoa
  93. m_pdoa_min_timer.set(*m_loop);
  94. m_pdoa_min_timer.set<one_ct_message_handle, &one_ct_message_handle::on_pdoa_min_timer>(this);
  95. m_pdoa_max_timer.set(*m_loop);
  96. m_pdoa_max_timer.set<one_ct_message_handle, &one_ct_message_handle::on_pdoa_max_timer>(this);
  97. // tdoa
  98. m_tdoa_min_timer.set(*m_loop);
  99. m_tdoa_min_timer.set<one_ct_message_handle, &one_ct_message_handle::on_tdoa_min_timer>(this);
  100. m_tdoa_max_timer.set(*m_loop);
  101. m_tdoa_max_timer.set<one_ct_message_handle, &one_ct_message_handle::on_tdoa_max_timer>(this);
  102. }
  103. void on_message(ev::dynamic_loop *loop,const message_locinfo&loc)
  104. {
  105. if(m_loop == nullptr && loop!=nullptr)
  106. set(loop);
  107. else if(loop == nullptr)
  108. return;
  109. // 如果消息队列非空,且ct切换,清空消息队列
  110. if(!m_msg_list.empty()&& m_ct!=loc.m_card_ct)
  111. {
  112. m_msg_list.clear();
  113. }
  114. auto s = sit_list::instance()->get(loc.m_site_id);
  115. if(nullptr == s)
  116. {
  117. log_warn("分站信息缺失, site_id=%d", loc.m_site_id);
  118. return;
  119. }
  120. // 如果定位数据缓存区为空,则保存定位数据
  121. if(m_msg_list.empty())
  122. {
  123. m_ct=loc.m_card_ct;
  124. m_ac=&s->config();
  125. m_min_timeout=false;
  126. //这里构造loc_message 保存数据
  127. m_msg_list.push_back(loc_message(s,loc.m_tof,loc.m_time_stamp,loc.m_card_id,
  128. loc.m_card_ct,loc.m_card_type,loc.m_ant_id,loc.m_rav,loc.m_acc,
  129. loc.m_sync_ct,loc.m_rssi,loc.m_batty_status));
  130. //启动本CT的最小、最大两个定时器
  131. m_min_timer.start(m_ac->min_wait_time);
  132. m_max_timer.start(m_ac->max_wait_time);
  133. return;
  134. }
  135. m_msg_list.push_back(loc_message(s,loc.m_tof,loc.m_time_stamp,loc.m_card_id,
  136. loc.m_card_ct,loc.m_card_type,loc.m_ant_id,loc.m_rav,loc.m_acc,
  137. loc.m_sync_ct,loc.m_rssi,loc.m_batty_status));
  138. // 满足数据条数,计算定位坐标
  139. if(m_min_timeout && (int)m_msg_list.size() >= m_ac->best_msg_cnt)
  140. {
  141. calc_location();
  142. m_max_timer.stop();
  143. }
  144. }
  145. /* pdoa
  146. * 主要实现两功能:
  147. * 1.将数据放入数据缓冲区;
  148. * 2.根据条件判断是否取出数据进行定位
  149. * */
  150. void on_message(ev::dynamic_loop* loop, const message_pdoa_locinfo& loc)
  151. {
  152. if(nullptr == m_loop && loop != nullptr)
  153. {
  154. set(loop);
  155. }
  156. else if(nullptr == loop)
  157. {
  158. return;
  159. }
  160. // 如果消息队列非空,且ct切换,清空消息队列
  161. auto site_ptr = sit_list::instance()->get(loc.m_site_id);
  162. if(nullptr == site_ptr)
  163. {
  164. log_warn("[pdoa] 分站信息缺失,site_id=%d", loc.m_site_id);
  165. return;
  166. }
  167. if(m_ct == loc.m_card_ct){
  168. return;
  169. }
  170. if(m_msg_list.empty()){
  171. m_ac = &site_ptr->config();
  172. m_min_timeout_pdoa = false;
  173. m_ct = loc.m_card_ct;
  174. //启动本CT的最小、最大两个定时器
  175. m_pdoa_min_timer.start(m_ac->min_wait_time);
  176. m_pdoa_max_timer.start(m_ac->max_wait_time);
  177. }
  178. //std::string s = concat(loc.m_site_id, loc.m_ant_id);
  179. //find_msg(loc.m_card_ct);
  180. std::shared_ptr<loc_message> _msg_v = trans_pdoa_msg_v(loc);
  181. if(nullptr != _msg_v){
  182. //add_msg(_msg, s, idx);
  183. m_msg_list.push_back(*_msg_v);
  184. m_min_timeout_pdoa = true;
  185. }
  186. log_info("[pdoa] size=%d, m_min_timeout_pdoa=%d", m_msg_list.size(), m_min_timeout_pdoa);
  187. // 默认处理
  188. if(m_min_timeout_pdoa && m_msg_list.size() > 0)
  189. {
  190. calc_pdoa_location(true);
  191. m_pdoa_max_timer.stop();
  192. }
  193. m_msg_list.clear();
  194. std::shared_ptr<loc_message> _msg = trans_pdoa_msg(loc);
  195. if (nullptr != _msg) {
  196. //add_msg(_msg, s, idx);
  197. m_msg_list.push_back(*_msg);
  198. m_min_timeout_pdoa = true;
  199. }
  200. log_info("[pdoa] size=%d, m_min_timeout_pdoa=%d", m_msg_list.size(), m_min_timeout_pdoa);
  201. // 默认处理
  202. if (m_min_timeout_pdoa && m_msg_list.size() > 0)
  203. {
  204. calc_pdoa_location();
  205. m_pdoa_max_timer.stop();
  206. }
  207. }
  208. /* tdoa
  209. * 主要实现两个功能:
  210. * 1.将数据放入数据缓冲区;
  211. * 2.根据条件判断是否取出数据进行定位;
  212. * */
  213. void on_message(ev::dynamic_loop* loop, const message_tdoa_locinfo& loc)
  214. {
  215. if(nullptr == m_loop && loop != nullptr)
  216. {
  217. set(loop);
  218. }
  219. else if(nullptr == loop)
  220. {
  221. return;
  222. }
  223. // 如果消息队列非空,且ct切换,清空消息队列
  224. auto site_ptr = sit_list::instance()->get(loc.m_site_msg.m_site_id);
  225. if(nullptr == site_ptr)
  226. {
  227. log_warn("[tdoa] 分站信息缺失,site_id=%d", loc.m_site_msg.m_site_id);
  228. return;
  229. }
  230. if(m_msg_list.empty()){
  231. m_ac = &site_ptr->config();
  232. m_min_timeout_tdoa = false;
  233. //启动本CT的最小、最大两个定时器
  234. m_tdoa_min_timer.start(m_ac->min_wait_time);
  235. m_tdoa_max_timer.start(m_ac->max_wait_time);
  236. }
  237. std::string s = concat(loc.m_site_msg.m_site_id, loc.m_card_msg.m_ant_id);
  238. //把信息放入定位的缓冲区,否则放入队列内
  239. int idx = find_msg(loc.m_card_msg.m_time_stamp);
  240. std::shared_ptr<loc_message> _msg = trans_tdoa_msg(loc);
  241. if(nullptr != _msg){
  242. add_msg(_msg, s, idx);
  243. }
  244. // tdoa默认处理2维
  245. if(m_min_timeout_tdoa && m_msg_list.size() >= 3){
  246. calc_tdoa_location();
  247. m_tdoa_max_timer.stop();
  248. }
  249. }
  250. // tof定位
  251. void calc_location()
  252. {
  253. auto v = m_msg_list;
  254. if(v.empty())
  255. {
  256. return;
  257. }
  258. log_info("calc_location_begin:card_id=%d, ct=%d, m_ct=%d", m_card->m_id, v[0].m_card_ct, m_ct);
  259. try{
  260. std::vector<point> rc = std::move(m_loc_tool.calc_location(v));
  261. if(!rc.empty())
  262. {
  263. m_card->on_location(std::move(rc), v);
  264. }
  265. }catch(...){
  266. }
  267. reset();
  268. }
  269. // pdoa定位,将定位结果传给主服务程序
  270. void calc_pdoa_location(bool is_v_map = false)
  271. {
  272. auto v = m_msg_list;
  273. if(v.empty()){
  274. return;
  275. }
  276. logn_info(3, "[pdoa] calc_location_pdoa_begin: card_id=%d, ct=%d, m_ct=%d", m_card->m_id, v[0].m_card_ct, m_ct);
  277. std::vector<point> rc = std::move(m_loc_tool.calc_location(v));
  278. logn_info(3, "[pdoa] calc_location_pdoa: card_id=%d, size=%d", m_card->m_id, rc.size());
  279. if(!rc.empty()){
  280. m_card->on_location(std::move(rc), v);
  281. }
  282. reset();
  283. }
  284. void calc_location_extend()
  285. {
  286. /*int dim = get_dimension();
  287. switch(dim){
  288. case _1D:
  289. break;
  290. case _2D:
  291. {
  292. if(LDT_TDOA == m_card->m_loc_type){
  293. }else if(LDT_PDOA == m_card->m_loc_type)
  294. {
  295. //m_loc_tool.set_tool()
  296. }else if(LDT_TOF == m_card->m_loc_type)
  297. {
  298. }
  299. }
  300. break;
  301. case _3D:
  302. {
  303. if(LDT_TDOA == m_card->m_loc_type){
  304. }else if(LDT_PDOA == m_card->m_loc_type)
  305. {
  306. }else if(LDT_TOF == m_card->m_loc_type)
  307. {
  308. }
  309. }
  310. break;
  311. }*/
  312. }
  313. int get_dimension()
  314. {
  315. split_data();
  316. /*if(vt_msg_3d.size() > _3D){
  317. // 构造
  318. return _3D;
  319. }else if(vt_msg_2d.size() > _2D){
  320. return _2D;
  321. }else if(vt_msg_1d.size() > _1D){
  322. return _1D;
  323. }*/
  324. return 0;
  325. }
  326. int split_data()
  327. {
  328. /*if(mp_msg_3d.size() > 0){
  329. mp_msg_3d.erase(mp_msg_3d.begin(), mp_msg_3d.end());
  330. }
  331. if(mp_msg_2d.size() > 0){
  332. mp_msg_2d.erase(mp_msg_2d.begin(), mp_msg_2d.end());
  333. }
  334. if(mp_msg_1d.size() > 0){
  335. mp_msg_1d.erase(mp_msg_1d.begin(), mp_msg_1d.end());
  336. }
  337. for(auto it : mp_msg_.front().m_msg_map)
  338. {
  339. switch(it.second->m_loc_dimension){
  340. case _1D:
  341. mp_msg_1d.insert(std::make_pair(it.first, it.second));
  342. break;
  343. case _2D:
  344. mp_msg_2d.insert(std::make_pair(it.first, it.second));
  345. break;
  346. case _3D:
  347. mp_msg_3d.insert(std::make_pair(it.first, it.second));
  348. break;
  349. }
  350. }*/
  351. return 0;
  352. }
  353. // tdoa定位
  354. void calc_tdoa_location()
  355. {
  356. auto v = m_msg_list;
  357. if(v.empty()){
  358. return;
  359. }
  360. log_info("[tdoa] calc_location_tdoa_begin: card_id=%d, ct=%d, m_ct=%d", m_card->m_id, v[0].m_card_ct, m_ct);
  361. std::vector<point> rc = std::move(m_loc_tool.calc_location(v));
  362. log_info("[tdoa] calc_location_tdoa: card_id=%d, size=%d", m_card->m_id, rc.size());
  363. if(!rc.empty()){
  364. m_card->on_location(std::move(rc), v);
  365. }
  366. reset();
  367. log_info("[tdoa] calc_location_tdoa_end: card_id=%d", m_card->m_id);
  368. }
  369. /*
  370. * 将数据放入队列中
  371. * */
  372. void add_msg(const std::shared_ptr<loc_message>& msg, const std::string& s, const int& idx)
  373. {
  374. if(-1 != idx){
  375. m_msg_deque[idx].m_msg_map[s] = msg;
  376. }else{
  377. int ct_delay = ceil(3 / (10*m_card->m_freq));
  378. ct_delay = (ct_delay > 1)?ct_delay:1;
  379. uint8_t _count_del = 0;
  380. while(true){
  381. bool tag = false;
  382. for(auto it = m_msg_deque.begin(); it != m_msg_deque.end();){
  383. bool is_over = false;
  384. if(1000 > msg->m_card_ct && 64536 < (*it).m_card_stamp){
  385. // 说明it为历史数据,需丢弃
  386. is_over = true;
  387. }
  388. if((!is_over && ((*it).m_card_stamp < msg->m_card_ct - ct_delay)) || (is_over && ((*it).m_card_stamp < 65536 + msg->m_card_ct - ct_delay)))
  389. {
  390. if((*it).m_msg_map.size() < 3){
  391. it = m_msg_deque.erase(it);
  392. }else{
  393. tag = true;
  394. break;
  395. }
  396. }else if((!is_over && ((*it).m_card_stamp > msg->m_card_ct + ct_delay)) || (is_over && ((*it).m_card_stamp > (65536 + msg->m_card_ct - ct_delay))))
  397. {
  398. if(is_over){
  399. if((*it).m_msg_map.size() < 3){
  400. it = m_msg_deque.erase(it);
  401. }else{
  402. tag = true;
  403. break;
  404. }
  405. }else{
  406. if(20 < ++_count_del){
  407. it = m_msg_deque.erase(it);
  408. }else{
  409. break;
  410. }
  411. }
  412. }else{
  413. ++it;
  414. }
  415. }
  416. if(tag){
  417. //1.计算
  418. for(auto item : m_msg_deque.front().m_msg_map){
  419. m_msg_list.push_back(*(item.second));
  420. }
  421. //2.删除数据
  422. m_msg_deque.pop_front();
  423. m_msg_list.erase(m_msg_list.begin(), m_msg_list.end());
  424. tag = false;
  425. }else{
  426. break;
  427. }
  428. }
  429. message_item mi;
  430. mi.m_card_stamp = msg->m_card_ct;
  431. mi.m_msg_map[s] = msg;
  432. m_msg_deque.push_back(mi);
  433. }
  434. }
  435. // pdoa定位数据
  436. std::shared_ptr<loc_message> trans_pdoa_msg(const message_pdoa_locinfo& loc)
  437. {
  438. // 分站
  439. auto s = sit_list::instance()->get(loc.m_site_id);
  440. if(nullptr == s){
  441. log_info("[pdoa] trans_pdoa_msg: 分站信息缺失,site_id=%d", loc.m_site_id);
  442. return nullptr;
  443. }
  444. return std::move(std::make_shared<loc_message>(s, loc.m_tof, loc.m_time_stamp, loc.m_card_id, loc.m_card_ct, loc.m_card_type, loc.m_ant_id, loc.m_rav, loc.m_acc, loc.m_sync_ct, loc.m_rssi, loc.m_batty_status, loc.m_loc_type, loc.m_loc_dimension, loc.m_poa[0], loc.m_poa[1], loc.m_poa[2]));
  445. }
  446. // pdoa定位数据,用于车辆定位系统
  447. std::shared_ptr<loc_message> trans_pdoa_msg_v(const message_pdoa_locinfo& loc)
  448. {
  449. // 分站
  450. auto s = sit_list_v::instance()->get(loc.m_site_id);
  451. if (nullptr == s) {
  452. log_info("[pdoa] trans_pdoa_msg_v: 分站信息缺失,site_id=%d", loc.m_site_id);
  453. return nullptr;
  454. }
  455. return std::move(std::make_shared<loc_message>(s, loc.m_tof, loc.m_time_stamp, loc.m_card_id, loc.m_card_ct, loc.m_card_type, loc.m_ant_id, loc.m_rav, loc.m_acc, 0, loc.m_rssi, loc.m_batty_status, loc.m_loc_type, loc.m_loc_dimension, loc.m_poa[0], loc.m_poa[1], loc.m_poa[2]));
  456. }
  457. // tdoa 定位数据
  458. std::shared_ptr<loc_message> trans_tdoa_msg(const message_tdoa_locinfo& loc)
  459. {
  460. // 分站
  461. auto s = sit_list::instance()->get(loc.m_site_msg.m_site_id);
  462. if(nullptr == s){
  463. log_info("[pdoa] trans_tdoa_msg: 分站信息缺失,site_id=%d", loc.m_site_msg.m_site_id);
  464. return nullptr;
  465. }
  466. return std::move(std::make_shared<loc_message>(s, loc.m_card_msg.m_loc_stamp, loc.m_card_msg.m_time_stamp, loc.m_card_msg.m_id, loc.m_card_msg.m_time_stamp, loc.m_card_msg.m_type, loc.m_card_msg.m_ant_id, loc.m_card_msg.m_rav, loc.m_card_msg.m_acc, loc.m_card_msg.m_sync_num, loc.m_card_msg.m_rssi, loc.m_card_msg.m_battery_status, loc.m_interpolation, loc.m_loc_type, loc.m_loc_dimension, m_card->m_freq));
  467. }
  468. // 分站+天线
  469. std::string concat(const int& lhs, const int& rhs)
  470. {
  471. char msg[10] = {0};
  472. snprintf(msg, 10, "%d-%d", lhs, rhs);
  473. return std::move(std::string(msg));
  474. }
  475. /*
  476. * 根据卡的ct号查找数据
  477. *
  478. * 参数
  479. * stamp 卡的ct号
  480. *
  481. * */
  482. int find_msg(const uint16_t& stamp)
  483. {
  484. int idx = -1;
  485. for(int i = m_msg_deque.size() - 1; i > 0; --i){
  486. if(m_msg_deque[i].m_card_stamp == stamp){
  487. idx = i;
  488. break;
  489. }
  490. }
  491. return idx;
  492. }
  493. };
  494. loc_tool_main one_ct_message_handle::m_loc_tool;
  495. card_message_handle::card_message_handle(card_location_base*card)
  496. {
  497. m_card = card;
  498. for(size_t i = 0;i < m_ct_list.size();i++)
  499. {
  500. m_ct_list[i] = new one_ct_message_handle(card);
  501. }
  502. }
  503. card_message_handle::~card_message_handle()
  504. {
  505. for(auto&it:m_ct_list)
  506. {
  507. delete it;
  508. }
  509. }
  510. void card_message_handle::on_message(zloop<task*> * loop,const message_locinfo&loc,bool is_history)
  511. {
  512. if(is_history)
  513. {
  514. log_warn("%s","当前代码没有处理历史消息记录。");
  515. return;
  516. }
  517. /*int c_status = STATUS_POWER_NOMARL;
  518. if(loc.m_batty_status == 2)
  519. {
  520. c_status ^= STATUS_POWER_NORMAL;
  521. c_status = STATUS_POWER_LOWER_SERIOUS;
  522. }
  523. if(loc.m_callinfo & 0x80)
  524. {
  525. c_status |= STATUS_HELP;
  526. }
  527. if((loc.m_callinfo & 0x01) || (loc.m_callinfo & 0x02))
  528. {
  529. c_status |= STATUS_CALL;
  530. }
  531. m_card->do_status(c_status);*/
  532. m_ct_list[loc.m_card_ct&(m_ct_list.size()-1)]->on_message(loop,loc);
  533. }
  534. /*
  535. * 算法模块
  536. * 1.第一步处理;
  537. * 2.根据主服务程序传入的数据使用算法模块进行tdoa定位
  538. * */
  539. void card_message_handle::on_message(zloop<task*>* loop, const message_tdoa_locinfo& loc, bool is_history)
  540. {
  541. if(is_history)
  542. {
  543. log_warn("%s","当前代码没有处理历史数据!");
  544. return;
  545. }
  546. /*int c_status = STATUS_POWER_LOWER_SERIOUS;
  547. if(loc.m_card_msg.m_call_info & 0x80)
  548. {
  549. c_status |= STATUS_HELP;
  550. }
  551. if((loc.m_card_msg.m_call_info & 0x01) || (loc.m_card_msg.m_call_info& 0x02))
  552. {
  553. c_status |= STATUS_CALL;
  554. }
  555. //处理卡呼叫/呼救业务
  556. m_card->do_status(c_status);
  557. */
  558. m_ct_list[loc.m_card_msg.m_sync_num & (m_ct_list.size()-1)]->on_message(loop, loc);
  559. }
  560. /*
  561. * 算法模块
  562. * 1.第一步处理;
  563. * 2.根据主服务程序传入的数据使用算法模块进行pdoa定位
  564. * */
  565. void card_message_handle::on_message(zloop<task*>* loop, const message_pdoa_locinfo& loc, bool is_history)
  566. {
  567. if(is_history)
  568. {
  569. log_warn("%s","当前代码没有处理历史数据!");
  570. return;
  571. }
  572. /*int c_status = STATUS_POWER_LOWER_SERIOUS;
  573. if(loc.m_callinfo & 0x80)
  574. {
  575. c_status |= STATUS_HELP;
  576. }
  577. if((loc.m_callinfo & 0x01) || (loc.m_callinfo& 0x02))
  578. {
  579. c_status |= STATUS_CALL;
  580. }
  581. //处理卡呼叫/呼救业务
  582. m_card->do_status(c_status);*/
  583. //根据取模结果调用响应的子模块处理
  584. m_ct_list[loc.m_card_ct & (m_ct_list.size()-1)]->on_message(loop, loc);
  585. }