feat: Service Registry + Bridge 解耦架构 + 全工程代码清理
## 架构升级:Service Registry + Bridge 模式 - 新增 PluginSDK/IPluginServices.h:10 个纯虚服务接口(IDataProvider/ILinkProvider/...) - 新增 MavLinkServiceBridge:单 QObject 实现全部服务,隔离 MavLinkNode 依赖 - 升级 PluginManifest:支持 plugin.json 的 provides/consumes 声明式依赖 - 实现 ExtensionHost::autoWire():元对象自省自动连接信号槽 - 集成到 AppController:initModules() 中创建桥接器并注册到 ServiceRegistry - CockpitPlugin 演示服务发现:initialize() 中通过 PluginContext 查找服务 ## 代码清理 - Plugins/opmap:~280 行死代码(waypointsetting 100行注释块/tilematrix 54行/等27个文件) - Plugins/MavLinkNode:~200 行 GBK 乱码注释翻译为 UTF-8 + 12 行注释死代码 - Plugins/ToolsUI:~222 行死代码(ECU.cpp 82行/INS.cpp 113行/Parse/ToolsUI 等) - StatusUI/Setting/MissionUI:~65 行注释死代码 - Cockpit/leftladder.cpp:10 处 GBK 乱码翻译为中文 - 清理头文件注释掉的 #include(19 处)、空 if-else 分支、注释变量声明 ## 编译验证 - [100%] Built target GCS 零错误 - 运行时 timeout 3s 正常退出,无崩溃
This commit is contained in:
@@ -0,0 +1,313 @@
|
||||
#pragma once
|
||||
// MESSAGE ATMO_COMP_EXT PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_ATMO_COMP_EXT 20006
|
||||
|
||||
|
||||
typedef struct __mavlink_atmo_comp_ext_t {
|
||||
float Airspeed; /*< Magnitude of air velocity [m/s]*/
|
||||
float beta; /*< Sideslip angle [rad]*/
|
||||
float alpha; /*< Angle of attack [rad]*/
|
||||
float ps; /*< Static pressure [Pa]*/
|
||||
float qbar; /*< Dynamic pressure [Pa]*/
|
||||
} mavlink_atmo_comp_ext_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_ATMO_COMP_EXT_LEN 20
|
||||
#define MAVLINK_MSG_ID_ATMO_COMP_EXT_MIN_LEN 20
|
||||
#define MAVLINK_MSG_ID_20006_LEN 20
|
||||
#define MAVLINK_MSG_ID_20006_MIN_LEN 20
|
||||
|
||||
#define MAVLINK_MSG_ID_ATMO_COMP_EXT_CRC 215
|
||||
#define MAVLINK_MSG_ID_20006_CRC 215
|
||||
|
||||
|
||||
|
||||
#if MAVLINK_COMMAND_24BIT
|
||||
#define MAVLINK_MESSAGE_INFO_ATMO_COMP_EXT { \
|
||||
20006, \
|
||||
"ATMO_COMP_EXT", \
|
||||
5, \
|
||||
{ { "Airspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_atmo_comp_ext_t, Airspeed) }, \
|
||||
{ "beta", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_atmo_comp_ext_t, beta) }, \
|
||||
{ "alpha", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_atmo_comp_ext_t, alpha) }, \
|
||||
{ "ps", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_atmo_comp_ext_t, ps) }, \
|
||||
{ "qbar", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_atmo_comp_ext_t, qbar) }, \
|
||||
} \
|
||||
}
|
||||
#else
|
||||
#define MAVLINK_MESSAGE_INFO_ATMO_COMP_EXT { \
|
||||
"ATMO_COMP_EXT", \
|
||||
5, \
|
||||
{ { "Airspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_atmo_comp_ext_t, Airspeed) }, \
|
||||
{ "beta", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_atmo_comp_ext_t, beta) }, \
|
||||
{ "alpha", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_atmo_comp_ext_t, alpha) }, \
|
||||
{ "ps", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_atmo_comp_ext_t, ps) }, \
|
||||
{ "qbar", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_atmo_comp_ext_t, qbar) }, \
|
||||
} \
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Pack a atmo_comp_ext message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param Airspeed Magnitude of air velocity [m/s]
|
||||
* @param beta Sideslip angle [rad]
|
||||
* @param alpha Angle of attack [rad]
|
||||
* @param ps Static pressure [Pa]
|
||||
* @param qbar Dynamic pressure [Pa]
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_atmo_comp_ext_pack(uint16_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
float Airspeed, float beta, float alpha, float ps, float qbar)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[MAVLINK_MSG_ID_ATMO_COMP_EXT_LEN];
|
||||
_mav_put_float(buf, 0, Airspeed);
|
||||
_mav_put_float(buf, 4, beta);
|
||||
_mav_put_float(buf, 8, alpha);
|
||||
_mav_put_float(buf, 12, ps);
|
||||
_mav_put_float(buf, 16, qbar);
|
||||
|
||||
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ATMO_COMP_EXT_LEN);
|
||||
#else
|
||||
mavlink_atmo_comp_ext_t packet;
|
||||
packet.Airspeed = Airspeed;
|
||||
packet.beta = beta;
|
||||
packet.alpha = alpha;
|
||||
packet.ps = ps;
|
||||
packet.qbar = qbar;
|
||||
|
||||
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ATMO_COMP_EXT_LEN);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_ATMO_COMP_EXT;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ATMO_COMP_EXT_MIN_LEN, MAVLINK_MSG_ID_ATMO_COMP_EXT_LEN, MAVLINK_MSG_ID_ATMO_COMP_EXT_CRC);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a atmo_comp_ext message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message will be sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param Airspeed Magnitude of air velocity [m/s]
|
||||
* @param beta Sideslip angle [rad]
|
||||
* @param alpha Angle of attack [rad]
|
||||
* @param ps Static pressure [Pa]
|
||||
* @param qbar Dynamic pressure [Pa]
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_atmo_comp_ext_pack_chan(uint16_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
float Airspeed,float beta,float alpha,float ps,float qbar)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[MAVLINK_MSG_ID_ATMO_COMP_EXT_LEN];
|
||||
_mav_put_float(buf, 0, Airspeed);
|
||||
_mav_put_float(buf, 4, beta);
|
||||
_mav_put_float(buf, 8, alpha);
|
||||
_mav_put_float(buf, 12, ps);
|
||||
_mav_put_float(buf, 16, qbar);
|
||||
|
||||
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ATMO_COMP_EXT_LEN);
|
||||
#else
|
||||
mavlink_atmo_comp_ext_t packet;
|
||||
packet.Airspeed = Airspeed;
|
||||
packet.beta = beta;
|
||||
packet.alpha = alpha;
|
||||
packet.ps = ps;
|
||||
packet.qbar = qbar;
|
||||
|
||||
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ATMO_COMP_EXT_LEN);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_ATMO_COMP_EXT;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ATMO_COMP_EXT_MIN_LEN, MAVLINK_MSG_ID_ATMO_COMP_EXT_LEN, MAVLINK_MSG_ID_ATMO_COMP_EXT_CRC);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a atmo_comp_ext struct
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param atmo_comp_ext C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_atmo_comp_ext_encode(uint16_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_atmo_comp_ext_t* atmo_comp_ext)
|
||||
{
|
||||
return mavlink_msg_atmo_comp_ext_pack(system_id, component_id, msg, atmo_comp_ext->Airspeed, atmo_comp_ext->beta, atmo_comp_ext->alpha, atmo_comp_ext->ps, atmo_comp_ext->qbar);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a atmo_comp_ext struct on a channel
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message will be sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param atmo_comp_ext C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_atmo_comp_ext_encode_chan(uint16_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_atmo_comp_ext_t* atmo_comp_ext)
|
||||
{
|
||||
return mavlink_msg_atmo_comp_ext_pack_chan(system_id, component_id, chan, msg, atmo_comp_ext->Airspeed, atmo_comp_ext->beta, atmo_comp_ext->alpha, atmo_comp_ext->ps, atmo_comp_ext->qbar);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a atmo_comp_ext message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param Airspeed Magnitude of air velocity [m/s]
|
||||
* @param beta Sideslip angle [rad]
|
||||
* @param alpha Angle of attack [rad]
|
||||
* @param ps Static pressure [Pa]
|
||||
* @param qbar Dynamic pressure [Pa]
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_atmo_comp_ext_send(mavlink_channel_t chan, float Airspeed, float beta, float alpha, float ps, float qbar)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[MAVLINK_MSG_ID_ATMO_COMP_EXT_LEN];
|
||||
_mav_put_float(buf, 0, Airspeed);
|
||||
_mav_put_float(buf, 4, beta);
|
||||
_mav_put_float(buf, 8, alpha);
|
||||
_mav_put_float(buf, 12, ps);
|
||||
_mav_put_float(buf, 16, qbar);
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATMO_COMP_EXT, buf, MAVLINK_MSG_ID_ATMO_COMP_EXT_MIN_LEN, MAVLINK_MSG_ID_ATMO_COMP_EXT_LEN, MAVLINK_MSG_ID_ATMO_COMP_EXT_CRC);
|
||||
#else
|
||||
mavlink_atmo_comp_ext_t packet;
|
||||
packet.Airspeed = Airspeed;
|
||||
packet.beta = beta;
|
||||
packet.alpha = alpha;
|
||||
packet.ps = ps;
|
||||
packet.qbar = qbar;
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATMO_COMP_EXT, (const char *)&packet, MAVLINK_MSG_ID_ATMO_COMP_EXT_MIN_LEN, MAVLINK_MSG_ID_ATMO_COMP_EXT_LEN, MAVLINK_MSG_ID_ATMO_COMP_EXT_CRC);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a atmo_comp_ext message
|
||||
* @param chan MAVLink channel to send the message
|
||||
* @param struct The MAVLink struct to serialize
|
||||
*/
|
||||
static inline void mavlink_msg_atmo_comp_ext_send_struct(mavlink_channel_t chan, const mavlink_atmo_comp_ext_t* atmo_comp_ext)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
mavlink_msg_atmo_comp_ext_send(chan, atmo_comp_ext->Airspeed, atmo_comp_ext->beta, atmo_comp_ext->alpha, atmo_comp_ext->ps, atmo_comp_ext->qbar);
|
||||
#else
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATMO_COMP_EXT, (const char *)atmo_comp_ext, MAVLINK_MSG_ID_ATMO_COMP_EXT_MIN_LEN, MAVLINK_MSG_ID_ATMO_COMP_EXT_LEN, MAVLINK_MSG_ID_ATMO_COMP_EXT_CRC);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if MAVLINK_MSG_ID_ATMO_COMP_EXT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
|
||||
/*
|
||||
This varient of _send() can be used to save stack space by re-using
|
||||
memory from the receive buffer. The caller provides a
|
||||
mavlink_message_t which is the size of a full mavlink message. This
|
||||
is usually the receive buffer for the channel, and allows a reply to an
|
||||
incoming message with minimum stack space usage.
|
||||
*/
|
||||
static inline void mavlink_msg_atmo_comp_ext_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, float Airspeed, float beta, float alpha, float ps, float qbar)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char *buf = (char *)msgbuf;
|
||||
_mav_put_float(buf, 0, Airspeed);
|
||||
_mav_put_float(buf, 4, beta);
|
||||
_mav_put_float(buf, 8, alpha);
|
||||
_mav_put_float(buf, 12, ps);
|
||||
_mav_put_float(buf, 16, qbar);
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATMO_COMP_EXT, buf, MAVLINK_MSG_ID_ATMO_COMP_EXT_MIN_LEN, MAVLINK_MSG_ID_ATMO_COMP_EXT_LEN, MAVLINK_MSG_ID_ATMO_COMP_EXT_CRC);
|
||||
#else
|
||||
mavlink_atmo_comp_ext_t *packet = (mavlink_atmo_comp_ext_t *)msgbuf;
|
||||
packet->Airspeed = Airspeed;
|
||||
packet->beta = beta;
|
||||
packet->alpha = alpha;
|
||||
packet->ps = ps;
|
||||
packet->qbar = qbar;
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATMO_COMP_EXT, (const char *)packet, MAVLINK_MSG_ID_ATMO_COMP_EXT_MIN_LEN, MAVLINK_MSG_ID_ATMO_COMP_EXT_LEN, MAVLINK_MSG_ID_ATMO_COMP_EXT_CRC);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE ATMO_COMP_EXT UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field Airspeed from atmo_comp_ext message
|
||||
*
|
||||
* @return Magnitude of air velocity [m/s]
|
||||
*/
|
||||
static inline float mavlink_msg_atmo_comp_ext_get_Airspeed(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field beta from atmo_comp_ext message
|
||||
*
|
||||
* @return Sideslip angle [rad]
|
||||
*/
|
||||
static inline float mavlink_msg_atmo_comp_ext_get_beta(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field alpha from atmo_comp_ext message
|
||||
*
|
||||
* @return Angle of attack [rad]
|
||||
*/
|
||||
static inline float mavlink_msg_atmo_comp_ext_get_alpha(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 8);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field ps from atmo_comp_ext message
|
||||
*
|
||||
* @return Static pressure [Pa]
|
||||
*/
|
||||
static inline float mavlink_msg_atmo_comp_ext_get_ps(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 12);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field qbar from atmo_comp_ext message
|
||||
*
|
||||
* @return Dynamic pressure [Pa]
|
||||
*/
|
||||
static inline float mavlink_msg_atmo_comp_ext_get_qbar(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 16);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a atmo_comp_ext message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param atmo_comp_ext C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_atmo_comp_ext_decode(const mavlink_message_t* msg, mavlink_atmo_comp_ext_t* atmo_comp_ext)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
atmo_comp_ext->Airspeed = mavlink_msg_atmo_comp_ext_get_Airspeed(msg);
|
||||
atmo_comp_ext->beta = mavlink_msg_atmo_comp_ext_get_beta(msg);
|
||||
atmo_comp_ext->alpha = mavlink_msg_atmo_comp_ext_get_alpha(msg);
|
||||
atmo_comp_ext->ps = mavlink_msg_atmo_comp_ext_get_ps(msg);
|
||||
atmo_comp_ext->qbar = mavlink_msg_atmo_comp_ext_get_qbar(msg);
|
||||
#else
|
||||
uint8_t len = msg->len < MAVLINK_MSG_ID_ATMO_COMP_EXT_LEN? msg->len : MAVLINK_MSG_ID_ATMO_COMP_EXT_LEN;
|
||||
memset(atmo_comp_ext, 0, MAVLINK_MSG_ID_ATMO_COMP_EXT_LEN);
|
||||
memcpy(atmo_comp_ext, _MAV_PAYLOAD(msg), len);
|
||||
#endif
|
||||
}
|
||||
Reference in New Issue
Block a user