first commit
This commit is contained in:
parent
0165a8893f
commit
e9b4fbb3d8
@ -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<int>();
|
||||
LOG_INFO("[MQTT] Step 3: got status=" + std::to_string(status));
|
||||
|
||||
// 处理 video_down
|
||||
auto j = nlohmann::json::parse(message);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user