//
// 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;




	//AB单元的9000和9001特殊处理, 删除168字节后面的
	if ( m_plc_id == 31 || m_plc_id == 32)
	{
		//调度指令
		t_index = 0;
		t_variable_information_vector.clear();
		t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_status", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
		t_index += sizeof(unsigned short)*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", 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_height_level", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
		t_index += sizeof(unsigned short)*1;
		t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved88_89", 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_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);
//		t_snap7_buf.init(DISPATCH_REQUEST_FROM_MANAGER_TO_PLC_DBNUMBER_0 , 50, sizeof(Dispatch_request_from_manager_to_plc_for_data), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
		m_send_buf_map[0] = t_snap7_buf;
	}
	else
	{

		//调度指令
		t_index = 0;
		t_variable_information_vector.clear();
		t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_status", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
		t_index += sizeof(unsigned short)*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 short).name(), t_index,sizeof(unsigned short), 1 });
		t_index += sizeof(unsigned short)*1;
		t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved75_79", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 4 });
		t_index += sizeof(unsigned char)*4;
		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", 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_height_level", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
		t_index += sizeof(unsigned short)*1;
		t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved88_89", 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_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_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_ab), 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_ab), t_variable_information_vector, Snap7_buf::NO_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);
//	t_snap7_buf.init(DISPATCH_REQUEST_FROM_MANAGER_TO_PLC_DBNUMBER_0 , 0, sizeof(Dispatch_request_from_manager_to_plc_for_key), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
	m_send_buf_map[1] = t_snap7_buf;





	//AB单元的9000和9001特殊处理, 删除168字节后面的
	if ( m_plc_id == 31 || m_plc_id == 32)
	{
		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_response_status", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
		t_index += sizeof(unsigned short)*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);
//		t_snap7_buf.init(DISPATCH_RESPONSE_FROM_PLC_TO_MANAGER_DBNUMBER_0 , 0, sizeof(Dispatch_response_from_plc_to_manager), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
		m_receive_buf_map[0] = t_snap7_buf;
	}
	else
	{
		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_response_status", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
		t_index += sizeof(unsigned short)*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 short).name(), t_index,sizeof(unsigned short), 1 });
		t_index += sizeof(unsigned short)*1;
		t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved75_79", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 4 });
		t_index += sizeof(unsigned char)*4;
		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_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_ab), 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_ab), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
		m_receive_buf_map[0] = t_snap7_buf;
	}






#ifdef CHUTIAN_PROJECT_PROJECT
	//调度状态
	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::NO_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::NO_COMMUNICATION);
	m_receive_buf_map[1] = t_snap7_buf;
#endif //CHUTIAN_PROJECT_PROJECT

#ifdef SHANGGUJIE_PROJECT_PROJECT
	//调度状态
	t_index = 0;
	t_variable_information_vector.clear();
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_dispatch_heartbeat", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
	t_index += sizeof(unsigned short)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_inlet_door_control_1", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
	t_index += sizeof(unsigned short)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_inlet_door_control_2", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
	t_index += sizeof(unsigned short)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_outlet_door_control_3", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
	t_index += sizeof(unsigned short)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_outlet_door_control_4", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
	t_index += sizeof(unsigned short)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_ready_small_space_count", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
	t_index += sizeof(unsigned short)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_ready_middle_space_count", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
	t_index += sizeof(unsigned short)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_ready_big_space_count", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
	t_index += sizeof(unsigned short)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_ready_total_space_count", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
	t_index += sizeof(unsigned short)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_wait_small_park_count", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
	t_index += sizeof(unsigned short)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_wait_middle_park_count", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
	t_index += sizeof(unsigned short)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_wait_big_park_count", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
	t_index += sizeof(unsigned short)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_wait_total_park_count", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
	t_index += sizeof(unsigned short)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_wait_small_pick_count", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
	t_index += sizeof(unsigned short)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_wait_middle_pick_count", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
	t_index += sizeof(unsigned short)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_wait_big_pick_count", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
	t_index += sizeof(unsigned short)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_wait_total_pick_count", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
	t_index += sizeof(unsigned short)*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 short).name(), t_index,sizeof(unsigned short), 1 });
	t_index += sizeof(unsigned short)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_plc_mode_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_plc_passway_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_plc_carrier_status", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
	t_index += sizeof(unsigned short)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved6_9", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 4 });
	t_index += sizeof(unsigned char)*4;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_car_height", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
	t_index += sizeof(unsigned short)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_outside_door_status", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
	t_index += sizeof(unsigned short)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_inside_door_status", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
	t_index += sizeof(unsigned short)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_comb_body_status", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
	t_index += sizeof(unsigned short)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_turnplate_angle_min", 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_max", typeid(float).name(), t_index,sizeof(float), 1 });
	t_index += sizeof(float)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_sensor_1", 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_sensor_2", 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_reserved18_25", 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_car_height", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
	t_index += sizeof(unsigned short)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_outside_door_status", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
	t_index += sizeof(unsigned short)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_inside_door_status", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
	t_index += sizeof(unsigned short)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_comb_body_status", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
	t_index += sizeof(unsigned short)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_turnplate_angle_min", 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_max", typeid(float).name(), t_index,sizeof(float), 1 });
	t_index += sizeof(float)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_sensor_1", 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_sensor_2", 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_reserved18_25", 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_car_height", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
	t_index += sizeof(unsigned short)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_outside_door_status", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
	t_index += sizeof(unsigned short)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_inside_door_status", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
	t_index += sizeof(unsigned short)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_comb_body_status", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
	t_index += sizeof(unsigned short)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_turnplate_angle_min", 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_max", typeid(float).name(), t_index,sizeof(float), 1 });
	t_index += sizeof(float)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_sensor_1", 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_sensor_2", 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_reserved18_25", 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_car_height", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
	t_index += sizeof(unsigned short)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_outside_door_status", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
	t_index += sizeof(unsigned short)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_inside_door_status", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
	t_index += sizeof(unsigned short)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_comb_body_status", typeid(unsigned short).name(), t_index,sizeof(unsigned short), 1 });
	t_index += sizeof(unsigned short)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_turnplate_angle_min", 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_max", typeid(float).name(), t_index,sizeof(float), 1 });
	t_index += sizeof(float)*1;
	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_sensor_1", 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_sensor_2", 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_reserved18_25", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 2 });
	t_index += sizeof(unsigned char)*2;

//	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;
#endif //SHANGGUJIE_PROJECT_PROJECT


	//地面雷达指令
	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_response_motion_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_reserved47", 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_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::LOOP_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::LOOP_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::NO_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::NO_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::NO_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::NO_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::NO_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::NO_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::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;



	//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(SETTING_PATH SNAP7_COMMUNICATION_PARAMETER_PATH_A);
			break;
		}
		case 1:
		{
			return Snap7_communication_base::communication_init_from_protobuf(SETTING_PATH SNAP7_COMMUNICATION_PARAMETER_PATH_B);
			break;
		}
		case 2:
		{
			return Snap7_communication_base::communication_init_from_protobuf(SETTING_PATH SNAP7_COMMUNICATION_PARAMETER_PATH_C);
			break;
		}
		case 11:
		{
			return Snap7_communication_base::communication_init_from_protobuf(SETTING_PATH SNAP7_COMMUNICATION_PARAMETER_PATH_A1);
			break;
		}
		case 12:
		{
			return Snap7_communication_base::communication_init_from_protobuf(SETTING_PATH SNAP7_COMMUNICATION_PARAMETER_PATH_A2);
			break;
		}
		case 13:
		{
			return Snap7_communication_base::communication_init_from_protobuf(SETTING_PATH SNAP7_COMMUNICATION_PARAMETER_PATH_A3);
			break;
		}
		case 14:
		{
			return Snap7_communication_base::communication_init_from_protobuf(SETTING_PATH SNAP7_COMMUNICATION_PARAMETER_PATH_A4);
			break;
		}
		case 21:
		{
			return Snap7_communication_base::communication_init_from_protobuf(SETTING_PATH SNAP7_COMMUNICATION_PARAMETER_PATH_B1);
			break;
		}
		case 22:
		{
			return Snap7_communication_base::communication_init_from_protobuf(SETTING_PATH SNAP7_COMMUNICATION_PARAMETER_PATH_B2);
			break;
		}
		case 23:
		{
			return Snap7_communication_base::communication_init_from_protobuf(SETTING_PATH SNAP7_COMMUNICATION_PARAMETER_PATH_B3);
			break;
		}
		case 24:
		{
			return Snap7_communication_base::communication_init_from_protobuf(SETTING_PATH SNAP7_COMMUNICATION_PARAMETER_PATH_B4);
			break;
		}
		case 25:
		{
			return Snap7_communication_base::communication_init_from_protobuf(SETTING_PATH SNAP7_COMMUNICATION_PARAMETER_PATH_B5);
			break;
		}
		case 31:
		{
			return Snap7_communication_base::communication_init_from_protobuf(SETTING_PATH SNAP7_COMMUNICATION_PARAMETER_PATH_C1);
			break;
		}
		case 32:
		{
			return Snap7_communication_base::communication_init_from_protobuf(SETTING_PATH SNAP7_COMMUNICATION_PARAMETER_PATH_C2);
			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);

	//AB单元的9000和9001特殊处理, 删除168字节后面的
	if ( m_plc_id == 31 || m_plc_id == 32)
	{
		memcpy(&m_dispatch_response_from_plc_to_manager, m_receive_buf_map[0].mp_buf_obverse,m_receive_buf_map[0].m_size);
	}
	else
	{
		memcpy(&m_dispatch_response_from_plc_to_manager_ab, 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);

//	std::cout << " huli test :::: " << " 1111111111111111111111111111111111111111111111111 (int)m_dispatch_plc_status_from_plc_to_manager.m_plc_heartbeat  = " <<  (int)m_dispatch_plc_status_from_plc_to_manager.m_plc_heartbeat  << std::endl;


	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);

//	std::cout << " huli test :::: " << " m_dispatch_plc_status_from_manager_to_plc 123= " << m_dispatch_plc_status_from_manager_to_plc.m_dispatch_heartbeat << std::endl;

	//AB单元的9000和9001特殊处理, 删除168字节后面的
	if ( m_plc_id == 31 || m_plc_id == 32)
	{
		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);

//		std::string asd =  std::string( (char*)m_dispatch_request_from_manager_to_plc_for_data.m_request_car_license, 20);
//		LOG(INFO) << " aasdasdasdasdasdasdasdasd " << asd << " "<< this;
//		for (int i = 0; i < 20; ++i)
//		{
//			int zxc = m_dispatch_request_from_manager_to_plc_for_data.m_request_car_license[i];
//			LOG(INFO) << i <<"  =  " << zxc;
//
//		}
//
//		int fgh = m_dispatch_request_from_manager_to_plc_for_data.m_request_dispatch_motion_direction;
//		LOG(INFO)  <<" m_request_dispatch_motion_direction                              =  " << fgh;

	}
	else
	{
		memcpy(m_send_buf_map[0].mp_buf_obverse, &m_dispatch_request_from_manager_to_plc_for_data_ab,
			   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 :::: " << " 2222222222222222222222222222222222222222222222222 (int)m_dispatch_plc_status_from_manager_to_plc.m_dispatch_heartbeat   = " <<  (int)m_dispatch_plc_status_from_manager_to_plc.m_dispatch_heartbeat  << std::endl;
//	std::cout << " huli test :::: " << " 3333333333333333333333333333333333333333333333333 (int)m_ground_lidar_response_from_manager_to_plc_for_data[0].m_response_heartbeat  = " <<  (int)m_ground_lidar_response_from_manager_to_plc_for_data[0].m_response_heartbeat  << std::endl;
//	std::cout << " huli test :::: " << " 4444444444444444444444444444444444444444444444444 (int)m_ground_lidar_response_from_manager_to_plc_for_data[1].m_response_heartbeat  = " <<  (int)m_ground_lidar_response_from_manager_to_plc_for_data[1].m_response_heartbeat  << std::endl;
//
//	std::cout << " huli test :::: " << " xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx = "  << std::endl;

	return Error_code::SUCCESS;
}




