修改心跳上报内容

This commit is contained in:
cxh 2025-11-13 13:11:24 +08:00
parent af37638f87
commit 88ff6f8b16
2 changed files with 14 additions and 14 deletions

View File

@ -6,7 +6,7 @@
"need_username_pwd": true, "need_username_pwd": true,
"client_id": "20004_vehmedia", "client_id": "20004_vehmedia",
"username": "20004_4A:69:BE:32:59:AE", "username": "20004_4A:69:BE:32:59:AE",
"password": "31d6bb29f177d5bf8560756c0f0e63c63fd412e52c5b9ea59476024eab893884a5f34f0637e0fe3ad42b802c16edb6feb37cde613957c3540c060c07b230cb0aa6b4547bb86fcae43d484179d3a11a1969a2f367ec0ceede4c10510757a89927af4c2d0c0484476be3241a9ff9242e7401f3fbcd824b5cfb19674663b7045e32dd2f97b4", "password": "Zxwl1234@",
"mqtt_heart_threshold": 1000 "mqtt_heart_threshold": 1000
}, },
"cameras": [ "cameras": [
@ -14,7 +14,7 @@
"device": "/dev/video0", "device": "/dev/video0",
"name": "AHD1", "name": "AHD1",
"enabled": true, "enabled": true,
"resolution": "960p", "bitrate": 2000000,
"width": 1280, "width": 1280,
"height": 960, "height": 960,
"fps": 30 "fps": 30
@ -23,7 +23,7 @@
"device": "/dev/video1", "device": "/dev/video1",
"name": "AHD2", "name": "AHD2",
"enabled": true, "enabled": true,
"resolution": "960p", "bitrate": 2000000,
"width": 1280, "width": 1280,
"height": 960, "height": 960,
"fps": 30 "fps": 30
@ -32,7 +32,7 @@
"device": "/dev/video2", "device": "/dev/video2",
"name": "AHD3", "name": "AHD3",
"enabled": true, "enabled": true,
"resolution": "960p", "bitrate": 2000000,
"width": 1280, "width": 1280,
"height": 960, "height": 960,
"fps": 30 "fps": 30
@ -41,7 +41,7 @@
"device": "/dev/video3", "device": "/dev/video3",
"name": "AHD4", "name": "AHD4",
"enabled": true, "enabled": true,
"resolution": "960p", "bitrate": 2000000,
"width": 1280, "width": 1280,
"height": 960, "height": 960,
"fps": 30 "fps": 30
@ -50,7 +50,7 @@
"device": "/dev/video11", "device": "/dev/video11",
"name": "AHD5", "name": "AHD5",
"enabled": true, "enabled": true,
"resolution": "960p", "bitrate": 2000000,
"width": 1280, "width": 1280,
"height": 960, "height": 960,
"fps": 30 "fps": 30
@ -59,7 +59,7 @@
"device": "/dev/video12", "device": "/dev/video12",
"name": "AHD6", "name": "AHD6",
"enabled": true, "enabled": true,
"resolution": "960p", "bitrate": 2000000,
"width": 1280, "width": 1280,
"height": 960, "height": 960,
"fps": 30 "fps": 30
@ -68,7 +68,7 @@
"device": "/dev/video13", "device": "/dev/video13",
"name": "AHD7", "name": "AHD7",
"enabled": true, "enabled": true,
"resolution": "960p", "bitrate": 2000000,
"width": 1280, "width": 1280,
"height": 960, "height": 960,
"fps": 30 "fps": 30
@ -77,7 +77,7 @@
"device": "/dev/video14", "device": "/dev/video14",
"name": "AHD8", "name": "AHD8",
"enabled": true, "enabled": true,
"resolution": "960p", "bitrate": 2000000,
"width": 1280, "width": 1280,
"height": 960, "height": 960,
"fps": 30 "fps": 30

View File

@ -31,7 +31,7 @@ static void send_heartbeat()
int total = static_cast<int>(channels_info.size()); int total = static_cast<int>(channels_info.size());
int running_count = 0; int running_count = 0;
for (const auto &ch : channels_info) for (const auto& ch : channels_info)
{ {
nlohmann::json item; nlohmann::json item;
item["loc"] = ch.loc; item["loc"] = ch.loc;
@ -39,7 +39,7 @@ static void send_heartbeat()
if (ch.running) if (ch.running)
{ {
item["url"] = ch.url; item["reason"] = nullptr;
running_count++; running_count++;
} }
else 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_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 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] Received message on topic [" + topic + "], len = " + std::to_string(message.size()));
LOG_INFO("[MQTT] Message content: " + j.dump(-1)); 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()); 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() 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<int>(cfg.keep_alive * 0.9)); auto heartbeat_interval = std::chrono::milliseconds(static_cast<int>(cfg.keep_alive * 0.9));
while (g_running) while (g_running)