command_manager.cpp 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  1. //
  2. // Created by zx on 2020/7/14.
  3. //
  4. #include <sstream>
  5. #include <iomanip>
  6. #include <parkspace_excutor.h>
  7. #include <notify_excutor.h>
  8. #include "command_manager.h"
  9. #include "StoreProcessTask.h"
  10. #include "PickupProcessTask.h"
  11. #include "command_accepter.h"
  12. Command_manager::Command_manager()
  13. :m_thread_queue_process(nullptr)
  14. ,m_system_paused(false)
  15. ,m_publish_statu_thread(nullptr)
  16. {
  17. }
  18. Command_manager::~Command_manager()
  19. {
  20. //等待线程池完成
  21. if(m_thread_queue_process!=nullptr) {
  22. m_thread_queue_process->WaitForFinish();
  23. m_thread_queue_process->Stop();
  24. }
  25. //退出发布线程
  26. m_publish_exit_condition.set_pass_ever(true);
  27. if(m_publish_statu_thread!= nullptr)
  28. {
  29. if(m_publish_statu_thread->joinable())
  30. {
  31. m_publish_statu_thread->join();
  32. }
  33. delete m_publish_statu_thread;
  34. m_publish_statu_thread=nullptr;
  35. }
  36. }
  37. Error_manager Command_manager::init(setting::System_setting system_setting) {
  38. /*
  39. * 检查参数
  40. */
  41. if (system_setting.has_bind_ip() == false || system_setting.has_entrance_num() == false
  42. || system_setting.has_export_num() == false) {
  43. return Error_manager(ERROR, MAJOR_ERROR, "系统配置错误");
  44. }
  45. if (system_setting.entrance_num() < 0 || system_setting.export_num() < 0) {
  46. return Error_manager(ERROR, MAJOR_ERROR, "系统配置出入口数量错误");
  47. }
  48. //初始化出入口状态为 Enable
  49. m_input_entrance_paused.resize(system_setting.entrance_num());
  50. for(int i=0;i<system_setting.entrance_num();++i)
  51. m_input_entrance_paused[i]=false;
  52. m_output_entrance_paused.resize(system_setting.export_num());
  53. for(int i=0;i<system_setting.export_num();++i)
  54. m_output_entrance_paused[i]=false;
  55. //创建线程池
  56. if (m_thread_queue_process == nullptr) {
  57. m_thread_queue_process = tq::TQFactory::CreateDefaultQueue();
  58. m_thread_queue_process->Start(48);
  59. }
  60. /*
  61. * 此处添加等待各个通讯模块正常代码
  62. */
  63. std::chrono::system_clock::time_point t_start=std::chrono::system_clock::now();
  64. std::chrono::system_clock::time_point t_end=std::chrono::system_clock::now();
  65. /*Error_manager parkspace_code=ERROR;
  66. LOG(INFO)<<"初始化车位管理模块...";
  67. do
  68. {
  69. if (parkspace_code != SUCCESS) {
  70. parkspace_code = Parkspace_excutor::get_instance_pointer()->check_statu();
  71. LOG_IF(INFO, parkspace_code == SUCCESS) << "车位管理模块初始化完成!!!";
  72. }
  73. if(parkspace_code==SUCCESS)
  74. break;
  75. t_end=std::chrono::system_clock::now();
  76. usleep(1000*100);
  77. }while(t_end-t_start<std::chrono::seconds(300));
  78. LOG_IF(ERROR,parkspace_code!=SUCCESS)<<"车位管理节点连接超时";
  79. if(parkspace_code!=SUCCESS)
  80. {
  81. return Error_manager(ERROR,MAJOR_ERROR,"车位管理模块初始化超时");
  82. }
  83. //检查节点并创建停取车流程
  84. for(int i=0;i<system_setting.entrance_num();++i)
  85. {
  86. //
  87. // 检查入口 i 的各个节点状态
  88. //
  89. LOG(INFO)<<"初始化停车入口:"<<i<<" 测量及调度模块...";
  90. Error_manager locate_code=ERROR,dispatch_code=ERROR;
  91. do {
  92. if (locate_code != SUCCESS) {
  93. locate_code = Measure_excutor::get_instance_pointer()->check_statu(i);
  94. LOG_IF(INFO, locate_code == SUCCESS) << "停车入口:"<<i<<" 测量模块初始化完成!!!";
  95. }
  96. if (dispatch_code != SUCCESS) {
  97. dispatch_code = Dispatch_excutor::get_instance_pointer()->check_entrance_statu(i);
  98. LOG_IF(INFO, dispatch_code == SUCCESS) << "停车入口:"<<i<<" 调度模块初始化完成!!!";
  99. }
  100. t_end=std::chrono::system_clock::now();
  101. if (locate_code == SUCCESS && dispatch_code == SUCCESS)
  102. break;
  103. usleep(1000*100);
  104. }while(t_end-t_start<std::chrono::seconds(300));
  105. LOG_IF(ERROR,locate_code!=SUCCESS||dispatch_code!=SUCCESS)<<"停车口:"<<i<<" 测量/调度节点连接超时";
  106. if(locate_code!=SUCCESS||dispatch_code!=SUCCESS)
  107. {
  108. return Error_manager(ERROR,MAJOR_ERROR,"停车入口通讯节点初始化超时");
  109. }
  110. }
  111. for(int i=0;i<system_setting.export_num();++i)
  112. {
  113. LOG(INFO)<<"初始化取车出口:"<<i<<" 调度模块...";
  114. Error_manager dispatch_code=ERROR;
  115. do {
  116. if (dispatch_code != SUCCESS) {
  117. dispatch_code = Dispatch_excutor::get_instance_pointer()->check_export_statu(i);
  118. LOG_IF(INFO, dispatch_code == SUCCESS) << "取车出口:" << i << " 调度模块初始化完成!!!";
  119. }
  120. t_end = std::chrono::system_clock::now();
  121. if (dispatch_code == SUCCESS)
  122. break;
  123. usleep(1000*100);
  124. }while(t_end-t_start<std::chrono::seconds(300));
  125. LOG_IF(ERROR,dispatch_code!=SUCCESS)<<"取车出口:"<<i<<" 调度节点连接超时";
  126. if(dispatch_code!=SUCCESS)
  127. {
  128. return Error_manager(ERROR,MAJOR_ERROR,"取车出口通讯节点初始化超时");
  129. }
  130. }
  131. */
  132. m_system_setting=system_setting;
  133. /*
  134. * 创建发布线程
  135. */
  136. if(m_publish_statu_thread== nullptr)
  137. {
  138. m_publish_exit_condition.reset(false, false, false);
  139. m_publish_statu_thread=new std::thread(publish_statu_function,this);
  140. }
  141. return SUCCESS;
  142. }
  143. /*
  144. * 执行停车请求
  145. */
  146. Error_manager Command_manager::execute_store_command(const message::Store_command_request_msg& request)
  147. {
  148. message::Error_manager error_msg;
  149. message::Store_command_response_msg response;
  150. if (m_system_paused == true)
  151. {
  152. error_msg.set_error_code(PAUSE);
  153. error_msg.set_error_description("急停");
  154. response.mutable_code()->CopyFrom(error_msg);
  155. Communication_message msg;
  156. msg.reset(response.base_info(), response.SerializeAsString());
  157. Message_communicator::get_instance_pointer()->send_msg(&msg);
  158. return Error_manager(PAUSE, MINOR_ERROR, "急停");
  159. }
  160. //判断entrance是否开放
  161. if (request.id_struct().terminal_id() < 0 || request.id_struct().terminal_id() >= m_system_setting.entrance_num())
  162. {
  163. error_msg.set_error_code(ERROR);
  164. error_msg.set_error_description(" xxxx entrance id 设置错误");
  165. response.mutable_code()->CopyFrom(error_msg);
  166. return Error_manager(ERROR, MINOR_ERROR, " xxxxx entrance id 设置错误");
  167. }
  168. if (m_input_entrance_paused[request.id_struct().terminal_id()] != false)
  169. {
  170. error_msg.set_error_code(ERROR);
  171. error_msg.set_error_description("中控entrance已停止使用");
  172. response.mutable_code()->CopyFrom(error_msg);
  173. Communication_message msg;
  174. msg.reset(response.base_info(), response.SerializeAsString());
  175. Message_communicator::get_instance_pointer()->send_msg(&msg);
  176. return Error_manager(ERROR, MINOR_ERROR, "中控entrance已停止使用");
  177. }
  178. message::Base_info base_info_response;
  179. base_info_response.set_msg_type(message::eStore_command_response_msg);
  180. base_info_response.set_sender(message::eMain);
  181. base_info_response.set_receiver(message::eTerminor);
  182. response.mutable_base_info()->CopyFrom(base_info_response);
  183. response.mutable_id_struct()->CopyFrom(request.id_struct());
  184. response.set_license(request.car_info().license());
  185. Error_manager code;
  186. if (request.base_info().msg_type() == message::eStore_command_request_msg
  187. && request.base_info().receiver() == message::eMain
  188. && request.base_info().sender() == message::eTerminor) {
  189. // LOG(WARNING) << request.DebugString();
  190. if (request.has_locate_information() && request.has_base_info())
  191. {
  192. message::Locate_information locate_info = request.locate_information();
  193. if (locate_info.has_locate_correct())
  194. {
  195. if (locate_info.locate_correct() == true)
  196. {
  197. if (locate_info.has_locate_width() && locate_info.has_locate_height()
  198. && locate_info.has_locate_x() && locate_info.has_locate_y()
  199. && locate_info.has_locate_angle() && locate_info.has_locate_wheel_base())
  200. {
  201. LOG(INFO) << "------ 停 ------- 收到停车,车牌:" << request.car_info().license() <<
  202. ",终端:" << request.id_struct().terminal_id() << "............................";
  203. //check hardwared
  204. Error_manager parkspace_code = Parkspace_excutor::get_instance_pointer()->check_statu();
  205. Error_manager dispatch_code = Dispatch_excutor::get_instance_pointer()->check_entrance_statu(request.id_struct().unit_id());
  206. if(parkspace_code!=SUCCESS)
  207. {
  208. error_msg.set_error_code(parkspace_code.get_error_code());
  209. error_msg.set_error_description(parkspace_code.to_string());
  210. response.mutable_code()->CopyFrom(error_msg);
  211. LOG(ERROR) << "xxxx 创建停车流程失败:" << request.id_struct().terminal_id() <<
  212. "车牌:" << request.car_info().license() << " " << parkspace_code.to_string();
  213. Communication_message msg;
  214. msg.reset(response.base_info(), response.SerializeAsString());
  215. Message_communicator::get_instance_pointer()->send_msg(&msg);
  216. return parkspace_code;
  217. }
  218. if(dispatch_code!=SUCCESS)
  219. {
  220. error_msg.set_error_code(dispatch_code.get_error_code());
  221. error_msg.set_error_description(dispatch_code.to_string());
  222. response.mutable_code()->CopyFrom(error_msg);
  223. LOG(ERROR) << "xxxx 创建停车流程失败:" << request.id_struct().terminal_id() <<
  224. "车牌:" << request.car_info().license() << " " << dispatch_code.to_string();
  225. Communication_message msg;
  226. msg.reset(response.base_info(), response.SerializeAsString());
  227. Message_communicator::get_instance_pointer()->send_msg(&msg);
  228. return dispatch_code;
  229. }
  230. /*
  231. * 检查消息完毕,开始处理
  232. */
  233. Process_task *ptask = new StoreProcessTask(request.id_struct(), request.car_info());
  234. StoreProcessTask *pStore_task = (StoreProcessTask *) ptask;
  235. //初始化流程
  236. code = pStore_task->init_task(locate_info);
  237. if (code != SUCCESS)
  238. {
  239. delete pStore_task;
  240. error_msg.set_error_code(code.get_error_code());
  241. error_msg.set_error_description(code.to_string());
  242. response.mutable_code()->CopyFrom(error_msg);
  243. LOG(ERROR) << "xxxx 创建停车流程失败(车位分配失败),终端:" << request.id_struct().terminal_id() <<
  244. "车牌:" << request.car_info().license() << " " << code.to_string();
  245. Communication_message msg;
  246. msg.reset(response.base_info(), response.SerializeAsString());
  247. Message_communicator::get_instance_pointer()->send_msg(&msg);
  248. return code;
  249. }
  250. m_thread_queue_process->AddTask(pStore_task);
  251. return SUCCESS;
  252. }
  253. }
  254. }
  255. }
  256. error_msg.set_error_code(FAILED);
  257. error_msg.set_error_description("创建停车流程失败...指令缺少必要信息...");
  258. response.mutable_code()->CopyFrom(error_msg);
  259. Communication_message msg;
  260. msg.reset(response.base_info(), response.SerializeAsString());
  261. Message_communicator::get_instance_pointer()->send_msg(&msg);
  262. return Error_manager(FAILED, MINOR_ERROR, "创建停车流程失败...指令缺少必要信息...");
  263. } else {
  264. error_msg.set_error_code(INVALID_MESSAGE);
  265. error_msg.set_error_description("停车请求基本信息错误");
  266. response.mutable_code()->CopyFrom(error_msg);
  267. Communication_message msg;
  268. msg.reset(response.base_info(),response.SerializeAsString());
  269. Message_communicator::get_instance_pointer()->send_msg(&msg);
  270. return Error_manager(INVALID_MESSAGE, MAJOR_ERROR, "停车请求基本信息错误");
  271. }
  272. }
  273. /*
  274. * 执行取车请求
  275. */
  276. Error_manager Command_manager::execute_pickup_command(const message::Pickup_command_request_msg& request)
  277. {
  278. message::Error_manager error_msg;
  279. message::Pickup_command_response_msg response;
  280. message::Base_info base_info_response;
  281. base_info_response.set_msg_type(message::ePickup_command_response_msg);
  282. base_info_response.set_sender(message::eMain);
  283. base_info_response.set_receiver(message::eTerminor);
  284. response.mutable_base_info()->CopyFrom(base_info_response);
  285. response.mutable_id_struct()->CopyFrom(request.id_struct());
  286. response.set_license(request.car_info().license());
  287. if (m_thread_queue_process == nullptr)
  288. {
  289. error_msg.set_error_code(ERROR);
  290. error_msg.set_error_description(" xxxxx 中控bug,线程池未初始化");
  291. response.mutable_code()->CopyFrom(error_msg);
  292. Communication_message msg;
  293. msg.reset(response.base_info(), response.SerializeAsString());
  294. Message_communicator::get_instance_pointer()->send_msg(&msg);
  295. return Error_manager(ERROR, MINOR_ERROR, "线程池未初始化,bug");
  296. }
  297. if (m_system_paused == true)
  298. {
  299. error_msg.set_error_code(PAUSE);
  300. error_msg.set_error_description("急停");
  301. response.mutable_code()->CopyFrom(error_msg);
  302. Communication_message msg;
  303. msg.reset(response.base_info(), response.SerializeAsString());
  304. Message_communicator::get_instance_pointer()->send_msg(&msg);
  305. return Error_manager(PAUSE, MINOR_ERROR, "急停");
  306. }
  307. //判断出口是否开放
  308. /*if (request.id_struct().unit_id() < 0 || request.id_struct().terminal_id() >= m_system_setting.export_num())
  309. {
  310. error_msg.set_error_code(ERROR);
  311. error_msg.set_error_description(" xxxx 出口 id 设置错误");
  312. response.mutable_code()->CopyFrom(error_msg);
  313. return Error_manager(ERROR, MINOR_ERROR, " xxxxx出口 id 设置错误");
  314. }
  315. if (m_output_entrance_paused[request.id_struct().terminal_id()] != false)
  316. {
  317. error_msg.set_error_code(ERROR);
  318. error_msg.set_error_description("中控出口已停止使用");
  319. response.mutable_code()->CopyFrom(error_msg);
  320. Communication_message msg;
  321. msg.reset(response.base_info(), response.SerializeAsString());
  322. Message_communicator::get_instance_pointer()->send_msg(&msg);
  323. return Error_manager(ERROR, MINOR_ERROR, "中控出口已停止使用");
  324. }*/
  325. if (request.base_info().msg_type() == message::ePickup_command_request_msg
  326. && request.base_info().receiver() == message::eMain
  327. && request.base_info().sender() == message::eTerminor
  328. && request.has_car_info())
  329. {
  330. response.mutable_id_struct()->CopyFrom(request.id_struct());
  331. /*
  332. * 检查各个节点是否正常
  333. */
  334. Error_manager parkspace_code = Parkspace_excutor::get_instance_pointer()->check_statu();
  335. if (parkspace_code != SUCCESS)
  336. {
  337. error_msg.set_error_code(parkspace_code.get_error_code());
  338. error_msg.set_error_description(parkspace_code.get_error_description());
  339. response.mutable_code()->CopyFrom(error_msg);
  340. Communication_message msg;
  341. msg.reset(response.base_info(), response.SerializeAsString());
  342. Message_communicator::get_instance_pointer()->send_msg(&msg);
  343. return parkspace_code;
  344. }
  345. Error_manager dispatch_code = Dispatch_excutor::get_instance_pointer()->check_export_statu(request.id_struct().unit_id());
  346. if (dispatch_code != SUCCESS)
  347. {
  348. error_msg.set_error_code(dispatch_code.get_error_code());
  349. error_msg.set_error_description(dispatch_code.get_error_description());
  350. response.mutable_code()->CopyFrom(error_msg);
  351. Communication_message msg;
  352. msg.reset(response.base_info(), response.SerializeAsString());
  353. Message_communicator::get_instance_pointer()->send_msg(&msg);
  354. return dispatch_code;
  355. }
  356. //检查取车口等候区通知节点
  357. Error_manager notify_code=Notify_excutor::get_instance_pointer()->check_node_statu();
  358. if(notify_code!=SUCCESS)
  359. {
  360. error_msg.set_error_code(notify_code.get_error_code());
  361. error_msg.set_error_description(notify_code.get_error_description());
  362. response.mutable_code()->CopyFrom(error_msg);
  363. Communication_message msg;
  364. msg.reset(response.base_info(), response.SerializeAsString());
  365. Message_communicator::get_instance_pointer()->send_msg(&msg);
  366. return notify_code;
  367. }
  368. //一切正常,接受指令
  369. Error_manager code;
  370. LOG(WARNING) << "--------- 取 -------收到取车-----------------------------" << request.car_info().license();
  371. Process_task *ptask = new PickupProcessTask(request.id_struct(), request.car_info());
  372. PickupProcessTask *pPick_task = (PickupProcessTask *) ptask;
  373. //初始化流程
  374. code = pPick_task->init_task(request);
  375. if (code == SUCCESS)
  376. {
  377. m_thread_queue_process->AddTask(pPick_task);
  378. return SUCCESS;
  379. }
  380. error_msg.set_error_code(code.get_error_code());
  381. error_msg.set_error_description(code.to_string());
  382. response.mutable_code()->CopyFrom(error_msg);
  383. LOG(ERROR) << "创建取车流程失败(车位查询失败),单元:" << request.id_struct().unit_id() <<
  384. "车牌:" << request.car_info().license() << " " << code.to_string();
  385. delete pPick_task;
  386. Communication_message msg;
  387. msg.reset(response.base_info(), response.SerializeAsString());
  388. Message_communicator::get_instance_pointer()->send_msg(&msg);
  389. return code;
  390. }
  391. else
  392. {
  393. error_msg.set_error_code(INVALID_MESSAGE);
  394. error_msg.set_error_description("停车请求信息错误");
  395. response.mutable_code()->CopyFrom(error_msg);
  396. Communication_message msg;
  397. msg.reset(response.base_info(), response.SerializeAsString());
  398. Message_communicator::get_instance_pointer()->send_msg(&msg);
  399. return Error_manager(INVALID_MESSAGE, MAJOR_ERROR, "停车请求信息错误");
  400. }
  401. }
  402. /*
  403. * 控制入口 开放或者关闭
  404. */
  405. Error_manager Command_manager::pause_entrance(int terminal_id,bool paused)
  406. {
  407. if(terminal_id<0 || terminal_id>m_system_setting.entrance_num())
  408. return Error_manager(ERROR,MINOR_ERROR,"xxxx");
  409. m_input_entrance_paused[terminal_id]=paused;
  410. return SUCCESS;
  411. }
  412. message::Entrance_statu Command_manager::get_entrance_statu(int terminal_id)
  413. {
  414. message::Entrance_statu entrance_statu;
  415. if(terminal_id<0 || terminal_id>=m_system_setting.entrance_num())
  416. return entrance_statu;
  417. message::Module_statu statu=message::eConnected;
  418. Error_manager code=Parkspace_excutor::get_instance_pointer()->check_statu();
  419. statu=(code==SUCCESS)?message::eConnected:message::eFault;
  420. entrance_statu.set_parkspace_statu(statu);
  421. code=Dispatch_excutor::get_instance_pointer()->check_entrance_statu(terminal_id);
  422. if (code==ERROR) statu=message::eFault;
  423. if(code==DISCONNECT) statu=message::eDisconnected;
  424. entrance_statu.set_dispatch_statu(statu);
  425. entrance_statu.set_paused(m_input_entrance_paused[terminal_id]);
  426. return entrance_statu;
  427. }
  428. message::Entrance_statu Command_manager::get_export_statu(int terminal_id)
  429. {
  430. message::Entrance_statu entrance_statu;
  431. if(terminal_id<0 || terminal_id>=m_system_setting.export_num())
  432. return entrance_statu;
  433. message::Module_statu statu=message::eConnected;
  434. Error_manager code=Parkspace_excutor::get_instance_pointer()->check_statu();
  435. statu=(code==SUCCESS)?message::eConnected:message::eFault;
  436. entrance_statu.set_parkspace_statu(statu);
  437. code=Dispatch_excutor::get_instance_pointer()->check_entrance_statu(terminal_id);
  438. if (code==ERROR) statu=message::eFault;
  439. if(code==DISCONNECT) statu=message::eDisconnected;
  440. entrance_statu.set_dispatch_statu(statu);
  441. code=Notify_excutor::get_instance_pointer()->check_node_statu();
  442. if (code==ERROR) statu=message::eFault;
  443. if(code==DISCONNECT) statu=message::eDisconnected;
  444. entrance_statu.set_notify_statu(statu);
  445. entrance_statu.set_paused(m_output_entrance_paused[terminal_id]);
  446. return entrance_statu;
  447. }
  448. /*
  449. * 控制出口 开放或者关闭
  450. */
  451. Error_manager Command_manager::pause_export(int terminal_id,bool paused)
  452. {
  453. if(terminal_id<0 || terminal_id>m_system_setting.export_num())
  454. return Error_manager(ERROR,MINOR_ERROR,"xxxx");
  455. m_output_entrance_paused[terminal_id]=paused;
  456. return SUCCESS;
  457. }
  458. /*
  459. * pause,系统急停
  460. */
  461. void Command_manager::pause_system()
  462. {
  463. m_system_paused=true;
  464. }
  465. void Command_manager::publish_statu_function(Command_manager* commander)
  466. {
  467. if(commander== nullptr)
  468. return ;
  469. commander->publish_statu();
  470. }
  471. void Command_manager::publish_statu()
  472. {
  473. while(m_publish_exit_condition.wait_for_millisecond(100)==false)
  474. {
  475. message::Central_controller_statu_msg msg;
  476. message::Base_info baseInfo;
  477. baseInfo.set_msg_type(message::eCentral_controller_statu_msg);
  478. baseInfo.set_sender(message::eMain);
  479. baseInfo.set_receiver(message::eEmpty);
  480. msg.mutable_base_info()->CopyFrom(baseInfo);
  481. for(int i=0;i<m_system_setting.entrance_num();++i)
  482. {
  483. message::Entrance_statu statu=get_entrance_statu(i);
  484. message::Entrance_statu* entrance_statu=msg.mutable_entrance_statu_vector()->Add();;
  485. entrance_statu->CopyFrom(statu);
  486. }
  487. for(int i=0;i<m_system_setting.export_num();++i)
  488. {
  489. message::Entrance_statu statu=get_export_statu(i);
  490. message::Entrance_statu* entrance_statu=msg.mutable_export_statu_vector()->Add();
  491. entrance_statu->CopyFrom(statu);
  492. }
  493. Command_accepter::get_instance_pointer()->post_central_statu(msg);
  494. //std::cout<<" 123 \n "<<msg.DebugString()<<std::endl;
  495. }
  496. }