feat: add readMemoryLocation method and update GatewayController for memory identity reads

Signed-off-by: Tony <tonylu@tony-cloud.com>
This commit is contained in:
Tony
2026-06-15 17:01:27 +08:00
parent 780b4aa8d5
commit 49dcd8785b
5 changed files with 77 additions and 0 deletions
@@ -149,6 +149,8 @@ class DaliDomainService {
std::optional<DaliDomainSnapshot> discoverDeviceTypes(
uint8_t gateway_id, int short_address, const std::vector<int>& fallback_types = {},
int max_next_types = 16) const;
std::optional<uint8_t> readMemoryLocation(uint8_t gateway_id, int short_address, uint8_t bank,
uint8_t location) const;
std::optional<DaliDomainSnapshot> baseStatusSnapshot(uint8_t gateway_id,
int short_address) const;
std::optional<DaliDomainSnapshot> dt1Snapshot(uint8_t gateway_id, int short_address) const;
@@ -942,6 +942,25 @@ std::optional<DaliDomainSnapshot> DaliDomainService::discoverDeviceTypes(
return snapshot;
}
std::optional<uint8_t> DaliDomainService::readMemoryLocation(uint8_t gateway_id,
int short_address,
uint8_t bank,
uint8_t location) const {
const auto* channel = findChannelByGateway(gateway_id);
if (channel == nullptr || channel->dali == nullptr) {
return std::nullopt;
}
if (short_address < 0 || short_address > 63) {
return std::nullopt;
}
markBusActivity(gateway_id);
const auto value = channel->dali->base.readMemoryLocation(short_address, bank, location);
if (!value.has_value()) {
return std::nullopt;
}
return static_cast<uint8_t>(value.value() & 0xFF);
}
std::optional<DaliDomainSnapshot> DaliDomainService::baseStatusSnapshot(
uint8_t gateway_id, int short_address) const {
const auto* channel = findChannelByGateway(gateway_id);