Files
Tony 4ce3513dd2 feat: Add DALI raw frame handling and USB setup bridge
- Introduced DaliRawFrame structure to encapsulate raw frame data.
- Enhanced DaliDomainService to manage raw frame sinks and processing.
- Implemented raw frame task for asynchronous handling of incoming DALI frames.
- Integrated raw frame handling in GatewayBleBridge and GatewayNetworkService.
- Added GatewayUsbSetupBridge to facilitate USB Serial/JTAG communication with DALI.
- Configured ESP-NOW for wireless communication and setup management.
- Updated GatewayRuntime to support clearing wireless credentials on boot button long press.
- Enhanced CMakeLists to include new components and dependencies.

Co-authored-by: Copilot <copilot@github.com>
2026-04-30 04:15:05 +08:00

48 lines
1.1 KiB
C++

#pragma once
#include <cstddef>
#include <cstdint>
#include <vector>
#include "dali_domain.hpp"
#include "esp_err.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
namespace gateway {
class GatewayController;
struct GatewayUsbSetupBridgeConfig {
bool enabled{false};
uint8_t channel_index{0};
size_t rx_buffer_size{256};
size_t tx_buffer_size{256};
uint32_t read_timeout_ms{20};
uint32_t write_timeout_ms{20};
uint32_t task_stack_size{4096};
UBaseType_t task_priority{4};
};
class GatewayUsbSetupBridge {
public:
GatewayUsbSetupBridge(GatewayController& controller, DaliDomainService& dali_domain,
GatewayUsbSetupBridgeConfig config = {});
esp_err_t start();
private:
static void TaskEntry(void* arg);
void taskLoop();
void handleBytes(const uint8_t* data, size_t len);
void handleRawFrame(const DaliRawFrame& frame);
uint8_t setupGatewayId() const;
GatewayController& controller_;
DaliDomainService& dali_domain_;
GatewayUsbSetupBridgeConfig config_;
TaskHandle_t task_handle_{nullptr};
bool started_{false};
};
} // namespace gateway