Add EtsDeviceRuntime class for handling KNX device runtime operations

- Introduced EtsDeviceRuntime class to manage device runtime functionalities including handling tunnel frames and function property commands.
- Added support for individual address management and memory snapshot retrieval.
- Updated EtsMemorySnapshot structure to include individual address.
- Implemented identity application for DALI devices in the memory loader.
- Enhanced CMakeLists.txt to include new source files and compile definitions.
- Updated header files to include new dependencies and declarations.
- Refactored existing memory loading logic to accommodate new device runtime features.

Signed-off-by: Tony <tonylu@tony-cloud.com>
This commit is contained in:
Tony
2026-05-12 05:19:14 +08:00
parent d231460612
commit 36d10702da
14 changed files with 1034 additions and 41 deletions
@@ -1276,7 +1276,8 @@ struct GatewayBridgeService::ChannelRuntime {
return result;
}
return knx->handleCemiFrame(data, len);
});
},
openKnxNamespace());
if (knx_config.has_value()) {
knx->setConfig(knx_config.value());
knx_router->setConfig(knx_config.value());
@@ -1308,10 +1309,15 @@ struct GatewayBridgeService::ChannelRuntime {
return;
}
const auto snapshot = openknx::LoadEtsMemorySnapshot(openKnxNamespace());
if (snapshot.associations.empty()) {
const bool has_downloaded_address = snapshot.individual_address != 0 &&
snapshot.individual_address != 0xffff;
if (!snapshot.configured && !has_downloaded_address && snapshot.associations.empty()) {
return;
}
GatewayKnxConfig updated = active_config.value();
if (has_downloaded_address) {
updated.individual_address = snapshot.individual_address;
}
updated.ets_associations.clear();
updated.ets_associations.reserve(snapshot.associations.size());
for (const auto& association : snapshot.associations) {
@@ -1319,9 +1325,9 @@ struct GatewayBridgeService::ChannelRuntime {
association.group_address, association.group_object_number});
}
knx_config = std::move(updated);
ESP_LOGI(kTag, "gateway=%u loaded %u OpenKNX ETS associations from NVS namespace %s",
channel.gateway_id, static_cast<unsigned>(snapshot.associations.size()),
openKnxNamespace().c_str());
ESP_LOGI(kTag, "gateway=%u loaded OpenKNX ETS address=0x%04x associations=%u from NVS namespace %s",
channel.gateway_id, snapshot.individual_address,
static_cast<unsigned>(snapshot.associations.size()), openKnxNamespace().c_str());
}
std::optional<DaliDomainSnapshot> diagnosticSnapshotLocked(int short_address,