#pragma once #include #include #include #include #include "esp_err.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" namespace gateway { class DaliDomainService; struct GatewayBridgeServiceConfig { bool bridge_enabled{true}; bool modbus_enabled{true}; bool modbus_startup_enabled{false}; bool bacnet_enabled{false}; bool bacnet_startup_enabled{false}; bool cloud_enabled{true}; bool cloud_startup_enabled{false}; uint32_t modbus_task_stack_size{6144}; UBaseType_t modbus_task_priority{4}; uint32_t bacnet_task_stack_size{8192}; UBaseType_t bacnet_task_priority{5}; }; struct GatewayBridgeHttpResponse { esp_err_t err{ESP_OK}; std::string body; }; class GatewayBridgeService { public: GatewayBridgeService(DaliDomainService& dali_domain, GatewayBridgeServiceConfig config = {}); ~GatewayBridgeService(); esp_err_t start(); GatewayBridgeHttpResponse handleGet(const std::string& action, int gateway_id = -1, const std::string& query = {}); GatewayBridgeHttpResponse handlePost(const std::string& action, int gateway_id, const std::string& body); private: struct ChannelRuntime; ChannelRuntime* findRuntime(uint8_t gateway_id); const ChannelRuntime* findRuntime(uint8_t gateway_id) const; DaliDomainService& dali_domain_; GatewayBridgeServiceConfig config_; std::vector> runtimes_; }; } // namespace gateway