feat: add readMemoryLocation method and update GatewayController for memory identity reads
Signed-off-by: Tony <tonylu@tony-cloud.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user