|
@@ -0,0 +1,558 @@
|
|
|
+//
|
|
|
+// 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_reserved217_231", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 25 });
|
|
|
+ t_index += sizeof(unsigned char)*25;
|
|
|
+
|
|
|
+// 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_reserved217_231", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 25 });
|
|
|
+ t_index += sizeof(unsigned char)*25;
|
|
|
+
|
|
|
+// 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_reserved45_48", 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_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_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_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::NO_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::NO_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::NO_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::NO_COMMUNICATION);
|
|
|
+ m_receive_buf_map[8] = 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);
|
|
|
+
|
|
|
+
|
|
|
+ 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;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|