feat: IoT MQTT 客户端实现 — NET_SSC_ENABLE=0 时启用

新增文件:
- iot_mqtt_srv.h/c: MQTT 客户端 (TCP→CONNECT→SUBSCRIBE→READY)
  支持: dev_info_query, pwd_verify (其他命令框架预留)
  上报: loop_data (传感器), heartbeat (心跳 60s)
  断线重连: 指数退避 5s~60s
  协议: DLD960 IoT MQTT V1.00 (dld960/{sn}/...)

修改:
- net_config.h: 新增 NET_IOT_ENABLE = !NET_SSC_ENABLE,
  IoT 模式分配 1 TCP socket (MQTT client)
- net_srv.c: IoT 初始化 + socket 中断路由
- peripheral_main.c: IoT poll + sensor publish 调用

模式:
  NET_SSC_ENABLE=1 → SCC + TCP JSON Server (原有行为)
  NET_SSC_ENABLE=0 → IoT MQTT Client (新增)
This commit is contained in:
wangfq
2026-07-03 17:36:22 +08:00
parent a73a9392bd
commit 9629729dc9
5 changed files with 718 additions and 7 deletions
@@ -24,6 +24,9 @@
#include "storage.h"
#include "tcp_json_srv.h"
#include "loop_uart_proto.h"
#if NET_IOT_ENABLE
#include "iot_mqtt_srv.h"
#endif
/*********************************************************************
* GLOBAL TYPEDEFS
@@ -270,9 +273,13 @@ void Main_Circulation(void)
poll_dbn_ble();
#if NET_IOT_ENABLE
iot_mqtt_publish_sensor(); // Push 0xC0 sensor data to MQTT broker
iot_mqtt_poll(); // IoT MQTT state machine + heartbeat
#else
tcp_json_push_sensor(); // Push 0xC0 sensor data to TCP JSON client
tcp_json_poll();
#endif
key_event_srv();
}