This commit is contained in:
cxh 2025-11-14 15:04:12 +08:00
parent ba07a6fe15
commit 16a05d9fc6
2 changed files with 6 additions and 0 deletions

View File

@ -38,11 +38,15 @@ struct VehicleMQTTTopics
{
std::string heartbeat_up;
std::string video_down;
std::string record_query;
std::string record_play;
void fill_with_veh_id(const std::string& vehId)
{
heartbeat_up = "/kun/vehicle/video/status/" + vehId;
video_down = "/kun/vehicle/video/request/" + vehId;
record_query = "/kun/vehicle/video/record/query/" + vehId;
record_play = "/kun/vehicle/video/record/play/" + vehId;
}
};

View File

@ -67,6 +67,8 @@ static void on_mqtt_connected()
{
LOG_INFO("[MQTT] Connected to broker: " + g_app_config.mqtt.server_ip);
mqtt_client->subscribe(g_app_config.mqtt.topics.video_down);
mqtt_client->subscribe(g_app_config.mqtt.topics.record_query);
mqtt_client->subscribe(g_app_config.mqtt.topics.record_play);
}
static void on_mqtt_disconnected() { LOG_WARN("[MQTT] Disconnected from broker: " + g_app_config.mqtt.server_ip); }