feat(gateway): enhance GatewayNetworkService with HTTP and UDP support, add status LED control
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -31,10 +31,34 @@ struct GatewayControllerConfig {
|
||||
bool internal_group_supported{true};
|
||||
};
|
||||
|
||||
struct GatewayChannelSnapshot {
|
||||
uint8_t channel_index{0};
|
||||
uint8_t gateway_id{0};
|
||||
std::string name;
|
||||
std::string phy;
|
||||
uint8_t scene_mask_low{0};
|
||||
uint8_t scene_mask_high{0};
|
||||
uint8_t group_mask_low{0};
|
||||
uint8_t group_mask_high{0};
|
||||
bool allocating{false};
|
||||
int last_alloc_addr{0};
|
||||
};
|
||||
|
||||
struct GatewayControllerSnapshot {
|
||||
bool setup_mode{false};
|
||||
bool ble_enabled{false};
|
||||
bool wifi_enabled{false};
|
||||
bool ip_router_enabled{false};
|
||||
bool internal_scene_supported{false};
|
||||
bool internal_group_supported{false};
|
||||
std::vector<GatewayChannelSnapshot> channels;
|
||||
};
|
||||
|
||||
class GatewayController {
|
||||
public:
|
||||
using NotificationSink = std::function<void(const std::vector<uint8_t>& frame)>;
|
||||
using BleStateSink = std::function<void(bool enabled)>;
|
||||
using WifiStateSink = std::function<void(uint8_t mode)>;
|
||||
using GatewayNameSink = std::function<void(uint8_t gateway_id)>;
|
||||
|
||||
GatewayController(GatewayRuntime& runtime, DaliDomainService& dali_domain,
|
||||
@@ -45,12 +69,14 @@ class GatewayController {
|
||||
bool enqueueCommandFrame(const std::vector<uint8_t>& frame);
|
||||
void addNotificationSink(NotificationSink sink);
|
||||
void addBleStateSink(BleStateSink sink);
|
||||
void addWifiStateSink(WifiStateSink sink);
|
||||
void addGatewayNameSink(GatewayNameSink sink);
|
||||
|
||||
bool setupMode() const;
|
||||
bool bleEnabled() const;
|
||||
bool wifiEnabled() const;
|
||||
bool ipRouterEnabled() const;
|
||||
GatewayControllerSnapshot snapshot();
|
||||
|
||||
private:
|
||||
struct InternalScene {
|
||||
@@ -143,6 +169,7 @@ class GatewayController {
|
||||
nvs_handle_t storage_{0};
|
||||
std::vector<NotificationSink> notification_sinks_;
|
||||
std::vector<BleStateSink> ble_state_sinks_;
|
||||
std::vector<WifiStateSink> wifi_state_sinks_;
|
||||
std::vector<GatewayNameSink> gateway_name_sinks_;
|
||||
std::map<uint8_t, SceneStore> scenes_;
|
||||
std::map<uint8_t, GroupStore> groups_;
|
||||
|
||||
Reference in New Issue
Block a user