feat(vd960DBN)+fix(DBNMQTTool): log_query 改 hex 原始字节上报 (2026-08-18)
背景: MQTT 快照流实测 MQTTSerialize_publish failed — JSON 化快照记录 ~810B/条 超 800B 发送缓冲
方案(用户拍板): 对齐 BLE 通道, 原始字节 hex 上报
固件 (V4.3):
- offlog.c/h: 新增 offlog_evt_to_hex() (32B→64 hex)
- snapshot.c/h: 新增 snap_rec_to_hex() (64B→128 hex); 删 SNAP_MAX_QUERY_JSON, 恢复 count=2
- tcp_json_srv.c / iot_mqtt_srv.c: log_query 改 {"seq":N,"hex":"..."}; SEND_BUF 保持 800
- 2 条快照 hex 响应 406B < 800B
文档: TCP JSON V1.03 / MQTT V1.07 §4.17 records 改 hex + 解析表引用 BLE §6.4/§7
工具: parse_offlog_hex/parse_snap_hex/offlog_payload_desc + hex 展示; 验证: gcc 9 断言 + 工具解析全过 + offscreen UI
This commit is contained in:
@@ -489,3 +489,17 @@ void offlog_clear(void)
|
||||
offlog_evt(OFFLOG_EVT_LOG_CLEAR, NULL, 0);
|
||||
offlog_flush_head();
|
||||
}
|
||||
|
||||
/* OfflogEvt -> hex string (flash 原始字节, 小端原样; 上位机按 BLE 协议 §7 字段表解析)
|
||||
Used by TCP JSON / MQTT log_query stream=event (protocol V1.03/V1.07).
|
||||
Returns snprintf written length; 32B -> 64 hex chars. */
|
||||
int offlog_evt_to_hex(const OfflogEvt *e, char *buf, int buf_len)
|
||||
{
|
||||
int i, pos = 0;
|
||||
const uint8_t *p = (const uint8_t *)e;
|
||||
for (i = 0; i < (int)sizeof(OfflogEvt); i++) {
|
||||
if (pos >= buf_len - 3) break;
|
||||
pos += snprintf(buf + pos, buf_len - pos, "%02x", p[i]);
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user