dispatch_communication.cpp 73 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971
  1. //
  2. // Created by huli on 2020/9/25.
  3. //
  4. #include "dispatch_communication.h"
  5. Dispatch_communication::Dispatch_communication()
  6. {
  7. }
  8. Dispatch_communication::~Dispatch_communication()
  9. {
  10. }
  11. //初始化 通信 模块。如下三选一
  12. Error_manager Dispatch_communication::communication_init(int plc_id)
  13. {
  14. m_plc_id = plc_id;
  15. int t_index = 0;
  16. std::vector<Snap7_buf::Variable_information> t_variable_information_vector;
  17. //往map通信缓存里面添加所需要的buf
  18. std::unique_lock<std::mutex> t_lock1(m_receive_buf_lock);
  19. std::unique_lock<std::mutex> t_lock2(m_send_buf_lock);
  20. Snap7_buf t_snap7_buf;
  21. //AB单元的9000和9001特殊处理, 删除168字节后面的
  22. if ( m_plc_id == 31 || m_plc_id == 32)
  23. {
  24. //调度指令
  25. t_index = 0;
  26. t_variable_information_vector.clear();
  27. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_status", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  28. t_index += sizeof(unsigned short)*1;
  29. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_working_total_time", typeid(float).name(), t_index,sizeof(float), 1 });
  30. t_index += sizeof(float)*1;
  31. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_working_remaining_time", typeid(float).name(), t_index,sizeof(float), 1 });
  32. t_index += sizeof(float)*1;
  33. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved60_73", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 14 });
  34. t_index += sizeof(unsigned char)*14;
  35. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_dispatch_motion_direction", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  36. t_index += sizeof(unsigned char)*1;
  37. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved75_79", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 5 });
  38. t_index += sizeof(unsigned char)*5;
  39. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_passageway_id", typeid(unsigned int).name(), t_index,sizeof(unsigned int), 1 });
  40. t_index += sizeof(unsigned int)*1;
  41. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_passageway_direction", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  42. t_index += sizeof(unsigned char)*1;
  43. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved85", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  44. t_index += sizeof(unsigned char)*1;
  45. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_height_level", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  46. t_index += sizeof(unsigned short)*1;
  47. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved88_89", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 2 });
  48. t_index += sizeof(unsigned char)*2;
  49. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_parkingspace_index_id", typeid(unsigned int).name(), t_index,sizeof(unsigned int), 1 });
  50. t_index += sizeof(unsigned int)*1;
  51. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_parkingspace_unit_id", typeid(unsigned int).name(), t_index,sizeof(unsigned int), 1 });
  52. t_index += sizeof(unsigned int)*1;
  53. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_parkingspace_label_id", typeid(unsigned int).name(), t_index,sizeof(unsigned int), 1 });
  54. t_index += sizeof(unsigned int)*1;
  55. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_parkingspace_floor_id", typeid(unsigned int).name(), t_index,sizeof(unsigned int), 1 });
  56. t_index += sizeof(unsigned int)*1;
  57. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_parkingspace_room_id", typeid(unsigned int).name(), t_index,sizeof(unsigned int), 1 });
  58. t_index += sizeof(unsigned int)*1;
  59. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_parkingspace_direction", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  60. t_index += sizeof(unsigned char)*1;
  61. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved111", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  62. t_index += sizeof(unsigned char)*1;
  63. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_center_x", typeid(float).name(), t_index,sizeof(float), 1 });
  64. t_index += sizeof(float)*1;
  65. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_center_y", typeid(float).name(), t_index,sizeof(float), 1 });
  66. t_index += sizeof(float)*1;
  67. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_angle", typeid(float).name(), t_index,sizeof(float), 1 });
  68. t_index += sizeof(float)*1;
  69. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_front_theta", typeid(float).name(), t_index,sizeof(float), 1 });
  70. t_index += sizeof(float)*1;
  71. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_length", typeid(float).name(), t_index,sizeof(float), 1 });
  72. t_index += sizeof(float)*1;
  73. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_width", typeid(float).name(), t_index,sizeof(float), 1 });
  74. t_index += sizeof(float)*1;
  75. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_height", typeid(float).name(), t_index,sizeof(float), 1 });
  76. t_index += sizeof(float)*1;
  77. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_wheel_base", typeid(float).name(), t_index,sizeof(float), 1 });
  78. t_index += sizeof(float)*1;
  79. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_wheel_width", typeid(float).name(), t_index,sizeof(float), 1 });
  80. t_index += sizeof(float)*1;
  81. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_license", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 20 });
  82. t_index += sizeof(unsigned char)*20;
  83. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved168_187", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 20 });
  84. t_index += sizeof(unsigned char)*20;
  85. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_type", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  86. t_index += sizeof(unsigned char)*1;
  87. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved189_191", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 3 });
  88. t_index += sizeof(unsigned char)*3;
  89. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_uniformed_car_x", typeid(float).name(), t_index,sizeof(float), 1 });
  90. t_index += sizeof(float)*1;
  91. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_uniformed_car_y", typeid(float).name(), t_index,sizeof(float), 1 });
  92. t_index += sizeof(float)*1;
  93. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved200_209", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 10 });
  94. t_index += sizeof(unsigned char)*10;
  95. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_anticollision_lidar_flag", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  96. t_index += sizeof(unsigned char)*1;
  97. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved211_215", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 5 });
  98. t_index += sizeof(unsigned char)*5;
  99. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_wheel_base_exact_value", typeid(float).name(), t_index,sizeof(float), 1 });
  100. t_index += sizeof(float)*1;
  101. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved217_231", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 25 });
  102. t_index += sizeof(unsigned char)*25;
  103. // t_snap7_buf.init(DISPATCH_REQUEST_FROM_MANAGER_TO_PLC_DBNUMBER_0 +m_plc_id*100, 50, sizeof(Dispatch_request_from_manager_to_plc_for_data), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
  104. t_snap7_buf.init(DISPATCH_REQUEST_FROM_MANAGER_TO_PLC_DBNUMBER_0 , 50, sizeof(Dispatch_request_from_manager_to_plc_for_data), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
  105. // t_snap7_buf.init(DISPATCH_REQUEST_FROM_MANAGER_TO_PLC_DBNUMBER_0 , 50, sizeof(Dispatch_request_from_manager_to_plc_for_data), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
  106. m_send_buf_map[0] = t_snap7_buf;
  107. }
  108. else
  109. {
  110. //调度指令
  111. t_index = 0;
  112. t_variable_information_vector.clear();
  113. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_status", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  114. t_index += sizeof(unsigned short)*1;
  115. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_working_total_time", typeid(float).name(), t_index,sizeof(float), 1 });
  116. t_index += sizeof(float)*1;
  117. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_working_remaining_time", typeid(float).name(), t_index,sizeof(float), 1 });
  118. t_index += sizeof(float)*1;
  119. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved60_73", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 14 });
  120. t_index += sizeof(unsigned char)*14;
  121. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_dispatch_motion_direction", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  122. t_index += sizeof(unsigned short)*1;
  123. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved75_79", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 4 });
  124. t_index += sizeof(unsigned char)*4;
  125. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_passageway_id", typeid(unsigned int).name(), t_index,sizeof(unsigned int), 1 });
  126. t_index += sizeof(unsigned int)*1;
  127. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_passageway_direction", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  128. t_index += sizeof(unsigned char)*1;
  129. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved85", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  130. t_index += sizeof(unsigned char)*1;
  131. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_height_level", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  132. t_index += sizeof(unsigned short)*1;
  133. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved88_89", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 2 });
  134. t_index += sizeof(unsigned char)*2;
  135. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_parkingspace_index_id", typeid(unsigned int).name(), t_index,sizeof(unsigned int), 1 });
  136. t_index += sizeof(unsigned int)*1;
  137. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_parkingspace_unit_id", typeid(unsigned int).name(), t_index,sizeof(unsigned int), 1 });
  138. t_index += sizeof(unsigned int)*1;
  139. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_parkingspace_label_id", typeid(unsigned int).name(), t_index,sizeof(unsigned int), 1 });
  140. t_index += sizeof(unsigned int)*1;
  141. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_parkingspace_floor_id", typeid(unsigned int).name(), t_index,sizeof(unsigned int), 1 });
  142. t_index += sizeof(unsigned int)*1;
  143. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_parkingspace_room_id", typeid(unsigned int).name(), t_index,sizeof(unsigned int), 1 });
  144. t_index += sizeof(unsigned int)*1;
  145. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_parkingspace_direction", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  146. t_index += sizeof(unsigned char)*1;
  147. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved111", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  148. t_index += sizeof(unsigned char)*1;
  149. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_center_x", typeid(float).name(), t_index,sizeof(float), 1 });
  150. t_index += sizeof(float)*1;
  151. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_center_y", typeid(float).name(), t_index,sizeof(float), 1 });
  152. t_index += sizeof(float)*1;
  153. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_angle", typeid(float).name(), t_index,sizeof(float), 1 });
  154. t_index += sizeof(float)*1;
  155. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_front_theta", typeid(float).name(), t_index,sizeof(float), 1 });
  156. t_index += sizeof(float)*1;
  157. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_length", typeid(float).name(), t_index,sizeof(float), 1 });
  158. t_index += sizeof(float)*1;
  159. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_width", typeid(float).name(), t_index,sizeof(float), 1 });
  160. t_index += sizeof(float)*1;
  161. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_height", typeid(float).name(), t_index,sizeof(float), 1 });
  162. t_index += sizeof(float)*1;
  163. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_wheel_base", typeid(float).name(), t_index,sizeof(float), 1 });
  164. t_index += sizeof(float)*1;
  165. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_wheel_width", typeid(float).name(), t_index,sizeof(float), 1 });
  166. t_index += sizeof(float)*1;
  167. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_license", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 20 });
  168. t_index += sizeof(unsigned char)*20;
  169. // t_snap7_buf.init(DISPATCH_REQUEST_FROM_MANAGER_TO_PLC_DBNUMBER_0 +m_plc_id*100, 50, sizeof(Dispatch_request_from_manager_to_plc_for_data), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
  170. t_snap7_buf.init(DISPATCH_REQUEST_FROM_MANAGER_TO_PLC_DBNUMBER_0 , 50, sizeof(Dispatch_request_from_manager_to_plc_for_data_ab), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
  171. // t_snap7_buf.init(DISPATCH_REQUEST_FROM_MANAGER_TO_PLC_DBNUMBER_0 , 50, sizeof(Dispatch_request_from_manager_to_plc_for_data_ab), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
  172. m_send_buf_map[0] = t_snap7_buf;
  173. }
  174. t_index = 0;
  175. t_variable_information_vector.clear();
  176. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_key", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 50 });
  177. t_index += sizeof(unsigned char)*50;
  178. // t_snap7_buf.init(DISPATCH_REQUEST_FROM_MANAGER_TO_PLC_DBNUMBER_0 +m_plc_id*100, 0, sizeof(Dispatch_request_from_manager_to_plc_for_key), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
  179. t_snap7_buf.init(DISPATCH_REQUEST_FROM_MANAGER_TO_PLC_DBNUMBER_0 , 0, sizeof(Dispatch_request_from_manager_to_plc_for_key), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
  180. // t_snap7_buf.init(DISPATCH_REQUEST_FROM_MANAGER_TO_PLC_DBNUMBER_0 , 0, sizeof(Dispatch_request_from_manager_to_plc_for_key), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
  181. m_send_buf_map[1] = t_snap7_buf;
  182. //AB单元的9000和9001特殊处理, 删除168字节后面的
  183. if ( m_plc_id == 31 || m_plc_id == 32)
  184. {
  185. t_index = 0;
  186. t_variable_information_vector.clear();
  187. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_response_key", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 50 });
  188. t_index += sizeof(unsigned char)*50;
  189. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_response_status", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  190. t_index += sizeof(unsigned short)*1;
  191. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_working_total_time", typeid(float).name(), t_index,sizeof(float), 1 });
  192. t_index += sizeof(float)*1;
  193. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_working_remaining_time", typeid(float).name(), t_index,sizeof(float), 1 });
  194. t_index += sizeof(float)*1;
  195. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved60_73", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 14 });
  196. t_index += sizeof(unsigned char)*14;
  197. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_dispatch_motion_direction", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  198. t_index += sizeof(unsigned char)*1;
  199. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved75_79", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 5 });
  200. t_index += sizeof(unsigned char)*5;
  201. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_passageway_id", typeid(unsigned int).name(), t_index,sizeof(unsigned int), 1 });
  202. t_index += sizeof(unsigned int)*1;
  203. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_passageway_direction", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  204. t_index += sizeof(unsigned char)*1;
  205. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved85_89", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 5 });
  206. t_index += sizeof(unsigned char)*5;
  207. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_parkingspace_index_id", typeid(unsigned int).name(), t_index,sizeof(unsigned int), 1 });
  208. t_index += sizeof(unsigned int)*1;
  209. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_parkingspace_unit_id", typeid(unsigned int).name(), t_index,sizeof(unsigned int), 1 });
  210. t_index += sizeof(unsigned int)*1;
  211. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_parkingspace_label_id", typeid(unsigned int).name(), t_index,sizeof(unsigned int), 1 });
  212. t_index += sizeof(unsigned int)*1;
  213. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_parkingspace_floor_id", typeid(unsigned int).name(), t_index,sizeof(unsigned int), 1 });
  214. t_index += sizeof(unsigned int)*1;
  215. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_parkingspace_room_id", typeid(unsigned int).name(), t_index,sizeof(unsigned int), 1 });
  216. t_index += sizeof(unsigned int)*1;
  217. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_parkingspace_direction", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  218. t_index += sizeof(unsigned char)*1;
  219. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved111", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  220. t_index += sizeof(unsigned char)*1;
  221. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_center_x", typeid(float).name(), t_index,sizeof(float), 1 });
  222. t_index += sizeof(float)*1;
  223. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_center_y", typeid(float).name(), t_index,sizeof(float), 1 });
  224. t_index += sizeof(float)*1;
  225. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_angle", typeid(float).name(), t_index,sizeof(float), 1 });
  226. t_index += sizeof(float)*1;
  227. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_front_theta", typeid(float).name(), t_index,sizeof(float), 1 });
  228. t_index += sizeof(float)*1;
  229. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_length", typeid(float).name(), t_index,sizeof(float), 1 });
  230. t_index += sizeof(float)*1;
  231. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_width", typeid(float).name(), t_index,sizeof(float), 1 });
  232. t_index += sizeof(float)*1;
  233. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_height", typeid(float).name(), t_index,sizeof(float), 1 });
  234. t_index += sizeof(float)*1;
  235. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_wheel_base", typeid(float).name(), t_index,sizeof(float), 1 });
  236. t_index += sizeof(float)*1;
  237. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_wheel_width", typeid(float).name(), t_index,sizeof(float), 1 });
  238. t_index += sizeof(float)*1;
  239. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_license", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 20 });
  240. t_index += sizeof(unsigned char)*20;
  241. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved168_187", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 20 });
  242. t_index += sizeof(unsigned char)*20;
  243. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_type", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  244. t_index += sizeof(unsigned char)*1;
  245. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved189_191", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 3 });
  246. t_index += sizeof(unsigned char)*3;
  247. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_uniformed_car_x", typeid(float).name(), t_index,sizeof(float), 1 });
  248. t_index += sizeof(float)*1;
  249. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_uniformed_car_y", typeid(float).name(), t_index,sizeof(float), 1 });
  250. t_index += sizeof(float)*1;
  251. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved200_209", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 10 });
  252. t_index += sizeof(unsigned char)*10;
  253. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_anticollision_lidar_flag", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  254. t_index += sizeof(unsigned char)*1;
  255. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved211_215", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 5 });
  256. t_index += sizeof(unsigned char)*5;
  257. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_wheel_base_exact_value", typeid(float).name(), t_index,sizeof(float), 1 });
  258. t_index += sizeof(float)*1;
  259. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved217_231", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 25 });
  260. t_index += sizeof(unsigned char)*25;
  261. // t_snap7_buf.init(DISPATCH_RESPONSE_FROM_PLC_TO_MANAGER_DBNUMBER_0 +m_plc_id*100, 0, sizeof(Dispatch_response_from_plc_to_manager), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
  262. t_snap7_buf.init(DISPATCH_RESPONSE_FROM_PLC_TO_MANAGER_DBNUMBER_0 , 0, sizeof(Dispatch_response_from_plc_to_manager), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
  263. // t_snap7_buf.init(DISPATCH_RESPONSE_FROM_PLC_TO_MANAGER_DBNUMBER_0 , 0, sizeof(Dispatch_response_from_plc_to_manager), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
  264. m_receive_buf_map[0] = t_snap7_buf;
  265. }
  266. else
  267. {
  268. t_index = 0;
  269. t_variable_information_vector.clear();
  270. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_response_key", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 50 });
  271. t_index += sizeof(unsigned char)*50;
  272. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_response_status", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  273. t_index += sizeof(unsigned short)*1;
  274. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_working_total_time", typeid(float).name(), t_index,sizeof(float), 1 });
  275. t_index += sizeof(float)*1;
  276. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_working_remaining_time", typeid(float).name(), t_index,sizeof(float), 1 });
  277. t_index += sizeof(float)*1;
  278. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved60_73", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 14 });
  279. t_index += sizeof(unsigned char)*14;
  280. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_dispatch_motion_direction", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  281. t_index += sizeof(unsigned short)*1;
  282. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved75_79", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 4 });
  283. t_index += sizeof(unsigned char)*4;
  284. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_passageway_id", typeid(unsigned int).name(), t_index,sizeof(unsigned int), 1 });
  285. t_index += sizeof(unsigned int)*1;
  286. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_passageway_direction", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  287. t_index += sizeof(unsigned char)*1;
  288. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved85_89", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 5 });
  289. t_index += sizeof(unsigned char)*5;
  290. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_parkingspace_index_id", typeid(unsigned int).name(), t_index,sizeof(unsigned int), 1 });
  291. t_index += sizeof(unsigned int)*1;
  292. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_parkingspace_unit_id", typeid(unsigned int).name(), t_index,sizeof(unsigned int), 1 });
  293. t_index += sizeof(unsigned int)*1;
  294. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_parkingspace_label_id", typeid(unsigned int).name(), t_index,sizeof(unsigned int), 1 });
  295. t_index += sizeof(unsigned int)*1;
  296. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_parkingspace_floor_id", typeid(unsigned int).name(), t_index,sizeof(unsigned int), 1 });
  297. t_index += sizeof(unsigned int)*1;
  298. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_parkingspace_room_id", typeid(unsigned int).name(), t_index,sizeof(unsigned int), 1 });
  299. t_index += sizeof(unsigned int)*1;
  300. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_parkingspace_direction", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  301. t_index += sizeof(unsigned char)*1;
  302. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved111", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  303. t_index += sizeof(unsigned char)*1;
  304. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_center_x", typeid(float).name(), t_index,sizeof(float), 1 });
  305. t_index += sizeof(float)*1;
  306. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_center_y", typeid(float).name(), t_index,sizeof(float), 1 });
  307. t_index += sizeof(float)*1;
  308. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_angle", typeid(float).name(), t_index,sizeof(float), 1 });
  309. t_index += sizeof(float)*1;
  310. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_front_theta", typeid(float).name(), t_index,sizeof(float), 1 });
  311. t_index += sizeof(float)*1;
  312. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_length", typeid(float).name(), t_index,sizeof(float), 1 });
  313. t_index += sizeof(float)*1;
  314. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_width", typeid(float).name(), t_index,sizeof(float), 1 });
  315. t_index += sizeof(float)*1;
  316. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_height", typeid(float).name(), t_index,sizeof(float), 1 });
  317. t_index += sizeof(float)*1;
  318. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_wheel_base", typeid(float).name(), t_index,sizeof(float), 1 });
  319. t_index += sizeof(float)*1;
  320. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_wheel_width", typeid(float).name(), t_index,sizeof(float), 1 });
  321. t_index += sizeof(float)*1;
  322. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_license", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 20 });
  323. t_index += sizeof(unsigned char)*20;
  324. // t_snap7_buf.init(DISPATCH_RESPONSE_FROM_PLC_TO_MANAGER_DBNUMBER_0 +m_plc_id*100, 0, sizeof(Dispatch_response_from_plc_to_manager), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
  325. t_snap7_buf.init(DISPATCH_RESPONSE_FROM_PLC_TO_MANAGER_DBNUMBER_0 , 0, sizeof(Dispatch_response_from_plc_to_manager_ab), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
  326. // t_snap7_buf.init(DISPATCH_RESPONSE_FROM_PLC_TO_MANAGER_DBNUMBER_0 , 0, sizeof(Dispatch_response_from_plc_to_manager_ab), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
  327. m_receive_buf_map[0] = t_snap7_buf;
  328. }
  329. #ifdef CHUTIAN_PROJECT_PROJECT
  330. //调度状态
  331. t_index = 0;
  332. t_variable_information_vector.clear();
  333. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_dispatch_heartbeat", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  334. t_index += sizeof(unsigned char)*1;
  335. // t_snap7_buf.init(DISPATCH_PLC_STATUS_FROM_MANAGER_TO_PLC_DBNUMBER_0 +m_plc_id*100, 0, sizeof(Dispatch_plc_status_from_manager_to_plc), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
  336. t_snap7_buf.init(DISPATCH_PLC_STATUS_FROM_MANAGER_TO_PLC_DBNUMBER_0 , 0, sizeof(Dispatch_plc_status_from_manager_to_plc), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
  337. m_send_buf_map[2] = t_snap7_buf;
  338. t_index = 0;
  339. t_variable_information_vector.clear();
  340. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_plc_heartbeat", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  341. t_index += sizeof(unsigned char)*1;
  342. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_plc_status_info", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  343. t_index += sizeof(unsigned char)*1;
  344. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved2_37", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 36 });
  345. t_index += sizeof(unsigned char)*36;
  346. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_turnplate_angle_min1", typeid(float).name(), t_index,sizeof(float), 1 });
  347. t_index += sizeof(float)*1;
  348. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_turnplate_angle_max1", typeid(float).name(), t_index,sizeof(float), 1 });
  349. t_index += sizeof(float)*1;
  350. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_turnplate_angle_min2", typeid(float).name(), t_index,sizeof(float), 1 });
  351. t_index += sizeof(float)*1;
  352. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_turnplate_angle_max2", typeid(float).name(), t_index,sizeof(float), 1 });
  353. t_index += sizeof(float)*1;
  354. // t_snap7_buf.init(DISPATCH_PLC_STATUS_FROM_PLC_TO_MANAGER_DBNUMBER_0 +m_plc_id*100, 0, sizeof(Dispatch_plc_status_from_plc_to_manager), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
  355. t_snap7_buf.init(DISPATCH_PLC_STATUS_FROM_PLC_TO_MANAGER_DBNUMBER_0 , 0, sizeof(Dispatch_plc_status_from_plc_to_manager), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
  356. m_receive_buf_map[1] = t_snap7_buf;
  357. #endif //CHUTIAN_PROJECT_PROJECT
  358. #ifdef SHANGGUJIE_PROJECT_PROJECT
  359. //调度状态
  360. t_index = 0;
  361. t_variable_information_vector.clear();
  362. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_dispatch_heartbeat", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  363. t_index += sizeof(unsigned short)*1;
  364. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_inlet_door_control_1", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  365. t_index += sizeof(unsigned short)*1;
  366. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_inlet_door_control_2", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  367. t_index += sizeof(unsigned short)*1;
  368. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_outlet_door_control_3", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  369. t_index += sizeof(unsigned short)*1;
  370. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_outlet_door_control_4", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  371. t_index += sizeof(unsigned short)*1;
  372. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_ready_small_space_count", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  373. t_index += sizeof(unsigned short)*1;
  374. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_ready_middle_space_count", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  375. t_index += sizeof(unsigned short)*1;
  376. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_ready_big_space_count", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  377. t_index += sizeof(unsigned short)*1;
  378. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_ready_total_space_count", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  379. t_index += sizeof(unsigned short)*1;
  380. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_wait_small_park_count", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  381. t_index += sizeof(unsigned short)*1;
  382. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_wait_middle_park_count", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  383. t_index += sizeof(unsigned short)*1;
  384. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_wait_big_park_count", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  385. t_index += sizeof(unsigned short)*1;
  386. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_wait_total_park_count", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  387. t_index += sizeof(unsigned short)*1;
  388. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_wait_small_pick_count", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  389. t_index += sizeof(unsigned short)*1;
  390. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_wait_middle_pick_count", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  391. t_index += sizeof(unsigned short)*1;
  392. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_wait_big_pick_count", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  393. t_index += sizeof(unsigned short)*1;
  394. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_wait_total_pick_count", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  395. t_index += sizeof(unsigned short)*1;
  396. // t_snap7_buf.init(DISPATCH_PLC_STATUS_FROM_MANAGER_TO_PLC_DBNUMBER_0 +m_plc_id*100, 0, sizeof(Dispatch_plc_status_from_manager_to_plc), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
  397. t_snap7_buf.init(DISPATCH_PLC_STATUS_FROM_MANAGER_TO_PLC_DBNUMBER_0 , 0, sizeof(Dispatch_plc_status_from_manager_to_plc), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
  398. m_send_buf_map[2] = t_snap7_buf;
  399. t_index = 0;
  400. t_variable_information_vector.clear();
  401. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_plc_heartbeat", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  402. t_index += sizeof(unsigned short)*1;
  403. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_plc_mode_status", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  404. t_index += sizeof(unsigned char)*1;
  405. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_plc_passway_status", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  406. t_index += sizeof(unsigned char)*1;
  407. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_plc_carrier_status", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  408. t_index += sizeof(unsigned short)*1;
  409. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved6_9", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 4 });
  410. t_index += sizeof(unsigned char)*4;
  411. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_car_height", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  412. t_index += sizeof(unsigned short)*1;
  413. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_outside_door_status", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  414. t_index += sizeof(unsigned short)*1;
  415. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_inside_door_status", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  416. t_index += sizeof(unsigned short)*1;
  417. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_comb_body_status", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  418. t_index += sizeof(unsigned short)*1;
  419. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_turnplate_angle_min", typeid(float).name(), t_index,sizeof(float), 1 });
  420. t_index += sizeof(float)*1;
  421. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_turnplate_angle_max", typeid(float).name(), t_index,sizeof(float), 1 });
  422. t_index += sizeof(float)*1;
  423. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_sensor_1", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  424. t_index += sizeof(unsigned char)*1;
  425. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_sensor_2", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  426. t_index += sizeof(unsigned char)*1;
  427. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved18_25", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 2 });
  428. t_index += sizeof(unsigned char)*2;
  429. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_car_height", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  430. t_index += sizeof(unsigned short)*1;
  431. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_outside_door_status", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  432. t_index += sizeof(unsigned short)*1;
  433. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_inside_door_status", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  434. t_index += sizeof(unsigned short)*1;
  435. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_comb_body_status", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  436. t_index += sizeof(unsigned short)*1;
  437. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_turnplate_angle_min", typeid(float).name(), t_index,sizeof(float), 1 });
  438. t_index += sizeof(float)*1;
  439. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_turnplate_angle_max", typeid(float).name(), t_index,sizeof(float), 1 });
  440. t_index += sizeof(float)*1;
  441. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_sensor_1", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  442. t_index += sizeof(unsigned char)*1;
  443. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_sensor_2", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  444. t_index += sizeof(unsigned char)*1;
  445. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved18_25", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 2 });
  446. t_index += sizeof(unsigned char)*2;
  447. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_car_height", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  448. t_index += sizeof(unsigned short)*1;
  449. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_outside_door_status", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  450. t_index += sizeof(unsigned short)*1;
  451. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_inside_door_status", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  452. t_index += sizeof(unsigned short)*1;
  453. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_comb_body_status", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  454. t_index += sizeof(unsigned short)*1;
  455. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_turnplate_angle_min", typeid(float).name(), t_index,sizeof(float), 1 });
  456. t_index += sizeof(float)*1;
  457. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_turnplate_angle_max", typeid(float).name(), t_index,sizeof(float), 1 });
  458. t_index += sizeof(float)*1;
  459. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_sensor_1", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  460. t_index += sizeof(unsigned char)*1;
  461. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_sensor_2", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  462. t_index += sizeof(unsigned char)*1;
  463. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved18_25", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 2 });
  464. t_index += sizeof(unsigned char)*2;
  465. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_car_height", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  466. t_index += sizeof(unsigned short)*1;
  467. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_outside_door_status", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  468. t_index += sizeof(unsigned short)*1;
  469. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_inside_door_status", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  470. t_index += sizeof(unsigned short)*1;
  471. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_comb_body_status", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
  472. t_index += sizeof(unsigned short)*1;
  473. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_turnplate_angle_min", typeid(float).name(), t_index,sizeof(float), 1 });
  474. t_index += sizeof(float)*1;
  475. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_turnplate_angle_max", typeid(float).name(), t_index,sizeof(float), 1 });
  476. t_index += sizeof(float)*1;
  477. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_sensor_1", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  478. t_index += sizeof(unsigned char)*1;
  479. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_sensor_2", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  480. t_index += sizeof(unsigned char)*1;
  481. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved18_25", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 2 });
  482. t_index += sizeof(unsigned char)*2;
  483. // t_snap7_buf.init(DISPATCH_PLC_STATUS_FROM_PLC_TO_MANAGER_DBNUMBER_0 +m_plc_id*100, 0, sizeof(Dispatch_plc_status_from_plc_to_manager), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
  484. t_snap7_buf.init(DISPATCH_PLC_STATUS_FROM_PLC_TO_MANAGER_DBNUMBER_0 , 0, sizeof(Dispatch_plc_status_from_plc_to_manager), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
  485. m_receive_buf_map[1] = t_snap7_buf;
  486. #endif //SHANGGUJIE_PROJECT_PROJECT
  487. //地面雷达指令
  488. t_index = 0;
  489. t_variable_information_vector.clear();
  490. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_center_x", typeid(float).name(), t_index,sizeof(float), 1 });
  491. t_index += sizeof(float)*1;
  492. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_center_y", typeid(float).name(), t_index,sizeof(float), 1 });
  493. t_index += sizeof(float)*1;
  494. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_angle", typeid(float).name(), t_index,sizeof(float), 1 });
  495. t_index += sizeof(float)*1;
  496. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_front_theta", typeid(float).name(), t_index,sizeof(float), 1 });
  497. t_index += sizeof(float)*1;
  498. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_length", typeid(float).name(), t_index,sizeof(float), 1 });
  499. t_index += sizeof(float)*1;
  500. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_width", typeid(float).name(), t_index,sizeof(float), 1 });
  501. t_index += sizeof(float)*1;
  502. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_height", typeid(float).name(), t_index,sizeof(float), 1 });
  503. t_index += sizeof(float)*1;
  504. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_wheel_base", typeid(float).name(), t_index,sizeof(float), 1 });
  505. t_index += sizeof(float)*1;
  506. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_wheel_width", typeid(float).name(), t_index,sizeof(float), 1 });
  507. t_index += sizeof(float)*1;
  508. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_uniformed_car_x", typeid(float).name(), t_index,sizeof(float), 1 });
  509. t_index += sizeof(float)*1;
  510. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_uniformed_car_y", typeid(float).name(), t_index,sizeof(float), 1 });
  511. t_index += sizeof(float)*1;
  512. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_response_locate_correct", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  513. t_index += sizeof(unsigned char)*1;
  514. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_response_ground_status", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  515. t_index += sizeof(unsigned char)*1;
  516. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_response_motion_status", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  517. t_index += sizeof(unsigned char)*1;
  518. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved47", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  519. t_index += sizeof(unsigned char)*1;
  520. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_heartbeat", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  521. t_index += sizeof(unsigned char)*1;
  522. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_communication_mode", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  523. t_index += sizeof(unsigned char)*1;
  524. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_refresh_command", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  525. t_index += sizeof(unsigned char)*1;
  526. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_data_validity", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  527. t_index += sizeof(unsigned char)*1;
  528. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_response_data_validity", typeid(int).name(), t_index,sizeof(int), 1 });
  529. t_index += sizeof(int)*1;
  530. // t_snap7_buf.init(GROUND_LIDAR_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_0 +m_plc_id*100, 0, sizeof(Ground_lidar_response_from_manager_to_plc_for_data), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
  531. t_snap7_buf.init(GROUND_LIDAR_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_0 , 0, sizeof(Ground_lidar_response_from_manager_to_plc_for_data), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
  532. m_send_buf_map[3] = t_snap7_buf;
  533. // t_snap7_buf.init(GROUND_LIDAR_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_1 +m_plc_id*100, 0, sizeof(Ground_lidar_response_from_manager_to_plc_for_data), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
  534. t_snap7_buf.init(GROUND_LIDAR_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_1 , 0, sizeof(Ground_lidar_response_from_manager_to_plc_for_data), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
  535. m_send_buf_map[4] = t_snap7_buf;
  536. t_index = 0;
  537. t_variable_information_vector.clear();
  538. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_heartbeat", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  539. t_index += sizeof(unsigned char)*1;
  540. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_communication_mode", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  541. t_index += sizeof(unsigned char)*1;
  542. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_refresh_command", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  543. t_index += sizeof(unsigned char)*1;
  544. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_data_validity", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  545. t_index += sizeof(unsigned char)*1;
  546. // t_snap7_buf.init(GROUND_LIDAR_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_0 +m_plc_id*100, 0, sizeof(Ground_lidar_response_from_manager_to_plc_for_key), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
  547. t_snap7_buf.init(GROUND_LIDAR_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_0 , 0, sizeof(Ground_lidar_response_from_manager_to_plc_for_key), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
  548. m_send_buf_map[5] = t_snap7_buf;
  549. // t_snap7_buf.init(GROUND_LIDAR_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_1 +m_plc_id*100, 0, sizeof(Ground_lidar_response_from_manager_to_plc_for_key), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
  550. t_snap7_buf.init(GROUND_LIDAR_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_1 , 0, sizeof(Ground_lidar_response_from_manager_to_plc_for_key), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
  551. m_send_buf_map[6] = t_snap7_buf;
  552. t_index = 0;
  553. t_variable_information_vector.clear();
  554. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_heartbeat", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  555. t_index += sizeof(unsigned char)*1;
  556. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_communication_mode", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  557. t_index += sizeof(unsigned char)*1;
  558. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_refresh_command", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  559. t_index += sizeof(unsigned char)*1;
  560. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_data_validity", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  561. t_index += sizeof(unsigned char)*1;
  562. // t_snap7_buf.init(GROUND_LIDAR_REQUEST_FROM_PLC_TO_MANAGER_DBNUMBER_0 +m_plc_id*100, 0, sizeof(Ground_lidar_request_from_plc_to_manager), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
  563. t_snap7_buf.init(GROUND_LIDAR_REQUEST_FROM_PLC_TO_MANAGER_DBNUMBER_0 , 0, sizeof(Ground_lidar_request_from_plc_to_manager), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
  564. m_receive_buf_map[2] = t_snap7_buf;
  565. // t_snap7_buf.init(GROUND_LIDAR_REQUEST_FROM_PLC_TO_MANAGER_DBNUMBER_1 +m_plc_id*100, 0, sizeof(Ground_lidar_request_from_plc_to_manager), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
  566. t_snap7_buf.init(GROUND_LIDAR_REQUEST_FROM_PLC_TO_MANAGER_DBNUMBER_1 , 0, sizeof(Ground_lidar_request_from_plc_to_manager), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
  567. m_receive_buf_map[3] = t_snap7_buf;
  568. //防撞雷达
  569. t_index = 0;
  570. t_variable_information_vector.clear();
  571. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_response_anticollision_lidar_flag", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  572. t_index += sizeof(unsigned char)*1;
  573. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved5_7", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 3 });
  574. t_index += sizeof(unsigned char)*3;
  575. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_response_offset_x", typeid(float).name(), t_index,sizeof(float), 1 });
  576. t_index += sizeof(float)*1;
  577. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_response_offset_angle", typeid(float).name(), t_index,sizeof(float), 1 });
  578. t_index += sizeof(float)*1;
  579. // t_snap7_buf.init(ANTICOLLISION_LIDAR_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_0 +m_plc_id*100, 4, sizeof(Anticollision_lidar_response_from_manager_to_plc_for_data), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
  580. t_snap7_buf.init(ANTICOLLISION_LIDAR_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_0 , 4, sizeof(Anticollision_lidar_response_from_manager_to_plc_for_data), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
  581. m_send_buf_map[7] = t_snap7_buf;
  582. t_index = 0;
  583. t_variable_information_vector.clear();
  584. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_heartbeat", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  585. t_index += sizeof(unsigned char)*1;
  586. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_communication_mode", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  587. t_index += sizeof(unsigned char)*1;
  588. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_refresh_command", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  589. t_index += sizeof(unsigned char)*1;
  590. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_data_validity", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  591. t_index += sizeof(unsigned char)*1;
  592. // t_snap7_buf.init(ANTICOLLISION_LIDAR_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_0 +m_plc_id*100, 0, sizeof(Anticollision_lidar_response_from_manager_to_plc_for_key), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
  593. t_snap7_buf.init(ANTICOLLISION_LIDAR_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_0 , 0, sizeof(Anticollision_lidar_response_from_manager_to_plc_for_key), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
  594. m_send_buf_map[8] = t_snap7_buf;
  595. t_index = 0;
  596. t_variable_information_vector.clear();
  597. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_heartbeat", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  598. t_index += sizeof(unsigned char)*1;
  599. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_communication_mode", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  600. t_index += sizeof(unsigned char)*1;
  601. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_refresh_command", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  602. t_index += sizeof(unsigned char)*1;
  603. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_data_validity", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  604. t_index += sizeof(unsigned char)*1;
  605. // t_snap7_buf.init(ANTICOLLISION_LIDAR_REQUEST_FROM_PLC_TO_MANAGER_DBNUMBER_0 +m_plc_id*100, 0, sizeof(Anticollision_lidar_request_from_plc_to_manager), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
  606. t_snap7_buf.init(ANTICOLLISION_LIDAR_REQUEST_FROM_PLC_TO_MANAGER_DBNUMBER_0 , 0, sizeof(Anticollision_lidar_request_from_plc_to_manager), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
  607. m_receive_buf_map[4] = t_snap7_buf;
  608. //单片机指令
  609. t_index = 0;
  610. t_variable_information_vector.clear();
  611. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_process_status", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  612. t_index += sizeof(unsigned char)*1;
  613. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_process_control", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  614. t_index += sizeof(unsigned char)*1;
  615. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_over_border_status", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  616. t_index += sizeof(unsigned char)*1;
  617. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_car_height_status_current", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  618. t_index += sizeof(unsigned char)*1;
  619. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_car_height_status_passing", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  620. t_index += sizeof(unsigned char)*1;
  621. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_outside_door_status", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  622. t_index += sizeof(unsigned char)*1;
  623. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_outside_door_control", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  624. t_index += sizeof(unsigned char)*1;
  625. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_dispatch_finish_flag", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  626. t_index += sizeof(unsigned char)*1;
  627. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_inside_existence_flag", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  628. t_index += sizeof(unsigned char)*1;
  629. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_outside_existence_flag", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  630. t_index += sizeof(unsigned char)*1;
  631. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reset_flag", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  632. t_index += sizeof(unsigned char)*1;
  633. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_stop_flag", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  634. t_index += sizeof(unsigned char)*1;
  635. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_error_code", typeid(unsigned int).name(), t_index,sizeof(unsigned int), 1 });
  636. t_index += sizeof(unsigned int)*1;
  637. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved16_35", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 20 });
  638. t_index += sizeof(unsigned char)*20;
  639. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_gpio_input", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 16 });
  640. t_index += sizeof(unsigned char)*16;
  641. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_gpio_output", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 8 });
  642. t_index += sizeof(unsigned char)*8;
  643. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved60_79", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 20 });
  644. t_index += sizeof(unsigned char)*20;
  645. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_heartbeat", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  646. t_index += sizeof(unsigned char)*1;
  647. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_communication_mode", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  648. t_index += sizeof(unsigned char)*1;
  649. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_refresh_command", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  650. t_index += sizeof(unsigned char)*1;
  651. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_data_validity", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  652. t_index += sizeof(unsigned char)*1;
  653. // t_snap7_buf.init(SINGLECHIP_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_0 +m_plc_id*100, 0, sizeof(Singlechip_response_from_manager_to_plc), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
  654. t_snap7_buf.init(SINGLECHIP_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_0 , 0, sizeof(Singlechip_response_from_manager_to_plc), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
  655. m_send_buf_map[9] = t_snap7_buf;
  656. // t_snap7_buf.init(SINGLECHIP_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_1 +m_plc_id*100, 0, sizeof(Singlechip_response_from_manager_to_plc), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
  657. t_snap7_buf.init(SINGLECHIP_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_1 , 0, sizeof(Singlechip_response_from_manager_to_plc), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
  658. m_send_buf_map[10] = t_snap7_buf;
  659. // t_snap7_buf.init(SINGLECHIP_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_2 +m_plc_id*100, 0, sizeof(Singlechip_response_from_manager_to_plc), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
  660. t_snap7_buf.init(SINGLECHIP_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_2 , 0, sizeof(Singlechip_response_from_manager_to_plc), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
  661. m_send_buf_map[11] = t_snap7_buf;
  662. // t_snap7_buf.init(SINGLECHIP_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_3 +m_plc_id*100, 0, sizeof(Singlechip_response_from_manager_to_plc), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
  663. t_snap7_buf.init(SINGLECHIP_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_3 , 0, sizeof(Singlechip_response_from_manager_to_plc), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
  664. m_send_buf_map[12] = t_snap7_buf;
  665. t_index = 0;
  666. t_variable_information_vector.clear();
  667. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_heartbeat", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  668. t_index += sizeof(unsigned char)*1;
  669. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_communication_mode", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  670. t_index += sizeof(unsigned char)*1;
  671. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_refresh_command", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  672. t_index += sizeof(unsigned char)*1;
  673. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_data_validity", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  674. t_index += sizeof(unsigned char)*1;
  675. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_insidedoor_status", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  676. t_index += sizeof(unsigned char)*1;
  677. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_outsidedoor_control", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
  678. t_index += sizeof(unsigned char)*1;
  679. // t_snap7_buf.init(SINGLECHIP_REQUEST_FROM_PLC_TO_MANAGER_DBNUMBER_0 +m_plc_id*100, 0, sizeof(Singlechip_request_from_plc_to_manager), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
  680. t_snap7_buf.init(SINGLECHIP_REQUEST_FROM_PLC_TO_MANAGER_DBNUMBER_0 , 0, sizeof(Singlechip_request_from_plc_to_manager), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
  681. m_receive_buf_map[5] = t_snap7_buf;
  682. // t_snap7_buf.init(SINGLECHIP_REQUEST_FROM_PLC_TO_MANAGER_DBNUMBER_1 +m_plc_id*100, 0, sizeof(Singlechip_request_from_plc_to_manager), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
  683. t_snap7_buf.init(SINGLECHIP_REQUEST_FROM_PLC_TO_MANAGER_DBNUMBER_1 , 0, sizeof(Singlechip_request_from_plc_to_manager), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
  684. m_receive_buf_map[6] = t_snap7_buf;
  685. // t_snap7_buf.init(SINGLECHIP_REQUEST_FROM_PLC_TO_MANAGER_DBNUMBER_2 +m_plc_id*100, 0, sizeof(Singlechip_request_from_plc_to_manager), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
  686. t_snap7_buf.init(SINGLECHIP_REQUEST_FROM_PLC_TO_MANAGER_DBNUMBER_2 , 0, sizeof(Singlechip_request_from_plc_to_manager), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
  687. m_receive_buf_map[7] = t_snap7_buf;
  688. // t_snap7_buf.init(SINGLECHIP_REQUEST_FROM_PLC_TO_MANAGER_DBNUMBER_3 +m_plc_id*100, 0, sizeof(Singlechip_request_from_plc_to_manager), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
  689. t_snap7_buf.init(SINGLECHIP_REQUEST_FROM_PLC_TO_MANAGER_DBNUMBER_3 , 0, sizeof(Singlechip_request_from_plc_to_manager), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
  690. m_receive_buf_map[8] = t_snap7_buf;
  691. //plc数据储存
  692. t_index = 0;
  693. t_variable_information_vector.clear();
  694. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_plc_data", typeid(float).name(), t_index,sizeof(float), DATA_STORAGE_PLC_DATA_LENGTH });
  695. t_index += sizeof(float)*DATA_STORAGE_PLC_DATA_LENGTH;
  696. t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_heartbeat", typeid(float).name(), t_index,sizeof(float), 1 });
  697. t_index += sizeof(float)*1;
  698. t_snap7_buf.init(DATA_STORAGE_FROM_PLC_TO_MANAGER_DBNUMBER_0 , 0, sizeof(Data_storage_from_plc_to_manager), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
  699. m_receive_buf_map[9] = t_snap7_buf;
  700. switch ( m_plc_id )
  701. {
  702. case 0:
  703. {
  704. return Snap7_communication_base::communication_init_from_protobuf(SETTING_PATH SNAP7_COMMUNICATION_PARAMETER_PATH_A);
  705. break;
  706. }
  707. case 1:
  708. {
  709. return Snap7_communication_base::communication_init_from_protobuf(SETTING_PATH SNAP7_COMMUNICATION_PARAMETER_PATH_B);
  710. break;
  711. }
  712. case 2:
  713. {
  714. return Snap7_communication_base::communication_init_from_protobuf(SETTING_PATH SNAP7_COMMUNICATION_PARAMETER_PATH_C);
  715. break;
  716. }
  717. case 11:
  718. {
  719. return Snap7_communication_base::communication_init_from_protobuf(SETTING_PATH SNAP7_COMMUNICATION_PARAMETER_PATH_A1);
  720. break;
  721. }
  722. case 12:
  723. {
  724. return Snap7_communication_base::communication_init_from_protobuf(SETTING_PATH SNAP7_COMMUNICATION_PARAMETER_PATH_A2);
  725. break;
  726. }
  727. case 13:
  728. {
  729. return Snap7_communication_base::communication_init_from_protobuf(SETTING_PATH SNAP7_COMMUNICATION_PARAMETER_PATH_A3);
  730. break;
  731. }
  732. case 14:
  733. {
  734. return Snap7_communication_base::communication_init_from_protobuf(SETTING_PATH SNAP7_COMMUNICATION_PARAMETER_PATH_A4);
  735. break;
  736. }
  737. case 21:
  738. {
  739. return Snap7_communication_base::communication_init_from_protobuf(SETTING_PATH SNAP7_COMMUNICATION_PARAMETER_PATH_B1);
  740. break;
  741. }
  742. case 22:
  743. {
  744. return Snap7_communication_base::communication_init_from_protobuf(SETTING_PATH SNAP7_COMMUNICATION_PARAMETER_PATH_B2);
  745. break;
  746. }
  747. case 23:
  748. {
  749. return Snap7_communication_base::communication_init_from_protobuf(SETTING_PATH SNAP7_COMMUNICATION_PARAMETER_PATH_B3);
  750. break;
  751. }
  752. case 24:
  753. {
  754. return Snap7_communication_base::communication_init_from_protobuf(SETTING_PATH SNAP7_COMMUNICATION_PARAMETER_PATH_B4);
  755. break;
  756. }
  757. case 25:
  758. {
  759. return Snap7_communication_base::communication_init_from_protobuf(SETTING_PATH SNAP7_COMMUNICATION_PARAMETER_PATH_B5);
  760. break;
  761. }
  762. case 31:
  763. {
  764. return Snap7_communication_base::communication_init_from_protobuf(SETTING_PATH SNAP7_COMMUNICATION_PARAMETER_PATH_C1);
  765. break;
  766. }
  767. case 32:
  768. {
  769. return Snap7_communication_base::communication_init_from_protobuf(SETTING_PATH SNAP7_COMMUNICATION_PARAMETER_PATH_C2);
  770. break;
  771. }
  772. default:
  773. {
  774. return Error_manager(Error_code::SNAP7_READ_PROTOBUF_ERROR, Error_level::MINOR_ERROR,
  775. " Dispatch_communication::communication_init m_plc_id error ");
  776. break;
  777. }
  778. }
  779. }
  780. //反初始化 通信 模块。
  781. Error_manager Dispatch_communication::communication_uninit()
  782. {
  783. return Snap7_communication_base::communication_uninit();
  784. }
  785. //更新数据
  786. Error_manager Dispatch_communication::updata_receive_buf()
  787. {
  788. // return Error_code::SUCCESS;
  789. std::unique_lock<std::mutex> t_lock1(m_receive_buf_lock);
  790. std::unique_lock<std::mutex> t_lock2(m_data_lock);
  791. //AB单元的9000和9001特殊处理, 删除168字节后面的
  792. if ( m_plc_id == 31 || m_plc_id == 32)
  793. {
  794. memcpy(&m_dispatch_response_from_plc_to_manager, m_receive_buf_map[0].mp_buf_obverse,m_receive_buf_map[0].m_size);
  795. }
  796. else
  797. {
  798. memcpy(&m_dispatch_response_from_plc_to_manager_ab, m_receive_buf_map[0].mp_buf_obverse,m_receive_buf_map[0].m_size);
  799. }
  800. memcpy(&m_dispatch_plc_status_from_plc_to_manager, m_receive_buf_map[1].mp_buf_obverse, m_receive_buf_map[1].m_size);
  801. memcpy(&m_ground_lidar_request_from_plc_to_manager[0], m_receive_buf_map[2].mp_buf_obverse, m_receive_buf_map[2].m_size);
  802. memcpy(&m_ground_lidar_request_from_plc_to_manager[1], m_receive_buf_map[3].mp_buf_obverse, m_receive_buf_map[3].m_size);
  803. memcpy(&m_anticollision_lidar_request_from_plc_to_manager, m_receive_buf_map[4].mp_buf_obverse, m_receive_buf_map[4].m_size);
  804. memcpy(&m_singlechip_request_from_plc_to_manager[0], m_receive_buf_map[5].mp_buf_obverse, m_receive_buf_map[5].m_size);
  805. memcpy(&m_singlechip_request_from_plc_to_manager[1], m_receive_buf_map[6].mp_buf_obverse, m_receive_buf_map[6].m_size);
  806. memcpy(&m_singlechip_request_from_plc_to_manager[3], m_receive_buf_map[7].mp_buf_obverse, m_receive_buf_map[7].m_size);
  807. memcpy(&m_singlechip_request_from_plc_to_manager[4], m_receive_buf_map[8].mp_buf_obverse, m_receive_buf_map[8].m_size);
  808. memcpy(&m_data_storage_from_plc_to_manager, m_receive_buf_map[9].mp_buf_obverse, m_receive_buf_map[9].m_size);
  809. // std::cout << " huli test :::: " << " 1111111111111111111111111111111111111111111111111 (int)m_dispatch_plc_status_from_plc_to_manager.m_plc_heartbeat = " << (int)m_dispatch_plc_status_from_plc_to_manager.m_plc_heartbeat << std::endl;
  810. return Error_code::SUCCESS;
  811. }
  812. Error_manager Dispatch_communication::updata_send_buf()
  813. {
  814. std::unique_lock<std::mutex> t_lock1(m_send_buf_lock);
  815. std::unique_lock<std::mutex> t_lock2(m_data_lock);
  816. // std::cout << " huli test :::: " << " m_dispatch_plc_status_from_manager_to_plc 123= " << m_dispatch_plc_status_from_manager_to_plc.m_dispatch_heartbeat << std::endl;
  817. //AB单元的9000和9001特殊处理, 删除168字节后面的
  818. if ( m_plc_id == 31 || m_plc_id == 32)
  819. {
  820. memcpy(m_send_buf_map[0].mp_buf_obverse, &m_dispatch_request_from_manager_to_plc_for_data,
  821. m_send_buf_map[0].m_size);
  822. // std::string asd = std::string( (char*)m_dispatch_request_from_manager_to_plc_for_data.m_request_car_license, 20);
  823. // LOG(INFO) << " aasdasdasdasdasdasdasdasd " << asd << " "<< this;
  824. // for (int i = 0; i < 20; ++i)
  825. // {
  826. // int zxc = m_dispatch_request_from_manager_to_plc_for_data.m_request_car_license[i];
  827. // LOG(INFO) << i <<" = " << zxc;
  828. //
  829. // }
  830. //
  831. // int fgh = m_dispatch_request_from_manager_to_plc_for_data.m_request_dispatch_motion_direction;
  832. // LOG(INFO) <<" m_request_dispatch_motion_direction = " << fgh;
  833. }
  834. else
  835. {
  836. memcpy(m_send_buf_map[0].mp_buf_obverse, &m_dispatch_request_from_manager_to_plc_for_data_ab,
  837. m_send_buf_map[0].m_size);
  838. }
  839. memcpy(m_send_buf_map[1].mp_buf_obverse, &m_dispatch_request_from_manager_to_plc_for_key, m_send_buf_map[1].m_size);
  840. memcpy(m_send_buf_map[2].mp_buf_obverse, &m_dispatch_plc_status_from_manager_to_plc, m_send_buf_map[2].m_size);
  841. memcpy(m_send_buf_map[3].mp_buf_obverse, &m_ground_lidar_response_from_manager_to_plc_for_data[0], m_send_buf_map[3].m_size);
  842. memcpy(m_send_buf_map[4].mp_buf_obverse, &m_ground_lidar_response_from_manager_to_plc_for_data[1], m_send_buf_map[4].m_size);
  843. memcpy(m_send_buf_map[5].mp_buf_obverse, &m_ground_lidar_response_from_manager_to_plc_for_key[0], m_send_buf_map[5].m_size);
  844. memcpy(m_send_buf_map[6].mp_buf_obverse, &m_ground_lidar_response_from_manager_to_plc_for_key[1], m_send_buf_map[6].m_size);
  845. memcpy(m_send_buf_map[7].mp_buf_obverse, &m_anticollision_lidar_response_from_manager_to_plc_for_data, m_send_buf_map[7].m_size);
  846. memcpy(m_send_buf_map[8].mp_buf_obverse, &m_anticollision_lidar_response_from_manager_to_plc_for_key, m_send_buf_map[8].m_size);
  847. memcpy(m_send_buf_map[9].mp_buf_obverse, &m_singlechip_response_from_manager_to_plc[0], m_send_buf_map[9].m_size);
  848. memcpy(m_send_buf_map[10].mp_buf_obverse, &m_singlechip_response_from_manager_to_plc[1], m_send_buf_map[10].m_size);
  849. memcpy(m_send_buf_map[11].mp_buf_obverse, &m_singlechip_response_from_manager_to_plc[2], m_send_buf_map[11].m_size);
  850. memcpy(m_send_buf_map[12].mp_buf_obverse, &m_singlechip_response_from_manager_to_plc[3], m_send_buf_map[12].m_size);
  851. // std::cout << " huli test :::: " << " 2222222222222222222222222222222222222222222222222 (int)m_dispatch_plc_status_from_manager_to_plc.m_dispatch_heartbeat = " << (int)m_dispatch_plc_status_from_manager_to_plc.m_dispatch_heartbeat << std::endl;
  852. // std::cout << " huli test :::: " << " 3333333333333333333333333333333333333333333333333 (int)m_ground_lidar_response_from_manager_to_plc_for_data[0].m_response_heartbeat = " << (int)m_ground_lidar_response_from_manager_to_plc_for_data[0].m_response_heartbeat << std::endl;
  853. // std::cout << " huli test :::: " << " 4444444444444444444444444444444444444444444444444 (int)m_ground_lidar_response_from_manager_to_plc_for_data[1].m_response_heartbeat = " << (int)m_ground_lidar_response_from_manager_to_plc_for_data[1].m_response_heartbeat << std::endl;
  854. //
  855. // std::cout << " huli test :::: " << " xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx = " << std::endl;
  856. return Error_code::SUCCESS;
  857. }