feat(iot_mqtt): 实现 event_report 平台必答+设备重发 (协议 V1.04); 时间单位统一 50ms
时间单位: - 串口协议 V1.06 / TCP JSON 协议: 杂项时间量、事件 value 由 5ms 修正为 50ms, 对齐 Loop 固件 50ms tick 实现 (TMR15 5ms×10) event_report (iot_mqtt_srv.c + net_srv.c): - 沿检测双路汇聚: Step1 消费路径 + lup 回调覆盖 uart_srv 路径, 不漏帧 - 16 深环形队列, 事件仅 ACK(code=0) 后出队; 溢出丢最旧 - 5s 超时重发同 msg_id/原始 ts ×3 次, 耗尽挂起, 新事件/重连沿合并补报 - 帧消费提前至 READY/enable 之前: 断网期间事件入队, 重连补报 - 线圈断开期间屏蔽 car 沿; loop_restore value=本地计时/50 - msg_id 独立 uint32 计数 (g_iot_msg_id 为 uint8 混用会破坏去重窗口) - net_srv.c ACK 路由: cmd=event_report 回显帧确认出队, 不回 unsupported - gcc 隔离单测 8 组全过 (tests/test_event_report.c), 单包 6 条实测 317B
This commit is contained in:
@@ -1522,6 +1522,16 @@ void manage_mqtt_recv_message(char * msg, int length)
|
||||
return;
|
||||
}
|
||||
|
||||
// --- event_report 平台应答 (V1.04): 回显帧, 确认后出队, 不再回复 ---
|
||||
if(strcmp(cmd_str, "event_report") == 0) {
|
||||
int code = -1;
|
||||
memset(tmp, 0, sizeof(tmp));
|
||||
simple_parse_json(msg, "\"code\"", tmp);
|
||||
if(strlen(tmp) > 0) code = (int)strtol(tmp, NULL, 10);
|
||||
iot_evt_handle_ack(msg_id, code);
|
||||
return; // 应答帧终止于此, 严禁再回 unsupported (否则与平台互相打乒乓)
|
||||
}
|
||||
|
||||
// --- 未支持的命令 ---
|
||||
{
|
||||
char resp[256];
|
||||
|
||||
Reference in New Issue
Block a user