Refactor KNX DALI Gateway Configuration and Update Device Parameters
- Introduced configuration macros for OEM manufacturer ID, application number, and application version in knxprod.h. - Updated product identity definitions to use the new configuration macros. - Modified device type enumeration to include additional device types. - Adjusted color space enumeration values for consistency. - Defined generated group object layout constants for memory offsets and block sizes. - Enhanced knx_dali_gw.cpp to utilize the new configuration macros for manufacturer ID and program version. - Updated the device initialization logic to reflect the new hardware and program version structures. - Removed obsolete knx_dali_gw subproject and updated related submodules. Signed-off-by: Tony <tonylu@tony-cloud.com>
This commit is contained in:
@@ -1433,11 +1433,7 @@ struct GatewayBridgeService::ChannelRuntime {
|
||||
}
|
||||
|
||||
knx = std::make_unique<GatewayKnxBridge>(*engine);
|
||||
knx_router = std::make_unique<GatewayKnxTpIpRouter>(
|
||||
*knx, [this](const uint8_t* data, size_t len) {
|
||||
return service.routeKnxCemiFrame(data, len);
|
||||
},
|
||||
openKnxNamespace());
|
||||
knx_router = std::make_unique<GatewayKnxTpIpRouter>(*knx, openKnxNamespace());
|
||||
knx_router->setGroupWriteHandler(
|
||||
[this](uint16_t group_address, const uint8_t* data, size_t len) {
|
||||
return service.routeKnxGroupWrite(group_address, data, len);
|
||||
@@ -4028,36 +4024,6 @@ esp_err_t GatewayBridgeService::stopKnxEndpoint(ChannelRuntime* requested_runtim
|
||||
return owner->stopKnx();
|
||||
}
|
||||
|
||||
DaliBridgeResult GatewayBridgeService::routeKnxCemiFrame(const uint8_t* data, size_t len) {
|
||||
std::vector<ChannelRuntime*> matches;
|
||||
for (const auto& runtime : runtimes_) {
|
||||
LockGuard guard(runtime->lock);
|
||||
if (runtime->knx != nullptr && runtime->knx->matchesCemiFrame(data, len)) {
|
||||
matches.push_back(runtime.get());
|
||||
}
|
||||
}
|
||||
if (matches.empty()) {
|
||||
DaliBridgeResult result;
|
||||
result.error = "No DALI bridge mapping matched KNX cEMI group write";
|
||||
return result;
|
||||
}
|
||||
if (matches.size() > 1) {
|
||||
DaliBridgeResult result;
|
||||
result.error = "KNX cEMI group write matched multiple DALI bridge channels";
|
||||
ESP_LOGW(kTag, "%s", result.error.c_str());
|
||||
return result;
|
||||
}
|
||||
|
||||
ChannelRuntime* runtime = matches.front();
|
||||
LockGuard guard(runtime->lock);
|
||||
if (runtime->knx == nullptr || !runtime->knx->matchesCemiFrame(data, len)) {
|
||||
DaliBridgeResult result;
|
||||
result.error = "DALI bridge mapping changed before KNX cEMI dispatch";
|
||||
return result;
|
||||
}
|
||||
return runtime->knx->handleCemiFrame(data, len);
|
||||
}
|
||||
|
||||
DaliBridgeResult GatewayBridgeService::routeKnxGroupWrite(uint16_t group_address,
|
||||
const uint8_t* data, size_t len) {
|
||||
std::vector<ChannelRuntime*> matches;
|
||||
|
||||
Reference in New Issue
Block a user