5b2d420e71
- Node control server now accepts HTTP POST /cmd for command dispatch (in addition to existing WebSocket control) - Added NodeControlClient: engine sends commands to nodes via HTTP POST - New REST endpoints: POST /api/graph/nodes/:id/connect-input - connect node input to MXL flow POST /api/graph/nodes/:id/connect-output - create new MXL flow + connect output POST /api/graph/nodes/:id/disconnect-port - remove reader/writer POST /api/graph/nodes/:id/command - send raw command to node - Flow IDs now use proper UUID v4 format (MXL requires standard UUIDs) - Flow definitions use NMOS format (urn:x-nmos:format:video) - Engine passes --mxl-domain to node processes - User-provided node IDs (via 'id' field in POST body) - End-to-end verified: testsrc → passthrough → new MXL output flow
34 lines
962 B
C++
34 lines
962 B
C++
#pragma once
|
|
|
|
#include <dmf-engine/graph.hpp>
|
|
|
|
#include <functional>
|
|
#include <memory>
|
|
#include <string>
|
|
|
|
struct lws_context;
|
|
|
|
namespace dmf_engine {
|
|
|
|
using RequestHandler = std::function<std::string(const std::string& method, const std::string& path, const std::string& body)>;
|
|
|
|
class ApiServer {
|
|
public:
|
|
ApiServer(uint16_t port, Graph& graph, class FlowManager& flow_manager, class ProcessManager& process_manager, class NodeControlClient& control_client, const std::string& mxl_domain = "/dev/shm/mxl");
|
|
~ApiServer();
|
|
|
|
ApiServer(const ApiServer&) = delete;
|
|
ApiServer& operator=(const ApiServer&) = delete;
|
|
|
|
void poll(int timeout_ms);
|
|
|
|
private:
|
|
void handle_rest(const std::string& method, const std::string& path, const std::string& body,
|
|
std::string& response_status, std::string& response_content_type, std::string& response_body);
|
|
|
|
struct Impl;
|
|
std::unique_ptr<Impl> impl_;
|
|
};
|
|
|
|
} // namespace dmf_engine
|