123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593 |
- //
- // Created by huli on 2020/9/25.
- //
- #include "dispatch_communication.h"
- Dispatch_communication::Dispatch_communication()
- {
- }
- Dispatch_communication::~Dispatch_communication()
- {
- }
- //初始化 通信 模块。如下三选一
- Error_manager Dispatch_communication::communication_init(int plc_id)
- {
- m_plc_id = plc_id;
- int t_index = 0;
- std::vector<Snap7_buf::Variable_information> t_variable_information_vector;
- //往map通信缓存里面添加所需要的buf
- std::unique_lock<std::mutex> t_lock1(m_receive_buf_lock);
- std::unique_lock<std::mutex> t_lock2(m_send_buf_lock);
- Snap7_buf t_snap7_buf;
- //调度指令
- t_index = 0;
- t_variable_information_vector.clear();
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_status", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved51", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_working_total_time", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_working_remaining_time", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved60_73", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 14 });
- t_index += sizeof(unsigned char)*14;
- 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 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved75_79", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 5 });
- t_index += sizeof(unsigned char)*5;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_passageway_id", typeid(unsigned int).name(), t_index,sizeof(unsigned int), 1 });
- t_index += sizeof(unsigned int)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_passageway_direction", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved85_89", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 5 });
- t_index += sizeof(unsigned char)*5;
- 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 });
- t_index += sizeof(unsigned int)*1;
- 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 });
- t_index += sizeof(unsigned int)*1;
- 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 });
- t_index += sizeof(unsigned int)*1;
- 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 });
- t_index += sizeof(unsigned int)*1;
- 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 });
- t_index += sizeof(unsigned int)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_parkingspace_direction", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved111", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_center_x", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_center_y", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_angle", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_front_theta", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_length", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_width", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_height", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_wheel_base", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_wheel_width", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_license", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 20 });
- t_index += sizeof(unsigned char)*20;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved168_187", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 20 });
- t_index += sizeof(unsigned char)*20;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_type", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved189_191", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 3 });
- t_index += sizeof(unsigned char)*3;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_uniformed_car_x", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_uniformed_car_y", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved200_209", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 10 });
- t_index += sizeof(unsigned char)*10;
- 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 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved211_215", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 5 });
- t_index += sizeof(unsigned char)*5;
- 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 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_clamp_lidar_deviation_1", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_clamp_lidar_deviation_2", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_clamp_lidar_deviation_3", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_clamp_lidar_deviation_4", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- // 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);
- 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);
- m_send_buf_map[0] = t_snap7_buf;
- t_index = 0;
- t_variable_information_vector.clear();
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_key", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 50 });
- t_index += sizeof(unsigned char)*50;
- // 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);
- 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);
- m_send_buf_map[1] = t_snap7_buf;
- t_index = 0;
- t_variable_information_vector.clear();
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_response_key", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 50 });
- t_index += sizeof(unsigned char)*50;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved50", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved51", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_working_total_time", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_working_remaining_time", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved60_73", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 14 });
- t_index += sizeof(unsigned char)*14;
- 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 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved75_79", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 5 });
- t_index += sizeof(unsigned char)*5;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_passageway_id", typeid(unsigned int).name(), t_index,sizeof(unsigned int), 1 });
- t_index += sizeof(unsigned int)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_passageway_direction", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved85_89", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 5 });
- t_index += sizeof(unsigned char)*5;
- 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 });
- t_index += sizeof(unsigned int)*1;
- 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 });
- t_index += sizeof(unsigned int)*1;
- 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 });
- t_index += sizeof(unsigned int)*1;
- 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 });
- t_index += sizeof(unsigned int)*1;
- 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 });
- t_index += sizeof(unsigned int)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_parkingspace_direction", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved111", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_center_x", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_center_y", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_angle", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_front_theta", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_length", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_width", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_height", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_wheel_base", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_wheel_width", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_license", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 20 });
- t_index += sizeof(unsigned char)*20;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved168_187", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 20 });
- t_index += sizeof(unsigned char)*20;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_type", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved189_191", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 3 });
- t_index += sizeof(unsigned char)*3;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_uniformed_car_x", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_uniformed_car_y", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved200_209", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 10 });
- t_index += sizeof(unsigned char)*10;
- 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 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved211_215", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 5 });
- t_index += sizeof(unsigned char)*5;
- 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 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_clamp_lidar_deviation_1", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_clamp_lidar_deviation_2", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_clamp_lidar_deviation_3", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_clamp_lidar_deviation_4", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- // 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);
- 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);
- m_receive_buf_map[0] = t_snap7_buf;
- //调度状态
- t_index = 0;
- t_variable_information_vector.clear();
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_dispatch_heartbeat", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- // 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);
- 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);
- m_send_buf_map[2] = t_snap7_buf;
- t_index = 0;
- t_variable_information_vector.clear();
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_plc_heartbeat", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_plc_status_info", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved2_37", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 36 });
- t_index += sizeof(unsigned char)*36;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_turnplate_angle_min1", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_turnplate_angle_max1", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_turnplate_angle_min2", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_turnplate_angle_max2", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- // 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);
- 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);
- m_receive_buf_map[1] = t_snap7_buf;
- //地面雷达指令
- t_index = 0;
- t_variable_information_vector.clear();
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_center_x", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_center_y", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_angle", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_front_theta", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_length", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_width", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_height", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_wheel_base", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_wheel_width", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_uniformed_car_x", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_uniformed_car_y", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_response_locate_correct", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_response_ground_status", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved46_47", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 2 });
- t_index += sizeof(unsigned char)*2;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_heartbeat", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_communication_mode", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_refresh_command", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_data_validity", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_response_data_validity", typeid(int).name(), t_index,sizeof(int), 1 });
- t_index += sizeof(int)*1;
- // 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);
- 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);
- m_send_buf_map[3] = t_snap7_buf;
- // 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);
- 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);
- m_send_buf_map[4] = t_snap7_buf;
- t_index = 0;
- t_variable_information_vector.clear();
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_heartbeat", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_communication_mode", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_refresh_command", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_data_validity", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- // 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);
- 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);
- m_send_buf_map[5] = t_snap7_buf;
- // 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);
- 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);
- m_send_buf_map[6] = t_snap7_buf;
- t_index = 0;
- t_variable_information_vector.clear();
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_heartbeat", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_communication_mode", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_refresh_command", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_data_validity", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- // 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);
- 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::NO_COMMUNICATION);
- m_receive_buf_map[2] = t_snap7_buf;
- // 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);
- 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::NO_COMMUNICATION);
- m_receive_buf_map[3] = t_snap7_buf;
- //防撞雷达
- t_index = 0;
- t_variable_information_vector.clear();
- 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 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved5_7", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 3 });
- t_index += sizeof(unsigned char)*3;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_response_offset_x", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_response_offset_angle", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- // 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);
- 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::LOOP_COMMUNICATION);
- m_send_buf_map[7] = t_snap7_buf;
- t_index = 0;
- t_variable_information_vector.clear();
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_heartbeat", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_communication_mode", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_refresh_command", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_data_validity", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- // 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);
- 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::LOOP_COMMUNICATION);
- m_send_buf_map[8] = t_snap7_buf;
- t_index = 0;
- t_variable_information_vector.clear();
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_heartbeat", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_communication_mode", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_refresh_command", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_data_validity", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- // 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);
- 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);
- m_receive_buf_map[4] = t_snap7_buf;
- //单片机指令
- t_index = 0;
- t_variable_information_vector.clear();
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_process_status", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_process_control", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_over_border_status", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- 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 });
- t_index += sizeof(unsigned char)*1;
- 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 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_outside_door_status", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_outside_door_control", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_dispatch_finish_flag", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_inside_existence_flag", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_outside_existence_flag", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reset_flag", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_stop_flag", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_error_code", typeid(unsigned int).name(), t_index,sizeof(unsigned int), 1 });
- t_index += sizeof(unsigned int)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved16_35", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 20 });
- t_index += sizeof(unsigned char)*20;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_gpio_input", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 16 });
- t_index += sizeof(unsigned char)*16;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_gpio_output", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 8 });
- t_index += sizeof(unsigned char)*8;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved60_79", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 20 });
- t_index += sizeof(unsigned char)*20;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_heartbeat", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_communication_mode", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_refresh_command", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_data_validity", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- // 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);
- 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::LOOP_COMMUNICATION);
- m_send_buf_map[9] = t_snap7_buf;
- // 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);
- 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::LOOP_COMMUNICATION);
- m_send_buf_map[10] = t_snap7_buf;
- // 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);
- 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::LOOP_COMMUNICATION);
- m_send_buf_map[11] = t_snap7_buf;
- // 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);
- 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::LOOP_COMMUNICATION);
- m_send_buf_map[12] = t_snap7_buf;
- t_index = 0;
- t_variable_information_vector.clear();
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_heartbeat", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_communication_mode", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_refresh_command", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_data_validity", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_insidedoor_status", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_outsidedoor_control", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
- t_index += sizeof(unsigned char)*1;
- // 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);
- 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::LOOP_COMMUNICATION);
- m_receive_buf_map[5] = t_snap7_buf;
- // 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);
- 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::LOOP_COMMUNICATION);
- m_receive_buf_map[6] = t_snap7_buf;
- // 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);
- 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::LOOP_COMMUNICATION);
- m_receive_buf_map[7] = t_snap7_buf;
- // 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);
- 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::LOOP_COMMUNICATION);
- m_receive_buf_map[8] = t_snap7_buf;
- //plc数据储存
- t_index = 0;
- t_variable_information_vector.clear();
- 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 });
- t_index += sizeof(float)*DATA_STORAGE_PLC_DATA_LENGTH;
- t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_heartbeat", typeid(float).name(), t_index,sizeof(float), 1 });
- t_index += sizeof(float)*1;
- 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);
- m_receive_buf_map[9] = t_snap7_buf;
- switch ( m_plc_id )
- {
- case 0:
- {
- return Snap7_communication_base::communication_init_from_protobuf(SNAP7_COMMUNICATION_PARAMETER_PATH_A);
- break;
- }
- case 1:
- {
- return Snap7_communication_base::communication_init_from_protobuf(SNAP7_COMMUNICATION_PARAMETER_PATH_B);
- break;
- }
- case 2:
- {
- return Snap7_communication_base::communication_init_from_protobuf(SNAP7_COMMUNICATION_PARAMETER_PATH_C);
- break;
- }
- default:
- {
- return Error_manager(Error_code::SNAP7_READ_PROTOBUF_ERROR, Error_level::MINOR_ERROR,
- " Dispatch_communication::communication_init m_plc_id error ");
- break;
- }
- }
- }
- //反初始化 通信 模块。
- Error_manager Dispatch_communication::communication_uninit()
- {
- return Snap7_communication_base::communication_uninit();
- }
- //更新数据
- Error_manager Dispatch_communication::updata_receive_buf()
- {
- // return Error_code::SUCCESS;
- std::unique_lock<std::mutex> t_lock1(m_receive_buf_lock);
- std::unique_lock<std::mutex> t_lock2(m_data_lock);
- memcpy(&m_dispatch_response_from_plc_to_manager, m_receive_buf_map[0].mp_buf_obverse, m_receive_buf_map[0].m_size);
- memcpy(&m_dispatch_plc_status_from_plc_to_manager, m_receive_buf_map[1].mp_buf_obverse, m_receive_buf_map[1].m_size);
- 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);
- 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);
- memcpy(&m_anticollision_lidar_request_from_plc_to_manager, m_receive_buf_map[4].mp_buf_obverse, m_receive_buf_map[4].m_size);
- memcpy(&m_singlechip_request_from_plc_to_manager[0], m_receive_buf_map[5].mp_buf_obverse, m_receive_buf_map[5].m_size);
- memcpy(&m_singlechip_request_from_plc_to_manager[1], m_receive_buf_map[6].mp_buf_obverse, m_receive_buf_map[6].m_size);
- memcpy(&m_singlechip_request_from_plc_to_manager[3], m_receive_buf_map[7].mp_buf_obverse, m_receive_buf_map[7].m_size);
- memcpy(&m_singlechip_request_from_plc_to_manager[4], m_receive_buf_map[8].mp_buf_obverse, m_receive_buf_map[8].m_size);
- memcpy(&m_data_storage_from_plc_to_manager, m_receive_buf_map[9].mp_buf_obverse, m_receive_buf_map[9].m_size);
- return Error_code::SUCCESS;
- }
- Error_manager Dispatch_communication::updata_send_buf()
- {
- std::unique_lock<std::mutex> t_lock1(m_send_buf_lock);
- std::unique_lock<std::mutex> t_lock2(m_data_lock);
- memcpy(m_send_buf_map[0].mp_buf_obverse, &m_dispatch_request_from_manager_to_plc_for_data, m_send_buf_map[0].m_size);
- 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);
- memcpy(m_send_buf_map[2].mp_buf_obverse, &m_dispatch_plc_status_from_manager_to_plc, m_send_buf_map[2].m_size);
- 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);
- 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);
- 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);
- 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);
- 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);
- 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);
- memcpy(m_send_buf_map[9].mp_buf_obverse, &m_singlechip_response_from_manager_to_plc[0], m_send_buf_map[9].m_size);
- memcpy(m_send_buf_map[10].mp_buf_obverse, &m_singlechip_response_from_manager_to_plc[1], m_send_buf_map[10].m_size);
- memcpy(m_send_buf_map[11].mp_buf_obverse, &m_singlechip_response_from_manager_to_plc[2], m_send_buf_map[11].m_size);
- memcpy(m_send_buf_map[12].mp_buf_obverse, &m_singlechip_response_from_manager_to_plc[3], m_send_buf_map[12].m_size);
- // std::cout << " huli test :::: " << " m_dispatch_request_from_manager_to_plc_for_data = " << m_dispatch_request_from_manager_to_plc_for_data.m_request_car_center_x << std::endl;
- return Error_code::SUCCESS;
- }
|