sweeper_video/include/mqtt_client_wrapper.hpp

35 lines
897 B
C++
Raw Normal View History

2025-09-08 15:09:33 +08:00
// mqtt_client_wrapper.hppa
2025-09-08 10:59:08 +08:00
#pragma once
2025-10-15 17:01:43 +08:00
#include <atomic>
#include <memory>
2025-09-08 15:09:33 +08:00
#include "app_config.hpp"
2025-09-08 10:59:08 +08:00
#include "logger.hpp"
#include "mqtt_client.hpp"
#include "rtmp_manager.hpp"
2025-10-15 17:01:43 +08:00
struct VideoPushRequest
{
std::string type; // "request"
std::string seqNo; // 流水号
struct DataItem
{
int switchVal; // 0=开始推流, 1=停止推流
std::vector<int> channels; // 需要推送的视频通道
int streamType; // 0=主码流, 1=子码流
};
std::vector<DataItem> data; // 可以支持多条任务(即一条消息既开又关多通道)
};
2025-09-08 10:59:08 +08:00
2025-09-08 15:09:33 +08:00
// 启动 MQTT 客户端线程(内部自动重连、订阅等)
2025-09-08 10:59:08 +08:00
void mqtt_client_thread_func();
// 外部可访问的 MQTT 客户端指针
extern std::shared_ptr<MQTTClient> mqtt_client;
2025-09-08 15:09:33 +08:00
// 请求 MQTT 客户端重启
extern std::atomic<bool> mqtt_restart_required;