#include "WeightBalance_output.hpp" namespace XNSim::C909::ATA04 { WeightBalance_output_Interface::WeightBalance_output_Interface() { MAP_DATA_FUNC(l_04_o_wbcomac_frz_l1); MAP_DATA_FUNC(l_04_o_wbcomac_zcgfrz_l1); MAP_DATA_FUNC(l_04_o_wbcomac_zcgfrz_grfx_l1); MAP_DATA_FUNC(l_04_o_wbcomac_ycgfrz_l1); MAP_DATA_FUNC(l_04_o_wbcomac_inertfrz_l1); MAP_DATA_FUNC(l_04_o_wbcomac_gw_f4); MAP_DATA_FUNC(l_04_o_wbcomac_cg_f4); MAP_DATA_FUNC(l_04_o_wbcomac_blcg_f8); MAP_DATA_FUNC(l_04_o_wbcomac_bscg_f8); MAP_DATA_FUNC(l_04_o_wbcomac_wlcg_f8); MAP_DATA_FUNC(l_04_o_wbcomac_xcg_f8); MAP_DATA_FUNC(l_04_o_wbcomac_ixx_f8); MAP_DATA_FUNC(l_04_o_wbcomac_ixy_f8); MAP_DATA_FUNC(l_04_o_wbcomac_ixz_f8); MAP_DATA_FUNC(l_04_o_wbcomac_iyy_f8); MAP_DATA_FUNC(l_04_o_wbcomac_iyz_f8); MAP_DATA_FUNC(l_04_o_wbcomac_izz_f8); MAP_DATA_FUNC(l_04_o_wbcomac_zfw_f4); MAP_DATA_FUNC(l_04_o_wbcomac_zfwcg_f4); MAP_DATA_FUNC(l_04_o_wbcomac_zfw_blcg_f4); MAP_DATA_FUNC(l_04_o_wbcomac_zfw_wlcg_f4); MAP_DATA_FUNC(l_04_o_wbcomac_fuel_cmd_f8); MAP_DATA_FUNC(l_04_o_wbcomac_fuel_mode_i4); MAP_DATA_FUNC(l_04_o_wbcomac_fuel_ixx_f8); MAP_DATA_FUNC(l_04_o_wbcomac_fuel_ixy_f8); MAP_DATA_FUNC(l_04_o_wbcomac_fuel_ixz_f8); MAP_DATA_FUNC(l_04_o_wbcomac_fuel_iyy_f8); MAP_DATA_FUNC(l_04_o_wbcomac_fuel_iyz_f8); MAP_DATA_FUNC(l_04_o_wbcomac_fuel_izz_f8); MAP_DATA_FUNC(l_04_o_wbcomac_l_wt_fuel_f8); MAP_DATA_FUNC(l_04_o_wbcomac_ice_airframe_total_f8); MAP_DATA_FUNC(l_04_o_wbcomac_ice_eng_f8); MAP_DATA_FUNC(l_04_o_wbcomac_ice_eng_total_f8); MAP_DATA_FUNC(l_04_o_wbcomac_ice_fuselage_f8); MAP_DATA_FUNC(l_04_o_wbcomac_ice_stab_left_f8); MAP_DATA_FUNC(l_04_o_wbcomac_ice_stab_right_f8); MAP_DATA_FUNC(l_04_o_wbcomac_ice_stab_total_f8); MAP_DATA_FUNC(l_04_o_wbcomac_ice_total_f8); MAP_DATA_FUNC(l_04_o_wbcomac_ice_total_frac_f8); MAP_DATA_FUNC(l_04_o_wbcomac_ice_vert_tail_f8); MAP_DATA_FUNC(l_04_o_wbcomac_ice_wing_left_f8); MAP_DATA_FUNC(l_04_o_wbcomac_ice_wing_right_f8); MAP_DATA_FUNC(l_04_o_wbcomac_ice_wing_total_f8); MAP_DATA_FUNC(l_04_o_wbcomac_init_l1); MAP_DATA_FUNC(l_04_o_wbcomac_potmin_gw_f8); MAP_DATA_FUNC(l_04_o_wbcomac_potmax_gw_f8); MAP_DATA_FUNC(l_04_o_wbcomac_potmin_gwcg_f8); MAP_DATA_FUNC(l_04_o_wbcomac_potmax_gwcg_f8); MAP_DATA_FUNC(l_04_o_wbcomac_min_cg_f4); MAP_DATA_FUNC(l_04_o_wbcomac_min_gw_f4); MAP_DATA_FUNC(l_04_o_wbcomac_min_zfw_f4); MAP_DATA_FUNC(l_04_o_wbcomac_min_zfwcg_f4); MAP_DATA_FUNC(l_04_o_wbcomac_max_cg_f4); MAP_DATA_FUNC(l_04_o_wbcomac_max_gw_f4); MAP_DATA_FUNC(l_04_o_wbcomac_max_zfw_f4); MAP_DATA_FUNC(l_04_o_wbcomac_max_zfwcg_f4); this->header[0] = 0xa6; // XNSim头,0xa6 this->header[1] = 0xc0; // 机型头,0xc0表示C909 this->header[2] = 0x04; // 章节头,0x04表示ATA04 this->header[3] = 0x01; // 模型头,0x01表示GroundHandling this->header[4] = 0x00; // 结构体头,0x00表示输入结构体 this->header[5] = 0x00; // 数据方向,0x00表示外部输入 this->header[6] = 0x00; // 数据大小 this->header[7] = 0x00; // 数据大小 } WeightBalance_output_Interface::~WeightBalance_output_Interface() { } void WeightBalance_output_Interface::Initialize(XNFrameworkPtr framework, uint32_t modelId,uint32_t DDS_type) { auto ddsManager = framework->GetDDSManager(); if (!ddsManager) { LOG_ERROR("DDSManager is nullptr"); return; } if (DDS_type == 0) { dataWriter = ddsManager->RegisterPublisher("XNSim::C909::ATA04::WeightBalance_output", modelId); ddsManager->RegisterSubscriber("XNSim::C909::ATA04::WeightBalance_output", modelId, std::bind(&WeightBalance_output_Interface::inputDataListener, this, std::placeholders::_1)); } else if (DDS_type == 1) { ddsManager->RegisterSubscriber("XNSim::C909::ATA04::WeightBalance_output", modelId, std::bind(&WeightBalance_output_Interface::inputDataListener, this, std::placeholders::_1)); } else if (DDS_type == 2) { dataWriter = ddsManager->RegisterPublisher("XNSim::C909::ATA04::WeightBalance_output", modelId); } } void WeightBalance_output_Interface::clearOutData() { this->out_data = XNSim::C909::ATA04::WeightBalance_output(); } void WeightBalance_output_Interface::sendOutData() { if (dataWriter) { dataWriter->write(&this->out_data); } } void WeightBalance_output_Interface::inputDataListener(const XNSim::C909::ATA04::WeightBalance_output &input) { this->data = input; } }