diff --git a/src/mqtt_client_wrapper.cpp b/src/mqtt_client_wrapper.cpp index d7e12d4..167a3fd 100644 --- a/src/mqtt_client_wrapper.cpp +++ b/src/mqtt_client_wrapper.cpp @@ -30,6 +30,24 @@ static void on_mqtt_message_received(const std::string &topic, const std::string { if (topic == g_app_config.mqtt.topics.video_down) { + LOG_INFO("[MQTT] Step 1: parsing json"); + auto j = nlohmann::json::parse(message); + + LOG_INFO("[MQTT] Step 2: checking data field"); + if (!j.contains("data")) + { + LOG_WARN("[MQTT] missing data"); + return; + } + if (!j["data"].contains("status")) + { + LOG_WARN("[MQTT] missing status"); + return; + } + + int status = j["data"]["status"].get(); + LOG_INFO("[MQTT] Step 3: got status=" + std::to_string(status)); + // 处理 video_down auto j = nlohmann::json::parse(message);