模型接口实现统一重构

This commit is contained in:
jinchao 2025-05-22 16:22:48 +08:00
parent e98331d16e
commit d2dafdbdea
68 changed files with 28010 additions and 12011 deletions

View File

@ -0,0 +1,65 @@
#include "GroundHandling_heartbeat.hpp"
namespace XNSim::C909::ATA04
{
GroundHandling_heartbeat_Interface::GroundHandling_heartbeat_Interface()
{
MAP_DATA_FUNC(groundhandling_model_heartbeat);
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] = 0x02; // 结构体头0x02表示心跳结构体
this->header[5] = 0x00; // 数据方向0x00表示外部输入
this->header[6] = 0x00; // 数据大小
this->header[7] = 0x00; // 数据大小
}
GroundHandling_heartbeat_Interface::~GroundHandling_heartbeat_Interface()
{
}
void GroundHandling_heartbeat_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_heartbeatPubSubType>(
"XNSim::C909::ATA04::GroundHandling_heartbeat", modelId);
ddsManager->RegisterSubscriber<XNSim::C909::ATA04::GroundHandling_heartbeatPubSubType>(
"XNSim::C909::ATA04::GroundHandling_heartbeat", modelId,
std::bind(&GroundHandling_heartbeat_Interface::heartbeatListener, this,
std::placeholders::_1));
} else if (DDS_type == 1) { // 只读取
ddsManager->RegisterSubscriber<XNSim::C909::ATA04::GroundHandling_heartbeatPubSubType>(
"XNSim::C909::ATA04::GroundHandling_heartbeat", modelId,
std::bind(&GroundHandling_heartbeat_Interface::heartbeatListener, this,
std::placeholders::_1));
} else if (DDS_type == 2) { // 只发送
dataWriter =
ddsManager->RegisterPublisher<XNSim::C909::ATA04::GroundHandling_heartbeatPubSubType>(
"XNSim::C909::ATA04::GroundHandling_heartbeat", modelId);
}
}
void GroundHandling_heartbeat_Interface::clearOutData()
{
this->out_data = XNSim::C909::ATA04::GroundHandling_heartbeat();
}
void GroundHandling_heartbeat_Interface::sendOutData()
{
dataWriter->write(&this->out_data);
}
void GroundHandling_heartbeat_Interface::heartbeatListener(
const XNSim::C909::ATA04::GroundHandling_heartbeat &heartbeat)
{
this->data = heartbeat;
}
} // namespace XNSim::C909::ATA04

View File

@ -0,0 +1,39 @@
#include "../C909_V1PubSubTypes.hpp"
#include "XNCore/XNDDSInterface.h"
namespace XNSim::C909::ATA04
{
class GroundHandling_heartbeat_Interface final : public XNDDSInterface
{
public:
GroundHandling_heartbeat_Interface();
virtual ~GroundHandling_heartbeat_Interface();
virtual void Initialize(XNFrameworkPtr framework, uint32_t modelId, uint32_t DDS_type) override;
void heartbeatListener(const XNSim::C909::ATA04::GroundHandling_heartbeat &heartbeat);
virtual void clearOutData() override;
virtual void sendOutData() override;
template <typename T>
void getData(T *model_data)
{
if (model_data == nullptr)
return;
assign_value_get(data.groundhandling_model_heartbeat(),
model_data->groundhandling_model_heartbeat);
}
template <typename T>
void setData(T *model_data)
{
if (model_data == nullptr)
return;
clearOutData();
assign_value_set(data.groundhandling_model_heartbeat(),
model_data->groundhandling_model_heartbeat);
sendOutData();
}
private:
XNSim::C909::ATA04::GroundHandling_heartbeat data;
XNSim::C909::ATA04::GroundHandling_heartbeat out_data;
};
} // namespace XNSim::C909::ATA04

View File

@ -0,0 +1,103 @@
#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

View File

@ -0,0 +1,141 @@
#include "../C909_V1PubSubTypes.hpp"
#include "XNCore/XNDDSInterface.h"
namespace XNSim::C909::ATA04
{
class GroundHandling_input_Interface final : public XNDDSInterface
{
public:
GroundHandling_input_Interface();
virtual ~GroundHandling_input_Interface();
virtual void Initialize(XNFrameworkPtr framework, uint32_t modelId, uint32_t DDS_type) override;
virtual void clearOutData() override;
virtual void sendOutData() override;
void inputDataListener(const XNSim::C909::ATA04::GroundHandling_input &input);
template <typename T>
void getData(T *model_data)
{
if (model_data == nullptr)
return;
assign_value_get(data.l_04_i_gdcomac_frz_l1(), model_data->l_04_i_gdcomac_frz_l1);
assign_value_get(data.l_04_i_gdcomac_chocks_l1(), model_data->l_04_i_gdcomac_chocks_l1);
assign_value_get(data.l_04_i_gdcomac_alt_agl_f8(), model_data->l_04_i_gdcomac_alt_agl_f8);
assign_value_get(data.l_04_i_gdcomac_frzflt_l1(), model_data->l_04_i_gdcomac_frzflt_l1);
assign_value_get(data.l_04_i_gdcomac_p_f8(), model_data->l_04_i_gdcomac_p_f8);
assign_value_get(data.l_04_i_gdcomac_q_f8(), model_data->l_04_i_gdcomac_q_f8);
assign_value_get(data.l_04_i_gdcomac_r_f8(), model_data->l_04_i_gdcomac_r_f8);
assign_value_get(data.l_04_i_gdcomac_ug_f8(), model_data->l_04_i_gdcomac_ug_f8);
assign_value_get(data.l_04_i_gdcomac_vg_f8(), model_data->l_04_i_gdcomac_vg_f8);
assign_value_get(data.l_04_i_gdcomac_wg_f8(), model_data->l_04_i_gdcomac_wg_f8);
assign_value_get(data.l_04_i_gdcomac_blcg_f8(), model_data->l_04_i_gdcomac_blcg_f8);
assign_value_get(data.l_04_i_gdcomac_bscg_f8(), model_data->l_04_i_gdcomac_bscg_f8);
assign_value_get(data.l_04_i_gdcomac_wlcg_f8(), model_data->l_04_i_gdcomac_wlcg_f8);
assign_value_get(data.l_04_i_gdcomac_pb_active_l1(),
model_data->l_04_i_gdcomac_pb_active_l1);
assign_value_get(data.l_04_i_gdcomac_brake_torq_f8(),
model_data->l_04_i_gdcomac_brake_torq_f8);
assign_value_get(data.l_04_i_gdcomac_gear_f8(), model_data->l_04_i_gdcomac_gear_f8);
assign_value_get(data.l_04_i_gdcomac_gsteer_f8(), model_data->l_04_i_gdcomac_gsteer_f8);
assign_value_get(data.l_04_i_gdcomac_tire_pres_f8(),
model_data->l_04_i_gdcomac_tire_pres_f8);
assign_value_get(data.l_04_i_gdcomac_onjax_l1(), model_data->l_04_i_gdcomac_onjax_l1);
assign_value_get(data.l_04_i_gdcomac_contdep_f8(), model_data->l_04_i_gdcomac_contdep_f8);
assign_value_get(data.l_04_i_gdcomac_thetag_f8(), model_data->l_04_i_gdcomac_thetag_f8);
assign_value_get(data.l_04_i_gdcomac_phig_f8(), model_data->l_04_i_gdcomac_phig_f8);
assign_value_get(data.l_04_i_gdcomac_rwyrgh_i2(), model_data->l_04_i_gdcomac_rwyrgh_i2);
assign_value_get(data.l_04_i_gdcomac_rwyhdg_f8(), model_data->l_04_i_gdcomac_rwyhdg_f8);
assign_value_get(data.l_04_i_gdcomac_reset_braketemp_l1(),
model_data->l_04_i_gdcomac_reset_braketemp_l1);
assign_value_get(data.l_04_i_gdcomac_reset_tirepress_l1(),
model_data->l_04_i_gdcomac_reset_tirepress_l1);
assign_value_get(data.l_04_i_gdcomac_temp_c_f8(), model_data->l_04_i_gdcomac_temp_c_f8);
assign_value_get(data.l_04_i_gdcomac_brake_temp_f8(),
model_data->l_04_i_gdcomac_brake_temp_f8);
assign_value_get(data.l_04_i_gdcomac_tire_tburst_l1(),
model_data->l_04_i_gdcomac_tire_tburst_l1);
assign_value_get(data.l_04_i_gdcomac_tire_tflat_l1(),
model_data->l_04_i_gdcomac_tire_tflat_l1);
assign_value_get(data.l_04_i_gdcomac_brk_reset_tpres_l1(),
model_data->l_04_i_gdcomac_brk_reset_tpres_l1);
assign_value_get(data.l_04_i_gdcomac_rcon_ci_f8(), model_data->l_04_i_gdcomac_rcon_ci_f8);
assign_value_get(data.l_04_i_gdcomac_pb_towforce_f8(),
model_data->l_04_i_gdcomac_pb_towforce_f8);
assign_value_get(data.l_04_i_gdcomac_gsteer_state_i4(),
model_data->l_04_i_gdcomac_gsteer_state_i4);
assign_value_get(data.l_04_i_gdcomac_trim_active_l1(),
model_data->l_04_i_gdcomac_trim_active_l1);
assign_value_get(data.l_04_i_gdcomac_phi_deg_f8(), model_data->l_04_i_gdcomac_phi_deg_f8);
assign_value_get(data.l_04_i_gdcomac_theta_deg_f8(),
model_data->l_04_i_gdcomac_theta_deg_f8);
assign_value_get(data.l_04_i_gdcomac_psi_deg_f8(), model_data->l_04_i_gdcomac_psi_deg_f8);
assign_value_get(data.l_04_i_gdcomac_resetint_l1(), model_data->l_04_i_gdcomac_resetint_l1);
}
template <typename T>
void setData(T *model_data)
{
if (model_data == nullptr)
return;
clearOutData();
assign_value_set(data.l_04_i_gdcomac_frz_l1(), model_data->l_04_i_gdcomac_frz_l1);
assign_value_set(data.l_04_i_gdcomac_chocks_l1(), model_data->l_04_i_gdcomac_chocks_l1);
assign_value_set(data.l_04_i_gdcomac_alt_agl_f8(), model_data->l_04_i_gdcomac_alt_agl_f8);
assign_value_set(data.l_04_i_gdcomac_frzflt_l1(), model_data->l_04_i_gdcomac_frzflt_l1);
assign_value_set(data.l_04_i_gdcomac_p_f8(), model_data->l_04_i_gdcomac_p_f8);
assign_value_set(data.l_04_i_gdcomac_q_f8(), model_data->l_04_i_gdcomac_q_f8);
assign_value_set(data.l_04_i_gdcomac_r_f8(), model_data->l_04_i_gdcomac_r_f8);
assign_value_set(data.l_04_i_gdcomac_ug_f8(), model_data->l_04_i_gdcomac_ug_f8);
assign_value_set(data.l_04_i_gdcomac_vg_f8(), model_data->l_04_i_gdcomac_vg_f8);
assign_value_set(data.l_04_i_gdcomac_wg_f8(), model_data->l_04_i_gdcomac_wg_f8);
assign_value_set(data.l_04_i_gdcomac_blcg_f8(), model_data->l_04_i_gdcomac_blcg_f8);
assign_value_set(data.l_04_i_gdcomac_bscg_f8(), model_data->l_04_i_gdcomac_bscg_f8);
assign_value_set(data.l_04_i_gdcomac_wlcg_f8(), model_data->l_04_i_gdcomac_wlcg_f8);
assign_value_set(data.l_04_i_gdcomac_pb_active_l1(),
model_data->l_04_i_gdcomac_pb_active_l1);
assign_value_set(data.l_04_i_gdcomac_brake_torq_f8(),
model_data->l_04_i_gdcomac_brake_torq_f8);
assign_value_set(data.l_04_i_gdcomac_gear_f8(), model_data->l_04_i_gdcomac_gear_f8);
assign_value_set(data.l_04_i_gdcomac_gsteer_f8(), model_data->l_04_i_gdcomac_gsteer_f8);
assign_value_set(data.l_04_i_gdcomac_tire_pres_f8(),
model_data->l_04_i_gdcomac_tire_pres_f8);
assign_value_set(data.l_04_i_gdcomac_onjax_l1(), model_data->l_04_i_gdcomac_onjax_l1);
assign_value_set(data.l_04_i_gdcomac_contdep_f8(), model_data->l_04_i_gdcomac_contdep_f8);
assign_value_set(data.l_04_i_gdcomac_thetag_f8(), model_data->l_04_i_gdcomac_thetag_f8);
assign_value_set(data.l_04_i_gdcomac_phig_f8(), model_data->l_04_i_gdcomac_phig_f8);
assign_value_set(data.l_04_i_gdcomac_rwyrgh_i2(), model_data->l_04_i_gdcomac_rwyrgh_i2);
assign_value_set(data.l_04_i_gdcomac_rwyhdg_f8(), model_data->l_04_i_gdcomac_rwyhdg_f8);
assign_value_set(data.l_04_i_gdcomac_reset_braketemp_l1(),
model_data->l_04_i_gdcomac_reset_braketemp_l1);
assign_value_set(data.l_04_i_gdcomac_reset_tirepress_l1(),
model_data->l_04_i_gdcomac_reset_tirepress_l1);
assign_value_set(data.l_04_i_gdcomac_temp_c_f8(), model_data->l_04_i_gdcomac_temp_c_f8);
assign_value_set(data.l_04_i_gdcomac_brake_temp_f8(),
model_data->l_04_i_gdcomac_brake_temp_f8);
assign_value_set(data.l_04_i_gdcomac_tire_tburst_l1(),
model_data->l_04_i_gdcomac_tire_tburst_l1);
assign_value_set(data.l_04_i_gdcomac_tire_tflat_l1(),
model_data->l_04_i_gdcomac_tire_tflat_l1);
assign_value_set(data.l_04_i_gdcomac_brk_reset_tpres_l1(),
model_data->l_04_i_gdcomac_brk_reset_tpres_l1);
assign_value_set(data.l_04_i_gdcomac_rcon_ci_f8(), model_data->l_04_i_gdcomac_rcon_ci_f8);
assign_value_set(data.l_04_i_gdcomac_pb_towforce_f8(),
model_data->l_04_i_gdcomac_pb_towforce_f8);
assign_value_set(data.l_04_i_gdcomac_gsteer_state_i4(),
model_data->l_04_i_gdcomac_gsteer_state_i4);
assign_value_set(data.l_04_i_gdcomac_trim_active_l1(),
model_data->l_04_i_gdcomac_trim_active_l1);
assign_value_set(data.l_04_i_gdcomac_phi_deg_f8(), model_data->l_04_i_gdcomac_phi_deg_f8);
assign_value_set(data.l_04_i_gdcomac_theta_deg_f8(),
model_data->l_04_i_gdcomac_theta_deg_f8);
assign_value_set(data.l_04_i_gdcomac_psi_deg_f8(), model_data->l_04_i_gdcomac_psi_deg_f8);
assign_value_set(data.l_04_i_gdcomac_resetint_l1(), model_data->l_04_i_gdcomac_resetint_l1);
sendOutData();
}
private:
XNSim::C909::ATA04::GroundHandling_input data;
XNSim::C909::ATA04::GroundHandling_input out_data;
};
} // namespace XNSim::C909::ATA04

View File

@ -0,0 +1,99 @@
#include "GroundHandling_output.hpp"
namespace XNSim::C909::ATA04
{
GroundHandling_output_Interface::GroundHandling_output_Interface()
{
MAP_DATA_FUNC(l_04_o_gdcomac_frz_l1);
MAP_DATA_FUNC(l_04_o_gdcomac_ac_on_ground_l1);
MAP_DATA_FUNC(l_04_o_gdcomac_ac_stationary_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_alt_tire_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_zcg_to_tire_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_fxb_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_fyb_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_fzb_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_mxb_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_myb_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_mzb_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_fygs_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_mzgs_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_mu_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_dstroke_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_sr_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_sy_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_sx_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_xft_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_yft_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_zft_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_distngrxcg_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_distmgrxcg_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_distmgrzcg_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_tire_vel_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_tire_burst_l1);
MAP_DATA_FUNC(l_04_o_gdcomac_tire_temp_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_wow_l1);
MAP_DATA_FUNC(l_04_o_gdcomac_utirew_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_vtirew_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_whl_omega_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_dstruc_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_wor_par_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_nd_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_vczt_f8);
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] = 0x01; // 结构体头0x01表示输出结构体
this->header[5] = 0x00; // 数据方向0x00表示外部输入
this->header[6] = 0x00; // 数据大小
this->header[7] = 0x00; // 数据大小
}
GroundHandling_output_Interface::~GroundHandling_output_Interface()
{
}
void GroundHandling_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::GroundHandling_outputPubSubType>(
"XNSim::C909::ATA04::GroundHandling_output", modelId);
ddsManager->RegisterSubscriber<XNSim::C909::ATA04::GroundHandling_outputPubSubType>(
"XNSim::C909::ATA04::GroundHandling_output", modelId,
std::bind(&GroundHandling_output_Interface::outputDataListener, this,
std::placeholders::_1));
} else if (DDS_type == 1) { // 只读取
ddsManager->RegisterSubscriber<XNSim::C909::ATA04::GroundHandling_outputPubSubType>(
"XNSim::C909::ATA04::GroundHandling_output", modelId,
std::bind(&GroundHandling_output_Interface::outputDataListener, this,
std::placeholders::_1));
} else if (DDS_type == 2) { // 只发送
dataWriter =
ddsManager->RegisterPublisher<XNSim::C909::ATA04::GroundHandling_outputPubSubType>(
"XNSim::C909::ATA04::GroundHandling_output", modelId);
}
}
void GroundHandling_output_Interface::clearOutData()
{
this->out_data = XNSim::C909::ATA04::GroundHandling_output();
}
void GroundHandling_output_Interface::sendOutData()
{
dataWriter->write(&this->out_data);
}
void GroundHandling_output_Interface::outputDataListener(
const XNSim::C909::ATA04::GroundHandling_output &output)
{
this->data = output;
}
} // namespace XNSim::C909::ATA04

View File

@ -0,0 +1,123 @@
#include "../C909_V1PubSubTypes.hpp"
#include "XNCore/XNDDSInterface.h"
namespace XNSim::C909::ATA04
{
class GroundHandling_output_Interface final : public XNDDSInterface
{
public:
GroundHandling_output_Interface();
virtual ~GroundHandling_output_Interface();
virtual void Initialize(XNFrameworkPtr framework, uint32_t modelId, uint32_t DDS_type) override;
void outputDataListener(const XNSim::C909::ATA04::GroundHandling_output &output);
virtual void clearOutData() override;
virtual void sendOutData() override;
template <typename T>
void getData(T *model_data)
{
if (model_data == nullptr)
return;
assign_value_get(data.l_04_o_gdcomac_frz_l1(), model_data->l_04_o_gdcomac_frz_l1);
assign_value_get(data.l_04_o_gdcomac_ac_on_ground_l1(),
model_data->l_04_o_gdcomac_ac_on_ground_l1);
assign_value_get(data.l_04_o_gdcomac_ac_stationary_f8(),
model_data->l_04_o_gdcomac_ac_stationary_f8);
assign_value_get(data.l_04_o_gdcomac_alt_tire_f8(), model_data->l_04_o_gdcomac_alt_tire_f8);
assign_value_get(data.l_04_o_gdcomac_zcg_to_tire_f8(),
model_data->l_04_o_gdcomac_zcg_to_tire_f8);
assign_value_get(data.l_04_o_gdcomac_fxb_f8(), model_data->l_04_o_gdcomac_fxb_f8);
assign_value_get(data.l_04_o_gdcomac_fyb_f8(), model_data->l_04_o_gdcomac_fyb_f8);
assign_value_get(data.l_04_o_gdcomac_fzb_f8(), model_data->l_04_o_gdcomac_fzb_f8);
assign_value_get(data.l_04_o_gdcomac_mxb_f8(), model_data->l_04_o_gdcomac_mxb_f8);
assign_value_get(data.l_04_o_gdcomac_myb_f8(), model_data->l_04_o_gdcomac_myb_f8);
assign_value_get(data.l_04_o_gdcomac_mzb_f8(), model_data->l_04_o_gdcomac_mzb_f8);
assign_value_get(data.l_04_o_gdcomac_fygs_f8(), model_data->l_04_o_gdcomac_fygs_f8);
assign_value_get(data.l_04_o_gdcomac_mzgs_f8(), model_data->l_04_o_gdcomac_mzgs_f8);
assign_value_get(data.l_04_o_gdcomac_mu_f8(), model_data->l_04_o_gdcomac_mu_f8);
assign_value_get(data.l_04_o_gdcomac_dstroke_f8(), model_data->l_04_o_gdcomac_dstroke_f8);
assign_value_get(data.l_04_o_gdcomac_sr_f8(), model_data->l_04_o_gdcomac_sr_f8);
assign_value_get(data.l_04_o_gdcomac_sy_f8(), model_data->l_04_o_gdcomac_sy_f8);
assign_value_get(data.l_04_o_gdcomac_sx_f8(), model_data->l_04_o_gdcomac_sx_f8);
assign_value_get(data.l_04_o_gdcomac_xft_f8(), model_data->l_04_o_gdcomac_xft_f8);
assign_value_get(data.l_04_o_gdcomac_yft_f8(), model_data->l_04_o_gdcomac_yft_f8);
assign_value_get(data.l_04_o_gdcomac_zft_f8(), model_data->l_04_o_gdcomac_zft_f8);
assign_value_get(data.l_04_o_gdcomac_distngrxcg_f8(),
model_data->l_04_o_gdcomac_distngrxcg_f8);
assign_value_get(data.l_04_o_gdcomac_distmgrxcg_f8(),
model_data->l_04_o_gdcomac_distmgrxcg_f8);
assign_value_get(data.l_04_o_gdcomac_distmgrzcg_f8(),
model_data->l_04_o_gdcomac_distmgrzcg_f8);
assign_value_get(data.l_04_o_gdcomac_tire_vel_f8(), model_data->l_04_o_gdcomac_tire_vel_f8);
assign_value_get(data.l_04_o_gdcomac_tire_burst_l1(),
model_data->l_04_o_gdcomac_tire_burst_l1);
assign_value_get(data.l_04_o_gdcomac_tire_temp_f8(),
model_data->l_04_o_gdcomac_tire_temp_f8);
assign_value_get(data.l_04_o_gdcomac_wow_l1(), model_data->l_04_o_gdcomac_wow_l1);
assign_value_get(data.l_04_o_gdcomac_utirew_f8(), model_data->l_04_o_gdcomac_utirew_f8);
assign_value_get(data.l_04_o_gdcomac_vtirew_f8(), model_data->l_04_o_gdcomac_vtirew_f8);
assign_value_get(data.l_04_o_gdcomac_whl_omega_f8(),
model_data->l_04_o_gdcomac_whl_omega_f8);
assign_value_get(data.l_04_o_gdcomac_dstruc_f8(), model_data->l_04_o_gdcomac_dstruc_f8);
assign_value_get(data.l_04_o_gdcomac_wor_par_f8(), model_data->l_04_o_gdcomac_wor_par_f8);
assign_value_get(data.l_04_o_gdcomac_nd_f8(), model_data->l_04_o_gdcomac_nd_f8);
assign_value_get(data.l_04_o_gdcomac_vczt_f8(), model_data->l_04_o_gdcomac_vczt_f8);
}
template <typename T>
void setData(T *model_data)
{
if (model_data == nullptr)
return;
clearOutData();
assign_value_set(data.l_04_o_gdcomac_frz_l1(), model_data->l_04_o_gdcomac_frz_l1);
assign_value_set(data.l_04_o_gdcomac_ac_on_ground_l1(),
model_data->l_04_o_gdcomac_ac_on_ground_l1);
assign_value_set(data.l_04_o_gdcomac_ac_stationary_f8(),
model_data->l_04_o_gdcomac_ac_stationary_f8);
assign_value_set(data.l_04_o_gdcomac_alt_tire_f8(), model_data->l_04_o_gdcomac_alt_tire_f8);
assign_value_set(data.l_04_o_gdcomac_zcg_to_tire_f8(),
model_data->l_04_o_gdcomac_zcg_to_tire_f8);
assign_value_set(data.l_04_o_gdcomac_fxb_f8(), model_data->l_04_o_gdcomac_fxb_f8);
assign_value_set(data.l_04_o_gdcomac_fyb_f8(), model_data->l_04_o_gdcomac_fyb_f8);
assign_value_set(data.l_04_o_gdcomac_fzb_f8(), model_data->l_04_o_gdcomac_fzb_f8);
assign_value_set(data.l_04_o_gdcomac_mxb_f8(), model_data->l_04_o_gdcomac_mxb_f8);
assign_value_set(data.l_04_o_gdcomac_myb_f8(), model_data->l_04_o_gdcomac_myb_f8);
assign_value_set(data.l_04_o_gdcomac_mzb_f8(), model_data->l_04_o_gdcomac_mzb_f8);
assign_value_set(data.l_04_o_gdcomac_fygs_f8(), model_data->l_04_o_gdcomac_fygs_f8);
assign_value_set(data.l_04_o_gdcomac_mzgs_f8(), model_data->l_04_o_gdcomac_mzgs_f8);
assign_value_set(data.l_04_o_gdcomac_mu_f8(), model_data->l_04_o_gdcomac_mu_f8);
assign_value_set(data.l_04_o_gdcomac_dstroke_f8(), model_data->l_04_o_gdcomac_dstroke_f8);
assign_value_set(data.l_04_o_gdcomac_sr_f8(), model_data->l_04_o_gdcomac_sr_f8);
assign_value_set(data.l_04_o_gdcomac_sy_f8(), model_data->l_04_o_gdcomac_sy_f8);
assign_value_set(data.l_04_o_gdcomac_sx_f8(), model_data->l_04_o_gdcomac_sx_f8);
assign_value_set(data.l_04_o_gdcomac_xft_f8(), model_data->l_04_o_gdcomac_xft_f8);
assign_value_set(data.l_04_o_gdcomac_yft_f8(), model_data->l_04_o_gdcomac_yft_f8);
assign_value_set(data.l_04_o_gdcomac_zft_f8(), model_data->l_04_o_gdcomac_zft_f8);
assign_value_set(data.l_04_o_gdcomac_distngrxcg_f8(),
model_data->l_04_o_gdcomac_distngrxcg_f8);
assign_value_set(data.l_04_o_gdcomac_distmgrxcg_f8(),
model_data->l_04_o_gdcomac_distmgrxcg_f8);
assign_value_set(data.l_04_o_gdcomac_distmgrzcg_f8(),
model_data->l_04_o_gdcomac_distmgrzcg_f8);
assign_value_set(data.l_04_o_gdcomac_tire_vel_f8(), model_data->l_04_o_gdcomac_tire_vel_f8);
assign_value_set(data.l_04_o_gdcomac_tire_burst_l1(),
model_data->l_04_o_gdcomac_tire_burst_l1);
assign_value_set(data.l_04_o_gdcomac_tire_temp_f8(),
model_data->l_04_o_gdcomac_tire_temp_f8);
assign_value_set(data.l_04_o_gdcomac_wow_l1(), model_data->l_04_o_gdcomac_wow_l1);
assign_value_set(data.l_04_o_gdcomac_utirew_f8(), model_data->l_04_o_gdcomac_utirew_f8);
assign_value_set(data.l_04_o_gdcomac_vtirew_f8(), model_data->l_04_o_gdcomac_vtirew_f8);
assign_value_set(data.l_04_o_gdcomac_whl_omega_f8(),
model_data->l_04_o_gdcomac_whl_omega_f8);
assign_value_set(data.l_04_o_gdcomac_dstruc_f8(), model_data->l_04_o_gdcomac_dstruc_f8);
assign_value_set(data.l_04_o_gdcomac_wor_par_f8(), model_data->l_04_o_gdcomac_wor_par_f8);
assign_value_set(data.l_04_o_gdcomac_nd_f8(), model_data->l_04_o_gdcomac_nd_f8);
assign_value_set(data.l_04_o_gdcomac_vczt_f8(), model_data->l_04_o_gdcomac_vczt_f8);
sendOutData();
}
private:
XNSim::C909::ATA04::GroundHandling_output data;
XNSim::C909::ATA04::GroundHandling_output out_data;
};
} // namespace XNSim::C909::ATA04

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,232 @@
module XNSim
{
module C909
{
module ATA04
{
struct Aerodynamics_input
{
@optional double l_04_i_aerocomac_alpha_f8;
@optional double l_04_i_aerocomac_alpdot_f8;
@optional double l_04_i_aerocomac_beta_f8;
@optional double l_04_i_aerocomac_press_alt_f8;
@optional double l_04_i_aerocomac_tas_f8;
@optional double l_04_i_aerocomac_mach_f8;
@optional double l_04_i_aerocomac_nx_f8;
@optional double l_04_i_aerocomac_ny_f8;
@optional double l_04_i_aerocomac_nz_f8;
@optional double l_04_i_aerocomac_p_f8;
@optional double l_04_i_aerocomac_q_f8;
@optional double l_04_i_aerocomac_r_f8;
@optional double l_04_i_aerocomac_qbar_f8;
@optional double l_04_i_aerocomac_blcg_f8;
@optional double l_04_i_aerocomac_bscg_f8;
@optional double l_04_i_aerocomac_wlcg_f8;
@optional double l_04_i_aerocomac_ail_f8[10];
@optional double l_04_i_aerocomac_elv_f8[4];
@optional double l_04_i_aerocomac_rud_f8[2];
@optional double l_04_i_aerocomac_stab_f8;
@optional double l_04_i_aerocomac_gear_f8[7];
@optional double l_04_i_aerocomac_flap_f8[10];
@optional double l_04_i_aerocomac_slat_f8[20];
@optional double l_04_i_aerocomac_spl_f8[20];
@optional double l_04_i_aerocomac_tnet_f8[4];
@optional double l_04_i_aerocomac_kice_f8[20];
@optional double l_04_i_aerocomac_alt_agl_f8;
};
struct Aerodynamics_output
{
@optional double l_04_o_aerocomac_fxb_f8;
@optional double l_04_o_aerocomac_fyb_f8;
@optional double l_04_o_aerocomac_fzb_f8;
@optional double l_04_o_aerocomac_mxb_f8;
@optional double l_04_o_aerocomac_myb_f8;
@optional double l_04_o_aerocomac_mzb_f8;
@optional double l_04_o_aerocomac_cls_f8;
@optional double l_04_o_aerocomac_cl_f8;
@optional double l_04_o_aerocomac_cd_f8;
@optional double l_04_o_aerocomac_cm_f8;
@optional double l_04_o_aerocomac_cr_f8;
@optional double l_04_o_aerocomac_cy_f8;
@optional double l_04_o_aerocomac_cn_f8;
};
struct Aerodynamics_heartbeat
{
@optional long aero_model_heartbeat;
};
struct GroundHandling_input
{
@optional char l_04_i_gdcomac_frz_l1;
@optional char l_04_i_gdcomac_chocks_l1;
@optional double l_04_i_gdcomac_alt_agl_f8;
@optional char l_04_i_gdcomac_frzflt_l1;
@optional double l_04_i_gdcomac_p_f8;
@optional double l_04_i_gdcomac_q_f8;
@optional double l_04_i_gdcomac_r_f8;
@optional double l_04_i_gdcomac_ug_f8;
@optional double l_04_i_gdcomac_vg_f8;
@optional double l_04_i_gdcomac_wg_f8;
@optional double l_04_i_gdcomac_blcg_f8;
@optional double l_04_i_gdcomac_bscg_f8;
@optional double l_04_i_gdcomac_wlcg_f8;
@optional char l_04_i_gdcomac_pb_active_l1;
@optional double l_04_i_gdcomac_brake_torq_f8[3][2];
@optional double l_04_i_gdcomac_gear_f8[3];
@optional double l_04_i_gdcomac_gsteer_f8[10];
@optional double l_04_i_gdcomac_tire_pres_f8[3][2];
@optional char l_04_i_gdcomac_onjax_l1;
@optional double l_04_i_gdcomac_contdep_f8[7];
@optional double l_04_i_gdcomac_thetag_f8;
@optional double l_04_i_gdcomac_phig_f8;
@optional long l_04_i_gdcomac_rwyrgh_i2;
@optional double l_04_i_gdcomac_rwyhdg_f8;
@optional char l_04_i_gdcomac_reset_braketemp_l1;
@optional char l_04_i_gdcomac_reset_tirepress_l1;
@optional double l_04_i_gdcomac_temp_c_f8;
@optional double l_04_i_gdcomac_brake_temp_f8[3][2];
@optional char l_04_i_gdcomac_tire_tburst_l1[3][2];
@optional char l_04_i_gdcomac_tire_tflat_l1[3][2];
@optional char l_04_i_gdcomac_brk_reset_tpres_l1;
@optional double l_04_i_gdcomac_rcon_ci_f8[14];
@optional double l_04_i_gdcomac_pb_towforce_f8;
@optional long l_04_i_gdcomac_gsteer_state_i4;
@optional char l_04_i_gdcomac_trim_active_l1;
@optional double l_04_i_gdcomac_phi_deg_f8;
@optional double l_04_i_gdcomac_theta_deg_f8;
@optional double l_04_i_gdcomac_psi_deg_f8;
@optional char l_04_i_gdcomac_resetint_l1;
};
struct GroundHandling_output
{
@optional char l_04_o_gdcomac_frz_l1;
@optional char l_04_o_gdcomac_ac_on_ground_l1;
@optional double l_04_o_gdcomac_ac_stationary_f8;
@optional double l_04_o_gdcomac_alt_tire_f8;
@optional double l_04_o_gdcomac_zcg_to_tire_f8;
@optional double l_04_o_gdcomac_fxb_f8;
@optional double l_04_o_gdcomac_fyb_f8;
@optional double l_04_o_gdcomac_fzb_f8;
@optional double l_04_o_gdcomac_mxb_f8;
@optional double l_04_o_gdcomac_myb_f8;
@optional double l_04_o_gdcomac_mzb_f8;
@optional double l_04_o_gdcomac_fygs_f8[3];
@optional double l_04_o_gdcomac_mzgs_f8[3];
@optional double l_04_o_gdcomac_mu_f8[3];
@optional double l_04_o_gdcomac_dstroke_f8[3];
@optional double l_04_o_gdcomac_sr_f8[3][2];
@optional double l_04_o_gdcomac_sy_f8[3][2];
@optional double l_04_o_gdcomac_sx_f8[3][2];
@optional double l_04_o_gdcomac_xft_f8[3];
@optional double l_04_o_gdcomac_yft_f8[3];
@optional double l_04_o_gdcomac_zft_f8[3];
@optional double l_04_o_gdcomac_distngrxcg_f8;
@optional double l_04_o_gdcomac_distmgrxcg_f8;
@optional double l_04_o_gdcomac_distmgrzcg_f8;
@optional double l_04_o_gdcomac_tire_vel_f8[3][2];
@optional char l_04_o_gdcomac_tire_burst_l1[3][2];
@optional double l_04_o_gdcomac_tire_temp_f8[3][2];
@optional char l_04_o_gdcomac_wow_l1;
@optional double l_04_o_gdcomac_utirew_f8[3][2];
@optional double l_04_o_gdcomac_vtirew_f8[3][2];
@optional double l_04_o_gdcomac_whl_omega_f8[3][2];
@optional double l_04_o_gdcomac_dstruc_f8[6];
@optional double l_04_o_gdcomac_wor_par_f8[3];
@optional double l_04_o_gdcomac_nd_f8[3];
@optional double l_04_o_gdcomac_vczt_f8[3][2];
};
struct GroundHandling_heartbeat
{
@optional long groundhandling_model_heartbeat;
};
struct WeightBalance_input
{
@optional double l_04_i_wbcomac_theta_deg_f8;
@optional char l_04_i_wbcomac_gear_mode_l1;
@optional double l_04_i_wbcomac_acset_gw_f8;
@optional double l_04_i_wbcomac_acset_cg_f8;
@optional float l_04_i_wbcomac_acset_tankfuel_f4[20];
@optional double l_04_i_wbcomac_acset_totfuel_f8;
@optional double l_04_i_wbcomac_acset_zfw_f8;
@optional double l_04_i_wbcomac_acset_zfwcg_f8;
@optional char l_04_i_wbcomac_eng_efsep_l1[4];
@optional double l_04_i_wbcomac_fuel_f8[20];
@optional double l_04_i_wbcomac_gear_avg_f8;
@optional double l_04_i_wbcomac_kice_f8[20];
@optional char l_04_i_wbcomac_bycglim_l1;
@optional char l_04_i_wbcomac_bygwlim_l1;
@optional char l_04_i_wbcomac_frz_l1;
@optional char l_04_i_wbcomac_zcgfrz_l1;
@optional char l_04_i_wbcomac_zcgfrz_grfx_l1;
@optional char l_04_i_wbcomac_ycgfrz_l1;
@optional char l_04_i_wbcomac_inertfrz_l1;
@optional double l_04_i_wbcomac_potreq_gw_f8;
@optional double l_04_i_wbcomac_potreq_gwcg_f8;
@optional double l_04_i_wbcomac_phi_deg_f8;
@optional double l_04_i_wbcomac_psi_deg_f8;
};
struct WeightBalance_output
{
@optional char l_04_o_wbcomac_frz_l1;
@optional char l_04_o_wbcomac_zcgfrz_l1;
@optional char l_04_o_wbcomac_zcgfrz_grfx_l1;
@optional char l_04_o_wbcomac_ycgfrz_l1;
@optional char l_04_o_wbcomac_inertfrz_l1;
@optional float l_04_o_wbcomac_gw_f4;
@optional float l_04_o_wbcomac_cg_f4;
@optional double l_04_o_wbcomac_blcg_f8;
@optional double l_04_o_wbcomac_bscg_f8;
@optional double l_04_o_wbcomac_wlcg_f8;
@optional double l_04_o_wbcomac_xcg_f8;
@optional double l_04_o_wbcomac_ixx_f8;
@optional double l_04_o_wbcomac_ixy_f8;
@optional double l_04_o_wbcomac_ixz_f8;
@optional double l_04_o_wbcomac_iyy_f8;
@optional double l_04_o_wbcomac_iyz_f8;
@optional double l_04_o_wbcomac_izz_f8;
@optional float l_04_o_wbcomac_zfw_f4;
@optional float l_04_o_wbcomac_zfwcg_f4;
@optional float l_04_o_wbcomac_zfw_blcg_f4;
@optional float l_04_o_wbcomac_zfw_wlcg_f4;
@optional double l_04_o_wbcomac_fuel_cmd_f8[20];
@optional long l_04_o_wbcomac_fuel_mode_i4;
@optional double l_04_o_wbcomac_fuel_ixx_f8;
@optional double l_04_o_wbcomac_fuel_ixy_f8;
@optional double l_04_o_wbcomac_fuel_ixz_f8;
@optional double l_04_o_wbcomac_fuel_iyy_f8;
@optional double l_04_o_wbcomac_fuel_iyz_f8;
@optional double l_04_o_wbcomac_fuel_izz_f8;
@optional double l_04_o_wbcomac_l_wt_fuel_f8;
@optional double l_04_o_wbcomac_ice_airframe_total_f8;
@optional double l_04_o_wbcomac_ice_eng_f8[4];
@optional double l_04_o_wbcomac_ice_eng_total_f8;
@optional double l_04_o_wbcomac_ice_fuselage_f8;
@optional double l_04_o_wbcomac_ice_stab_left_f8;
@optional double l_04_o_wbcomac_ice_stab_right_f8;
@optional double l_04_o_wbcomac_ice_stab_total_f8;
@optional double l_04_o_wbcomac_ice_total_f8;
@optional double l_04_o_wbcomac_ice_total_frac_f8;
@optional double l_04_o_wbcomac_ice_vert_tail_f8;
@optional double l_04_o_wbcomac_ice_wing_left_f8;
@optional double l_04_o_wbcomac_ice_wing_right_f8;
@optional double l_04_o_wbcomac_ice_wing_total_f8;
@optional char l_04_o_wbcomac_init_l1;
@optional double l_04_o_wbcomac_potmin_gw_f8;
@optional double l_04_o_wbcomac_potmax_gw_f8;
@optional double l_04_o_wbcomac_potmin_gwcg_f8;
@optional double l_04_o_wbcomac_potmax_gwcg_f8;
@optional float l_04_o_wbcomac_min_cg_f4;
@optional float l_04_o_wbcomac_min_gw_f4;
@optional float l_04_o_wbcomac_min_zfw_f4;
@optional float l_04_o_wbcomac_min_zfwcg_f4;
@optional float l_04_o_wbcomac_max_cg_f4;
@optional float l_04_o_wbcomac_max_gw_f4;
@optional float l_04_o_wbcomac_max_zfw_f4;
@optional float l_04_o_wbcomac_max_zfwcg_f4;
};
struct WeightBalance_heartbeat
{
@optional long weightbody_model_heartbeat;
};
};
};
};

View File

@ -0,0 +1,102 @@
// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*!
* @file C909_V1CdrAux.hpp
* This source file contains some definitions of CDR related functions.
*
* This file was generated by the tool fastddsgen.
*/
#ifndef FAST_DDS_GENERATED__XNSIM_C909_ATA04_C909_V1CDRAUX_HPP
#define FAST_DDS_GENERATED__XNSIM_C909_ATA04_C909_V1CDRAUX_HPP
#include "C909_V1.hpp"
constexpr uint32_t XNSim_C909_ATA04_GroundHandling_input_max_cdr_typesize {1093UL};
constexpr uint32_t XNSim_C909_ATA04_GroundHandling_input_max_key_cdr_typesize {0UL};
constexpr uint32_t XNSim_C909_ATA04_GroundHandling_heartbeat_max_cdr_typesize {12UL};
constexpr uint32_t XNSim_C909_ATA04_GroundHandling_heartbeat_max_key_cdr_typesize {0UL};
constexpr uint32_t XNSim_C909_ATA04_Aerodynamics_output_max_cdr_typesize {312UL};
constexpr uint32_t XNSim_C909_ATA04_Aerodynamics_output_max_key_cdr_typesize {0UL};
constexpr uint32_t XNSim_C909_ATA04_WeightBalance_output_max_cdr_typesize {1184UL};
constexpr uint32_t XNSim_C909_ATA04_WeightBalance_output_max_key_cdr_typesize {0UL};
constexpr uint32_t XNSim_C909_ATA04_WeightBalance_heartbeat_max_cdr_typesize {12UL};
constexpr uint32_t XNSim_C909_ATA04_WeightBalance_heartbeat_max_key_cdr_typesize {0UL};
constexpr uint32_t XNSim_C909_ATA04_GroundHandling_output_max_cdr_typesize {1328UL};
constexpr uint32_t XNSim_C909_ATA04_GroundHandling_output_max_key_cdr_typesize {0UL};
constexpr uint32_t XNSim_C909_ATA04_WeightBalance_input_max_cdr_typesize {784UL};
constexpr uint32_t XNSim_C909_ATA04_WeightBalance_input_max_key_cdr_typesize {0UL};
constexpr uint32_t XNSim_C909_ATA04_Aerodynamics_input_max_cdr_typesize {1352UL};
constexpr uint32_t XNSim_C909_ATA04_Aerodynamics_input_max_key_cdr_typesize {0UL};
constexpr uint32_t XNSim_C909_ATA04_Aerodynamics_heartbeat_max_cdr_typesize {12UL};
constexpr uint32_t XNSim_C909_ATA04_Aerodynamics_heartbeat_max_key_cdr_typesize {0UL};
namespace eprosima {
namespace fastcdr {
class Cdr;
class CdrSizeCalculator;
eProsima_user_DllExport void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const XNSim::C909::ATA04::Aerodynamics_input& data);
eProsima_user_DllExport void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const XNSim::C909::ATA04::Aerodynamics_output& data);
eProsima_user_DllExport void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const XNSim::C909::ATA04::Aerodynamics_heartbeat& data);
eProsima_user_DllExport void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const XNSim::C909::ATA04::GroundHandling_input& data);
eProsima_user_DllExport void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const XNSim::C909::ATA04::GroundHandling_output& data);
eProsima_user_DllExport void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const XNSim::C909::ATA04::GroundHandling_heartbeat& data);
eProsima_user_DllExport void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const XNSim::C909::ATA04::WeightBalance_input& data);
eProsima_user_DllExport void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const XNSim::C909::ATA04::WeightBalance_output& data);
eProsima_user_DllExport void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const XNSim::C909::ATA04::WeightBalance_heartbeat& data);
} // namespace fastcdr
} // namespace eprosima
#endif // FAST_DDS_GENERATED__XNSIM_C909_ATA04_C909_V1CDRAUX_HPP

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,780 @@
// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*!
* @file C909_V1PubSubTypes.hpp
* This header file contains the declaration of the serialization functions.
*
* This file was generated by the tool fastddsgen.
*/
#ifndef FAST_DDS_GENERATED__XNSIM_C909_ATA04_C909_V1_PUBSUBTYPES_HPP
#define FAST_DDS_GENERATED__XNSIM_C909_ATA04_C909_V1_PUBSUBTYPES_HPP
#include <fastdds/dds/core/policy/QosPolicies.hpp>
#include <fastdds/dds/topic/TopicDataType.hpp>
#include <fastdds/rtps/common/InstanceHandle.hpp>
#include <fastdds/rtps/common/SerializedPayload.hpp>
#include <fastdds/utils/md5.hpp>
#include "C909_V1.hpp"
#if !defined(FASTDDS_GEN_API_VER) || (FASTDDS_GEN_API_VER != 3)
#error \
Generated C909_V1 is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen.
#endif // FASTDDS_GEN_API_VER
namespace XNSim
{
namespace C909
{
namespace ATA04
{
/*!
* @brief This class represents the TopicDataType of the type Aerodynamics_input defined by the user in the IDL file.
* @ingroup C909_V1
*/
class Aerodynamics_inputPubSubType : public eprosima::fastdds::dds::TopicDataType
{
public:
typedef Aerodynamics_input type;
eProsima_user_DllExport Aerodynamics_inputPubSubType();
eProsima_user_DllExport ~Aerodynamics_inputPubSubType() override;
eProsima_user_DllExport bool serialize(
const void* const data,
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool deserialize(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
void* data) override;
eProsima_user_DllExport uint32_t calculate_serialized_size(
const void* const data,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool compute_key(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport bool compute_key(
const void* const data,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport void* create_data() override;
eProsima_user_DllExport void delete_data(
void* data) override;
//Register TypeObject representation in Fast DDS TypeObjectRegistry
eProsima_user_DllExport void register_type_object_representation() override;
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
eProsima_user_DllExport inline bool is_bounded() const override
{
return true;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
eProsima_user_DllExport inline bool is_plain(
eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override
{
static_cast<void>(data_representation);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
eProsima_user_DllExport inline bool construct_sample(
void* memory) const override
{
static_cast<void>(memory);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
private:
eprosima::fastdds::MD5 md5_;
unsigned char* key_buffer_;
};
/*!
* @brief This class represents the TopicDataType of the type Aerodynamics_output defined by the user in the IDL file.
* @ingroup C909_V1
*/
class Aerodynamics_outputPubSubType : public eprosima::fastdds::dds::TopicDataType
{
public:
typedef Aerodynamics_output type;
eProsima_user_DllExport Aerodynamics_outputPubSubType();
eProsima_user_DllExport ~Aerodynamics_outputPubSubType() override;
eProsima_user_DllExport bool serialize(
const void* const data,
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool deserialize(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
void* data) override;
eProsima_user_DllExport uint32_t calculate_serialized_size(
const void* const data,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool compute_key(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport bool compute_key(
const void* const data,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport void* create_data() override;
eProsima_user_DllExport void delete_data(
void* data) override;
//Register TypeObject representation in Fast DDS TypeObjectRegistry
eProsima_user_DllExport void register_type_object_representation() override;
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
eProsima_user_DllExport inline bool is_bounded() const override
{
return true;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
eProsima_user_DllExport inline bool is_plain(
eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override
{
static_cast<void>(data_representation);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
eProsima_user_DllExport inline bool construct_sample(
void* memory) const override
{
static_cast<void>(memory);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
private:
eprosima::fastdds::MD5 md5_;
unsigned char* key_buffer_;
};
/*!
* @brief This class represents the TopicDataType of the type Aerodynamics_heartbeat defined by the user in the IDL file.
* @ingroup C909_V1
*/
class Aerodynamics_heartbeatPubSubType : public eprosima::fastdds::dds::TopicDataType
{
public:
typedef Aerodynamics_heartbeat type;
eProsima_user_DllExport Aerodynamics_heartbeatPubSubType();
eProsima_user_DllExport ~Aerodynamics_heartbeatPubSubType() override;
eProsima_user_DllExport bool serialize(
const void* const data,
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool deserialize(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
void* data) override;
eProsima_user_DllExport uint32_t calculate_serialized_size(
const void* const data,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool compute_key(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport bool compute_key(
const void* const data,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport void* create_data() override;
eProsima_user_DllExport void delete_data(
void* data) override;
//Register TypeObject representation in Fast DDS TypeObjectRegistry
eProsima_user_DllExport void register_type_object_representation() override;
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
eProsima_user_DllExport inline bool is_bounded() const override
{
return true;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
eProsima_user_DllExport inline bool is_plain(
eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override
{
static_cast<void>(data_representation);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
eProsima_user_DllExport inline bool construct_sample(
void* memory) const override
{
static_cast<void>(memory);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
private:
eprosima::fastdds::MD5 md5_;
unsigned char* key_buffer_;
};
/*!
* @brief This class represents the TopicDataType of the type GroundHandling_input defined by the user in the IDL file.
* @ingroup C909_V1
*/
class GroundHandling_inputPubSubType : public eprosima::fastdds::dds::TopicDataType
{
public:
typedef GroundHandling_input type;
eProsima_user_DllExport GroundHandling_inputPubSubType();
eProsima_user_DllExport ~GroundHandling_inputPubSubType() override;
eProsima_user_DllExport bool serialize(
const void* const data,
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool deserialize(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
void* data) override;
eProsima_user_DllExport uint32_t calculate_serialized_size(
const void* const data,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool compute_key(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport bool compute_key(
const void* const data,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport void* create_data() override;
eProsima_user_DllExport void delete_data(
void* data) override;
//Register TypeObject representation in Fast DDS TypeObjectRegistry
eProsima_user_DllExport void register_type_object_representation() override;
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
eProsima_user_DllExport inline bool is_bounded() const override
{
return true;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
eProsima_user_DllExport inline bool is_plain(
eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override
{
static_cast<void>(data_representation);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
eProsima_user_DllExport inline bool construct_sample(
void* memory) const override
{
static_cast<void>(memory);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
private:
eprosima::fastdds::MD5 md5_;
unsigned char* key_buffer_;
};
/*!
* @brief This class represents the TopicDataType of the type GroundHandling_output defined by the user in the IDL file.
* @ingroup C909_V1
*/
class GroundHandling_outputPubSubType : public eprosima::fastdds::dds::TopicDataType
{
public:
typedef GroundHandling_output type;
eProsima_user_DllExport GroundHandling_outputPubSubType();
eProsima_user_DllExport ~GroundHandling_outputPubSubType() override;
eProsima_user_DllExport bool serialize(
const void* const data,
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool deserialize(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
void* data) override;
eProsima_user_DllExport uint32_t calculate_serialized_size(
const void* const data,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool compute_key(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport bool compute_key(
const void* const data,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport void* create_data() override;
eProsima_user_DllExport void delete_data(
void* data) override;
//Register TypeObject representation in Fast DDS TypeObjectRegistry
eProsima_user_DllExport void register_type_object_representation() override;
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
eProsima_user_DllExport inline bool is_bounded() const override
{
return true;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
eProsima_user_DllExport inline bool is_plain(
eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override
{
static_cast<void>(data_representation);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
eProsima_user_DllExport inline bool construct_sample(
void* memory) const override
{
static_cast<void>(memory);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
private:
eprosima::fastdds::MD5 md5_;
unsigned char* key_buffer_;
};
/*!
* @brief This class represents the TopicDataType of the type GroundHandling_heartbeat defined by the user in the IDL file.
* @ingroup C909_V1
*/
class GroundHandling_heartbeatPubSubType : public eprosima::fastdds::dds::TopicDataType
{
public:
typedef GroundHandling_heartbeat type;
eProsima_user_DllExport GroundHandling_heartbeatPubSubType();
eProsima_user_DllExport ~GroundHandling_heartbeatPubSubType() override;
eProsima_user_DllExport bool serialize(
const void* const data,
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool deserialize(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
void* data) override;
eProsima_user_DllExport uint32_t calculate_serialized_size(
const void* const data,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool compute_key(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport bool compute_key(
const void* const data,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport void* create_data() override;
eProsima_user_DllExport void delete_data(
void* data) override;
//Register TypeObject representation in Fast DDS TypeObjectRegistry
eProsima_user_DllExport void register_type_object_representation() override;
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
eProsima_user_DllExport inline bool is_bounded() const override
{
return true;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
eProsima_user_DllExport inline bool is_plain(
eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override
{
static_cast<void>(data_representation);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
eProsima_user_DllExport inline bool construct_sample(
void* memory) const override
{
static_cast<void>(memory);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
private:
eprosima::fastdds::MD5 md5_;
unsigned char* key_buffer_;
};
/*!
* @brief This class represents the TopicDataType of the type WeightBalance_input defined by the user in the IDL file.
* @ingroup C909_V1
*/
class WeightBalance_inputPubSubType : public eprosima::fastdds::dds::TopicDataType
{
public:
typedef WeightBalance_input type;
eProsima_user_DllExport WeightBalance_inputPubSubType();
eProsima_user_DllExport ~WeightBalance_inputPubSubType() override;
eProsima_user_DllExport bool serialize(
const void* const data,
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool deserialize(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
void* data) override;
eProsima_user_DllExport uint32_t calculate_serialized_size(
const void* const data,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool compute_key(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport bool compute_key(
const void* const data,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport void* create_data() override;
eProsima_user_DllExport void delete_data(
void* data) override;
//Register TypeObject representation in Fast DDS TypeObjectRegistry
eProsima_user_DllExport void register_type_object_representation() override;
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
eProsima_user_DllExport inline bool is_bounded() const override
{
return true;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
eProsima_user_DllExport inline bool is_plain(
eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override
{
static_cast<void>(data_representation);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
eProsima_user_DllExport inline bool construct_sample(
void* memory) const override
{
static_cast<void>(memory);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
private:
eprosima::fastdds::MD5 md5_;
unsigned char* key_buffer_;
};
/*!
* @brief This class represents the TopicDataType of the type WeightBalance_output defined by the user in the IDL file.
* @ingroup C909_V1
*/
class WeightBalance_outputPubSubType : public eprosima::fastdds::dds::TopicDataType
{
public:
typedef WeightBalance_output type;
eProsima_user_DllExport WeightBalance_outputPubSubType();
eProsima_user_DllExport ~WeightBalance_outputPubSubType() override;
eProsima_user_DllExport bool serialize(
const void* const data,
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool deserialize(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
void* data) override;
eProsima_user_DllExport uint32_t calculate_serialized_size(
const void* const data,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool compute_key(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport bool compute_key(
const void* const data,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport void* create_data() override;
eProsima_user_DllExport void delete_data(
void* data) override;
//Register TypeObject representation in Fast DDS TypeObjectRegistry
eProsima_user_DllExport void register_type_object_representation() override;
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
eProsima_user_DllExport inline bool is_bounded() const override
{
return true;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
eProsima_user_DllExport inline bool is_plain(
eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override
{
static_cast<void>(data_representation);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
eProsima_user_DllExport inline bool construct_sample(
void* memory) const override
{
static_cast<void>(memory);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
private:
eprosima::fastdds::MD5 md5_;
unsigned char* key_buffer_;
};
/*!
* @brief This class represents the TopicDataType of the type WeightBalance_heartbeat defined by the user in the IDL file.
* @ingroup C909_V1
*/
class WeightBalance_heartbeatPubSubType : public eprosima::fastdds::dds::TopicDataType
{
public:
typedef WeightBalance_heartbeat type;
eProsima_user_DllExport WeightBalance_heartbeatPubSubType();
eProsima_user_DllExport ~WeightBalance_heartbeatPubSubType() override;
eProsima_user_DllExport bool serialize(
const void* const data,
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool deserialize(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
void* data) override;
eProsima_user_DllExport uint32_t calculate_serialized_size(
const void* const data,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool compute_key(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport bool compute_key(
const void* const data,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport void* create_data() override;
eProsima_user_DllExport void delete_data(
void* data) override;
//Register TypeObject representation in Fast DDS TypeObjectRegistry
eProsima_user_DllExport void register_type_object_representation() override;
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
eProsima_user_DllExport inline bool is_bounded() const override
{
return true;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
eProsima_user_DllExport inline bool is_plain(
eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override
{
static_cast<void>(data_representation);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
eProsima_user_DllExport inline bool construct_sample(
void* memory) const override
{
static_cast<void>(memory);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
private:
eprosima::fastdds::MD5 md5_;
unsigned char* key_buffer_;
};
} // namespace ATA04
} // namespace C909
} // namespace XNSim
#endif // FAST_DDS_GENERATED__XNSIM_C909_ATA04_C909_V1_PUBSUBTYPES_HPP

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,169 @@
// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*!
* @file C909_V1TypeObjectSupport.hpp
* Header file containing the API required to register the TypeObject representation of the described types in the IDL file
*
* This file was generated by the tool fastddsgen.
*/
#ifndef FAST_DDS_GENERATED__XNSIM_C909_ATA04_C909_V1_TYPE_OBJECT_SUPPORT_HPP
#define FAST_DDS_GENERATED__XNSIM_C909_ATA04_C909_V1_TYPE_OBJECT_SUPPORT_HPP
#include <fastdds/dds/xtypes/type_representation/TypeObject.hpp>
#if defined(_WIN32)
#if defined(EPROSIMA_USER_DLL_EXPORT)
#define eProsima_user_DllExport __declspec( dllexport )
#else
#define eProsima_user_DllExport
#endif // EPROSIMA_USER_DLL_EXPORT
#else
#define eProsima_user_DllExport
#endif // _WIN32
#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC
namespace XNSim {
namespace C909 {
namespace ATA04 {
/**
* @brief Register Aerodynamics_input related TypeIdentifier.
* Fully-descriptive TypeIdentifiers are directly registered.
* Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is
* indirectly registered as well.
*
* @param[out] TypeIdentifier of the registered type.
* The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers.
* Invalid TypeIdentifier is returned in case of error.
*/
eProsima_user_DllExport void register_Aerodynamics_input_type_identifier(
eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids);
/**
* @brief Register Aerodynamics_output related TypeIdentifier.
* Fully-descriptive TypeIdentifiers are directly registered.
* Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is
* indirectly registered as well.
*
* @param[out] TypeIdentifier of the registered type.
* The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers.
* Invalid TypeIdentifier is returned in case of error.
*/
eProsima_user_DllExport void register_Aerodynamics_output_type_identifier(
eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids);
/**
* @brief Register Aerodynamics_heartbeat related TypeIdentifier.
* Fully-descriptive TypeIdentifiers are directly registered.
* Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is
* indirectly registered as well.
*
* @param[out] TypeIdentifier of the registered type.
* The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers.
* Invalid TypeIdentifier is returned in case of error.
*/
eProsima_user_DllExport void register_Aerodynamics_heartbeat_type_identifier(
eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids);
/**
* @brief Register GroundHandling_input related TypeIdentifier.
* Fully-descriptive TypeIdentifiers are directly registered.
* Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is
* indirectly registered as well.
*
* @param[out] TypeIdentifier of the registered type.
* The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers.
* Invalid TypeIdentifier is returned in case of error.
*/
eProsima_user_DllExport void register_GroundHandling_input_type_identifier(
eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids);
/**
* @brief Register GroundHandling_output related TypeIdentifier.
* Fully-descriptive TypeIdentifiers are directly registered.
* Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is
* indirectly registered as well.
*
* @param[out] TypeIdentifier of the registered type.
* The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers.
* Invalid TypeIdentifier is returned in case of error.
*/
eProsima_user_DllExport void register_GroundHandling_output_type_identifier(
eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids);
/**
* @brief Register GroundHandling_heartbeat related TypeIdentifier.
* Fully-descriptive TypeIdentifiers are directly registered.
* Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is
* indirectly registered as well.
*
* @param[out] TypeIdentifier of the registered type.
* The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers.
* Invalid TypeIdentifier is returned in case of error.
*/
eProsima_user_DllExport void register_GroundHandling_heartbeat_type_identifier(
eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids);
/**
* @brief Register WeightBalance_input related TypeIdentifier.
* Fully-descriptive TypeIdentifiers are directly registered.
* Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is
* indirectly registered as well.
*
* @param[out] TypeIdentifier of the registered type.
* The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers.
* Invalid TypeIdentifier is returned in case of error.
*/
eProsima_user_DllExport void register_WeightBalance_input_type_identifier(
eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids);
/**
* @brief Register WeightBalance_output related TypeIdentifier.
* Fully-descriptive TypeIdentifiers are directly registered.
* Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is
* indirectly registered as well.
*
* @param[out] TypeIdentifier of the registered type.
* The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers.
* Invalid TypeIdentifier is returned in case of error.
*/
eProsima_user_DllExport void register_WeightBalance_output_type_identifier(
eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids);
/**
* @brief Register WeightBalance_heartbeat related TypeIdentifier.
* Fully-descriptive TypeIdentifiers are directly registered.
* Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is
* indirectly registered as well.
*
* @param[out] TypeIdentifier of the registered type.
* The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers.
* Invalid TypeIdentifier is returned in case of error.
*/
eProsima_user_DllExport void register_WeightBalance_heartbeat_type_identifier(
eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids);
} // namespace ATA04
} // namespace C909
} // namespace XNSim
#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC
#endif // FAST_DDS_GENERATED__XNSIM_C909_ATA04_C909_V1_TYPE_OBJECT_SUPPORT_HPP

View File

@ -0,0 +1,65 @@
cmake_minimum_required(VERSION 3.16)
project(C909_V1_Interface LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
#
if(DEFINED ENV{XNCore})
set(XNCore_PATH $ENV{XNCore})
else()
message(FATAL_ERROR "Environment variable XNCore is not set.")
endif()
# XNCore_PATH include
include_directories(${XNCore_PATH}/include)
if(NOT fastcdr_FOUND)
find_package(fastcdr 2 REQUIRED)
endif()
if(NOT fastdds_FOUND)
find_package(fastdds 3 REQUIRED)
endif()
find_package(OpenSSL REQUIRED)
add_library(C909_V1_Interface SHARED
C909_V1.hpp
C909_V1CdrAux.hpp
C909_V1CdrAux.ipp
C909_V1PubSubTypes.hpp
C909_V1PubSubTypes.cxx
C909_V1TypeObjectSupport.hpp
C909_V1TypeObjectSupport.cxx
ATA04/GroundHandling_input.hpp
ATA04/GroundHandling_input.cxx
ATA04/GroundHandling_output.hpp
ATA04/GroundHandling_output.cxx
ATA04/GroundHandling_heartbeat.hpp
ATA04/GroundHandling_heartbeat.cxx
)
target_link_libraries(C909_V1_Interface PRIVATE
fastcdr
fastdds
OpenSSL::SSL
OpenSSL::Crypto
${XNCore_PATH}/lib/libXNCore.so
)
target_compile_definitions(C909_V1_Interface PRIVATE C909_V1_INTERFACE_LIBRARY)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${XNCore_PATH}" CACHE PATH "Install path prefix" FORCE)
endif()
include(GNUInstallDirs)
install(TARGETS C909_V1_Interface
BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION .
)

View File

@ -1,56 +0,0 @@
module XNSim
{
module ATA04
{
struct Aerodynamics_input
{
@optional double l_04_i_aerocomac_alpha_f8;
@optional double l_04_i_aerocomac_alpdot_f8;
@optional double l_04_i_aerocomac_beta_f8;
@optional double l_04_i_aerocomac_press_alt_f8;
@optional double l_04_i_aerocomac_tas_f8;
@optional double l_04_i_aerocomac_mach_f8;
@optional double l_04_i_aerocomac_nx_f8;
@optional double l_04_i_aerocomac_ny_f8;
@optional double l_04_i_aerocomac_nz_f8;
@optional double l_04_i_aerocomac_p_f8;
@optional double l_04_i_aerocomac_q_f8;
@optional double l_04_i_aerocomac_r_f8;
@optional double l_04_i_aerocomac_qbar_f8;
@optional double l_04_i_aerocomac_blcg_f8;
@optional double l_04_i_aerocomac_bscg_f8;
@optional double l_04_i_aerocomac_wlcg_f8;
@optional double l_04_i_aerocomac_ail_f8[10];
@optional double l_04_i_aerocomac_elv_f8[4];
@optional double l_04_i_aerocomac_rud_f8[2];
@optional double l_04_i_aerocomac_stab_f8;
@optional double l_04_i_aerocomac_gear_f8[7];
@optional double l_04_i_aerocomac_flap_f8[10];
@optional double l_04_i_aerocomac_slat_f8[20];
@optional double l_04_i_aerocomac_spl_f8[20];
@optional double l_04_i_aerocomac_tnet_f8[4];
@optional double l_04_i_aerocomac_kice_f8[20];
@optional double l_04_i_aerocomac_alt_agl_f8;
};
struct Aerodynamics_output
{
@optional double l_04_o_aerocomac_fxb_f8;
@optional double l_04_o_aerocomac_fyb_f8;
@optional double l_04_o_aerocomac_fzb_f8;
@optional double l_04_o_aerocomac_mxb_f8;
@optional double l_04_o_aerocomac_myb_f8;
@optional double l_04_o_aerocomac_mzb_f8;
@optional double l_04_o_aerocomac_cls_f8;
@optional double l_04_o_aerocomac_cl_f8;
@optional double l_04_o_aerocomac_cd_f8;
@optional double l_04_o_aerocomac_cm_f8;
@optional double l_04_o_aerocomac_cr_f8;
@optional double l_04_o_aerocomac_cy_f8;
@optional double l_04_o_aerocomac_cn_f8;
};
struct Aerodynamics_heartbeat
{
long aero_model_heartbeat;
};
};
};

View File

@ -1,90 +0,0 @@
module XNSim
{
module ATA04
{
struct GroundHandling_input
{
@optional char l_04_i_gdcomac_frz_l1;
@optional char l_04_i_gdcomac_chocks_l1;
@optional double l_04_i_gdcomac_alt_agl_f8;
@optional char l_04_i_gdcomac_frzflt_l1;
@optional double l_04_i_gdcomac_p_f8;
@optional double l_04_i_gdcomac_q_f8;
@optional double l_04_i_gdcomac_r_f8;
@optional double l_04_i_gdcomac_ug_f8;
@optional double l_04_i_gdcomac_vg_f8;
@optional double l_04_i_gdcomac_wg_f8;
@optional double l_04_i_gdcomac_blcg_f8;
@optional double l_04_i_gdcomac_bscg_f8;
@optional double l_04_i_gdcomac_wlcg_f8;
@optional char l_04_i_gdcomac_pb_active_l1;
@optional double l_04_i_gdcomac_brake_torq_f8[3][2];
@optional double l_04_i_gdcomac_gear_f8[3];
@optional double l_04_i_gdcomac_gsteer_f8[10];
@optional double l_04_i_gdcomac_tire_pres_f8[3][2];
@optional char l_04_i_gdcomac_onjax_l1;
@optional double l_04_i_gdcomac_contdep_f8[7];
@optional double l_04_i_gdcomac_thetag_f8;
@optional double l_04_i_gdcomac_phig_f8;
@optional long l_04_i_gdcomac_rwyrgh_i2;
@optional double l_04_i_gdcomac_rwyhdg_f8;
@optional char l_04_i_gdcomac_reset_braketemp_l1;
@optional char l_04_i_gdcomac_reset_tirepress_l1;
@optional double l_04_i_gdcomac_temp_c_f8;
@optional double l_04_i_gdcomac_brake_temp_f8[3][2];
@optional char l_04_i_gdcomac_tire_tburst_l1[3][2];
@optional char l_04_i_gdcomac_tire_tflat_l1[3][2];
@optional char l_04_i_gdcomac_brk_reset_tpres_l1;
@optional double l_04_i_gdcomac_rcon_ci_f8[14];
@optional double l_04_i_gdcomac_pb_towforce_f8;
@optional long l_04_i_gdcomac_gsteer_state_i4;
@optional char l_04_i_gdcomac_trim_active_l1;
@optional double l_04_i_gdcomac_phi_deg_f8;
@optional double l_04_i_gdcomac_theta_deg_f8;
@optional double l_04_i_gdcomac_psi_deg_f8;
@optional char l_04_i_gdcomac_resetint_l1;
};
struct GroundHandling_output
{
@optional char l_04_o_gdcomac_frz_l1;
@optional char l_04_o_gdcomac_ac_on_ground_l1;
@optional double l_04_o_gdcomac_ac_stationary_f8;
@optional double l_04_o_gdcomac_alt_tire_f8;
@optional double l_04_o_gdcomac_zcg_to_tire_f8;
@optional double l_04_o_gdcomac_fxb_f8;
@optional double l_04_o_gdcomac_fyb_f8;
@optional double l_04_o_gdcomac_fzb_f8;
@optional double l_04_o_gdcomac_mxb_f8;
@optional double l_04_o_gdcomac_myb_f8;
@optional double l_04_o_gdcomac_mzb_f8;
@optional double l_04_o_gdcomac_fygs_f8[3];
@optional double l_04_o_gdcomac_mzgs_f8[3];
@optional double l_04_o_gdcomac_mu_f8[3];
@optional double l_04_o_gdcomac_dstroke_f8[3];
@optional double l_04_o_gdcomac_sr_f8[3][2];
@optional double l_04_o_gdcomac_sy_f8[3][2];
@optional double l_04_o_gdcomac_sx_f8[3][2];
@optional double l_04_o_gdcomac_xft_f8[3];
@optional double l_04_o_gdcomac_yft_f8[3];
@optional double l_04_o_gdcomac_zft_f8[3];
@optional double l_04_o_gdcomac_distngrxcg_f8;
@optional double l_04_o_gdcomac_distmgrxcg_f8;
@optional double l_04_o_gdcomac_distmgrzcg_f8;
@optional double l_04_o_gdcomac_tire_vel_f8[3][2];
@optional char l_04_o_gdcomac_tire_burst_l1[3][2];
@optional double l_04_o_gdcomac_tire_temp_f8[3][2];
@optional char l_04_o_gdcomac_wow_l1;
@optional double l_04_o_gdcomac_utirew_f8[3][2];
@optional double l_04_o_gdcomac_vtirew_f8[3][2];
@optional double l_04_o_gdcomac_whl_omega_f8[3][2];
@optional double l_04_o_gdcomac_dstruc_f8[6];
@optional double l_04_o_gdcomac_wor_par_f8[3];
@optional double l_04_o_gdcomac_nd_f8[3];
@optional double l_04_o_gdcomac_vczt_f8[3][2];
};
struct GroundHandling_heartbeat
{
long groundhandling_model_heartbeat;
};
};
};

View File

@ -1,95 +0,0 @@
module XNSim
{
module ATA04
{
struct WeightBalance_input
{
@optional double l_04_i_wbcomac_theta_deg_f8;
@optional char l_04_i_wbcomac_gear_mode_l1;
@optional double l_04_i_wbcomac_acset_gw_f8;
@optional double l_04_i_wbcomac_acset_cg_f8;
@optional float l_04_i_wbcomac_acset_tankfuel_f4[20];
@optional double l_04_i_wbcomac_acset_totfuel_f8;
@optional double l_04_i_wbcomac_acset_zfw_f8;
@optional double l_04_i_wbcomac_acset_zfwcg_f8;
@optional char l_04_i_wbcomac_eng_efsep_l1[4];
@optional double l_04_i_wbcomac_fuel_f8[20];
@optional double l_04_i_wbcomac_gear_avg_f8;
@optional double l_04_i_wbcomac_kice_f8[20];
@optional char l_04_i_wbcomac_bycglim_l1;
@optional char l_04_i_wbcomac_bygwlim_l1;
@optional char l_04_i_wbcomac_frz_l1;
@optional char l_04_i_wbcomac_zcgfrz_l1;
@optional char l_04_i_wbcomac_zcgfrz_grfx_l1;
@optional char l_04_i_wbcomac_ycgfrz_l1;
@optional char l_04_i_wbcomac_inertfrz_l1;
@optional double l_04_i_wbcomac_potreq_gw_f8;
@optional double l_04_i_wbcomac_potreq_gwcg_f8;
@optional double l_04_i_wbcomac_phi_deg_f8;
@optional double l_04_i_wbcomac_psi_deg_f8;
};
struct WeightBalance_output
{
@optional char l_04_o_wbcomac_frz_l1;
@optional char l_04_o_wbcomac_zcgfrz_l1;
@optional char l_04_o_wbcomac_zcgfrz_grfx_l1;
@optional char l_04_o_wbcomac_ycgfrz_l1;
@optional char l_04_o_wbcomac_inertfrz_l1;
@optional float l_04_o_wbcomac_gw_f4;
@optional float l_04_o_wbcomac_cg_f4;
@optional double l_04_o_wbcomac_blcg_f8;
@optional double l_04_o_wbcomac_bscg_f8;
@optional double l_04_o_wbcomac_wlcg_f8;
@optional double l_04_o_wbcomac_xcg_f8;
@optional double l_04_o_wbcomac_ixx_f8;
@optional double l_04_o_wbcomac_ixy_f8;
@optional double l_04_o_wbcomac_ixz_f8;
@optional double l_04_o_wbcomac_iyy_f8;
@optional double l_04_o_wbcomac_iyz_f8;
@optional double l_04_o_wbcomac_izz_f8;
@optional float l_04_o_wbcomac_zfw_f4;
@optional float l_04_o_wbcomac_zfwcg_f4;
@optional float l_04_o_wbcomac_zfw_blcg_f4;
@optional float l_04_o_wbcomac_zfw_wlcg_f4;
@optional double l_04_o_wbcomac_fuel_cmd_f8[20];
@optional long l_04_o_wbcomac_fuel_mode_i4;
@optional double l_04_o_wbcomac_fuel_ixx_f8;
@optional double l_04_o_wbcomac_fuel_ixy_f8;
@optional double l_04_o_wbcomac_fuel_ixz_f8;
@optional double l_04_o_wbcomac_fuel_iyy_f8;
@optional double l_04_o_wbcomac_fuel_iyz_f8;
@optional double l_04_o_wbcomac_fuel_izz_f8;
@optional double l_04_o_wbcomac_l_wt_fuel_f8;
@optional double l_04_o_wbcomac_ice_airframe_total_f8;
@optional double l_04_o_wbcomac_ice_eng_f8[4];
@optional double l_04_o_wbcomac_ice_eng_total_f8;
@optional double l_04_o_wbcomac_ice_fuselage_f8;
@optional double l_04_o_wbcomac_ice_stab_left_f8;
@optional double l_04_o_wbcomac_ice_stab_right_f8;
@optional double l_04_o_wbcomac_ice_stab_total_f8;
@optional double l_04_o_wbcomac_ice_total_f8;
@optional double l_04_o_wbcomac_ice_total_frac_f8;
@optional double l_04_o_wbcomac_ice_vert_tail_f8;
@optional double l_04_o_wbcomac_ice_wing_left_f8;
@optional double l_04_o_wbcomac_ice_wing_right_f8;
@optional double l_04_o_wbcomac_ice_wing_total_f8;
@optional char l_04_o_wbcomac_init_l1;
@optional double l_04_o_wbcomac_potmin_gw_f8;
@optional double l_04_o_wbcomac_potmax_gw_f8;
@optional double l_04_o_wbcomac_potmin_gwcg_f8;
@optional double l_04_o_wbcomac_potmax_gwcg_f8;
@optional float l_04_o_wbcomac_min_cg_f4;
@optional float l_04_o_wbcomac_min_gw_f4;
@optional float l_04_o_wbcomac_min_zfw_f4;
@optional float l_04_o_wbcomac_min_zfwcg_f4;
@optional float l_04_o_wbcomac_max_cg_f4;
@optional float l_04_o_wbcomac_max_gw_f4;
@optional float l_04_o_wbcomac_max_zfw_f4;
@optional float l_04_o_wbcomac_max_zfwcg_f4;
};
struct WeightBalance_heartbeat
{
long weightbody_model_heartbeat;
};
};
};

View File

@ -1,56 +0,0 @@
module XNSim
{
module ATA04
{
struct Aerodynamics_input
{
@optional double l_04_i_aerocomac_alpha_f8;
@optional double l_04_i_aerocomac_alpdot_f8;
@optional double l_04_i_aerocomac_beta_f8;
@optional double l_04_i_aerocomac_press_alt_f8;
@optional double l_04_i_aerocomac_tas_f8;
@optional double l_04_i_aerocomac_mach_f8;
@optional double l_04_i_aerocomac_nx_f8;
@optional double l_04_i_aerocomac_ny_f8;
@optional double l_04_i_aerocomac_nz_f8;
@optional double l_04_i_aerocomac_p_f8;
@optional double l_04_i_aerocomac_q_f8;
@optional double l_04_i_aerocomac_r_f8;
@optional double l_04_i_aerocomac_qbar_f8;
@optional double l_04_i_aerocomac_blcg_f8;
@optional double l_04_i_aerocomac_bscg_f8;
@optional double l_04_i_aerocomac_wlcg_f8;
@optional double l_04_i_aerocomac_ail_f8[10];
@optional double l_04_i_aerocomac_elv_f8[4];
@optional double l_04_i_aerocomac_rud_f8[2];
@optional double l_04_i_aerocomac_stab_f8;
@optional double l_04_i_aerocomac_gear_f8[7];
@optional double l_04_i_aerocomac_flap_f8[10];
@optional double l_04_i_aerocomac_slat_f8[20];
@optional double l_04_i_aerocomac_spl_f8[20];
@optional double l_04_i_aerocomac_tnet_f8[4];
@optional double l_04_i_aerocomac_kice_f8[20];
@optional double l_04_i_aerocomac_alt_agl_f8;
};
struct Aerodynamics_output
{
@optional double l_04_o_aerocomac_fxb_f8;
@optional double l_04_o_aerocomac_fyb_f8;
@optional double l_04_o_aerocomac_fzb_f8;
@optional double l_04_o_aerocomac_mxb_f8;
@optional double l_04_o_aerocomac_myb_f8;
@optional double l_04_o_aerocomac_mzb_f8;
@optional double l_04_o_aerocomac_cls_f8;
@optional double l_04_o_aerocomac_cl_f8;
@optional double l_04_o_aerocomac_cd_f8;
@optional double l_04_o_aerocomac_cm_f8;
@optional double l_04_o_aerocomac_cr_f8;
@optional double l_04_o_aerocomac_cy_f8;
@optional double l_04_o_aerocomac_cn_f8;
};
struct Aerodynamics_heartbeat
{
long aero_model_heartbeat;
};
};
};

View File

@ -1,93 +0,0 @@
module XNSim
{
module C909
{
module ATA04
{
struct GroundHandling_input
{
@optional char l_04_i_gdcomac_frz_l1;
@optional char l_04_i_gdcomac_chocks_l1;
@optional double l_04_i_gdcomac_alt_agl_f8;
@optional char l_04_i_gdcomac_frzflt_l1;
@optional double l_04_i_gdcomac_p_f8;
@optional double l_04_i_gdcomac_q_f8;
@optional double l_04_i_gdcomac_r_f8;
@optional double l_04_i_gdcomac_ug_f8;
@optional double l_04_i_gdcomac_vg_f8;
@optional double l_04_i_gdcomac_wg_f8;
@optional double l_04_i_gdcomac_blcg_f8;
@optional double l_04_i_gdcomac_bscg_f8;
@optional double l_04_i_gdcomac_wlcg_f8;
@optional char l_04_i_gdcomac_pb_active_l1;
@optional double l_04_i_gdcomac_brake_torq_f8[3][2];
@optional double l_04_i_gdcomac_gear_f8[3];
@optional double l_04_i_gdcomac_gsteer_f8[10];
@optional double l_04_i_gdcomac_tire_pres_f8[3][2];
@optional char l_04_i_gdcomac_onjax_l1;
@optional double l_04_i_gdcomac_contdep_f8[7];
@optional double l_04_i_gdcomac_thetag_f8;
@optional double l_04_i_gdcomac_phig_f8;
@optional long l_04_i_gdcomac_rwyrgh_i2;
@optional double l_04_i_gdcomac_rwyhdg_f8;
@optional char l_04_i_gdcomac_reset_braketemp_l1;
@optional char l_04_i_gdcomac_reset_tirepress_l1;
@optional double l_04_i_gdcomac_temp_c_f8;
@optional double l_04_i_gdcomac_brake_temp_f8[3][2];
@optional char l_04_i_gdcomac_tire_tburst_l1[3][2];
@optional char l_04_i_gdcomac_tire_tflat_l1[3][2];
@optional char l_04_i_gdcomac_brk_reset_tpres_l1;
@optional double l_04_i_gdcomac_rcon_ci_f8[14];
@optional double l_04_i_gdcomac_pb_towforce_f8;
@optional long l_04_i_gdcomac_gsteer_state_i4;
@optional char l_04_i_gdcomac_trim_active_l1;
@optional double l_04_i_gdcomac_phi_deg_f8;
@optional double l_04_i_gdcomac_theta_deg_f8;
@optional double l_04_i_gdcomac_psi_deg_f8;
@optional char l_04_i_gdcomac_resetint_l1;
};
struct GroundHandling_output
{
@optional char l_04_o_gdcomac_frz_l1;
@optional char l_04_o_gdcomac_ac_on_ground_l1;
@optional double l_04_o_gdcomac_ac_stationary_f8;
@optional double l_04_o_gdcomac_alt_tire_f8;
@optional double l_04_o_gdcomac_zcg_to_tire_f8;
@optional double l_04_o_gdcomac_fxb_f8;
@optional double l_04_o_gdcomac_fyb_f8;
@optional double l_04_o_gdcomac_fzb_f8;
@optional double l_04_o_gdcomac_mxb_f8;
@optional double l_04_o_gdcomac_myb_f8;
@optional double l_04_o_gdcomac_mzb_f8;
@optional double l_04_o_gdcomac_fygs_f8[3];
@optional double l_04_o_gdcomac_mzgs_f8[3];
@optional double l_04_o_gdcomac_mu_f8[3];
@optional double l_04_o_gdcomac_dstroke_f8[3];
@optional double l_04_o_gdcomac_sr_f8[3][2];
@optional double l_04_o_gdcomac_sy_f8[3][2];
@optional double l_04_o_gdcomac_sx_f8[3][2];
@optional double l_04_o_gdcomac_xft_f8[3];
@optional double l_04_o_gdcomac_yft_f8[3];
@optional double l_04_o_gdcomac_zft_f8[3];
@optional double l_04_o_gdcomac_distngrxcg_f8;
@optional double l_04_o_gdcomac_distmgrxcg_f8;
@optional double l_04_o_gdcomac_distmgrzcg_f8;
@optional double l_04_o_gdcomac_tire_vel_f8[3][2];
@optional char l_04_o_gdcomac_tire_burst_l1[3][2];
@optional double l_04_o_gdcomac_tire_temp_f8[3][2];
@optional char l_04_o_gdcomac_wow_l1;
@optional double l_04_o_gdcomac_utirew_f8[3][2];
@optional double l_04_o_gdcomac_vtirew_f8[3][2];
@optional double l_04_o_gdcomac_whl_omega_f8[3][2];
@optional double l_04_o_gdcomac_dstruc_f8[6];
@optional double l_04_o_gdcomac_wor_par_f8[3];
@optional double l_04_o_gdcomac_nd_f8[3];
@optional double l_04_o_gdcomac_vczt_f8[3][2];
};
struct GroundHandling_heartbeat
{
@optional long groundhandling_model_heartbeat;
};
};
};
};

View File

@ -8,6 +8,6 @@
<ChangeTime>2025-02-19 16:22:19</ChangeTime>
<Node>0-0</Node>
<Priority>99</Priority>
<MathLib>ATA04_SACSCGroundHandling_2.0.27.1H_20241106/libSACSCGroundHandling.so</MathLib>
<MathLib>ATA04_SACSCGroundHandling_2.0.143.1H_20250506/libSACSCGroundHandling.so.2.0.143.1H</MathLib>
<CommandList/>
</Model>

View File

@ -1,95 +0,0 @@
module XNSim
{
module ATA04
{
struct WeightBalance_input
{
@optional double l_04_i_wbcomac_theta_deg_f8;
@optional char l_04_i_wbcomac_gear_mode_l1;
@optional double l_04_i_wbcomac_acset_gw_f8;
@optional double l_04_i_wbcomac_acset_cg_f8;
@optional float l_04_i_wbcomac_acset_tankfuel_f4[20];
@optional double l_04_i_wbcomac_acset_totfuel_f8;
@optional double l_04_i_wbcomac_acset_zfw_f8;
@optional double l_04_i_wbcomac_acset_zfwcg_f8;
@optional char l_04_i_wbcomac_eng_efsep_l1[4];
@optional double l_04_i_wbcomac_fuel_f8[20];
@optional double l_04_i_wbcomac_gear_avg_f8;
@optional double l_04_i_wbcomac_kice_f8[20];
@optional char l_04_i_wbcomac_bycglim_l1;
@optional char l_04_i_wbcomac_bygwlim_l1;
@optional char l_04_i_wbcomac_frz_l1;
@optional char l_04_i_wbcomac_zcgfrz_l1;
@optional char l_04_i_wbcomac_zcgfrz_grfx_l1;
@optional char l_04_i_wbcomac_ycgfrz_l1;
@optional char l_04_i_wbcomac_inertfrz_l1;
@optional double l_04_i_wbcomac_potreq_gw_f8;
@optional double l_04_i_wbcomac_potreq_gwcg_f8;
@optional double l_04_i_wbcomac_phi_deg_f8;
@optional double l_04_i_wbcomac_psi_deg_f8;
};
struct WeightBalance_output
{
@optional char l_04_o_wbcomac_frz_l1;
@optional char l_04_o_wbcomac_zcgfrz_l1;
@optional char l_04_o_wbcomac_zcgfrz_grfx_l1;
@optional char l_04_o_wbcomac_ycgfrz_l1;
@optional char l_04_o_wbcomac_inertfrz_l1;
@optional float l_04_o_wbcomac_gw_f4;
@optional float l_04_o_wbcomac_cg_f4;
@optional double l_04_o_wbcomac_blcg_f8;
@optional double l_04_o_wbcomac_bscg_f8;
@optional double l_04_o_wbcomac_wlcg_f8;
@optional double l_04_o_wbcomac_xcg_f8;
@optional double l_04_o_wbcomac_ixx_f8;
@optional double l_04_o_wbcomac_ixy_f8;
@optional double l_04_o_wbcomac_ixz_f8;
@optional double l_04_o_wbcomac_iyy_f8;
@optional double l_04_o_wbcomac_iyz_f8;
@optional double l_04_o_wbcomac_izz_f8;
@optional float l_04_o_wbcomac_zfw_f4;
@optional float l_04_o_wbcomac_zfwcg_f4;
@optional float l_04_o_wbcomac_zfw_blcg_f4;
@optional float l_04_o_wbcomac_zfw_wlcg_f4;
@optional double l_04_o_wbcomac_fuel_cmd_f8[20];
@optional long l_04_o_wbcomac_fuel_mode_i4;
@optional double l_04_o_wbcomac_fuel_ixx_f8;
@optional double l_04_o_wbcomac_fuel_ixy_f8;
@optional double l_04_o_wbcomac_fuel_ixz_f8;
@optional double l_04_o_wbcomac_fuel_iyy_f8;
@optional double l_04_o_wbcomac_fuel_iyz_f8;
@optional double l_04_o_wbcomac_fuel_izz_f8;
@optional double l_04_o_wbcomac_l_wt_fuel_f8;
@optional double l_04_o_wbcomac_ice_airframe_total_f8;
@optional double l_04_o_wbcomac_ice_eng_f8[4];
@optional double l_04_o_wbcomac_ice_eng_total_f8;
@optional double l_04_o_wbcomac_ice_fuselage_f8;
@optional double l_04_o_wbcomac_ice_stab_left_f8;
@optional double l_04_o_wbcomac_ice_stab_right_f8;
@optional double l_04_o_wbcomac_ice_stab_total_f8;
@optional double l_04_o_wbcomac_ice_total_f8;
@optional double l_04_o_wbcomac_ice_total_frac_f8;
@optional double l_04_o_wbcomac_ice_vert_tail_f8;
@optional double l_04_o_wbcomac_ice_wing_left_f8;
@optional double l_04_o_wbcomac_ice_wing_right_f8;
@optional double l_04_o_wbcomac_ice_wing_total_f8;
@optional char l_04_o_wbcomac_init_l1;
@optional double l_04_o_wbcomac_potmin_gw_f8;
@optional double l_04_o_wbcomac_potmax_gw_f8;
@optional double l_04_o_wbcomac_potmin_gwcg_f8;
@optional double l_04_o_wbcomac_potmax_gwcg_f8;
@optional float l_04_o_wbcomac_min_cg_f4;
@optional float l_04_o_wbcomac_min_gw_f4;
@optional float l_04_o_wbcomac_min_zfw_f4;
@optional float l_04_o_wbcomac_min_zfwcg_f4;
@optional float l_04_o_wbcomac_max_cg_f4;
@optional float l_04_o_wbcomac_max_gw_f4;
@optional float l_04_o_wbcomac_max_zfw_f4;
@optional float l_04_o_wbcomac_max_zfwcg_f4;
};
struct WeightBalance_heartbeat
{
long weightbody_model_heartbeat;
};
};
};

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?><Model>
<Name>asdf</Name>
<Description>模型描述</Description>
<Author>用户</Author>
<Version>1.0.0</Version>
<CreateTime>2025-04-23 15:43:50</CreateTime>
<ChangeTime>2025-04-23 15:43:50</ChangeTime>
<Node>0-0</Node>
<Priority>99</Priority>
<MathLib/>
<CommandList><Command Name="asdf" Call="asdf" Description="asdf"/></CommandList>
</Model>

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?><Model>
<Name>asdf</Name>
<Description>模型描述</Description>
<Author>用户</Author>
<Version>1.0.0</Version>
<CreateTime>2025-04-23 15:43:50</CreateTime>
<ChangeTime>2025-04-23 15:43:50</ChangeTime>
<Node>0-0</Node>
<Priority>99</Priority>
<MathLib/>
<CommandList><Command Name="sdf" Call="asdf" Description="adsf"/></CommandList>
</Model>

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?><Model>
<Name>asdf</Name>
<Description>模型描述</Description>
<Author>用户</Author>
<Version>1.0.0</Version>
<CreateTime>2025-04-23 15:43:50</CreateTime>
<ChangeTime>2025-04-23 15:43:50</ChangeTime>
<Node>0-0</Node>
<Priority>99</Priority>
<MathLib/>
<CommandList/>
</Model>

View File

@ -7,4 +7,7 @@
<Model Name="ATA04地面操纵模型" ClassName="XNGroundHandling"/>
<Model Name="ATA04数据处理模型" ClassName="XNATA04DataProcessor"/>
</ModelGroup>
<ServicesList>
<Service Name="UDP通信服务" ClassName="XNUDPService"/>
</ServicesList>
</Scenario>

Binary file not shown.

View File

@ -0,0 +1,593 @@
#ifndef CMCLIB_H
#define CMCLIB_H
#include <string>
typedef struct ComacDataStructure_S {
int aero_model_heartbeat;
int weightbody_model_heartbeat;
int groundhandling_model_heartbeat;
double yitim;
struct input_aero_S* input_aero;
struct output_aero_S* output_aero;
struct input_weight_S* input_weight;
struct output_weight_S* output_weight;
struct input_ground_S* input_ground;
struct output_ground_S* output_ground;
};
struct input_weight_S {
double l_04_i_wbcomac_theta_deg_f8;
double l_04_i_wbcomac_phi_deg_f8;
double l_04_i_wbcomac_psi_deg_f8;
unsigned char l_04_i_wbcomac_gear_mode_l1;
double l_04_i_wbcomac_acset_gw_f8;
double l_04_i_wbcomac_acset_cg_f8;
// [0]: left wing tank
// [1]: right wing tan
// [2]: center tank
float* l_04_i_wbcomac_acset_tankfuel_f4;
double l_04_i_wbcomac_acset_totfuel_f8;
double l_04_i_wbcomac_acset_zfw_f8;
double l_04_i_wbcomac_acset_zfwcg_f8;
// [0]: Engine #1
// [1]: Engine #2
unsigned char* l_04_i_wbcomac_eng_efsep_l1;
// [0]: left wing tank
// [1]: right wing tan
// [2]: center tank
double* l_04_i_wbcomac_fuel_f8;
double l_04_i_wbcomac_gear_avg_f8;
// [0]: outboard left wing
// [1]: inboard left wing
// [2]: root left wing
// [3]: root right wing
// [4]: inboard right wing
// [5]: outboard right wing
// [6]: fuselage icing
// [7]: left horizontal tail
// [8]: right horizontal tail
// [9]: vertical tail
// [10]: engine 1
// [11]: engine 2
double* l_04_i_wbcomac_kice_f8;
unsigned char l_04_i_wbcomac_bycglim_l1;
unsigned char l_04_i_wbcomac_bygwlim_l1;
unsigned char l_04_i_wbcomac_frz_l1;
unsigned char l_04_i_wbcomac_zcgfrz_l1;
unsigned char l_04_i_wbcomac_zcgfrz_grfx_l1;
unsigned char l_04_i_wbcomac_ycgfrz_l1;
unsigned char l_04_i_wbcomac_inertfrz_l1;
double l_04_i_wbcomac_potreq_gw_f8;
double l_04_i_wbcomac_potreq_gwcg_f8;
};
struct output_weight_S {
float l_04_o_wbcomac_gw_f4;
float l_04_o_wbcomac_cg_f4;
double l_04_o_wbcomac_xcg_f8;
double l_04_o_wbcomac_blcg_f8;
double l_04_o_wbcomac_bscg_f8;
double l_04_o_wbcomac_wlcg_f8;
double l_04_o_wbcomac_ixx_f8;
double l_04_o_wbcomac_ixy_f8;
double l_04_o_wbcomac_ixz_f8;
double l_04_o_wbcomac_iyy_f8;
double l_04_o_wbcomac_iyz_f8;
double l_04_o_wbcomac_izz_f8;
float l_04_o_wbcomac_zfw_f4;
float l_04_o_wbcomac_zfwcg_f4;
float l_04_o_wbcomac_zfw_blcg_f4;
float l_04_o_wbcomac_zfw_wlcg_f4;
// [0]: left wing tank (if mode is 2)
// [1]: right wing tank (if mode is 2)
// [2]: center tank (if mode is 2)
double* l_04_o_wbcomac_fuel_cmd_f8;
// 0 = backdrive inactive, 1 = total fuel backdrive, 2 = individual fuel tank backdrive
int l_04_o_wbcomac_fuel_mode_i4;
double l_04_o_wbcomac_fuel_ixx_f8;
double l_04_o_wbcomac_fuel_ixy_f8;
double l_04_o_wbcomac_fuel_ixz_f8;
double l_04_o_wbcomac_fuel_iyy_f8;
double l_04_o_wbcomac_fuel_iyz_f8;
double l_04_o_wbcomac_fuel_izz_f8;
double l_04_o_wbcomac_l_wt_fuel_f8;
double l_04_o_wbcomac_ice_airframe_total_f8;
// [0]: Engine #1
// [1]: Engine #2
double* l_04_o_wbcomac_ice_eng_f8;
double l_04_o_wbcomac_ice_eng_total_f8;
double l_04_o_wbcomac_ice_fuselage_f8;
double l_04_o_wbcomac_ice_stab_left_f8;
double l_04_o_wbcomac_ice_stab_right_f8;
double l_04_o_wbcomac_ice_stab_total_f8;
double l_04_o_wbcomac_ice_total_f8;
double l_04_o_wbcomac_ice_total_frac_f8;
double l_04_o_wbcomac_ice_vert_tail_f8;
double l_04_o_wbcomac_ice_wing_left_f8;
double l_04_o_wbcomac_ice_wing_right_f8;
double l_04_o_wbcomac_ice_wing_total_f8;
unsigned char l_04_o_wbcomac_frz_l1;
unsigned char l_04_o_wbcomac_zcgfrz_l1;
unsigned char l_04_o_wbcomac_zcgfrz_grfx_l1;
unsigned char l_04_o_wbcomac_ycgfrz_l1;
unsigned char l_04_o_wbcomac_inertfrz_l1;
unsigned char l_04_o_wbcomac_init_l1;
float l_04_o_wbcomac_min_gw_f4;
float l_04_o_wbcomac_max_gw_f4;
float l_04_o_wbcomac_min_cg_f4; // 0 = Leading Edge MAC, 1 = Trailing Edge MAC
float l_04_o_wbcomac_max_cg_f4; // 0 = Leading Edge MAC, 1 = Trailing Edge MAC
float l_04_o_wbcomac_min_zfw_f4; // 0 = Leading Edge MAC, 1 = Trailing Edge MAC
float l_04_o_wbcomac_max_zfw_f4; // 0 = Leading Edge MAC, 1 = Trailing Edge MAC
float l_04_o_wbcomac_min_zfwcg_f4;
float l_04_o_wbcomac_max_zfwcg_f4;
double l_04_o_wbcomac_potmin_gw_f8; // 0 = Leading Edge MAC, 1 = Trailing Edge MAC
double l_04_o_wbcomac_potmax_gw_f8; // 0 = Leading Edge MAC, 1 = Trailing Edge MAC
double l_04_o_wbcomac_potmin_gwcg_f8;
double l_04_o_wbcomac_potmax_gwcg_f8;
};
struct input_ground_S {
unsigned char l_04_i_gdcomac_frz_l1;
unsigned char l_04_i_gdcomac_chocks_l1; // 1 = A/C on chocks
double l_04_i_gdcomac_alt_agl_f8;
unsigned char l_04_i_gdcomac_frzflt_l1;
double l_04_i_gdcomac_p_f8;
double l_04_i_gdcomac_q_f8;
double l_04_i_gdcomac_r_f8;
double l_04_i_gdcomac_ug_f8;
double l_04_i_gdcomac_vg_f8;
double l_04_i_gdcomac_wg_f8;
double l_04_i_gdcomac_blcg_f8;
double l_04_i_gdcomac_bscg_f8;
double l_04_i_gdcomac_wlcg_f8;
unsigned char l_04_i_gdcomac_pb_active_l1;
double l_04_i_gdcomac_pb_towforce_f8; // "PUSHBACK TOW FORCE"
// [0][0]: Nose gear, Tire left
// [0][1]: Nose gear, Tire right
// [1][0]: Left gear, Tire left
// [1][1]: Left gear, Tire right
// [2][0]: Right gear, Tire left
// [2][1]: Right gear, Tire right
double** l_04_i_gdcomac_brake_torq_f8;
// [0] : Nose gear,
// [1] : Left gear,
// [2] : Right gear
double* l_04_i_gdcomac_gear_f8; // 1 = Gear down / 0 = Gear up
// [0] : Nose gear,
// [1] : Left gear,
// [2] : Right gear
double* l_04_i_gdcomac_gsteer_f8; // Positive: turn right
// [0][0] : Nose gear, Tire left
// [0][1] : Nose gear, Tire right
// [1][0] : Left gear, Tire left
// [1][1] : Left gear, Tire right
// [2][0] : Right gear, Tire left
// [2][1] : Right gear, Tire right
double** l_04_i_gdcomac_tire_pres_f8;
unsigned char l_04_i_gdcomac_onjax_l1; // Positive: turn right
// [0]: Nose gear
// [1]: Left gear
// [2]: Right gea
double* l_04_i_gdcomac_contdep_f8; // Will be provided according to contamination type.
double l_04_i_gdcomac_thetag_f8;
double l_04_i_gdcomac_phig_f8;
int l_04_i_gdcomac_rwyrgh_i2;// 4 Levels of Roughness. From MIN to MAX.
double l_04_i_gdcomac_rwyhdg_f8;// North-South axis
unsigned char l_04_i_gdcomac_reset_braketemp_l1;
unsigned char l_04_i_gdcomac_reset_tirepress_l1;
double l_04_i_gdcomac_temp_c_f8;
// [0][0]: Nose gear, Tire left
// [0][1]: Nose gear, Tire right
// [1][0]: Left gear, Tire left
// [1][1]: Left gear, Tire right
// [2][0]: Right gear, Tire left
// [2][1]: Right gear, Tire right
double** l_04_i_gdcomac_brake_temp_f8;
// [0][0]: Nose gear, Tire left
// [0][1]: Nose gear, Tire right
// [1][0]: Left gear, Tire left
// [1][1]: Left gear, Tire right
// [2][0]: Right gear, Tire left
// [2][1]: Right gear, Tire right
unsigned char** l_04_i_gdcomac_tire_tburst_l1; // 1 = Tire is burst
// [0][0]: Nose gear, Tire left
// [0][1]: Nose gear, Tire right
// [1][0]: Left gear, Tire left
// [1][1]: Left gear, Tire right
// [2][0]: Right gear, Tire left
// [2][1]: Right gear, Tire right
unsigned char** l_04_i_gdcomac_tire_tflat_l1; // 1 = Tire is flat
unsigned char l_04_i_gdcomac_brk_reset_tpres_l1; // Reset the tire pressure to the value set from flight control.
// [0]: Dried
// [1]: Wet
// [2]: Flooded
// [3]: Wet with rubber
// [4]: Flooded with ru
// [5]: Melting Slush
// [6]: Freezing Slush
// [7]: Wet Snow
// [8]: Dry Snow
// [9]: Wet Ice
// [10]: Cold Ice
// [11]: Thin Dust/Dirs
// [12]: Thick Dust/Dir
// [13]: White Strip
double* l_04_i_gdcomac_rcon_ci_f8;
int l_04_i_gdcomac_gsteer_state_i4; // 0 = Engaged, 2 = Castoring
unsigned char l_04_i_gdcomac_trim_active_l1;
double l_04_i_gdcomac_theta_deg_f8;
double l_04_i_gdcomac_phi_deg_f8;
double l_04_i_gdcomac_psi_deg_f8;
unsigned char l_04_i_gdcomac_resetint_l1; // when this is true, the ground model should return the default values of the ground parameters
unsigned char l_04_i_gdcomac_eom_wgfrz_l1;
unsigned char l_04_i_gdcomac_eom_vgfrz_l1;
unsigned char l_04_i_gdcomac_eom_ugfrz_l1;
unsigned char l_04_i_gdcomac_eom_pfrz_l1;
unsigned char l_04_i_gdcomac_eom_qfrz_l1;
unsigned char l_04_i_gdcomac_eom_rfrz_l1;
unsigned char l_04_i_gdcomac_eom_hfrz_l1;
unsigned char l_04_i_gdcomac_eom_phifrz_l1;
unsigned char l_04_i_gdcomac_eom_thefrz_l1;
unsigned char l_04_i_gdcomac_eom_psifrz_l1;
};
struct output_ground_S {
unsigned char l_04_o_gdcomac_frz_l1;
unsigned char l_04_o_gdcomac_ac_on_ground_l1; // 1 = A/C is on ground
double l_04_o_gdcomac_ac_stationary_f8; // 1 = A/C is moving / 0 = A/C is stationary
double l_04_o_gdcomac_alt_tire_f8;
double l_04_o_gdcomac_zcg_to_tire_f8;
double l_04_o_gdcomac_fxb_f8;
double l_04_o_gdcomac_fyb_f8;
double l_04_o_gdcomac_fzb_f8;
double l_04_o_gdcomac_mxb_f8;
double l_04_o_gdcomac_myb_f8;
double l_04_o_gdcomac_mzb_f8;
// [0]: Nose gear
// [1]: Left gear
// [2]: Right gea
double* l_04_o_gdcomac_fygs_f8;
// [0]: Nose gear
// [1]: Left gear
// [2]: Right gea
double* l_04_o_gdcomac_mzgs_f8;
// [0]: Nose gear
// [1]: Left gear
// [2]: Right gea
double* l_04_o_gdcomac_mu_f8;
// [0]: Nose gear
// [1]: Left gear
// [2]: Right gea
double* l_04_o_gdcomac_dstroke_f8;
// [0][0]: Nose gear, Tire left
// [0][1]: Nose gear, Tire right
// [1][0]: Left gear, Tire left
// [1][1]: Left gear, Tire right
// [2][0]: Right gear, Tire left
// [2][1]: Right gear, Tire right
double** l_04_o_gdcomac_sr_f8;
// [0][0]: Nose gear, Tire left
// [0][1]: Nose gear, Tire right
// [1][0]: Left gear, Tire left
// [1][1]: Left gear, Tire right
// [2][0]: Right gear, Tire left
// [2][1]: Right gear, Tire right
double** l_04_o_gdcomac_sy_f8;
// [0][0]: Nose gear, Tire left
// [0][1]: Nose gear, Tire right
// [1][0]: Left gear, Tire left
// [1][1]: Left gear, Tire right
// [2][0]: Right gear, Tire left
// [2][1]: Right gear, Tire right
double** l_04_o_gdcomac_sx_f8;
// [0]: Nose gear
// [1]: Left gear
// [2]: Right gea
double* l_04_o_gdcomac_xft_f8;
// [0]: Nose gear
// [1]: Left gear
// [2]: Right gea
double* l_04_o_gdcomac_yft_f8;
// [0]: Nose gear
// [1]: Left gear
// [2]: Right gea
double* l_04_o_gdcomac_zft_f8;
double l_04_o_gdcomac_distngrxcg_f8;
double l_04_o_gdcomac_distmgrxcg_f8;
double l_04_o_gdcomac_distmgrzcg_f8;
// [0][0]: Nose gear, Tire left
// [0][1]: Nose gear, Tire right
// [1][0]: Left gear, Tire left
// [1][1]: Left gear, Tire right
// [2][0]: Right gear, Tire left
// [2][1]: Right gear, Tire right
double** l_04_o_gdcomac_tire_vel_f8;
// [0][0]: Nose gear, Tire left
// [0][1]: Nose gear, Tire right
// [1][0]: Left gear, Tire left
// [1][1]: Left gear, Tire right
// [2][0]: Right gear, Tire left
// [2][1]: Right gear, Tire right
double** l_04_o_gdcomac_tire_temp_f8;
// [0][0]: Nose gear, Tire left
// [0][1]: Nose gear, Tire right
// [1][0]: Left gear, Tire left
// [1][1]: Left gear, Tire right
// [2][0]: Right gear, Tire left
// [2][1]: Right gear, Tire right
unsigned char** l_04_o_gdcomac_tire_burst_l1;
unsigned char l_04_o_gdcomac_wow_l1;
// [0][0]: Nose gear, Tire left
// [0][1]: Nose gear, Tire right
// [1][0]: Left gear, Tire left
// [1][1]: Left gear, Tire right
// [2][0]: Right gear, Tire left
// [2][1]: Right gear, Tire right
double** l_04_o_gdcomac_utirew_f8;
// [0][0]: Nose gear, Tire left
// [0][1]: Nose gear, Tire right
// [1][0]: Left gear, Tire left
// [1][1]: Left gear, Tire right
// [2][0]: Right gear, Tire left
// [2][1]: Right gear, Tire right
double** l_04_o_gdcomac_vtirew_f8;
// [0][0]: Nose gear, Tire left
// [0][1]: Nose gear, Tire right
// [1][0]: Left gear, Tire left
// [1][1]: Left gear, Tire right
// [2][0]: Right gear, Tire left
// [2][1]: Right gear, Tire right
double** l_04_o_gdcomac_whl_omega_f8;
// [0] = Nose
// [1] = Left wing
// [2] = Right wing
// [3] = Left Body
// [4] = Right Body
// [5] = Tail
double* l_04_o_gdcomac_dstruc_f8;
// [0]: Nose gear
// [1]: Left gear
// [2]: Right gea
double* l_04_o_gdcomac_nd_f8;
// [0]: Nose gear
// [1]: Left gear
// [2]: Right gea
double* l_04_o_gdcomac_wor_par_f8; // Only [0]: Nose gear can have yaw / is driven
// [0][0]: Nose gear, Tire left
// [0][1]: Nose gear, Tire right
// [1][0]: Left gear, Tire left
// [1][1]: Left gear, Tire right
// [2][0]: Right gear, Tire left
// [2][1]: Right gear, Tire right
double** l_04_o_gdcomac_vczt_f8;
unsigned char l_04_o_gdcomac_eom_wgfrz_l1; // DISABLE INTEG. OF Z BODY VELOCI
unsigned char l_04_o_gdcomac_eom_vgfrz_l1; // DISABLE INTEG. OF Y BODY VELOCI
unsigned char l_04_o_gdcomac_eom_ugfrz_l1; // DISABLE INTEG. OF X BODY VELOCI
unsigned char l_04_o_gdcomac_eom_pfrz_l1; // DISABLE INTEG. OF BODY AXIS ROL
unsigned char l_04_o_gdcomac_eom_qfrz_l1; // DISABLE INTEG. OF BODY AXIS PIT
unsigned char l_04_o_gdcomac_eom_rfrz_l1; // DISABLE INTEG. OF BODY AXIS YAW
unsigned char l_04_o_gdcomac_eom_hfrz_l1; // DISABLE INTEG. OF ALTITUDE ABOV
unsigned char l_04_o_gdcomac_eom_phifrz_l1; // DISABLE INTEG. OF ROLL ANGLE
unsigned char l_04_o_gdcomac_eom_thefrz_l1; // DISABLE INTEG. OF PITCH ANGLE
unsigned char l_04_o_gdcomac_eom_psifrz_l1; // DISABLE INTEG. OF YAW ANGLE
};
struct output_aero_S {
double l_04_o_aerocomac_fxb_f8;
double l_04_o_aerocomac_fyb_f8;
double l_04_o_aerocomac_fzb_f8;
double l_04_o_aerocomac_mxb_f8;
double l_04_o_aerocomac_myb_f8;
double l_04_o_aerocomac_mzb_f8;
double l_04_o_aerocomac_cls_f8;
double l_04_o_aerocomac_cl_f8;
double l_04_o_aerocomac_cd_f8;
double l_04_o_aerocomac_cm_f8;
double l_04_o_aerocomac_cr_f8;
double l_04_o_aerocomac_cy_f8;
double l_04_o_aerocomac_cn_f8;
};
struct input_aero_S {
// double l_04_i_aerocomac_uprt_swvtx_p_f8; // UPRT Simplified wake vortex rotational wind (Roll)
// double l_04_i_aerocomac_uprt_swvtx_q_f8; // UPRT Simplified wake vortex rotational wind (Pitch)
double l_04_i_aerocomac_alpha_f8;
double l_04_i_aerocomac_alpdot_f8;
double l_04_i_aerocomac_beta_f8;
double l_04_i_aerocomac_press_alt_f8;
double l_04_i_aerocomac_tas_f8;
double l_04_i_aerocomac_mach_f8;
double l_04_i_aerocomac_nx_f8;
double l_04_i_aerocomac_ny_f8;
double l_04_i_aerocomac_nz_f8;
double l_04_i_aerocomac_p_f8;
double l_04_i_aerocomac_q_f8;
double l_04_i_aerocomac_r_f8;
double l_04_i_aerocomac_qbar_f8;
double l_04_i_aerocomac_blcg_f8;
double l_04_i_aerocomac_bscg_f8;
double l_04_i_aerocomac_wlcg_f8;
double l_04_i_aerocomac_stab_f8;
// [0] : left aileron
// [1] : right aileron
double* l_04_i_aerocomac_ail_f8;
// [0] : left elevator
// [1] : right elevator
double* l_04_i_aerocomac_elv_f8;
// [0] : rudder
// [1] : not use
double* l_04_i_aerocomac_rud_f8; // Size = 2
// [0] : Nose Gear
// [1] : Left Main Gear
// [2] : Right Main Gear
double* l_04_i_aerocomac_gear_f8; // Index 1 : Nose Gear
// [0] : left wing flap
// [1] : right wing flap
double* l_04_i_aerocomac_flap_f8;
// [0] : left wing slat
// [1] : right wing slat
double* l_04_i_aerocomac_slat_f8;
// Spoiler 1 (deg +ve TED) // Index 1 to 8 : from left outboard spoiler to right outboard spoiler
// Spoiler 2 (deg +ve TED) // Index 1 to 8 : from left outboard spoiler to right outboard spoiler
// Spoiler 3 (deg +ve TED) // Index 1 to 8 : from left outboard spoiler to right outboard spoiler
// Spoiler 4 (deg +ve TED) // Index 1 to 8 : from left outboard spoiler to right outboard spoiler
// Spoiler 5 (deg +ve TED) // Index 1 to 8 : from left outboard spoiler to right outboard spoiler
// Spoiler 6 (deg +ve TED) // Index 1 to 8 : from left outboard spoiler to right outboard spoiler
// Spoiler 7 (deg +ve TED) // Index 1 to 8 : from left outboard spoiler to right outboard spoiler
// Spoiler 8 (deg +ve TED) // Index 1 to 8 : from left outboard spoiler to right outboard spoiler
double* l_04_i_aerocomac_spl_f8;
// [0] : engine #1
// [1] : engine #2
double* l_04_i_aerocomac_tnet_f8;
// [0]: outboard left wing
// [1]: inboard left wing
// [2]: root left wing
// [3]: root right wing
// [4]: inboard right wing
// [5]: outboard right wing
// [6]: fuselage icing
// [7]: left horizontal tail
// [8]: right horizontal tail
// [9]: vertical tail
// [10]: engine 1
// [11]: engine 2
double* l_04_i_aerocomac_kice_f8;
double l_04_i_aerocomac_alt_agl_f8;
};
void comacAeroModelPreProcess(ComacDataStructure_S* ComacDataStructure);
void comacAeroModelPostProcess(ComacDataStructure_S* ComacDataStructure);
void comacWeightModelPreProcess(ComacDataStructure_S* ComacDataStructure);
void comacWeightModelPostProcess(ComacDataStructure_S* ComacDataStructure);
void comacGroundModelPreProcess(ComacDataStructure_S* ComacDataStructure);
void comacGroundModelPostProcess(ComacDataStructure_S* ComacDataStructure);
ComacDataStructure_S* allocateComacDataStructure_S(double yitim_, int cnf_numgear_i4, int cnf_numtire_i4);
void init_input_weight_S(input_weight_S* ptr);
void init_output_weight_S(output_weight_S* ptr);
void init_input_ground_S(input_ground_S* ptr, int ngear, int ntiregear);
void init_output_ground_S(output_ground_S* ptr, int ngear, int ntiregear);
void init_input_aero_S(input_aero_S* ptr, int ngear);
void init_output_aero_S(output_aero_S* ptr);
#endif //CMCLIB_H

View File

@ -240,32 +240,6 @@ public:
virtual void RegisterDDSParticipant();
};
#define XN_DECLARE_DDS() \
public: \
virtual void RegisterDDSParticipant() override;
#define XN_REGISTER_PARTICIPANT_BEGIN(class) \
void class ::RegisterDDSParticipant() \
{ \
XNModelObject::RegisterDDSParticipant(); \
T_D(); \
auto framework = GetFramework(); \
if (!framework) \
return; \
XNDDSManagerPtr ddsManager = framework->GetDDSManager(); \
if (!ddsManager) \
return; \
uint32_t MyID = GetUniqueId();
#define XN_PUBLISHTOPIC(topic) \
d->_dataWriters[#topic] = ddsManager->RegisterPublisher<topic##PubSubType>(#topic, MyID);
#define XN_SUBSCRIBETOPIC(topic, fun) \
ddsManager->RegisterSubscriber<topic##PubSubType>( \
#topic, MyID, std::bind(fun, this, std::placeholders::_1));
#define XN_REGISTER_PARTICIPANT_END(class) }
#define XN_MODEL_INITIALIZE(ClassName) \
extern "C" XNModelObjectPtr Initial##ClassName() \
{ \

View File

@ -52,7 +52,7 @@ struct XNModelObjectPrivate : public XNObjectPrivate {
/**
* @brief
*/
std::unordered_map<std::string, FAST_DDS_MACRO::DataWriter *> _dataWriters;
FAST_DDS_MACRO::DataWriter *_dataWriter;
/**
* @brief

View File

@ -43,7 +43,9 @@ public:
void TriggerRTEvent(const std::string &eventName, const std::any &eventData = std::any());
virtual void Initialize(uint32_t initialType);
void SetInitializeType(uint32_t initialType);
virtual void Initialize();
virtual void PrepareForExecute();
virtual void RegisterDDSParticipant();
@ -56,35 +58,9 @@ protected:
XNCLASS_PTR_DECLARE(XNServiceObject)
#define XN_DECLARE_DDS_SERVICE() \
public: \
virtual void RegisterDDSParticipant() override;
#define XN_REGISTER_SERVICE_BEGIN_SERVICE(class) \
void class ::RegisterDDSParticipant() \
{ \
XNServiceObject::RegisterDDSParticipant(); \
Q_D(class); \
auto framework = GetFramework(); \
if (!framework) \
return; \
XNDDSManagerPtr ddsManager = framework->GetDDSManager(); \
if (!ddsManager) \
return; \
quint32 MyID = getUniqueId();
#define XN_PUBLISHTOPIC_SERVICE(topic) \
d->_dataWriters[#topic] = ddsManager->RegisterPublisher<topic##PubSubType>(#topic, MyID);
#define XN_SUBSCRIBETOPIC_SERVICE(topic, fun) \
ddsManager->RegisterSubscriber<topic##PubSubType>( \
#topic, MyID, std::bind(fun, this, std::placeholders::_1));
#define XN_REGISTER_SERVICE_END_SERVICE(class) }
#define XN_SERVICE_INITIALIZE(ClassName) \
extern "C" XNServiceObjectPtr Initial##ClassName() \
{ \
ClassNamePtr obj = std::make_shared<ClassName>(); \
ClassName##Ptr obj = std::make_shared<ClassName>(); \
return obj; \
}

View File

@ -10,4 +10,5 @@ struct XNServiceObjectPrivate : public XNObjectPrivate {
std::string _sVersion;
std::unordered_map<std::string, FAST_DDS_MACRO::DataWriter *> _dataWriters;
XNFrameworkPtr pFramework;
uint32_t _initialType;
};

View File

@ -4,6 +4,7 @@ project(XNCore LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if(NOT fastcdr_FOUND)
find_package(fastcdr 2 REQUIRED)
@ -75,6 +76,7 @@ target_link_libraries(XNCore PRIVATE
pthread
OpenSSL::SSL
OpenSSL::Crypto
dl
)
target_compile_definitions(XNCore PRIVATE XNCORE_LIBRARY)

View File

@ -291,5 +291,5 @@ void XNEventManager::EventProcessed(const std::string &eventName, bool success)
{
T_D();
// 这里可以添加事件处理完成的回调逻辑
LOG_INFO("Event " + eventName + " processed " + (success ? "successfully" : "with error"));
//LOG_INFO("Event " + eventName + " processed " + (success ? "successfully" : "with error"));
}

View File

@ -298,9 +298,7 @@ void XNModelObject::StepUpdate()
{
T_D();
uint32_t setFreq = d->_setFreq < 1.0 ? 1 : (uint32_t)d->_setFreq;
if (d->_dataWriters.find("XNSim::XNSimStatus::XNModelStatus") != d->_dataWriters.end()
&& d->_dataWriters["XNSim::XNSimStatus::XNModelStatus"] != nullptr && d->_runCnt > 0
&& d->_runCnt % setFreq == 0) {
if (d->_dataWriter != nullptr && d->_runCnt > 0 && d->_runCnt % setFreq == 0) {
XNSim::XNSimStatus::XNModelStatus modelStatus;
modelStatus.XNModelName(GetObjectName());
modelStatus.XNModelID(GetUniqueId());
@ -315,7 +313,7 @@ void XNModelObject::StepUpdate()
(now.tv_sec - d->_lastRunTime.tv_sec) + (now.tv_nsec - d->_lastRunTime.tv_nsec) / 1.0E9;
modelStatus.XNMdlCurFreq(d->_setFreq / time_diff);
modelStatus.XNMdlSetFreq(d->_setFreq);
d->_dataWriters["XNSim::XNSimStatus::XNModelStatus"]->write(&modelStatus);
d->_dataWriter->write(&modelStatus);
d->_lastRunTime = now;
LOG_DEBUG("Model: %1 Write DDS!", GetObjectName());
}
@ -345,8 +343,9 @@ void XNModelObject::RegisterDDSParticipant()
LOG_WARNING("Failed to get DDSManager!");
return;
}
uint32_t MyID = GetUniqueId();
XN_PUBLISHTOPIC(XNSim::XNSimStatus::XNModelStatus);
uint32_t MyID = GetUniqueId();
d->_dataWriter = ddsManager->RegisterPublisher<XNSim::XNSimStatus::XNModelStatusPubSubType>(
"XNSim::XNSimStatus::XNModelStatus", MyID);
}
int XNModelObject::RegisterEventHandler(const std::string &eventName, XNEventCallback callback,

View File

@ -240,32 +240,6 @@ public:
virtual void RegisterDDSParticipant();
};
#define XN_DECLARE_DDS() \
public: \
virtual void RegisterDDSParticipant() override;
#define XN_REGISTER_PARTICIPANT_BEGIN(class) \
void class ::RegisterDDSParticipant() \
{ \
XNModelObject::RegisterDDSParticipant(); \
T_D(); \
auto framework = GetFramework(); \
if (!framework) \
return; \
XNDDSManagerPtr ddsManager = framework->GetDDSManager(); \
if (!ddsManager) \
return; \
uint32_t MyID = GetUniqueId();
#define XN_PUBLISHTOPIC(topic) \
d->_dataWriters[#topic] = ddsManager->RegisterPublisher<topic##PubSubType>(#topic, MyID);
#define XN_SUBSCRIBETOPIC(topic, fun) \
ddsManager->RegisterSubscriber<topic##PubSubType>( \
#topic, MyID, std::bind(fun, this, std::placeholders::_1));
#define XN_REGISTER_PARTICIPANT_END(class) }
#define XN_MODEL_INITIALIZE(ClassName) \
extern "C" XNModelObjectPtr Initial##ClassName() \
{ \

View File

@ -52,7 +52,7 @@ struct XNModelObjectPrivate : public XNObjectPrivate {
/**
* @brief
*/
std::unordered_map<std::string, FAST_DDS_MACRO::DataWriter *> _dataWriters;
FAST_DDS_MACRO::DataWriter *_dataWriter;
/**
* @brief

View File

@ -66,9 +66,9 @@ void XNServiceManager::LoadService(const std::string &servicePath, const std::st
// 注册服务到管理器
d->ServiceList[serviceID] = service;
service->SetInitializeType(initialType);
// 初始化服务
service->Initialize(initialType);
service->Initialize();
} else {
LOG_WARNING("0x2173 Service %s Not found in dynamic link library %s!",
serviceName.c_str(), servicePath.c_str());

View File

@ -5,6 +5,8 @@
XNServiceObject::XNServiceObject() : XNObject(new XNServiceObjectPrivate())
{
T_D();
d->_initialType = 0;
}
XNServiceObject::~XNServiceObject()
@ -127,10 +129,16 @@ void XNServiceObject::TriggerRTEvent(const std::string &eventName, const std::an
TriggerEvent(eventName, eventData, true, XNEvent::Priority::RealTime);
}
void XNServiceObject::Initialize(uint32_t initialType)
void XNServiceObject::SetInitializeType(uint32_t initialType)
{
T_D();
if (initialType == 0) {
d->_initialType = initialType;
}
void XNServiceObject::Initialize()
{
T_D();
if (d->_initialType == 0) {
tinyxml2::XMLDocument doc;
if (doc.LoadFile(GetXmlPath().c_str()) != tinyxml2::XML_SUCCESS) {
LOG_WARNING("Failed to open the service configuration file: %1!", GetXmlPath());

View File

@ -43,7 +43,9 @@ public:
void TriggerRTEvent(const std::string &eventName, const std::any &eventData = std::any());
virtual void Initialize(uint32_t initialType);
void SetInitializeType(uint32_t initialType);
virtual void Initialize();
virtual void PrepareForExecute();
virtual void RegisterDDSParticipant();
@ -56,35 +58,9 @@ protected:
XNCLASS_PTR_DECLARE(XNServiceObject)
#define XN_DECLARE_DDS_SERVICE() \
public: \
virtual void RegisterDDSParticipant() override;
#define XN_REGISTER_SERVICE_BEGIN_SERVICE(class) \
void class ::RegisterDDSParticipant() \
{ \
XNServiceObject::RegisterDDSParticipant(); \
Q_D(class); \
auto framework = GetFramework(); \
if (!framework) \
return; \
XNDDSManagerPtr ddsManager = framework->GetDDSManager(); \
if (!ddsManager) \
return; \
quint32 MyID = getUniqueId();
#define XN_PUBLISHTOPIC_SERVICE(topic) \
d->_dataWriters[#topic] = ddsManager->RegisterPublisher<topic##PubSubType>(#topic, MyID);
#define XN_SUBSCRIBETOPIC_SERVICE(topic, fun) \
ddsManager->RegisterSubscriber<topic##PubSubType>( \
#topic, MyID, std::bind(fun, this, std::placeholders::_1));
#define XN_REGISTER_SERVICE_END_SERVICE(class) }
#define XN_SERVICE_INITIALIZE(ClassName) \
extern "C" XNServiceObjectPtr Initial##ClassName() \
{ \
ClassNamePtr obj = std::make_shared<ClassName>(); \
ClassName##Ptr obj = std::make_shared<ClassName>(); \
return obj; \
}

View File

@ -10,4 +10,5 @@ struct XNServiceObjectPrivate : public XNObjectPrivate {
std::string _sVersion;
std::unordered_map<std::string, FAST_DDS_MACRO::DataWriter *> _dataWriters;
XNFrameworkPtr pFramework;
uint32_t _initialType;
};

View File

@ -59,7 +59,7 @@ bool XNThread::Initialize()
}
// 设置线程栈空间大小
ret = pthread_attr_setstacksize(&(d->attr), PTHREAD_STACK_MIN);
ret = pthread_attr_setstacksize(&(d->attr), PTHREAD_STACK_MIN * 20);
if (ret) {
LOG_ERROR("0x2211 Thread: %1 Set Stack Space Failed!", GetObjectName());
return false;

View File

@ -30,6 +30,7 @@ target_link_libraries(XNEngine PRIVATE
pthread
OpenSSL::SSL
OpenSSL::Crypto
dl
)
# Check if CMAKE_INSTALL_PREFIX is set to its default value

View File

@ -90,7 +90,7 @@ bool XNEngine::SetLogLevel(const std::string &XmlPath)
CPU_ZERO(&mask);
CPUAffinity = 0;
// 获取CPU亲和性配置
//获取CPU亲和性配置
tinyxml2::XMLElement *envNode = root->FirstChildElement("Environment");
if (envNode) {
const char *cpuAffinityStr = envNode->Attribute("CPUAffinity");

View File

@ -4,6 +4,7 @@ project(XNGroundHandling LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
#
if(DEFINED ENV{XNCore})
@ -14,6 +15,36 @@ endif()
# XNCore_PATH include
include_directories(${XNCore_PATH}/include)
include_directories(${XNCore_PATH}/IDL)
add_subdirectory(XNGroundHandlingInterface)
add_subdirectory(XNGroundHandling)
add_library(XNGroundHandling SHARED
XNGroundHandling_global.h
XNGroundHandling.cpp
XNGroundHandling.h
XNGroundHandling_p.h
${DDS_XNIDL_SOURCES_CXX}
)
target_link_libraries(XNGroundHandling PRIVATE
${XNCore_PATH}/lib/libXNCore.so
${XNCore_PATH}/lib/libC909_V1_Interface.so
dl)
target_compile_definitions(XNGroundHandling PRIVATE XNGROUNDHANDLING_LIBRARY)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${XNCore_PATH}/Models" CACHE PATH "Install path prefix" FORCE)
endif()
include(GNUInstallDirs)
install(TARGETS XNGroundHandling
BUNDLE DESTINATION .
LIBRARY DESTINATION .
RUNTIME DESTINATION .
)
#
file(GLOB CONFIG_FILE "*.mcfg")
# 使 install
install(FILES ${CONFIG_FILE} DESTINATION ${CMAKE_INSTALL_PREFIX})

View File

@ -8,6 +8,6 @@
<ChangeTime>2025-02-19 16:22:19</ChangeTime>
<Node>0-0</Node>
<Priority>99</Priority>
<MathLib>ATA04_SACSCGroundHandling_2.0.27.1H_20241106/libSACSCGroundHandling.so</MathLib>
<MathLib>ATA04_SACSCGroundHandling_2.0.143.1H_20250506/libSACSCGroundHandling.so.2.0.143.1H</MathLib>
<CommandList/>
</Model>

View File

@ -1,30 +0,0 @@
add_library(XNGroundHandling SHARED
XNGroundHandling_global.h
XNGroundHandling.cpp
XNGroundHandling.h
XNGroundHandling_p.h
${DDS_XNIDL_SOURCES_CXX}
)
target_link_libraries(XNGroundHandling PRIVATE
${XNCore_PATH}/lib/libXNCore.so
XNGroundHandlingInterface)
target_compile_definitions(XNGroundHandling PRIVATE XNGROUNDHANDLING_LIBRARY)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${XNCore_PATH}/Models" CACHE PATH "Install path prefix" FORCE)
endif()
include(GNUInstallDirs)
install(TARGETS XNGroundHandling
BUNDLE DESTINATION .
LIBRARY DESTINATION .
RUNTIME DESTINATION .
)
#
file(GLOB CONFIG_FILE "*.mcfg")
# 使 install
install(FILES ${CONFIG_FILE} DESTINATION ${CMAKE_INSTALL_PREFIX})

View File

@ -1,52 +0,0 @@
cmake_minimum_required(VERSION 3.16)
project(XNGroundHandlingInterface LANGUAGES CXX)
if(NOT fastcdr_FOUND)
find_package(fastcdr 2 REQUIRED)
endif()
if(NOT fastdds_FOUND)
find_package(fastdds 3 REQUIRED)
endif()
find_package(OpenSSL REQUIRED)
add_library(XNGroundHandlingInterface SHARED
XNGroundHandling.hpp
XNGroundHandlingInterface.hpp
XNGroundHandlingInterface.cxx
XNGroundHandlingCdrAux.hpp
XNGroundHandlingCdrAux.ipp
XNGroundHandlingPubSubTypes.hpp
XNGroundHandlingPubSubTypes.cxx
XNGroundHandlingTypeObjectSupport.hpp
XNGroundHandlingTypeObjectSupport.cxx
)
target_link_libraries(XNGroundHandlingInterface PRIVATE
fastcdr
fastdds
OpenSSL::SSL
OpenSSL::Crypto
${XNCore_PATH}/lib/libXNCore.so
)
target_compile_definitions(XNGroundHandlingInterface PRIVATE XNGROUNDHANDLINGINTERFACE_LIBRARY)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${XNCore_PATH}/Models" CACHE PATH "Install path prefix" FORCE)
endif()
include(GNUInstallDirs)
install(TARGETS XNGroundHandlingInterface
BUNDLE DESTINATION .
LIBRARY DESTINATION .
RUNTIME DESTINATION .
)
#
file(GLOB IDL_FILE "*.idl")
# 使 install
install(FILES ${IDL_FILE} DESTINATION ${CMAKE_INSTALL_PREFIX})

View File

@ -1,93 +0,0 @@
module XNSim
{
module C909
{
module ATA04
{
struct GroundHandling_input
{
@optional char l_04_i_gdcomac_frz_l1;
@optional char l_04_i_gdcomac_chocks_l1;
@optional double l_04_i_gdcomac_alt_agl_f8;
@optional char l_04_i_gdcomac_frzflt_l1;
@optional double l_04_i_gdcomac_p_f8;
@optional double l_04_i_gdcomac_q_f8;
@optional double l_04_i_gdcomac_r_f8;
@optional double l_04_i_gdcomac_ug_f8;
@optional double l_04_i_gdcomac_vg_f8;
@optional double l_04_i_gdcomac_wg_f8;
@optional double l_04_i_gdcomac_blcg_f8;
@optional double l_04_i_gdcomac_bscg_f8;
@optional double l_04_i_gdcomac_wlcg_f8;
@optional char l_04_i_gdcomac_pb_active_l1;
@optional double l_04_i_gdcomac_brake_torq_f8[3][2];
@optional double l_04_i_gdcomac_gear_f8[3];
@optional double l_04_i_gdcomac_gsteer_f8[10];
@optional double l_04_i_gdcomac_tire_pres_f8[3][2];
@optional char l_04_i_gdcomac_onjax_l1;
@optional double l_04_i_gdcomac_contdep_f8[7];
@optional double l_04_i_gdcomac_thetag_f8;
@optional double l_04_i_gdcomac_phig_f8;
@optional long l_04_i_gdcomac_rwyrgh_i2;
@optional double l_04_i_gdcomac_rwyhdg_f8;
@optional char l_04_i_gdcomac_reset_braketemp_l1;
@optional char l_04_i_gdcomac_reset_tirepress_l1;
@optional double l_04_i_gdcomac_temp_c_f8;
@optional double l_04_i_gdcomac_brake_temp_f8[3][2];
@optional char l_04_i_gdcomac_tire_tburst_l1[3][2];
@optional char l_04_i_gdcomac_tire_tflat_l1[3][2];
@optional char l_04_i_gdcomac_brk_reset_tpres_l1;
@optional double l_04_i_gdcomac_rcon_ci_f8[14];
@optional double l_04_i_gdcomac_pb_towforce_f8;
@optional long l_04_i_gdcomac_gsteer_state_i4;
@optional char l_04_i_gdcomac_trim_active_l1;
@optional double l_04_i_gdcomac_phi_deg_f8;
@optional double l_04_i_gdcomac_theta_deg_f8;
@optional double l_04_i_gdcomac_psi_deg_f8;
@optional char l_04_i_gdcomac_resetint_l1;
};
struct GroundHandling_output
{
@optional char l_04_o_gdcomac_frz_l1;
@optional char l_04_o_gdcomac_ac_on_ground_l1;
@optional double l_04_o_gdcomac_ac_stationary_f8;
@optional double l_04_o_gdcomac_alt_tire_f8;
@optional double l_04_o_gdcomac_zcg_to_tire_f8;
@optional double l_04_o_gdcomac_fxb_f8;
@optional double l_04_o_gdcomac_fyb_f8;
@optional double l_04_o_gdcomac_fzb_f8;
@optional double l_04_o_gdcomac_mxb_f8;
@optional double l_04_o_gdcomac_myb_f8;
@optional double l_04_o_gdcomac_mzb_f8;
@optional double l_04_o_gdcomac_fygs_f8[3];
@optional double l_04_o_gdcomac_mzgs_f8[3];
@optional double l_04_o_gdcomac_mu_f8[3];
@optional double l_04_o_gdcomac_dstroke_f8[3];
@optional double l_04_o_gdcomac_sr_f8[3][2];
@optional double l_04_o_gdcomac_sy_f8[3][2];
@optional double l_04_o_gdcomac_sx_f8[3][2];
@optional double l_04_o_gdcomac_xft_f8[3];
@optional double l_04_o_gdcomac_yft_f8[3];
@optional double l_04_o_gdcomac_zft_f8[3];
@optional double l_04_o_gdcomac_distngrxcg_f8;
@optional double l_04_o_gdcomac_distmgrxcg_f8;
@optional double l_04_o_gdcomac_distmgrzcg_f8;
@optional double l_04_o_gdcomac_tire_vel_f8[3][2];
@optional char l_04_o_gdcomac_tire_burst_l1[3][2];
@optional double l_04_o_gdcomac_tire_temp_f8[3][2];
@optional char l_04_o_gdcomac_wow_l1;
@optional double l_04_o_gdcomac_utirew_f8[3][2];
@optional double l_04_o_gdcomac_vtirew_f8[3][2];
@optional double l_04_o_gdcomac_whl_omega_f8[3][2];
@optional double l_04_o_gdcomac_dstruc_f8[6];
@optional double l_04_o_gdcomac_wor_par_f8[3];
@optional double l_04_o_gdcomac_nd_f8[3];
@optional double l_04_o_gdcomac_vczt_f8[3][2];
};
struct GroundHandling_heartbeat
{
@optional long groundhandling_model_heartbeat;
};
};
};
};

View File

@ -1,60 +0,0 @@
// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*!
* @file XNGroundHandlingCdrAux.hpp
* This source file contains some definitions of CDR related functions.
*
* This file was generated by the tool fastddsgen.
*/
#ifndef FAST_DDS_GENERATED__XNSIM_C909_ATA04_XNGROUNDHANDLINGCDRAUX_HPP
#define FAST_DDS_GENERATED__XNSIM_C909_ATA04_XNGROUNDHANDLINGCDRAUX_HPP
#include "XNGroundHandling.hpp"
constexpr uint32_t XNSim_C909_ATA04_GroundHandling_input_max_cdr_typesize {1093UL};
constexpr uint32_t XNSim_C909_ATA04_GroundHandling_input_max_key_cdr_typesize {0UL};
constexpr uint32_t XNSim_C909_ATA04_GroundHandling_heartbeat_max_cdr_typesize {12UL};
constexpr uint32_t XNSim_C909_ATA04_GroundHandling_heartbeat_max_key_cdr_typesize {0UL};
constexpr uint32_t XNSim_C909_ATA04_GroundHandling_output_max_cdr_typesize {1328UL};
constexpr uint32_t XNSim_C909_ATA04_GroundHandling_output_max_key_cdr_typesize {0UL};
namespace eprosima {
namespace fastcdr {
class Cdr;
class CdrSizeCalculator;
eProsima_user_DllExport void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const XNSim::C909::ATA04::GroundHandling_input& data);
eProsima_user_DllExport void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const XNSim::C909::ATA04::GroundHandling_output& data);
eProsima_user_DllExport void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const XNSim::C909::ATA04::GroundHandling_heartbeat& data);
} // namespace fastcdr
} // namespace eprosima
#endif // FAST_DDS_GENERATED__XNSIM_C909_ATA04_XNGROUNDHANDLINGCDRAUX_HPP

View File

@ -1,259 +0,0 @@
#include "XNGroundHandlingInterface.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;
}
GroundHandling_output_Interface::GroundHandling_output_Interface()
{
MAP_DATA_FUNC(l_04_o_gdcomac_frz_l1);
MAP_DATA_FUNC(l_04_o_gdcomac_ac_on_ground_l1);
MAP_DATA_FUNC(l_04_o_gdcomac_ac_stationary_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_alt_tire_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_zcg_to_tire_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_fxb_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_fyb_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_fzb_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_mxb_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_myb_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_mzb_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_fygs_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_mzgs_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_mu_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_dstroke_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_sr_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_sy_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_sx_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_xft_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_yft_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_zft_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_distngrxcg_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_distmgrxcg_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_distmgrzcg_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_tire_vel_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_tire_burst_l1);
MAP_DATA_FUNC(l_04_o_gdcomac_tire_temp_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_wow_l1);
MAP_DATA_FUNC(l_04_o_gdcomac_utirew_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_vtirew_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_whl_omega_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_dstruc_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_wor_par_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_nd_f8);
MAP_DATA_FUNC(l_04_o_gdcomac_vczt_f8);
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] = 0x01; // 结构体头0x01表示输出结构体
this->header[5] = 0x00; // 数据方向0x00表示外部输入
this->header[6] = 0x00; // 数据大小
this->header[7] = 0x00; // 数据大小
}
GroundHandling_output_Interface::~GroundHandling_output_Interface()
{
}
void GroundHandling_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::GroundHandling_outputPubSubType>(
"XNSim::C909::ATA04::GroundHandling_output", modelId);
ddsManager->RegisterSubscriber<XNSim::C909::ATA04::GroundHandling_outputPubSubType>(
"XNSim::C909::ATA04::GroundHandling_output", modelId,
std::bind(&GroundHandling_output_Interface::outputDataListener, this,
std::placeholders::_1));
} else if (DDS_type == 1) { // 只读取
ddsManager->RegisterSubscriber<XNSim::C909::ATA04::GroundHandling_outputPubSubType>(
"XNSim::C909::ATA04::GroundHandling_output", modelId,
std::bind(&GroundHandling_output_Interface::outputDataListener, this,
std::placeholders::_1));
} else if (DDS_type == 2) { // 只发送
dataWriter =
ddsManager->RegisterPublisher<XNSim::C909::ATA04::GroundHandling_outputPubSubType>(
"XNSim::C909::ATA04::GroundHandling_output", modelId);
}
}
void GroundHandling_output_Interface::clearOutData()
{
this->out_data = XNSim::C909::ATA04::GroundHandling_output();
}
void GroundHandling_output_Interface::sendOutData()
{
dataWriter->write(&this->out_data);
}
void GroundHandling_output_Interface::outputDataListener(
const XNSim::C909::ATA04::GroundHandling_output &output)
{
this->data = output;
}
GroundHandling_heartbeat_Interface::GroundHandling_heartbeat_Interface()
{
MAP_DATA_FUNC(groundhandling_model_heartbeat);
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] = 0x02; // 结构体头0x02表示心跳结构体
this->header[5] = 0x00; // 数据方向0x00表示外部输入
this->header[6] = 0x00; // 数据大小
this->header[7] = 0x00; // 数据大小
}
GroundHandling_heartbeat_Interface::~GroundHandling_heartbeat_Interface()
{
}
void GroundHandling_heartbeat_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_heartbeatPubSubType>(
"XNSim::C909::ATA04::GroundHandling_heartbeat", modelId);
ddsManager->RegisterSubscriber<XNSim::C909::ATA04::GroundHandling_heartbeatPubSubType>(
"XNSim::C909::ATA04::GroundHandling_heartbeat", modelId,
std::bind(&GroundHandling_heartbeat_Interface::heartbeatListener, this,
std::placeholders::_1));
} else if (DDS_type == 1) { // 只读取
ddsManager->RegisterSubscriber<XNSim::C909::ATA04::GroundHandling_heartbeatPubSubType>(
"XNSim::C909::ATA04::GroundHandling_heartbeat", modelId,
std::bind(&GroundHandling_heartbeat_Interface::heartbeatListener, this,
std::placeholders::_1));
} else if (DDS_type == 2) { // 只发送
dataWriter =
ddsManager->RegisterPublisher<XNSim::C909::ATA04::GroundHandling_heartbeatPubSubType>(
"XNSim::C909::ATA04::GroundHandling_heartbeat", modelId);
}
}
void GroundHandling_heartbeat_Interface::clearOutData()
{
this->out_data = XNSim::C909::ATA04::GroundHandling_heartbeat();
}
void GroundHandling_heartbeat_Interface::sendOutData()
{
dataWriter->write(&this->out_data);
}
void GroundHandling_heartbeat_Interface::heartbeatListener(
const XNSim::C909::ATA04::GroundHandling_heartbeat &heartbeat)
{
this->data = heartbeat;
}
} // namespace XNSim::C909::ATA04

View File

@ -1,294 +0,0 @@
#include "XNGroundHandling.hpp"
#include "XNGroundHandlingPubSubTypes.hpp"
#include "XNCore/XNDDSInterface.h"
namespace XNSim::C909::ATA04
{
class GroundHandling_input_Interface final : public XNDDSInterface
{
public:
GroundHandling_input_Interface();
virtual ~GroundHandling_input_Interface();
virtual void Initialize(XNFrameworkPtr framework, uint32_t modelId, uint32_t DDS_type) override;
virtual void clearOutData() override;
virtual void sendOutData() override;
void inputDataListener(const XNSim::C909::ATA04::GroundHandling_input &input);
template <typename T>
void getData(T *model_data)
{
if (model_data == nullptr)
return;
assign_value_get(data.l_04_i_gdcomac_frz_l1(), model_data->l_04_i_gdcomac_frz_l1);
assign_value_get(data.l_04_i_gdcomac_chocks_l1(), model_data->l_04_i_gdcomac_chocks_l1);
assign_value_get(data.l_04_i_gdcomac_alt_agl_f8(), model_data->l_04_i_gdcomac_alt_agl_f8);
assign_value_get(data.l_04_i_gdcomac_frzflt_l1(), model_data->l_04_i_gdcomac_frzflt_l1);
assign_value_get(data.l_04_i_gdcomac_p_f8(), model_data->l_04_i_gdcomac_p_f8);
assign_value_get(data.l_04_i_gdcomac_q_f8(), model_data->l_04_i_gdcomac_q_f8);
assign_value_get(data.l_04_i_gdcomac_r_f8(), model_data->l_04_i_gdcomac_r_f8);
assign_value_get(data.l_04_i_gdcomac_ug_f8(), model_data->l_04_i_gdcomac_ug_f8);
assign_value_get(data.l_04_i_gdcomac_vg_f8(), model_data->l_04_i_gdcomac_vg_f8);
assign_value_get(data.l_04_i_gdcomac_wg_f8(), model_data->l_04_i_gdcomac_wg_f8);
assign_value_get(data.l_04_i_gdcomac_blcg_f8(), model_data->l_04_i_gdcomac_blcg_f8);
assign_value_get(data.l_04_i_gdcomac_bscg_f8(), model_data->l_04_i_gdcomac_bscg_f8);
assign_value_get(data.l_04_i_gdcomac_wlcg_f8(), model_data->l_04_i_gdcomac_wlcg_f8);
assign_value_get(data.l_04_i_gdcomac_pb_active_l1(),
model_data->l_04_i_gdcomac_pb_active_l1);
assign_value_get(data.l_04_i_gdcomac_brake_torq_f8(),
model_data->l_04_i_gdcomac_brake_torq_f8);
assign_value_get(data.l_04_i_gdcomac_gear_f8(), model_data->l_04_i_gdcomac_gear_f8);
assign_value_get(data.l_04_i_gdcomac_gsteer_f8(), model_data->l_04_i_gdcomac_gsteer_f8);
assign_value_get(data.l_04_i_gdcomac_tire_pres_f8(),
model_data->l_04_i_gdcomac_tire_pres_f8);
assign_value_get(data.l_04_i_gdcomac_onjax_l1(), model_data->l_04_i_gdcomac_onjax_l1);
assign_value_get(data.l_04_i_gdcomac_contdep_f8(), model_data->l_04_i_gdcomac_contdep_f8);
assign_value_get(data.l_04_i_gdcomac_thetag_f8(), model_data->l_04_i_gdcomac_thetag_f8);
assign_value_get(data.l_04_i_gdcomac_phig_f8(), model_data->l_04_i_gdcomac_phig_f8);
assign_value_get(data.l_04_i_gdcomac_rwyrgh_i2(), model_data->l_04_i_gdcomac_rwyrgh_i2);
assign_value_get(data.l_04_i_gdcomac_rwyhdg_f8(), model_data->l_04_i_gdcomac_rwyhdg_f8);
assign_value_get(data.l_04_i_gdcomac_reset_braketemp_l1(),
model_data->l_04_i_gdcomac_reset_braketemp_l1);
assign_value_get(data.l_04_i_gdcomac_reset_tirepress_l1(),
model_data->l_04_i_gdcomac_reset_tirepress_l1);
assign_value_get(data.l_04_i_gdcomac_temp_c_f8(), model_data->l_04_i_gdcomac_temp_c_f8);
assign_value_get(data.l_04_i_gdcomac_brake_temp_f8(),
model_data->l_04_i_gdcomac_brake_temp_f8);
assign_value_get(data.l_04_i_gdcomac_tire_tburst_l1(),
model_data->l_04_i_gdcomac_tire_tburst_l1);
assign_value_get(data.l_04_i_gdcomac_tire_tflat_l1(),
model_data->l_04_i_gdcomac_tire_tflat_l1);
assign_value_get(data.l_04_i_gdcomac_brk_reset_tpres_l1(),
model_data->l_04_i_gdcomac_brk_reset_tpres_l1);
assign_value_get(data.l_04_i_gdcomac_rcon_ci_f8(), model_data->l_04_i_gdcomac_rcon_ci_f8);
assign_value_get(data.l_04_i_gdcomac_pb_towforce_f8(),
model_data->l_04_i_gdcomac_pb_towforce_f8);
assign_value_get(data.l_04_i_gdcomac_gsteer_state_i4(),
model_data->l_04_i_gdcomac_gsteer_state_i4);
assign_value_get(data.l_04_i_gdcomac_trim_active_l1(),
model_data->l_04_i_gdcomac_trim_active_l1);
assign_value_get(data.l_04_i_gdcomac_phi_deg_f8(), model_data->l_04_i_gdcomac_phi_deg_f8);
assign_value_get(data.l_04_i_gdcomac_theta_deg_f8(),
model_data->l_04_i_gdcomac_theta_deg_f8);
assign_value_get(data.l_04_i_gdcomac_psi_deg_f8(), model_data->l_04_i_gdcomac_psi_deg_f8);
assign_value_get(data.l_04_i_gdcomac_resetint_l1(), model_data->l_04_i_gdcomac_resetint_l1);
}
template <typename T>
void setData(T *model_data)
{
if (model_data == nullptr)
return;
clearOutData();
assign_value_set(data.l_04_i_gdcomac_frz_l1(), model_data->l_04_i_gdcomac_frz_l1);
assign_value_set(data.l_04_i_gdcomac_chocks_l1(), model_data->l_04_i_gdcomac_chocks_l1);
assign_value_set(data.l_04_i_gdcomac_alt_agl_f8(), model_data->l_04_i_gdcomac_alt_agl_f8);
assign_value_set(data.l_04_i_gdcomac_frzflt_l1(), model_data->l_04_i_gdcomac_frzflt_l1);
assign_value_set(data.l_04_i_gdcomac_p_f8(), model_data->l_04_i_gdcomac_p_f8);
assign_value_set(data.l_04_i_gdcomac_q_f8(), model_data->l_04_i_gdcomac_q_f8);
assign_value_set(data.l_04_i_gdcomac_r_f8(), model_data->l_04_i_gdcomac_r_f8);
assign_value_set(data.l_04_i_gdcomac_ug_f8(), model_data->l_04_i_gdcomac_ug_f8);
assign_value_set(data.l_04_i_gdcomac_vg_f8(), model_data->l_04_i_gdcomac_vg_f8);
assign_value_set(data.l_04_i_gdcomac_wg_f8(), model_data->l_04_i_gdcomac_wg_f8);
assign_value_set(data.l_04_i_gdcomac_blcg_f8(), model_data->l_04_i_gdcomac_blcg_f8);
assign_value_set(data.l_04_i_gdcomac_bscg_f8(), model_data->l_04_i_gdcomac_bscg_f8);
assign_value_set(data.l_04_i_gdcomac_wlcg_f8(), model_data->l_04_i_gdcomac_wlcg_f8);
assign_value_set(data.l_04_i_gdcomac_pb_active_l1(),
model_data->l_04_i_gdcomac_pb_active_l1);
assign_value_set(data.l_04_i_gdcomac_brake_torq_f8(),
model_data->l_04_i_gdcomac_brake_torq_f8);
assign_value_set(data.l_04_i_gdcomac_gear_f8(), model_data->l_04_i_gdcomac_gear_f8);
assign_value_set(data.l_04_i_gdcomac_gsteer_f8(), model_data->l_04_i_gdcomac_gsteer_f8);
assign_value_set(data.l_04_i_gdcomac_tire_pres_f8(),
model_data->l_04_i_gdcomac_tire_pres_f8);
assign_value_set(data.l_04_i_gdcomac_onjax_l1(), model_data->l_04_i_gdcomac_onjax_l1);
assign_value_set(data.l_04_i_gdcomac_contdep_f8(), model_data->l_04_i_gdcomac_contdep_f8);
assign_value_set(data.l_04_i_gdcomac_thetag_f8(), model_data->l_04_i_gdcomac_thetag_f8);
assign_value_set(data.l_04_i_gdcomac_phig_f8(), model_data->l_04_i_gdcomac_phig_f8);
assign_value_set(data.l_04_i_gdcomac_rwyrgh_i2(), model_data->l_04_i_gdcomac_rwyrgh_i2);
assign_value_set(data.l_04_i_gdcomac_rwyhdg_f8(), model_data->l_04_i_gdcomac_rwyhdg_f8);
assign_value_set(data.l_04_i_gdcomac_reset_braketemp_l1(),
model_data->l_04_i_gdcomac_reset_braketemp_l1);
assign_value_set(data.l_04_i_gdcomac_reset_tirepress_l1(),
model_data->l_04_i_gdcomac_reset_tirepress_l1);
assign_value_set(data.l_04_i_gdcomac_temp_c_f8(), model_data->l_04_i_gdcomac_temp_c_f8);
assign_value_set(data.l_04_i_gdcomac_brake_temp_f8(),
model_data->l_04_i_gdcomac_brake_temp_f8);
assign_value_set(data.l_04_i_gdcomac_tire_tburst_l1(),
model_data->l_04_i_gdcomac_tire_tburst_l1);
assign_value_set(data.l_04_i_gdcomac_tire_tflat_l1(),
model_data->l_04_i_gdcomac_tire_tflat_l1);
assign_value_set(data.l_04_i_gdcomac_brk_reset_tpres_l1(),
model_data->l_04_i_gdcomac_brk_reset_tpres_l1);
assign_value_set(data.l_04_i_gdcomac_rcon_ci_f8(), model_data->l_04_i_gdcomac_rcon_ci_f8);
assign_value_set(data.l_04_i_gdcomac_pb_towforce_f8(),
model_data->l_04_i_gdcomac_pb_towforce_f8);
assign_value_set(data.l_04_i_gdcomac_gsteer_state_i4(),
model_data->l_04_i_gdcomac_gsteer_state_i4);
assign_value_set(data.l_04_i_gdcomac_trim_active_l1(),
model_data->l_04_i_gdcomac_trim_active_l1);
assign_value_set(data.l_04_i_gdcomac_phi_deg_f8(), model_data->l_04_i_gdcomac_phi_deg_f8);
assign_value_set(data.l_04_i_gdcomac_theta_deg_f8(),
model_data->l_04_i_gdcomac_theta_deg_f8);
assign_value_set(data.l_04_i_gdcomac_psi_deg_f8(), model_data->l_04_i_gdcomac_psi_deg_f8);
assign_value_set(data.l_04_i_gdcomac_resetint_l1(), model_data->l_04_i_gdcomac_resetint_l1);
sendOutData();
}
private:
XNSim::C909::ATA04::GroundHandling_input data;
XNSim::C909::ATA04::GroundHandling_input out_data;
};
class GroundHandling_output_Interface final : public XNDDSInterface
{
public:
GroundHandling_output_Interface();
virtual ~GroundHandling_output_Interface();
virtual void Initialize(XNFrameworkPtr framework, uint32_t modelId, uint32_t DDS_type) override;
void outputDataListener(const XNSim::C909::ATA04::GroundHandling_output &output);
virtual void clearOutData() override;
virtual void sendOutData() override;
template <typename T>
void getData(T *model_data)
{
if (model_data == nullptr)
return;
assign_value_get(data.l_04_o_gdcomac_frz_l1(), model_data->l_04_o_gdcomac_frz_l1);
assign_value_get(data.l_04_o_gdcomac_ac_on_ground_l1(),
model_data->l_04_o_gdcomac_ac_on_ground_l1);
assign_value_get(data.l_04_o_gdcomac_ac_stationary_f8(),
model_data->l_04_o_gdcomac_ac_stationary_f8);
assign_value_get(data.l_04_o_gdcomac_alt_tire_f8(), model_data->l_04_o_gdcomac_alt_tire_f8);
assign_value_get(data.l_04_o_gdcomac_zcg_to_tire_f8(),
model_data->l_04_o_gdcomac_zcg_to_tire_f8);
assign_value_get(data.l_04_o_gdcomac_fxb_f8(), model_data->l_04_o_gdcomac_fxb_f8);
assign_value_get(data.l_04_o_gdcomac_fyb_f8(), model_data->l_04_o_gdcomac_fyb_f8);
assign_value_get(data.l_04_o_gdcomac_fzb_f8(), model_data->l_04_o_gdcomac_fzb_f8);
assign_value_get(data.l_04_o_gdcomac_mxb_f8(), model_data->l_04_o_gdcomac_mxb_f8);
assign_value_get(data.l_04_o_gdcomac_myb_f8(), model_data->l_04_o_gdcomac_myb_f8);
assign_value_get(data.l_04_o_gdcomac_mzb_f8(), model_data->l_04_o_gdcomac_mzb_f8);
assign_value_get(data.l_04_o_gdcomac_fygs_f8(), model_data->l_04_o_gdcomac_fygs_f8);
assign_value_get(data.l_04_o_gdcomac_mzgs_f8(), model_data->l_04_o_gdcomac_mzgs_f8);
assign_value_get(data.l_04_o_gdcomac_mu_f8(), model_data->l_04_o_gdcomac_mu_f8);
assign_value_get(data.l_04_o_gdcomac_dstroke_f8(), model_data->l_04_o_gdcomac_dstroke_f8);
assign_value_get(data.l_04_o_gdcomac_sr_f8(), model_data->l_04_o_gdcomac_sr_f8);
assign_value_get(data.l_04_o_gdcomac_sy_f8(), model_data->l_04_o_gdcomac_sy_f8);
assign_value_get(data.l_04_o_gdcomac_sx_f8(), model_data->l_04_o_gdcomac_sx_f8);
assign_value_get(data.l_04_o_gdcomac_xft_f8(), model_data->l_04_o_gdcomac_xft_f8);
assign_value_get(data.l_04_o_gdcomac_yft_f8(), model_data->l_04_o_gdcomac_yft_f8);
assign_value_get(data.l_04_o_gdcomac_zft_f8(), model_data->l_04_o_gdcomac_zft_f8);
assign_value_get(data.l_04_o_gdcomac_distngrxcg_f8(),
model_data->l_04_o_gdcomac_distngrxcg_f8);
assign_value_get(data.l_04_o_gdcomac_distmgrxcg_f8(),
model_data->l_04_o_gdcomac_distmgrxcg_f8);
assign_value_get(data.l_04_o_gdcomac_distmgrzcg_f8(),
model_data->l_04_o_gdcomac_distmgrzcg_f8);
assign_value_get(data.l_04_o_gdcomac_tire_vel_f8(), model_data->l_04_o_gdcomac_tire_vel_f8);
assign_value_get(data.l_04_o_gdcomac_tire_burst_l1(),
model_data->l_04_o_gdcomac_tire_burst_l1);
assign_value_get(data.l_04_o_gdcomac_tire_temp_f8(),
model_data->l_04_o_gdcomac_tire_temp_f8);
assign_value_get(data.l_04_o_gdcomac_wow_l1(), model_data->l_04_o_gdcomac_wow_l1);
assign_value_get(data.l_04_o_gdcomac_utirew_f8(), model_data->l_04_o_gdcomac_utirew_f8);
assign_value_get(data.l_04_o_gdcomac_vtirew_f8(), model_data->l_04_o_gdcomac_vtirew_f8);
assign_value_get(data.l_04_o_gdcomac_whl_omega_f8(),
model_data->l_04_o_gdcomac_whl_omega_f8);
assign_value_get(data.l_04_o_gdcomac_dstruc_f8(), model_data->l_04_o_gdcomac_dstruc_f8);
assign_value_get(data.l_04_o_gdcomac_wor_par_f8(), model_data->l_04_o_gdcomac_wor_par_f8);
assign_value_get(data.l_04_o_gdcomac_nd_f8(), model_data->l_04_o_gdcomac_nd_f8);
assign_value_get(data.l_04_o_gdcomac_vczt_f8(), model_data->l_04_o_gdcomac_vczt_f8);
}
template <typename T>
void setData(T *model_data)
{
if (model_data == nullptr)
return;
clearOutData();
assign_value_set(data.l_04_o_gdcomac_frz_l1(), model_data->l_04_o_gdcomac_frz_l1);
assign_value_set(data.l_04_o_gdcomac_ac_on_ground_l1(),
model_data->l_04_o_gdcomac_ac_on_ground_l1);
assign_value_set(data.l_04_o_gdcomac_ac_stationary_f8(),
model_data->l_04_o_gdcomac_ac_stationary_f8);
assign_value_set(data.l_04_o_gdcomac_alt_tire_f8(), model_data->l_04_o_gdcomac_alt_tire_f8);
assign_value_set(data.l_04_o_gdcomac_zcg_to_tire_f8(),
model_data->l_04_o_gdcomac_zcg_to_tire_f8);
assign_value_set(data.l_04_o_gdcomac_fxb_f8(), model_data->l_04_o_gdcomac_fxb_f8);
assign_value_set(data.l_04_o_gdcomac_fyb_f8(), model_data->l_04_o_gdcomac_fyb_f8);
assign_value_set(data.l_04_o_gdcomac_fzb_f8(), model_data->l_04_o_gdcomac_fzb_f8);
assign_value_set(data.l_04_o_gdcomac_mxb_f8(), model_data->l_04_o_gdcomac_mxb_f8);
assign_value_set(data.l_04_o_gdcomac_myb_f8(), model_data->l_04_o_gdcomac_myb_f8);
assign_value_set(data.l_04_o_gdcomac_mzb_f8(), model_data->l_04_o_gdcomac_mzb_f8);
assign_value_set(data.l_04_o_gdcomac_fygs_f8(), model_data->l_04_o_gdcomac_fygs_f8);
assign_value_set(data.l_04_o_gdcomac_mzgs_f8(), model_data->l_04_o_gdcomac_mzgs_f8);
assign_value_set(data.l_04_o_gdcomac_mu_f8(), model_data->l_04_o_gdcomac_mu_f8);
assign_value_set(data.l_04_o_gdcomac_dstroke_f8(), model_data->l_04_o_gdcomac_dstroke_f8);
assign_value_set(data.l_04_o_gdcomac_sr_f8(), model_data->l_04_o_gdcomac_sr_f8);
assign_value_set(data.l_04_o_gdcomac_sy_f8(), model_data->l_04_o_gdcomac_sy_f8);
assign_value_set(data.l_04_o_gdcomac_sx_f8(), model_data->l_04_o_gdcomac_sx_f8);
assign_value_set(data.l_04_o_gdcomac_xft_f8(), model_data->l_04_o_gdcomac_xft_f8);
assign_value_set(data.l_04_o_gdcomac_yft_f8(), model_data->l_04_o_gdcomac_yft_f8);
assign_value_set(data.l_04_o_gdcomac_zft_f8(), model_data->l_04_o_gdcomac_zft_f8);
assign_value_set(data.l_04_o_gdcomac_distngrxcg_f8(),
model_data->l_04_o_gdcomac_distngrxcg_f8);
assign_value_set(data.l_04_o_gdcomac_distmgrxcg_f8(),
model_data->l_04_o_gdcomac_distmgrxcg_f8);
assign_value_set(data.l_04_o_gdcomac_distmgrzcg_f8(),
model_data->l_04_o_gdcomac_distmgrzcg_f8);
assign_value_set(data.l_04_o_gdcomac_tire_vel_f8(), model_data->l_04_o_gdcomac_tire_vel_f8);
assign_value_set(data.l_04_o_gdcomac_tire_burst_l1(),
model_data->l_04_o_gdcomac_tire_burst_l1);
assign_value_set(data.l_04_o_gdcomac_tire_temp_f8(),
model_data->l_04_o_gdcomac_tire_temp_f8);
assign_value_set(data.l_04_o_gdcomac_wow_l1(), model_data->l_04_o_gdcomac_wow_l1);
assign_value_set(data.l_04_o_gdcomac_utirew_f8(), model_data->l_04_o_gdcomac_utirew_f8);
assign_value_set(data.l_04_o_gdcomac_vtirew_f8(), model_data->l_04_o_gdcomac_vtirew_f8);
assign_value_set(data.l_04_o_gdcomac_whl_omega_f8(),
model_data->l_04_o_gdcomac_whl_omega_f8);
assign_value_set(data.l_04_o_gdcomac_dstruc_f8(), model_data->l_04_o_gdcomac_dstruc_f8);
assign_value_set(data.l_04_o_gdcomac_wor_par_f8(), model_data->l_04_o_gdcomac_wor_par_f8);
assign_value_set(data.l_04_o_gdcomac_nd_f8(), model_data->l_04_o_gdcomac_nd_f8);
assign_value_set(data.l_04_o_gdcomac_vczt_f8(), model_data->l_04_o_gdcomac_vczt_f8);
sendOutData();
}
private:
XNSim::C909::ATA04::GroundHandling_output data;
XNSim::C909::ATA04::GroundHandling_output out_data;
};
class GroundHandling_heartbeat_Interface final : public XNDDSInterface
{
public:
GroundHandling_heartbeat_Interface();
virtual ~GroundHandling_heartbeat_Interface();
virtual void Initialize(XNFrameworkPtr framework, uint32_t modelId, uint32_t DDS_type) override;
void heartbeatListener(const XNSim::C909::ATA04::GroundHandling_heartbeat &heartbeat);
virtual void clearOutData() override;
virtual void sendOutData() override;
template <typename T>
void getData(T *model_data)
{
if (model_data == nullptr)
return;
assign_value_get(data.groundhandling_model_heartbeat(),
model_data->groundhandling_model_heartbeat);
}
template <typename T>
void setData(T *model_data)
{
if (model_data == nullptr)
return;
clearOutData();
assign_value_set(data.groundhandling_model_heartbeat(),
model_data->groundhandling_model_heartbeat);
sendOutData();
}
private:
XNSim::C909::ATA04::GroundHandling_heartbeat data;
XNSim::C909::ATA04::GroundHandling_heartbeat out_data;
};
} // namespace XNSim::C909::ATA04

View File

@ -1,591 +0,0 @@
// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*!
* @file XNGroundHandlingPubSubTypes.cpp
* This header file contains the implementation of the serialization functions.
*
* This file was generated by the tool fastddsgen.
*/
#include "XNGroundHandlingPubSubTypes.hpp"
#include <fastdds/dds/log/Log.hpp>
#include <fastdds/rtps/common/CdrSerialization.hpp>
#include "XNGroundHandlingCdrAux.hpp"
#include "XNGroundHandlingTypeObjectSupport.hpp"
using SerializedPayload_t = eprosima::fastdds::rtps::SerializedPayload_t;
using InstanceHandle_t = eprosima::fastdds::rtps::InstanceHandle_t;
using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t;
namespace XNSim {
namespace C909 {
namespace ATA04 {
GroundHandling_inputPubSubType::GroundHandling_inputPubSubType()
{
set_name("XNSim::C909::ATA04::GroundHandling_input");
uint32_t type_size = XNSim_C909_ATA04_GroundHandling_input_max_cdr_typesize;
type_size += static_cast<uint32_t>(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */
max_serialized_type_size = type_size + 4; /*encapsulation*/
is_compute_key_provided = false;
uint32_t key_length = XNSim_C909_ATA04_GroundHandling_input_max_key_cdr_typesize > 16 ? XNSim_C909_ATA04_GroundHandling_input_max_key_cdr_typesize : 16;
key_buffer_ = reinterpret_cast<unsigned char*>(malloc(key_length));
memset(key_buffer_, 0, key_length);
}
GroundHandling_inputPubSubType::~GroundHandling_inputPubSubType()
{
if (key_buffer_ != nullptr)
{
free(key_buffer_);
}
}
bool GroundHandling_inputPubSubType::serialize(
const void* const data,
SerializedPayload_t& payload,
DataRepresentationId_t data_representation)
{
const GroundHandling_input* p_type = static_cast<const GroundHandling_input*>(data);
// Object that manages the raw buffer.
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(payload.data), payload.max_size);
// Object that serializes the data.
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN,
data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ?
eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2);
payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE;
ser.set_encoding_flag(
data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ?
eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR :
eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2);
try
{
// Serialize encapsulation
ser.serialize_encapsulation();
// Serialize the object.
ser << *p_type;
ser.set_dds_cdr_options({0,0});
}
catch (eprosima::fastcdr::exception::Exception& /*exception*/)
{
return false;
}
// Get the serialized length
payload.length = static_cast<uint32_t>(ser.get_serialized_data_length());
return true;
}
bool GroundHandling_inputPubSubType::deserialize(
SerializedPayload_t& payload,
void* data)
{
try
{
// Convert DATA to pointer of your type
GroundHandling_input* p_type = static_cast<GroundHandling_input*>(data);
// Object that manages the raw buffer.
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(payload.data), payload.length);
// Object that deserializes the data.
eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN);
// Deserialize encapsulation.
deser.read_encapsulation();
payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE;
// Deserialize the object.
deser >> *p_type;
}
catch (eprosima::fastcdr::exception::Exception& /*exception*/)
{
return false;
}
return true;
}
uint32_t GroundHandling_inputPubSubType::calculate_serialized_size(
const void* const data,
DataRepresentationId_t data_representation)
{
try
{
eprosima::fastcdr::CdrSizeCalculator calculator(
data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ?
eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2);
size_t current_alignment {0};
return static_cast<uint32_t>(calculator.calculate_serialized_size(
*static_cast<const GroundHandling_input*>(data), current_alignment)) +
4u /*encapsulation*/;
}
catch (eprosima::fastcdr::exception::Exception& /*exception*/)
{
return 0;
}
}
void* GroundHandling_inputPubSubType::create_data()
{
return reinterpret_cast<void*>(new GroundHandling_input());
}
void GroundHandling_inputPubSubType::delete_data(
void* data)
{
delete(reinterpret_cast<GroundHandling_input*>(data));
}
bool GroundHandling_inputPubSubType::compute_key(
SerializedPayload_t& payload,
InstanceHandle_t& handle,
bool force_md5)
{
if (!is_compute_key_provided)
{
return false;
}
GroundHandling_input data;
if (deserialize(payload, static_cast<void*>(&data)))
{
return compute_key(static_cast<void*>(&data), handle, force_md5);
}
return false;
}
bool GroundHandling_inputPubSubType::compute_key(
const void* const data,
InstanceHandle_t& handle,
bool force_md5)
{
if (!is_compute_key_provided)
{
return false;
}
const GroundHandling_input* p_type = static_cast<const GroundHandling_input*>(data);
// Object that manages the raw buffer.
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(key_buffer_),
XNSim_C909_ATA04_GroundHandling_input_max_key_cdr_typesize);
// Object that serializes the data.
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2);
ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2);
eprosima::fastcdr::serialize_key(ser, *p_type);
if (force_md5 || XNSim_C909_ATA04_GroundHandling_input_max_key_cdr_typesize > 16)
{
md5_.init();
md5_.update(key_buffer_, static_cast<unsigned int>(ser.get_serialized_data_length()));
md5_.finalize();
for (uint8_t i = 0; i < 16; ++i)
{
handle.value[i] = md5_.digest[i];
}
}
else
{
for (uint8_t i = 0; i < 16; ++i)
{
handle.value[i] = key_buffer_[i];
}
}
return true;
}
void GroundHandling_inputPubSubType::register_type_object_representation()
{
register_GroundHandling_input_type_identifier(type_identifiers_);
}
GroundHandling_outputPubSubType::GroundHandling_outputPubSubType()
{
set_name("XNSim::C909::ATA04::GroundHandling_output");
uint32_t type_size = XNSim_C909_ATA04_GroundHandling_output_max_cdr_typesize;
type_size += static_cast<uint32_t>(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */
max_serialized_type_size = type_size + 4; /*encapsulation*/
is_compute_key_provided = false;
uint32_t key_length = XNSim_C909_ATA04_GroundHandling_output_max_key_cdr_typesize > 16 ? XNSim_C909_ATA04_GroundHandling_output_max_key_cdr_typesize : 16;
key_buffer_ = reinterpret_cast<unsigned char*>(malloc(key_length));
memset(key_buffer_, 0, key_length);
}
GroundHandling_outputPubSubType::~GroundHandling_outputPubSubType()
{
if (key_buffer_ != nullptr)
{
free(key_buffer_);
}
}
bool GroundHandling_outputPubSubType::serialize(
const void* const data,
SerializedPayload_t& payload,
DataRepresentationId_t data_representation)
{
const GroundHandling_output* p_type = static_cast<const GroundHandling_output*>(data);
// Object that manages the raw buffer.
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(payload.data), payload.max_size);
// Object that serializes the data.
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN,
data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ?
eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2);
payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE;
ser.set_encoding_flag(
data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ?
eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR :
eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2);
try
{
// Serialize encapsulation
ser.serialize_encapsulation();
// Serialize the object.
ser << *p_type;
ser.set_dds_cdr_options({0,0});
}
catch (eprosima::fastcdr::exception::Exception& /*exception*/)
{
return false;
}
// Get the serialized length
payload.length = static_cast<uint32_t>(ser.get_serialized_data_length());
return true;
}
bool GroundHandling_outputPubSubType::deserialize(
SerializedPayload_t& payload,
void* data)
{
try
{
// Convert DATA to pointer of your type
GroundHandling_output* p_type = static_cast<GroundHandling_output*>(data);
// Object that manages the raw buffer.
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(payload.data), payload.length);
// Object that deserializes the data.
eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN);
// Deserialize encapsulation.
deser.read_encapsulation();
payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE;
// Deserialize the object.
deser >> *p_type;
}
catch (eprosima::fastcdr::exception::Exception& /*exception*/)
{
return false;
}
return true;
}
uint32_t GroundHandling_outputPubSubType::calculate_serialized_size(
const void* const data,
DataRepresentationId_t data_representation)
{
try
{
eprosima::fastcdr::CdrSizeCalculator calculator(
data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ?
eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2);
size_t current_alignment {0};
return static_cast<uint32_t>(calculator.calculate_serialized_size(
*static_cast<const GroundHandling_output*>(data), current_alignment)) +
4u /*encapsulation*/;
}
catch (eprosima::fastcdr::exception::Exception& /*exception*/)
{
return 0;
}
}
void* GroundHandling_outputPubSubType::create_data()
{
return reinterpret_cast<void*>(new GroundHandling_output());
}
void GroundHandling_outputPubSubType::delete_data(
void* data)
{
delete(reinterpret_cast<GroundHandling_output*>(data));
}
bool GroundHandling_outputPubSubType::compute_key(
SerializedPayload_t& payload,
InstanceHandle_t& handle,
bool force_md5)
{
if (!is_compute_key_provided)
{
return false;
}
GroundHandling_output data;
if (deserialize(payload, static_cast<void*>(&data)))
{
return compute_key(static_cast<void*>(&data), handle, force_md5);
}
return false;
}
bool GroundHandling_outputPubSubType::compute_key(
const void* const data,
InstanceHandle_t& handle,
bool force_md5)
{
if (!is_compute_key_provided)
{
return false;
}
const GroundHandling_output* p_type = static_cast<const GroundHandling_output*>(data);
// Object that manages the raw buffer.
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(key_buffer_),
XNSim_C909_ATA04_GroundHandling_output_max_key_cdr_typesize);
// Object that serializes the data.
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2);
ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2);
eprosima::fastcdr::serialize_key(ser, *p_type);
if (force_md5 || XNSim_C909_ATA04_GroundHandling_output_max_key_cdr_typesize > 16)
{
md5_.init();
md5_.update(key_buffer_, static_cast<unsigned int>(ser.get_serialized_data_length()));
md5_.finalize();
for (uint8_t i = 0; i < 16; ++i)
{
handle.value[i] = md5_.digest[i];
}
}
else
{
for (uint8_t i = 0; i < 16; ++i)
{
handle.value[i] = key_buffer_[i];
}
}
return true;
}
void GroundHandling_outputPubSubType::register_type_object_representation()
{
register_GroundHandling_output_type_identifier(type_identifiers_);
}
GroundHandling_heartbeatPubSubType::GroundHandling_heartbeatPubSubType()
{
set_name("XNSim::C909::ATA04::GroundHandling_heartbeat");
uint32_t type_size = XNSim_C909_ATA04_GroundHandling_heartbeat_max_cdr_typesize;
type_size += static_cast<uint32_t>(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */
max_serialized_type_size = type_size + 4; /*encapsulation*/
is_compute_key_provided = false;
uint32_t key_length = XNSim_C909_ATA04_GroundHandling_heartbeat_max_key_cdr_typesize > 16 ? XNSim_C909_ATA04_GroundHandling_heartbeat_max_key_cdr_typesize : 16;
key_buffer_ = reinterpret_cast<unsigned char*>(malloc(key_length));
memset(key_buffer_, 0, key_length);
}
GroundHandling_heartbeatPubSubType::~GroundHandling_heartbeatPubSubType()
{
if (key_buffer_ != nullptr)
{
free(key_buffer_);
}
}
bool GroundHandling_heartbeatPubSubType::serialize(
const void* const data,
SerializedPayload_t& payload,
DataRepresentationId_t data_representation)
{
const GroundHandling_heartbeat* p_type = static_cast<const GroundHandling_heartbeat*>(data);
// Object that manages the raw buffer.
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(payload.data), payload.max_size);
// Object that serializes the data.
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN,
data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ?
eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2);
payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE;
ser.set_encoding_flag(
data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ?
eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR :
eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2);
try
{
// Serialize encapsulation
ser.serialize_encapsulation();
// Serialize the object.
ser << *p_type;
ser.set_dds_cdr_options({0,0});
}
catch (eprosima::fastcdr::exception::Exception& /*exception*/)
{
return false;
}
// Get the serialized length
payload.length = static_cast<uint32_t>(ser.get_serialized_data_length());
return true;
}
bool GroundHandling_heartbeatPubSubType::deserialize(
SerializedPayload_t& payload,
void* data)
{
try
{
// Convert DATA to pointer of your type
GroundHandling_heartbeat* p_type = static_cast<GroundHandling_heartbeat*>(data);
// Object that manages the raw buffer.
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(payload.data), payload.length);
// Object that deserializes the data.
eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN);
// Deserialize encapsulation.
deser.read_encapsulation();
payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE;
// Deserialize the object.
deser >> *p_type;
}
catch (eprosima::fastcdr::exception::Exception& /*exception*/)
{
return false;
}
return true;
}
uint32_t GroundHandling_heartbeatPubSubType::calculate_serialized_size(
const void* const data,
DataRepresentationId_t data_representation)
{
try
{
eprosima::fastcdr::CdrSizeCalculator calculator(
data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ?
eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2);
size_t current_alignment {0};
return static_cast<uint32_t>(calculator.calculate_serialized_size(
*static_cast<const GroundHandling_heartbeat*>(data), current_alignment)) +
4u /*encapsulation*/;
}
catch (eprosima::fastcdr::exception::Exception& /*exception*/)
{
return 0;
}
}
void* GroundHandling_heartbeatPubSubType::create_data()
{
return reinterpret_cast<void*>(new GroundHandling_heartbeat());
}
void GroundHandling_heartbeatPubSubType::delete_data(
void* data)
{
delete(reinterpret_cast<GroundHandling_heartbeat*>(data));
}
bool GroundHandling_heartbeatPubSubType::compute_key(
SerializedPayload_t& payload,
InstanceHandle_t& handle,
bool force_md5)
{
if (!is_compute_key_provided)
{
return false;
}
GroundHandling_heartbeat data;
if (deserialize(payload, static_cast<void*>(&data)))
{
return compute_key(static_cast<void*>(&data), handle, force_md5);
}
return false;
}
bool GroundHandling_heartbeatPubSubType::compute_key(
const void* const data,
InstanceHandle_t& handle,
bool force_md5)
{
if (!is_compute_key_provided)
{
return false;
}
const GroundHandling_heartbeat* p_type = static_cast<const GroundHandling_heartbeat*>(data);
// Object that manages the raw buffer.
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(key_buffer_),
XNSim_C909_ATA04_GroundHandling_heartbeat_max_key_cdr_typesize);
// Object that serializes the data.
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2);
ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2);
eprosima::fastcdr::serialize_key(ser, *p_type);
if (force_md5 || XNSim_C909_ATA04_GroundHandling_heartbeat_max_key_cdr_typesize > 16)
{
md5_.init();
md5_.update(key_buffer_, static_cast<unsigned int>(ser.get_serialized_data_length()));
md5_.finalize();
for (uint8_t i = 0; i < 16; ++i)
{
handle.value[i] = md5_.digest[i];
}
}
else
{
for (uint8_t i = 0; i < 16; ++i)
{
handle.value[i] = key_buffer_[i];
}
}
return true;
}
void GroundHandling_heartbeatPubSubType::register_type_object_representation()
{
register_GroundHandling_heartbeat_type_identifier(type_identifiers_);
}
} // namespace ATA04
} // namespace C909
} // namespace XNSim
// Include auxiliary functions like for serializing/deserializing.
#include "XNGroundHandlingCdrAux.ipp"

View File

@ -1,294 +0,0 @@
// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*!
* @file XNGroundHandlingPubSubTypes.hpp
* This header file contains the declaration of the serialization functions.
*
* This file was generated by the tool fastddsgen.
*/
#ifndef FAST_DDS_GENERATED__XNSIM_C909_ATA04_XNGROUNDHANDLING_PUBSUBTYPES_HPP
#define FAST_DDS_GENERATED__XNSIM_C909_ATA04_XNGROUNDHANDLING_PUBSUBTYPES_HPP
#include <fastdds/dds/core/policy/QosPolicies.hpp>
#include <fastdds/dds/topic/TopicDataType.hpp>
#include <fastdds/rtps/common/InstanceHandle.hpp>
#include <fastdds/rtps/common/SerializedPayload.hpp>
#include <fastdds/utils/md5.hpp>
#include "XNGroundHandling.hpp"
#if !defined(FASTDDS_GEN_API_VER) || (FASTDDS_GEN_API_VER != 3)
#error \
Generated XNGroundHandling is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen.
#endif // FASTDDS_GEN_API_VER
namespace XNSim
{
namespace C909
{
namespace ATA04
{
/*!
* @brief This class represents the TopicDataType of the type GroundHandling_input defined by the user in the IDL file.
* @ingroup XNGroundHandling
*/
class GroundHandling_inputPubSubType : public eprosima::fastdds::dds::TopicDataType
{
public:
typedef GroundHandling_input type;
eProsima_user_DllExport GroundHandling_inputPubSubType();
eProsima_user_DllExport ~GroundHandling_inputPubSubType() override;
eProsima_user_DllExport bool serialize(
const void* const data,
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool deserialize(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
void* data) override;
eProsima_user_DllExport uint32_t calculate_serialized_size(
const void* const data,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool compute_key(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport bool compute_key(
const void* const data,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport void* create_data() override;
eProsima_user_DllExport void delete_data(
void* data) override;
//Register TypeObject representation in Fast DDS TypeObjectRegistry
eProsima_user_DllExport void register_type_object_representation() override;
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
eProsima_user_DllExport inline bool is_bounded() const override
{
return true;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
eProsima_user_DllExport inline bool is_plain(
eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override
{
static_cast<void>(data_representation);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
eProsima_user_DllExport inline bool construct_sample(
void* memory) const override
{
static_cast<void>(memory);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
private:
eprosima::fastdds::MD5 md5_;
unsigned char* key_buffer_;
};
/*!
* @brief This class represents the TopicDataType of the type GroundHandling_output defined by the user in the IDL file.
* @ingroup XNGroundHandling
*/
class GroundHandling_outputPubSubType : public eprosima::fastdds::dds::TopicDataType
{
public:
typedef GroundHandling_output type;
eProsima_user_DllExport GroundHandling_outputPubSubType();
eProsima_user_DllExport ~GroundHandling_outputPubSubType() override;
eProsima_user_DllExport bool serialize(
const void* const data,
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool deserialize(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
void* data) override;
eProsima_user_DllExport uint32_t calculate_serialized_size(
const void* const data,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool compute_key(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport bool compute_key(
const void* const data,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport void* create_data() override;
eProsima_user_DllExport void delete_data(
void* data) override;
//Register TypeObject representation in Fast DDS TypeObjectRegistry
eProsima_user_DllExport void register_type_object_representation() override;
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
eProsima_user_DllExport inline bool is_bounded() const override
{
return true;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
eProsima_user_DllExport inline bool is_plain(
eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override
{
static_cast<void>(data_representation);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
eProsima_user_DllExport inline bool construct_sample(
void* memory) const override
{
static_cast<void>(memory);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
private:
eprosima::fastdds::MD5 md5_;
unsigned char* key_buffer_;
};
/*!
* @brief This class represents the TopicDataType of the type GroundHandling_heartbeat defined by the user in the IDL file.
* @ingroup XNGroundHandling
*/
class GroundHandling_heartbeatPubSubType : public eprosima::fastdds::dds::TopicDataType
{
public:
typedef GroundHandling_heartbeat type;
eProsima_user_DllExport GroundHandling_heartbeatPubSubType();
eProsima_user_DllExport ~GroundHandling_heartbeatPubSubType() override;
eProsima_user_DllExport bool serialize(
const void* const data,
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool deserialize(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
void* data) override;
eProsima_user_DllExport uint32_t calculate_serialized_size(
const void* const data,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool compute_key(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport bool compute_key(
const void* const data,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport void* create_data() override;
eProsima_user_DllExport void delete_data(
void* data) override;
//Register TypeObject representation in Fast DDS TypeObjectRegistry
eProsima_user_DllExport void register_type_object_representation() override;
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
eProsima_user_DllExport inline bool is_bounded() const override
{
return true;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
eProsima_user_DllExport inline bool is_plain(
eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override
{
static_cast<void>(data_representation);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
eProsima_user_DllExport inline bool construct_sample(
void* memory) const override
{
static_cast<void>(memory);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
private:
eprosima::fastdds::MD5 md5_;
unsigned char* key_buffer_;
};
} // namespace ATA04
} // namespace C909
} // namespace XNSim
#endif // FAST_DDS_GENERATED__XNSIM_C909_ATA04_XNGROUNDHANDLING_PUBSUBTYPES_HPP

View File

@ -1,91 +0,0 @@
// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*!
* @file XNGroundHandlingTypeObjectSupport.hpp
* Header file containing the API required to register the TypeObject representation of the described types in the IDL file
*
* This file was generated by the tool fastddsgen.
*/
#ifndef FAST_DDS_GENERATED__XNSIM_C909_ATA04_XNGROUNDHANDLING_TYPE_OBJECT_SUPPORT_HPP
#define FAST_DDS_GENERATED__XNSIM_C909_ATA04_XNGROUNDHANDLING_TYPE_OBJECT_SUPPORT_HPP
#include <fastdds/dds/xtypes/type_representation/TypeObject.hpp>
#if defined(_WIN32)
#if defined(EPROSIMA_USER_DLL_EXPORT)
#define eProsima_user_DllExport __declspec( dllexport )
#else
#define eProsima_user_DllExport
#endif // EPROSIMA_USER_DLL_EXPORT
#else
#define eProsima_user_DllExport
#endif // _WIN32
#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC
namespace XNSim {
namespace C909 {
namespace ATA04 {
/**
* @brief Register GroundHandling_input related TypeIdentifier.
* Fully-descriptive TypeIdentifiers are directly registered.
* Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is
* indirectly registered as well.
*
* @param[out] TypeIdentifier of the registered type.
* The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers.
* Invalid TypeIdentifier is returned in case of error.
*/
eProsima_user_DllExport void register_GroundHandling_input_type_identifier(
eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids);
/**
* @brief Register GroundHandling_output related TypeIdentifier.
* Fully-descriptive TypeIdentifiers are directly registered.
* Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is
* indirectly registered as well.
*
* @param[out] TypeIdentifier of the registered type.
* The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers.
* Invalid TypeIdentifier is returned in case of error.
*/
eProsima_user_DllExport void register_GroundHandling_output_type_identifier(
eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids);
/**
* @brief Register GroundHandling_heartbeat related TypeIdentifier.
* Fully-descriptive TypeIdentifiers are directly registered.
* Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is
* indirectly registered as well.
*
* @param[out] TypeIdentifier of the registered type.
* The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers.
* Invalid TypeIdentifier is returned in case of error.
*/
eProsima_user_DllExport void register_GroundHandling_heartbeat_type_identifier(
eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids);
} // namespace ATA04
} // namespace C909
} // namespace XNSim
#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC
#endif // FAST_DDS_GENERATED__XNSIM_C909_ATA04_XNGROUNDHANDLING_TYPE_OBJECT_SUPPORT_HPP

View File

@ -1,7 +1,9 @@
#pragma once
#include <XNCore/XNModelObject_p.h>
#include <DataModels/libSACSCGroundHandling_V2.0.27.1H/std_04_dll.h>
#include "../XNGroundHandlingInterface/XNGroundHandlingInterface.hpp"
#include <DataModels/libSACSCGroundHandling_V2.0.143.1H/std_04_dll.h>
#include <C909_V1/ATA04/GroundHandling_input.hpp>
#include <C909_V1/ATA04/GroundHandling_output.hpp>
#include <C909_V1/ATA04/GroundHandling_heartbeat.hpp>
typedef void (*FunctionType)(ComacDataStructure_S *);

View File

@ -2,9 +2,6 @@ cmake_minimum_required(VERSION 3.16)
project(XNUDPService LANGUAGES CXX)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@ -18,9 +15,6 @@ endif()
# XNCore_PATH include
include_directories(${XNCore_PATH}/include)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Network Xml)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Network Xml)
add_library(XNUDPService SHARED
XNUDPService_global.h
XNUDPService.cpp
@ -29,20 +23,7 @@ add_library(XNUDPService SHARED
)
target_link_libraries(XNUDPService PRIVATE
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Network
Qt${QT_VERSION_MAJOR}::Xml
${XNCore_PATH}/lib/libXNCore.so
)
# Qt
get_target_property(QT_LIB_DIR Qt${QT_VERSION_MAJOR}::Core LOCATION)
get_filename_component(QT_LIB_DIR ${QT_LIB_DIR} DIRECTORY)
# rpath
set_target_properties(XNUDPService PROPERTIES
BUILD_WITH_INSTALL_RPATH TRUE
INSTALL_RPATH "${QT_LIB_DIR}"
${XNCore_PATH}/lib/libXNCore.so
)
target_compile_definitions(XNUDPService PRIVATE XNUDPSERVICE_LIBRARY)

View File

@ -2,53 +2,72 @@
#include "XNUDPService_p.h"
#include <XNCore/XNServiceManager.h>
#include <XNCore/XNDDSManager.h>
#include <QFile>
#include <QDomDocument>
#include <fstream>
#include <sstream>
#include <cstring>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <XNCore/XNByteArray.h>
XN_DLL_INITIALIZE(XNUDPService)
XN_SERVICE_INITIALIZE(XNUDPService)
XN_REGISTER_SERVICE_BEGIN_SERVICE(XNUDPService)
XN_REGISTER_SERVICE_END_SERVICE(XNUDPService)
XNUDPService::XNUDPService(QObject *parent)
: XNServiceObject(*new XNUDPServicePrivate(this), parent)
XNUDPService::XNUDPService() : XNServiceObject(new XNUDPServicePrivate())
{
}
XNUDPService::~XNUDPService()
{
}
T_D();
if (d->udpSocket >= 0) {
close(d->udpSocket);
d->udpSocket = -1;
}
};
XNUDPService::XNUDPService(XNUDPServicePrivate &dd, QObject *parent) : XNServiceObject(dd, parent)
XNUDPService::XNUDPService(PrivateType *p) : XNServiceObject(p)
{
}
void XNUDPService::OnInitialize()
void XNUDPService::Initialize()
{
Q_D(XNUDPService);
XNServiceObject::OnInitialize();
XNServiceObject::Initialize();
T_D();
// 读取配置文件
QFile file(GetXmlPath());
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
LOG_WARNING("Failed to open config file:%1", GetXmlPath());
std::ifstream file(GetXmlPath());
if (!file.is_open()) {
LOG_WARNING("Failed to open config file:%s", GetXmlPath().c_str());
return;
}
QDomDocument doc;
if (!doc.setContent(&file)) {
file.close();
LOG_WARNING("Failed to parse config file:%1", GetXmlPath());
return;
}
std::stringstream buffer;
buffer << file.rdbuf();
std::string content = buffer.str();
file.close();
// 读取UDP配置
QDomElement udpElement = doc.documentElement().firstChildElement("UDP");
if (!udpElement.isNull()) {
d->localPort = udpElement.firstChildElement("LocalPort").text().toUInt();
d->targetHost = udpElement.firstChildElement("TargetHost").text();
d->targetPort = udpElement.firstChildElement("TargetPort").text().toUInt();
// 简单的XML解析
size_t udpPos = content.find("<UDP>");
if (udpPos != std::string::npos) {
size_t localPortPos = content.find("<LocalPort>", udpPos);
size_t targetHostPos = content.find("<TargetHost>", udpPos);
size_t targetPortPos = content.find("<TargetPort>", udpPos);
if (localPortPos != std::string::npos) {
size_t endPos = content.find("</LocalPort>", localPortPos);
d->localPort = std::stoi(content.substr(localPortPos + 11, endPos - localPortPos - 11));
}
if (targetHostPos != std::string::npos) {
size_t endPos = content.find("</TargetHost>", targetHostPos);
d->targetHost = content.substr(targetHostPos + 12, endPos - targetHostPos - 12);
}
if (targetPortPos != std::string::npos) {
size_t endPos = content.find("</TargetPort>", targetPortPos);
d->targetPort =
std::stoi(content.substr(targetPortPos + 12, endPos - targetPortPos - 12));
}
} else {
LOG_WARNING("UDP configuration not found, using default values");
d->localPort = 12345;
@ -57,22 +76,34 @@ void XNUDPService::OnInitialize()
}
}
void XNUDPService::OnPrepareForExecute()
void XNUDPService::PrepareForExecute()
{
Q_D(XNUDPService);
XNServiceObject::OnPrepareForExecute();
XNServiceObject::PrepareForExecute();
T_D();
// 初始化UDP socket
d->udpSocket = new QUdpSocket(this);
// 绑定本地端口
if (!d->udpSocket->bind(QHostAddress::Any, d->localPort)) {
LOG_WARNING("UDP socket bind failed on port:%1", d->localPort);
d->udpSocket = socket(AF_INET, SOCK_DGRAM, 0);
if (d->udpSocket < 0) {
LOG_WARNING("Failed to create UDP socket");
return;
}
// 连接UDP socket的信号
connect(d->udpSocket, &QUdpSocket::readyRead, this, &XNUDPService::HandleIncomingData);
// 设置非阻塞模式
int flags = fcntl(d->udpSocket, F_GETFL, 0);
fcntl(d->udpSocket, F_SETFL, flags | O_NONBLOCK);
// 绑定本地端口
struct sockaddr_in localAddr;
memset(&localAddr, 0, sizeof(localAddr));
localAddr.sin_family = AF_INET;
localAddr.sin_addr.s_addr = INADDR_ANY;
localAddr.sin_port = htons(d->localPort);
if (bind(d->udpSocket, (struct sockaddr *)&localAddr, sizeof(localAddr)) < 0) {
LOG_WARNING("UDP socket bind failed on port:%d", d->localPort);
close(d->udpSocket);
d->udpSocket = -1;
return;
}
RegisterRTEventHandler("SendUDPData",
std::bind(&XNUDPService::SendData, this, std::placeholders::_1));
@ -80,37 +111,51 @@ void XNUDPService::OnPrepareForExecute()
void XNUDPService::HandleIncomingData()
{
Q_D(XNUDPService);
while (d->udpSocket->hasPendingDatagrams()) {
QByteArray datagram;
datagram.resize(d->udpSocket->pendingDatagramSize());
QHostAddress sender;
quint16 senderPort;
T_D();
if (d->udpSocket < 0)
return;
d->udpSocket->readDatagram(datagram.data(), datagram.size(), &sender, &senderPort);
char buffer[65536];
struct sockaddr_in senderAddr;
socklen_t senderLen = sizeof(senderAddr);
if (datagram.size() <= 6) {
LOG_WARNING("Invalid size of UDP datagram received, size:%1", datagram.size());
while (true) {
ssize_t bytesRead = recvfrom(d->udpSocket, buffer, sizeof(buffer), 0,
(struct sockaddr *)&senderAddr, &senderLen);
if (bytesRead <= 0) {
if (errno == EAGAIN || errno == EWOULDBLOCK) {
break; // 没有更多数据
}
LOG_WARNING("Error reading from UDP socket");
break;
}
if (bytesRead <= 6) {
LOG_WARNING("Invalid size of UDP datagram received, size:%zd", bytesRead);
continue;
}
// 使用处理后的数据
quint8 header = (quint8)datagram[0];
quint8 type = (quint8)datagram[1];
quint8 subType1 = (quint8)datagram[2];
quint8 subType2 = (quint8)datagram[3];
quint16 size = (quint8)datagram[4] << 8 | (quint8)datagram[5];
// 解析数据包头
uint8_t header = buffer[0];
uint8_t type = buffer[1];
uint8_t subType1 = buffer[2];
uint8_t subType2 = buffer[3];
uint16_t size = (buffer[4] << 8) | buffer[5];
if (header != 0x0b) {
LOG_WARNING("Invalid header of UDP datagram received, header:%1", header);
LOG_WARNING("Invalid header of UDP datagram received, header:%d", header);
continue;
}
if (datagram.size() < size) {
LOG_WARNING("Invalid size of UDP datagram received, size:%1, expected:%2",
datagram.size(), size);
if (bytesRead < size) {
LOG_WARNING("Invalid size of UDP datagram received, size:%zd, expected:%d", bytesRead,
size);
continue;
}
std::vector<uint8_t> datagram(buffer, buffer + bytesRead);
if (type == 0x04) {
if (subType1 == 0x00 && subType2 == 0x00) {
TriggerRTEvent("ATA04AeroInput", datagram);
@ -123,26 +168,29 @@ void XNUDPService::HandleIncomingData()
continue;
}
}
// TODO: 根据具体需求处理其它数据
TriggerRTEvent("ReceiveUDPData", datagram);
}
}
void XNUDPService::SendData(const QVariant &data)
void XNUDPService::SendData(const std::any &data)
{
Q_D(XNUDPService);
if (!d->udpSocket) {
T_D();
if (d->udpSocket < 0) {
LOG_WARNING("UDP socket not initialized");
return;
}
// 将QVariant转换为字节数组
QByteArray datagram = data.toByteArray();
struct sockaddr_in targetAddr;
memset(&targetAddr, 0, sizeof(targetAddr));
targetAddr.sin_family = AF_INET;
targetAddr.sin_port = htons(d->targetPort);
inet_pton(AF_INET, d->targetHost.c_str(), &targetAddr.sin_addr);
// 发送数据
qint64 bytesSent =
d->udpSocket->writeDatagram(datagram, QHostAddress(d->targetHost), d->targetPort);
if (bytesSent == -1) {
LOG_WARNING("Failed to send UDP datagram:%1", d->udpSocket->errorString());
XNByteArray packet = std::any_cast<XNByteArray>(data);
ssize_t bytesSent = sendto(d->udpSocket, packet.data(), packet.size(), 0,
(struct sockaddr *)&targetAddr, sizeof(targetAddr));
if (bytesSent < 0) {
LOG_WARNING("Failed to send UDP datagram: %s", strerror(errno));
}
}

View File

@ -1,29 +1,27 @@
#pragma once
#include "XNUDPService_global.h"
#include <XNCore/XNServiceObject.h>
#include <QVariant>
class XNUDPServicePrivate;
#include <string>
#include <memory>
struct XNUDPServicePrivate;
class XNUDPSERVICE_EXPORT XNUDPService : public XNServiceObject
{
Q_OBJECT
Q_DISABLE_COPY(XNUDPService)
Q_DECLARE_PRIVATE(XNUDPService)
XN_DECLARE_DDS_SERVICE()
XN_METATYPE(XNUDPService, XNServiceObject)
XN_DECLARE_PRIVATE(XNUDPService)
public:
explicit XNUDPService(QObject *parent = nullptr);
explicit XNUDPService();
virtual ~XNUDPService();
protected:
XNUDPService(XNUDPServicePrivate &dd, QObject *parent = nullptr);
public slots:
virtual void OnInitialize() override;
virtual void OnPrepareForExecute() override;
void HandleIncomingData();
XNUDPService(PrivateType *p);
public:
void SendData(const QVariant &data);
virtual void Initialize() override;
virtual void PrepareForExecute() override;
void HandleIncomingData();
void SendData(const std::any &data);
};
Q_DECLARE_METATYPE(XNUDPService)
XNCLASS_PTR_DECLARE(XNUDPService)

View File

@ -1,12 +1,10 @@
#ifndef XNUDPSERVICE_GLOBAL_H
#define XNUDPSERVICE_GLOBAL_H
#include <QtCore/qglobal.h>
#if defined(XNUDPSERVICE_LIBRARY)
# define XNUDPSERVICE_EXPORT Q_DECL_EXPORT
# define XNUDPSERVICE_EXPORT __attribute__((visibility("default")))
#else
# define XNUDPSERVICE_EXPORT Q_DECL_IMPORT
# define XNUDPSERVICE_EXPORT __attribute__((visibility("default")))
#endif
#endif // XNUDPSERVICE_GLOBAL_H

View File

@ -1,17 +1,15 @@
#pragma once
#include <XNCore/XNServiceObject_p.h>
#include <QUdpSocket>
#include <QString>
#include <string>
#include <memory>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
class XNUDPServicePrivate : public XNServiceObjectPrivate
{
public:
Q_DECLARE_PUBLIC(XNUDPService)
XNUDPServicePrivate(XNUDPService *q) : XNServiceObjectPrivate(q) {}
QUdpSocket *udpSocket{nullptr};
QString targetHost;
quint16 targetPort{0};
quint16 localPort{0};
struct XNUDPServicePrivate : public XNServiceObjectPrivate {
int udpSocket{-1};
std::string targetHost;
uint16_t targetPort{0};
uint16_t localPort{0};
};