feat(gateway): enhance DALI host activity tracking and presence management

Signed-off-by: Tony <tonylu@tony-cloud.com>
This commit is contained in:
Tony
2026-05-26 22:21:36 +08:00
parent f922993d2f
commit 865bf8425a
9 changed files with 441 additions and 39 deletions
@@ -5,6 +5,7 @@
#include <cstdint>
#include <functional>
#include <map>
#include <optional>
#include <string>
#include <string_view>
#include <vector>
@@ -36,6 +37,8 @@ struct GatewayControllerConfig {
bool cache_supported{true};
uint32_t cache_refresh_interval_ms{120000};
uint32_t cache_refresh_idle_ms{100};
uint32_t cache_host_snooze_ms{5000};
uint32_t cache_host_echo_ms{250};
};
struct GatewayChannelSnapshot {
@@ -101,7 +104,9 @@ class GatewayController {
GatewayCacheChannelFlags flags{};
Phase phase{Phase::kReloadFlags};
uint8_t short_address{0};
std::optional<GatewayCacheDaliTarget> target;
std::vector<uint8_t> addresses;
size_t address_index{0};
uint8_t scene_id{0};
};
@@ -120,9 +125,11 @@ class GatewayController {
static void TaskEntry(void* arg);
void taskLoop();
void dispatchCommand(const std::vector<uint8_t>& command);
void scheduleReconciliation(uint8_t gateway_id);
void scheduleReconciliation(uint8_t gateway_id,
std::optional<GatewayCacheDaliTarget> target = std::nullopt);
bool hasPendingReconciliation() const;
bool cacheRefreshEnabled() const;
bool cacheMaintenanceSnoozed(uint8_t gateway_id) const;
bool runMaintenanceStep();
bool runReconciliationStep(uint8_t gateway_id, ReconciliationJob& job);
bool runCacheRefreshStep();