feat: enhance gateway channel management with serial command handling and gateway ID updates

Signed-off-by: Tony <tonylu@tony-cloud.com>
This commit is contained in:
Tony
2026-06-11 21:04:20 +08:00
parent 6ffca719d9
commit dceede8602
8 changed files with 298 additions and 14 deletions
+21 -4
View File
@@ -48,9 +48,26 @@ commands, address allocation, live management reads, bridge traffic, and any raw
DALI bus activity from another master until the bus has been idle. Group and
broadcast targets are never queried for refresh.
Gateway feature opcode `0x06` advertises cache support with bit `0x40`. Gateway
opcode `0x39` returns cache summary and target snapshots so frontend clients can
read cached state without issuing live DALI queries on supported gateways.
Gateway feature opcode `0x06` keeps the Lua-compatible low-byte feature bits,
advertises cache support with bit `0x40`, and advertises the native C++ gateway
type with bit `0x0100`. Gateway opcode `0x39` returns cache summary and target
snapshots so frontend clients can read cached state without issuing live DALI
queries on supported gateways.
Gateway opcode `0x09` with address/data `0x00/0x00` is a chip-level channel-id
report. It returns the enabled DALI channel ids so clients do not need to probe
every possible gateway id one by one. For native C++ gateways, channel number is
the fixed 1-based Kconfig slot (`1` to `16`) and channel id is the persisted,
Lua-compatible gateway id used by normal `0x28 0x01 ...` command frames.
Gateway opcode `0x0B` is the serial-scoped channel command. The serial is the
last three bytes of the ESP base MAC. Operation `0x00` reports serial plus
`(channel number, channel id)` pairs. Operations `0x01` and `0x02` get and set
the channel id for the fixed channel number in the command frame gateway byte.
Operation `0x03` wraps an existing gateway command and dispatches it by fixed
channel number after the serial matches, so BLE/Wi-Fi configuration and DALI
send/query commands can target a channel even when its variable channel id is
unknown.
## Current status
@@ -113,4 +130,4 @@ BACnet/IP is owned by `gateway/components/gateway_bacnet` and is started through
Provisioned BACnet models still use generic `BridgeModel` fields such as object type, object instance, property, and optional `bitIndex`. Query-style models refresh BACnet `Present_Value` from live DALI reads, and binary models with `bitIndex` expose a single packed status bit.
For discovered DALI short addresses, the gateway also mirrors the generated Modbus discrete diagnostics as BACnet binary-input objects. Object instances are allocated in a gateway-owned generated range using the channel index plus the generated Modbus discrete-input offset, so generated objects stay deterministic while avoiding the provisioned-object address space in normal deployments.
For discovered DALI short addresses, the gateway also mirrors the generated Modbus discrete diagnostics as BACnet binary-input objects. Object instances are allocated in a gateway-owned generated range using the channel index plus the generated Modbus discrete-input offset, so generated objects stay deterministic while avoiding the provisioned-object address space in normal deployments.