feat(gateway_network): integrate GatewayBridgeService and add bridge handling
- Updated CMakeLists.txt to require gateway_bridge component. - Modified GatewayNetworkService to include a pointer to GatewayBridgeService. - Added new HTTP handlers for bridge GET and POST requests. - Implemented query utility functions for handling request parameters. - Enhanced response handling for bridge actions with JSON responses. Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -21,6 +21,7 @@ namespace gateway {
|
||||
|
||||
class GatewayController;
|
||||
class DaliDomainService;
|
||||
class GatewayBridgeService;
|
||||
struct DaliRawFrame;
|
||||
|
||||
struct GatewayNetworkServiceConfig {
|
||||
@@ -48,7 +49,9 @@ struct GatewayNetworkServiceConfig {
|
||||
class GatewayNetworkService {
|
||||
public:
|
||||
GatewayNetworkService(GatewayController& controller, GatewayRuntime& runtime,
|
||||
DaliDomainService& dali_domain, GatewayNetworkServiceConfig config = {});
|
||||
DaliDomainService& dali_domain,
|
||||
GatewayNetworkServiceConfig config = {},
|
||||
GatewayBridgeService* bridge_service = nullptr);
|
||||
|
||||
esp_err_t start();
|
||||
|
||||
@@ -58,6 +61,8 @@ class GatewayNetworkService {
|
||||
static esp_err_t HandleInfoGet(httpd_req_t* req);
|
||||
static esp_err_t HandleCommandGet(httpd_req_t* req);
|
||||
static esp_err_t HandleCommandPost(httpd_req_t* req);
|
||||
static esp_err_t HandleBridgeGet(httpd_req_t* req);
|
||||
static esp_err_t HandleBridgePost(httpd_req_t* req);
|
||||
static esp_err_t HandleLedOnGet(httpd_req_t* req);
|
||||
static esp_err_t HandleLedOffGet(httpd_req_t* req);
|
||||
static esp_err_t HandleJqJsGet(httpd_req_t* req);
|
||||
@@ -91,12 +96,14 @@ class GatewayNetworkService {
|
||||
std::string deviceInfoJson() const;
|
||||
std::string deviceInfoDoubleEncodedJson() const;
|
||||
std::string gatewaySnapshotJson();
|
||||
esp_err_t sendBridgeResponse(httpd_req_t* req, bool post);
|
||||
void setStatusLed(bool on);
|
||||
|
||||
GatewayController& controller_;
|
||||
GatewayRuntime& runtime_;
|
||||
DaliDomainService& dali_domain_;
|
||||
GatewayNetworkServiceConfig config_;
|
||||
GatewayBridgeService* bridge_service_{nullptr};
|
||||
bool started_{false};
|
||||
httpd_handle_t http_server_{nullptr};
|
||||
esp_netif_t* wifi_sta_netif_{nullptr};
|
||||
|
||||
Reference in New Issue
Block a user