feat(vd960DBN)+fix(DBNMQTTool): MQTT 查询命令补齐 + 工具命令集对齐 (2026-08-18)
固件 (V4.2): - iot_mqtt_srv.c 补齐 ssc_net_query / iot_net_query / iot_topic_query (只读全局组包, 与 TCP JSON §4.5/4.7/4.9 对齐) - 修复实测: MQTT 通道 ssc_net_query/iot_net_query 返回 code=4 unsupported 工具: - 禁用固件未实现的 6 个按钮 (ssc/iot_net/iot_topic_set + pwd_set/factory_reset/device_reset) + tooltip 引导 TCP/BLE - 设备刷新列表移除 loop_param_query (固件未实现) - offscreen 验证按钮状态正确
This commit is contained in:
@@ -671,6 +671,56 @@ static void iot_handle_publish(const char *topic, uint8_t *payload, int payload_
|
||||
msg_id, dev_time_now());
|
||||
iot_mqtt_publish(resp_topic, resp, strlen(resp), 1);
|
||||
|
||||
} else if (strcmp(cmd_str, "ssc_net_query") == 0) {
|
||||
/* SSC 网络配置查询 (只读全局, 协议 V1.02) */
|
||||
char resp[400];
|
||||
snprintf(resp, sizeof(resp),
|
||||
"{\"msg_id\":%lu,\"cmd\":\"ssc_net_query\","
|
||||
"\"ts\":%lu,\"code\":0,\"msg\":\"success\","
|
||||
"\"data\":{\"dev_ip\":\"%d.%d.%d.%d\",\"subnet_mask\":\"%d.%d.%d.%d\","
|
||||
"\"route_ip\":\"%d.%d.%d.%d\",\"lssc_ip\":\"%d.%d.%d.%d\","
|
||||
"\"dns\":\"%d.%d.%d.%d\",\"port\":%d}}",
|
||||
msg_id, dev_time_now(),
|
||||
local_net_cfg.lip[0], local_net_cfg.lip[1], local_net_cfg.lip[2], local_net_cfg.lip[3],
|
||||
local_net_cfg.sub[0], local_net_cfg.sub[1], local_net_cfg.sub[2], local_net_cfg.sub[3],
|
||||
local_net_cfg.gw[0], local_net_cfg.gw[1], local_net_cfg.gw[2], local_net_cfg.gw[3],
|
||||
net_center_info.lssc_ip[0], net_center_info.lssc_ip[1],
|
||||
net_center_info.lssc_ip[2], net_center_info.lssc_ip[3],
|
||||
local_net_cfg.dns[0], local_net_cfg.dns[1], local_net_cfg.dns[2], local_net_cfg.dns[3],
|
||||
net_center_info.tcp_port);
|
||||
iot_mqtt_publish(resp_topic, resp, strlen(resp), 1);
|
||||
PRINT("IOT: ssc_net_query dev_ip=%d.%d.%d.%d\n",
|
||||
local_net_cfg.lip[0], local_net_cfg.lip[1], local_net_cfg.lip[2], local_net_cfg.lip[3]);
|
||||
|
||||
} else if (strcmp(cmd_str, "iot_net_query") == 0) {
|
||||
/* IoT 网络配置查询 (只读全局) */
|
||||
char resp[400];
|
||||
snprintf(resp, sizeof(resp),
|
||||
"{\"msg_id\":%lu,\"cmd\":\"iot_net_query\","
|
||||
"\"ts\":%lu,\"code\":0,\"msg\":\"success\","
|
||||
"\"data\":{\"host\":\"%s\",\"port\":%d,\"client_id\":\"%s\","
|
||||
"\"username\":\"%s\",\"password\":\"%s\"}}",
|
||||
msg_id, dev_time_now(),
|
||||
iot_net_info.remote_addr, iot_net_info.mqtt_port,
|
||||
iot_net_info.client_id, iot_net_info.username, iot_net_info.password);
|
||||
iot_mqtt_publish(resp_topic, resp, strlen(resp), 1);
|
||||
PRINT("IOT: iot_net_query host=%s port=%d\n",
|
||||
iot_net_info.remote_addr, iot_net_info.mqtt_port);
|
||||
|
||||
} else if (strcmp(cmd_str, "iot_topic_query") == 0) {
|
||||
/* IoT Topic 配置查询 (只读全局) */
|
||||
char resp[300];
|
||||
snprintf(resp, sizeof(resp),
|
||||
"{\"msg_id\":%lu,\"cmd\":\"iot_topic_query\","
|
||||
"\"ts\":%lu,\"code\":0,\"msg\":\"success\","
|
||||
"\"data\":{\"client_id_enable\":%s,\"topic_pub\":\"%s\",\"topic_sub\":\"%s\"}}",
|
||||
msg_id, dev_time_now(),
|
||||
g_iot_topic.clientid_enable ? "true" : "false",
|
||||
g_iot_topic.topic_pub, g_iot_topic.topic_sub);
|
||||
iot_mqtt_publish(resp_topic, resp, strlen(resp), 1);
|
||||
PRINT("IOT: iot_topic_query pub=%s sub=%s\n",
|
||||
g_iot_topic.topic_pub, g_iot_topic.topic_sub);
|
||||
|
||||
} else {
|
||||
// 暂不支持的命令, 返回错误
|
||||
char resp[256];
|
||||
|
||||
Reference in New Issue
Block a user