From 88ff6f8b1634d6a819898d05861f12c86324d4af Mon Sep 17 00:00:00 2001 From: cxh Date: Thu, 13 Nov 2025 13:11:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BF=83=E8=B7=B3=E4=B8=8A?= =?UTF-8?q?=E6=8A=A5=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.json | 18 +++++++++--------- src/mqtt_client_wrapper.cpp | 10 +++++----- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/config.json b/config.json index 897477a..bafbb75 100644 --- a/config.json +++ b/config.json @@ -6,7 +6,7 @@ "need_username_pwd": true, "client_id": "20004_vehmedia", "username": "20004_4A:69:BE:32:59:AE", - "password": "31d6bb29f177d5bf8560756c0f0e63c63fd412e52c5b9ea59476024eab893884a5f34f0637e0fe3ad42b802c16edb6feb37cde613957c3540c060c07b230cb0aa6b4547bb86fcae43d484179d3a11a1969a2f367ec0ceede4c10510757a89927af4c2d0c0484476be3241a9ff9242e7401f3fbcd824b5cfb19674663b7045e32dd2f97b4", + "password": "Zxwl1234@", "mqtt_heart_threshold": 1000 }, "cameras": [ @@ -14,7 +14,7 @@ "device": "/dev/video0", "name": "AHD1", "enabled": true, - "resolution": "960p", + "bitrate": 2000000, "width": 1280, "height": 960, "fps": 30 @@ -23,7 +23,7 @@ "device": "/dev/video1", "name": "AHD2", "enabled": true, - "resolution": "960p", + "bitrate": 2000000, "width": 1280, "height": 960, "fps": 30 @@ -32,7 +32,7 @@ "device": "/dev/video2", "name": "AHD3", "enabled": true, - "resolution": "960p", + "bitrate": 2000000, "width": 1280, "height": 960, "fps": 30 @@ -41,7 +41,7 @@ "device": "/dev/video3", "name": "AHD4", "enabled": true, - "resolution": "960p", + "bitrate": 2000000, "width": 1280, "height": 960, "fps": 30 @@ -50,7 +50,7 @@ "device": "/dev/video11", "name": "AHD5", "enabled": true, - "resolution": "960p", + "bitrate": 2000000, "width": 1280, "height": 960, "fps": 30 @@ -59,7 +59,7 @@ "device": "/dev/video12", "name": "AHD6", "enabled": true, - "resolution": "960p", + "bitrate": 2000000, "width": 1280, "height": 960, "fps": 30 @@ -68,7 +68,7 @@ "device": "/dev/video13", "name": "AHD7", "enabled": true, - "resolution": "960p", + "bitrate": 2000000, "width": 1280, "height": 960, "fps": 30 @@ -77,7 +77,7 @@ "device": "/dev/video14", "name": "AHD8", "enabled": true, - "resolution": "960p", + "bitrate": 2000000, "width": 1280, "height": 960, "fps": 30 diff --git a/src/mqtt_client_wrapper.cpp b/src/mqtt_client_wrapper.cpp index e17852c..ebd7264 100644 --- a/src/mqtt_client_wrapper.cpp +++ b/src/mqtt_client_wrapper.cpp @@ -31,7 +31,7 @@ static void send_heartbeat() int total = static_cast(channels_info.size()); int running_count = 0; - for (const auto &ch : channels_info) + for (const auto& ch : channels_info) { nlohmann::json item; item["loc"] = ch.loc; @@ -39,7 +39,7 @@ static void send_heartbeat() if (ch.running) { - item["url"] = ch.url; + item["reason"] = nullptr; running_count++; } else @@ -67,7 +67,7 @@ static void on_mqtt_connected() { LOG_INFO("[MQTT] Connected to broker: " + g_ap static void on_mqtt_disconnected() { LOG_WARN("[MQTT] Disconnected from broker: " + g_app_config.mqtt.server_ip); } -static void on_mqtt_message_received(const std::string &topic, const std::string &message) +static void on_mqtt_message_received(const std::string& topic, const std::string& message) { try { @@ -76,7 +76,7 @@ static void on_mqtt_message_received(const std::string &topic, const std::string LOG_INFO("[MQTT] Received message on topic [" + topic + "], len = " + std::to_string(message.size())); LOG_INFO("[MQTT] Message content: " + j.dump(-1)); } - catch (const std::exception &e) + catch (const std::exception& e) { LOG_ERROR(std::string("[MQTT] Failed to process incoming JSON: ") + e.what()); } @@ -84,7 +84,7 @@ static void on_mqtt_message_received(const std::string &topic, const std::string void mqtt_client_thread_func() { - const auto &cfg = g_app_config.mqtt; + const auto& cfg = g_app_config.mqtt; auto heartbeat_interval = std::chrono::milliseconds(static_cast(cfg.keep_alive * 0.9)); while (g_running)