年前提交
This commit is contained in:
47
http_server.h
Normal file
47
http_server.h
Normal 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
|
||||
Reference in New Issue
Block a user