XNSim/Release/IDL/C909_V1/ATA04/GroundHandling_input.cxx

104 lines
3.8 KiB
C++
Raw Normal View History

2025-05-22 16:22:48 +08:00
#include "GroundHandling_input.hpp"
namespace XNSim::C909::ATA04
{
GroundHandling_input_Interface::GroundHandling_input_Interface()
{
MAP_DATA_FUNC(l_04_i_gdcomac_frz_l1);
MAP_DATA_FUNC(l_04_i_gdcomac_chocks_l1);
MAP_DATA_FUNC(l_04_i_gdcomac_alt_agl_f8);
MAP_DATA_FUNC(l_04_i_gdcomac_frzflt_l1);
MAP_DATA_FUNC(l_04_i_gdcomac_p_f8);
MAP_DATA_FUNC(l_04_i_gdcomac_q_f8);
MAP_DATA_FUNC(l_04_i_gdcomac_r_f8);
MAP_DATA_FUNC(l_04_i_gdcomac_ug_f8);
MAP_DATA_FUNC(l_04_i_gdcomac_vg_f8);
MAP_DATA_FUNC(l_04_i_gdcomac_wg_f8);
MAP_DATA_FUNC(l_04_i_gdcomac_blcg_f8);
MAP_DATA_FUNC(l_04_i_gdcomac_bscg_f8);
MAP_DATA_FUNC(l_04_i_gdcomac_wlcg_f8);
MAP_DATA_FUNC(l_04_i_gdcomac_pb_active_l1);
MAP_DATA_FUNC(l_04_i_gdcomac_brake_torq_f8);
MAP_DATA_FUNC(l_04_i_gdcomac_gear_f8);
MAP_DATA_FUNC(l_04_i_gdcomac_gsteer_f8);
MAP_DATA_FUNC(l_04_i_gdcomac_tire_pres_f8);
MAP_DATA_FUNC(l_04_i_gdcomac_onjax_l1);
MAP_DATA_FUNC(l_04_i_gdcomac_contdep_f8);
MAP_DATA_FUNC(l_04_i_gdcomac_thetag_f8);
MAP_DATA_FUNC(l_04_i_gdcomac_phig_f8);
MAP_DATA_FUNC(l_04_i_gdcomac_rwyrgh_i2);
MAP_DATA_FUNC(l_04_i_gdcomac_rwyhdg_f8);
MAP_DATA_FUNC(l_04_i_gdcomac_reset_braketemp_l1);
MAP_DATA_FUNC(l_04_i_gdcomac_reset_tirepress_l1);
MAP_DATA_FUNC(l_04_i_gdcomac_temp_c_f8);
MAP_DATA_FUNC(l_04_i_gdcomac_brake_temp_f8);
MAP_DATA_FUNC(l_04_i_gdcomac_tire_tburst_l1);
MAP_DATA_FUNC(l_04_i_gdcomac_tire_tflat_l1);
MAP_DATA_FUNC(l_04_i_gdcomac_brk_reset_tpres_l1);
MAP_DATA_FUNC(l_04_i_gdcomac_rcon_ci_f8);
MAP_DATA_FUNC(l_04_i_gdcomac_pb_towforce_f8);
MAP_DATA_FUNC(l_04_i_gdcomac_gsteer_state_i4);
MAP_DATA_FUNC(l_04_i_gdcomac_trim_active_l1);
MAP_DATA_FUNC(l_04_i_gdcomac_phi_deg_f8);
MAP_DATA_FUNC(l_04_i_gdcomac_theta_deg_f8);
MAP_DATA_FUNC(l_04_i_gdcomac_psi_deg_f8);
MAP_DATA_FUNC(l_04_i_gdcomac_resetint_l1);
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; // 数据大小
}
GroundHandling_input_Interface::~GroundHandling_input_Interface()
{
}
void GroundHandling_input_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::GroundHandling_inputPubSubType>(
"XNSim::C909::ATA04::GroundHandling_input", modelId);
ddsManager->RegisterSubscriber<XNSim::C909::ATA04::GroundHandling_inputPubSubType>(
"XNSim::C909::ATA04::GroundHandling_input", modelId,
std::bind(&GroundHandling_input_Interface::inputDataListener, this,
std::placeholders::_1));
} else if (DDS_type == 1) { // 只读取
ddsManager->RegisterSubscriber<XNSim::C909::ATA04::GroundHandling_inputPubSubType>(
"XNSim::C909::ATA04::GroundHandling_input", modelId,
std::bind(&GroundHandling_input_Interface::inputDataListener, this,
std::placeholders::_1));
} else if (DDS_type == 2) { // 只发送
dataWriter =
ddsManager->RegisterPublisher<XNSim::C909::ATA04::GroundHandling_inputPubSubType>(
"XNSim::C909::ATA04::GroundHandling_input", modelId);
}
}
void GroundHandling_input_Interface::clearOutData()
{
this->out_data = XNSim::C909::ATA04::GroundHandling_input();
}
void GroundHandling_input_Interface::sendOutData()
{
dataWriter->write(&this->out_data);
}
void GroundHandling_input_Interface::inputDataListener(
const XNSim::C909::ATA04::GroundHandling_input &input)
{
this->data = input;
}
} // namespace XNSim::C909::ATA04