feat(gateway): implement serial communication handling in DaliDomainService and GatewayController

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
Tony
2026-05-01 01:59:32 +08:00
parent ae4669e1b3
commit 2c1aa28d4f
6 changed files with 172 additions and 20 deletions
@@ -98,6 +98,7 @@ class GatewayRuntime {
std::optional<std::vector<uint8_t>> popNextCommand();
void completeCurrentCommand();
bool hasPendingQueryCommand(const std::vector<uint8_t>& command) const;
bool hasActiveQueryCommand(uint8_t gateway_id) const;
CommandDropReason lastEnqueueDropReason() const;
void setGatewayCount(size_t gateway_count);
@@ -334,6 +334,12 @@ bool GatewayRuntime::hasPendingQueryCommand(const std::vector<uint8_t>& command)
});
}
bool GatewayRuntime::hasActiveQueryCommand(uint8_t gateway_id) const {
LockGuard guard(command_lock_);
return current_command_.has_value() && isQueryCommand(*current_command_) &&
current_command_->size() > 2 && (*current_command_)[2] == gateway_id;
}
GatewayRuntime::CommandDropReason GatewayRuntime::lastEnqueueDropReason() const {
LockGuard guard(command_lock_);
return last_enqueue_drop_reason_;