Implement DALI Bridge Engine and Model Management

- Added `bridge.cpp` to handle DALI bridge operations including model management, command execution, and response formatting.
- Introduced `bridge_model.cpp` for defining bridge models, value transformations, and JSON serialization/deserialization.
- Created `bridge_provisioning.cpp` for managing bridge configuration storage and retrieval using NVS on ESP platform.
- Enhanced `gateway_cloud.cpp` to integrate DALI bridge requests and responses with cloud communication.
- Introduced `modbus_bridge.cpp` to handle Modbus-specific operations and register management.
- Implemented utility functions for converting between DaliValue and cJSON formats.
- Added error handling and metadata management in bridge responses.
This commit is contained in:
Tony
2026-04-22 10:14:42 +08:00
parent ec5f36b581
commit 21afc6b942
22 changed files with 2045 additions and 35 deletions
+33
View File
@@ -0,0 +1,33 @@
# ESP32-S3 Bridge Example
This ESP-IDF example wires `dali_cpp` into a standalone application and demonstrates how to register strongly typed Modbus and BACnet bridge models.
## Environment
```bash
cd /Users/tonylu/StudioProjects/dalimaster/dali_cpp
. ./scripts/export_esp_idf.sh
```
## Build
```bash
cd /Users/tonylu/StudioProjects/dalimaster/dali_cpp/examples/esp32s3_bridge
idf.py set-target esp32s3
idf.py build
```
## What It Shows
- `DaliBridgeEngine` resolving model bindings.
- `BridgeProvisioningStore` loading and saving model/config state in NVS.
- `DaliModbusBridge` mapping Modbus TCP holding-register writes to DALI operations.
- `DaliBacnetBridge` mapping BACnet property writes to DALI brightness percentage updates.
- A simple Modbus TCP listener supporting write-single-register (`0x06`) and write-multiple-registers (`0x10`).
- Placeholder DALI gateway callbacks where you can connect your UART transport.
## Modbus Mapping Notes
- The example listens on port `1502` by default.
- Holding register `0` maps to bridge register `40001`.
- The default config is stored to NVS on first boot and reused on later boots.