年前提交

This commit is contained in:
2026-02-08 08:58:29 +08:00
commit a4a03b3533
113 changed files with 60809 additions and 0 deletions

47
http_server.h Normal file
View File

@@ -0,0 +1,47 @@
#ifndef HTTP_SERVER_H
#define HTTP_SERVER_H
#include <QString>
#include <QDebug>
#include <QTimer>
#include "mongoose.h"
#include "hk-net-sdk.h"
#include "camera.h"
#include "camera_info.h"
class HttpServer : public QObject
{
Q_OBJECT
public:
/**
* 单例
*/
static HttpServer& instance();
/**
* 启动服务
*/
void start(const QString &host, int port);
/**
* 停止服务
*/
void stop();
private:
HttpServer() = default;
~HttpServer();
HttpServer(const HttpServer&) = delete;
HttpServer& operator=(const HttpServer&) = delete;
struct mg_mgr mgr;
QTimer *timer{nullptr};
static void ev_handler(struct mg_connection *c, int ev, void *ev_data);
static QHash<unsigned long, Camera*> sockets;
};
#endif // HTTP_SERVER_H