42 lines
778 B
C++
42 lines
778 B
C++
#ifndef KINEMATICS_WEBAPI_H
|
|
#define KINEMATICS_WEBAPI_H
|
|
|
|
#include "utils.h"
|
|
#include "RobotManager.h"
|
|
#include "spc_core.h"
|
|
#include <string>
|
|
#include <atomic>
|
|
#include <functional>
|
|
#include <nlohmann/json.hpp>
|
|
|
|
using json = nlohmann::json;
|
|
|
|
class KinematicsWebAPI
|
|
{
|
|
private:
|
|
std::atomic<bool> running_{false};
|
|
int m_port;
|
|
|
|
std::function<void(const std::string &)> onLog;
|
|
|
|
public:
|
|
KinematicsWebAPI();
|
|
|
|
// 日志函数
|
|
void log(const std::string &message);
|
|
|
|
// 获取当前时间戳
|
|
std::string getCurrentTimestamp();
|
|
|
|
// 处理API请求的主函数
|
|
std::string func(std::string sanitized_body);
|
|
|
|
// 初始化函数
|
|
std::string init_func();
|
|
|
|
// 运行状态检查
|
|
bool is_running() const;
|
|
};
|
|
|
|
#endif // KINEMATICS_WEBAPI_H
|