64 lines
2.5 KiB
C++
64 lines
2.5 KiB
C++
#include "Aerodynamics_output.hpp"
|
||
namespace XNSim::C909::ATA04
|
||
{
|
||
Aerodynamics_output_Interface::Aerodynamics_output_Interface()
|
||
{
|
||
MAP_DATA_FUNC(l_04_o_aerocomac_fxb_f8);
|
||
MAP_DATA_FUNC(l_04_o_aerocomac_fyb_f8);
|
||
MAP_DATA_FUNC(l_04_o_aerocomac_fzb_f8);
|
||
MAP_DATA_FUNC(l_04_o_aerocomac_mxb_f8);
|
||
MAP_DATA_FUNC(l_04_o_aerocomac_myb_f8);
|
||
MAP_DATA_FUNC(l_04_o_aerocomac_mzb_f8);
|
||
MAP_DATA_FUNC(l_04_o_aerocomac_cls_f8);
|
||
MAP_DATA_FUNC(l_04_o_aerocomac_cl_f8);
|
||
MAP_DATA_FUNC(l_04_o_aerocomac_cd_f8);
|
||
MAP_DATA_FUNC(l_04_o_aerocomac_cm_f8);
|
||
MAP_DATA_FUNC(l_04_o_aerocomac_cr_f8);
|
||
MAP_DATA_FUNC(l_04_o_aerocomac_cy_f8);
|
||
MAP_DATA_FUNC(l_04_o_aerocomac_cn_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] = 0x00; // 结构体头,0x00表示输入结构体
|
||
this->header[5] = 0x00; // 数据方向,0x00表示外部输入
|
||
this->header[6] = 0x00; // 数据大小
|
||
this->header[7] = 0x00; // 数据大小
|
||
}
|
||
Aerodynamics_output_Interface::~Aerodynamics_output_Interface()
|
||
{
|
||
}
|
||
void Aerodynamics_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::Aerodynamics_outputPubSubType>("XNSim::C909::ATA04::Aerodynamics_output", modelId);
|
||
ddsManager->RegisterSubscriber<XNSim::C909::ATA04::Aerodynamics_outputPubSubType>("XNSim::C909::ATA04::Aerodynamics_output", modelId, std::bind(&Aerodynamics_output_Interface::inputDataListener, this, std::placeholders::_1));
|
||
}
|
||
else if (DDS_type == 1) {
|
||
ddsManager->RegisterSubscriber<XNSim::C909::ATA04::Aerodynamics_outputPubSubType>("XNSim::C909::ATA04::Aerodynamics_output", modelId, std::bind(&Aerodynamics_output_Interface::inputDataListener, this, std::placeholders::_1));
|
||
}
|
||
else if (DDS_type == 2) {
|
||
dataWriter = ddsManager->RegisterPublisher<XNSim::C909::ATA04::Aerodynamics_outputPubSubType>("XNSim::C909::ATA04::Aerodynamics_output", modelId);
|
||
}
|
||
}
|
||
void Aerodynamics_output_Interface::clearOutData()
|
||
{
|
||
this->out_data = XNSim::C909::ATA04::Aerodynamics_output();
|
||
}
|
||
void Aerodynamics_output_Interface::sendOutData()
|
||
{
|
||
if (dataWriter) {
|
||
dataWriter->write(&this->out_data);
|
||
}
|
||
}
|
||
void Aerodynamics_output_Interface::inputDataListener(const XNSim::C909::ATA04::Aerodynamics_output &input)
|
||
{
|
||
this->data = input;
|
||
}
|
||
}
|