feat: 拆分发送和接收功能声明,优化config配置方式

This commit is contained in:
2026-07-26 10:01:30 +08:00
parent c3af3ae4e2
commit 51e081118a
12 changed files with 815 additions and 871 deletions
+51
View File
@@ -0,0 +1,51 @@
/**
* @file datarouter_config_template.h
* @brief 数据路由配置模板 —— 复制此文件到项目目录并修改
*
* 使用方法:
* 1. 将此文件复制到你的项目目录,重命名为 datarouter_config.h
* 2. 修改下面的 DATAROUTER_SEND_CAPABILITIES 和 DATAROUTER_RECV_CAPABILITIES
* 3. 编译时添加 -I /path/to/your/project
* 4. 库将自动使用你的配置,无需修改库源代码
*
* 格式说明:
* 发送能力:DATAROUTER_SEND(标识符, "描述")
* 接收能力:DATAROUTER_RECV(标识符, "描述")
*
* 标识符只能包含字母、数字、下划线。
* 描述为字符串字面量。
*
* 示例配置:
* // 传感器设备:只需发送
* #define DATAROUTER_SEND_CAPABILITIES \
* DATAROUTER_SEND(sensor, "Sensor data report")
* #define DATAROUTER_RECV_CAPABILITIES
*
* // 遥控设备:只需接收
* #define DATAROUTER_SEND_CAPABILITIES
* #define DATAROUTER_RECV_CAPABILITIES \
* DATAROUTER_RECV(command, "Remote command")
*
* // 网关设备:同时收发
* #define DATAROUTER_SEND_CAPABILITIES \
* DATAROUTER_SEND(status, "Status report")
* #define DATAROUTER_RECV_CAPABILITIES \
* DATAROUTER_RECV(config, "Configuration update")
*/
#ifndef DATAROUTER_CONFIG_H
#define DATAROUTER_CONFIG_H
/* ========== 在此声明你的发送能力 ========== */
#define DATAROUTER_SEND_CAPABILITIES \
DATAROUTER_SEND(sensor, "Sensor data report") \
DATAROUTER_SEND(status, "Device status report")
/* ========== 在此声明你的接收能力 ========== */
#define DATAROUTER_RECV_CAPABILITIES \
DATAROUTER_RECV(rtcm, "RTCM correction data") \
DATAROUTER_RECV(command, "Remote control command")
#endif /* DATAROUTER_CONFIG_H */