Refactor DALI component: remove Modbus bridge support, update documentation, and enhance bridge model handling
This commit is contained in:
@@ -50,29 +50,28 @@ The component now includes a protocol-agnostic bridge layer for mapping external
|
||||
|
||||
- `bridge_model.hpp` defines the strongly typed mapping model: protocol kind, external point, DALI target, default operation, and value transform.
|
||||
- `bridge.hpp` provides `DaliBridgeEngine`, which resolves models and dispatches requests into `DaliComm`, `DaliBase`, and `DaliDT8`.
|
||||
- `bridge_provisioning.hpp` provides `BridgeProvisioningStore` for persisting bridge models and protocol config in ESP-IDF NVS.
|
||||
- `modbus_bridge.hpp` provides a Modbus skeleton adapter keyed by holding register bindings.
|
||||
- `bridge_provisioning.hpp` provides `BridgeProvisioningStore` for persisting bridge models and shared protocol config in ESP-IDF NVS.
|
||||
- Modbus runtime support is owned by the native gateway project in `gateway/components/gateway_modbus`.
|
||||
- `bacnet_bridge.hpp` provides a BACnet skeleton adapter keyed by object type, instance, and property bindings.
|
||||
|
||||
### Example Model Mapping
|
||||
|
||||
```cpp
|
||||
BridgeModel modbusBrightness;
|
||||
modbusBrightness.id = "modbus-light-1";
|
||||
modbusBrightness.name = "Line 1 brightness";
|
||||
modbusBrightness.protocol = BridgeProtocolKind::modbus;
|
||||
modbusBrightness.external.objectType = BridgeObjectType::holdingRegister;
|
||||
modbusBrightness.external.registerAddress = 40001;
|
||||
modbusBrightness.dali.shortAddress = 1;
|
||||
modbusBrightness.operation = BridgeOperation::setBrightness;
|
||||
modbusBrightness.valueTransform.clampMin = 0;
|
||||
modbusBrightness.valueTransform.clampMax = 254;
|
||||
BridgeModel brightness;
|
||||
brightness.id = "line-1-brightness";
|
||||
brightness.name = "Line 1 brightness";
|
||||
brightness.dali.shortAddress = 1;
|
||||
brightness.operation = BridgeOperation::setBrightness;
|
||||
brightness.valueTransform.clampMin = 0;
|
||||
brightness.valueTransform.clampMax = 254;
|
||||
|
||||
DaliBridgeEngine engine(comm);
|
||||
engine.upsertModel(modbusBrightness);
|
||||
engine.upsertModel(brightness);
|
||||
|
||||
DaliModbusBridge modbus(engine);
|
||||
modbus.handleHoldingRegisterWrite(40001, 180);
|
||||
DaliBridgeRequest request;
|
||||
request.modelID = "line-1-brightness";
|
||||
request.value = 180;
|
||||
engine.execute(request);
|
||||
```
|
||||
|
||||
### Supported Bridge Operations
|
||||
@@ -108,16 +107,11 @@ Query-style operations return `data` when available and may include decoded flag
|
||||
|
||||
## Bridge Provisioning via NVS
|
||||
|
||||
Use `BridgeProvisioningStore` to persist bridge models and protocol-specific config for Modbus and BACnet:
|
||||
Use `BridgeProvisioningStore` to persist bridge models and shared protocol-specific config such as BACnet:
|
||||
|
||||
```cpp
|
||||
BridgeRuntimeConfig runtime;
|
||||
runtime.models.push_back(modbusBrightness);
|
||||
|
||||
ModbusBridgeConfig modbus;
|
||||
modbus.transport = "tcp-server";
|
||||
modbus.port = 1502;
|
||||
runtime.modbus = modbus;
|
||||
runtime.models.push_back(brightness);
|
||||
|
||||
BridgeProvisioningStore store;
|
||||
store.save(runtime);
|
||||
@@ -128,6 +122,8 @@ if (store.load(&loaded) == ESP_OK) {
|
||||
}
|
||||
```
|
||||
|
||||
The gateway project stores Modbus TCP settings in the same persisted JSON shape, but parses and applies that section in `gateway/components/gateway_modbus` rather than in this standalone DALI component.
|
||||
|
||||
## Cloud Bridge (ESP32 Gateway)
|
||||
|
||||
The component now includes `DaliCloudBridge` in `include/gateway_cloud.hpp` to connect ESP32 gateways to the backend MQTT broker.
|
||||
|
||||
Reference in New Issue
Block a user