37 lines
753 B
Plaintext
37 lines
753 B
Plaintext
#ifndef HTTP_SERVER_H_
|
|
#define HTTP_SERVER_H_
|
|
|
|
#include <httplib.h>
|
|
#include "color.h"
|
|
#include "conveyorBeltController.hpp"
|
|
#include <glog/logging.h>
|
|
#include <json/json.h>
|
|
#include <map>
|
|
#include <memory>
|
|
#include <thread>
|
|
|
|
class HttpServer {
|
|
public:
|
|
|
|
// 构造函数,接收 ConveyorBeltController 的引用
|
|
explicit HttpServer(ConveyorBeltController& controller);
|
|
|
|
void Init();
|
|
void Run();
|
|
|
|
private:
|
|
// http服务器
|
|
std::shared_ptr<httplib::Server> server;
|
|
|
|
// 控制器
|
|
//std::shared_ptr<ConveyorBeltController> controller;
|
|
|
|
std::map<int, int> directionMap;
|
|
std::map<int, std::string> ipMap;
|
|
|
|
// 引用 ConveyorBeltController 实例
|
|
ConveyorBeltController& controller;
|
|
};
|
|
|
|
#endif // HTTP_SERVER_H_
|