feat(gateway): implement GatewayController and enhance GatewayRuntime

- Added GatewayController class to manage gateway operations, including command handling, scene and group management, and BLE state management.
- Introduced methods for scene and group storage, including loading, saving, and deleting scenes/groups.
- Enhanced GatewayRuntime with BLE management capabilities, including methods to check and set BLE state, and to generate BLE gateway names.
- Implemented utility functions for string normalization and CSV parsing.
- Added notification sinks for various events in the GatewayController.

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
Tony
2026-04-29 23:02:40 +08:00
parent f4756ce816
commit 4433fe97c7
13 changed files with 1967 additions and 12 deletions
@@ -6,6 +6,7 @@
#include <memory>
#include <optional>
#include <string>
#include <string_view>
#include <vector>
#include "esp_err.h"
@@ -79,6 +80,9 @@ class DaliDomainService {
std::vector<DaliChannelInfo> channelInfo() const;
bool resetBus(uint8_t gateway_id) const;
bool writeBridgeFrame(uint8_t gateway_id, const uint8_t* data, size_t len) const;
std::vector<uint8_t> transactBridgeFrame(uint8_t gateway_id, const uint8_t* data,
size_t len) const;
bool sendRaw(uint8_t gateway_id, uint8_t raw_addr, uint8_t command) const;
bool sendExtRaw(uint8_t gateway_id, uint8_t raw_addr, uint8_t command) const;
std::optional<uint8_t> queryRaw(uint8_t gateway_id, uint8_t raw_addr, uint8_t command) const;
@@ -90,6 +94,13 @@ class DaliDomainService {
bool on(uint8_t gateway_id, int short_address) const;
bool off(uint8_t gateway_id, int short_address) const;
bool off(int short_address) const;
bool updateChannelName(uint8_t gateway_id, std::string_view name);
bool allocateAllAddr(uint8_t gateway_id, int start_address = 0) const;
void stopAllocAddr(uint8_t gateway_id) const;
bool resetAndAllocAddr(uint8_t gateway_id, int start_address = 0,
bool remove_addr_first = false, bool close_light = false) const;
bool isAllocAddr(uint8_t gateway_id) const;
int lastAllocAddr(uint8_t gateway_id) const;
private:
struct DaliChannel;