feat: MQTT 双主题同步到 vd960DBN 固件 + DBNMQTTool devlog
vd960DBN 固件改动:
- net_srv.h: 默认 topic 改为 dld960/{sn}/srv + dld960/{sn}/dev
- net_srv.c: dg_subscribe_display_topic() 直接用 topic_sub 订阅(不再追加 client_id/sn 后缀)
- net_srv.c: mqtt_deserialize_publish() topic 过滤改用 g_iot_topic.topic_sub(不再硬编码 TOPIC_DEFAULT_SUBSCRIBE)
DBNMQTTool 文档:
- devlog.md: 清理过期 topic 引用语义
This commit is contained in:
@@ -32,8 +32,8 @@
|
||||
#define COM_LSSC_UDP_PORT 5500
|
||||
#define COM_DEV_MESSAGE_PORT 4900 //udp dev local message port
|
||||
|
||||
#define TOPIC_DEFAULT_SUBSCRIBE "ptpc/display"
|
||||
#define TOPIC_DEFAULT_PUBLISH "gtpc/display/Initialize"
|
||||
#define TOPIC_DEFAULT_SUBSCRIBE "dld960/{sn}/srv"
|
||||
#define TOPIC_DEFAULT_PUBLISH "dld960/{sn}/dev"
|
||||
|
||||
#define UART_BAUD_DEFAULT_PORT_1 115200 // ��Loop MCU ͨ�ŵIJ����� TTL, g_storage_uart_baud_1
|
||||
#define UART_BAUD_DEFAULT_PORT_2 115200 // baud2 TTL g_storage_uart_baud_2
|
||||
|
||||
@@ -137,17 +137,13 @@ void dg_subscribe_display_topic(void)
|
||||
}
|
||||
memset(mBuff, 0, 256);
|
||||
|
||||
if(g_iot_topic.clientid_enable)
|
||||
{
|
||||
sprintf(mBuff, "%s/%s", g_iot_topic.topic_sub, iot_net_info.client_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(mBuff, "%s/%s", g_iot_topic.topic_sub, g_dev_number_str);
|
||||
}
|
||||
// V1.01: 双主题协议 — topic_sub 即为完整订阅主题,不再追加后缀
|
||||
strcpy(mBuff, (char *)g_iot_topic.topic_sub);
|
||||
|
||||
{
|
||||
PRINT("\r\nWill subscribe display_topic:\n%s\r\n", mBuff);
|
||||
PRINT("
|
||||
\nWill subscribe display_topic:\n%s
|
||||
\n", mBuff);
|
||||
}
|
||||
MQTT_Subscribe(mBuff, 1);
|
||||
|
||||
@@ -225,9 +221,11 @@ void mqtt_deserialize_publish(char* topic, char* msg, int length)
|
||||
{
|
||||
// if(g_flag_debug)
|
||||
// {
|
||||
// printf("display_mqtt_callback rev topic: %s\n msg:%s, len:%d\r\n", topic, msg, length);
|
||||
// printf("display_mqtt_callback rev topic: %s\n msg:%s, len:%d
|
||||
\n", topic, msg, length);
|
||||
// }
|
||||
if(strstr(topic, (char *)TOPIC_DEFAULT_SUBSCRIBE) != NULL) //
|
||||
// V1.01: 使用配置的 topic_sub 匹配,而非硬编码默认值
|
||||
if(strstr(topic, (char *)g_iot_topic.topic_sub) != NULL)
|
||||
{
|
||||
manage_mqtt_recv_message(msg, length);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user