@@ -124,38 +124,6 @@ graph TB
124124 - ** LocalSession** : Factory for creating device-specific local connections
1251256 . ** Protocol Layer** : Message encoding/decoding for different device versions
1261267 . ** Transport Layer** : Low-level MQTT and TCP communication
127- LC --> V1P
128-
129- MS --> MQTT
130- LC --> TCP
131- MQTT <--> TCP
132-
133- style User fill:#e1f5ff
134- style DM fill:#fff4e1
135- style V1C fill:#ffe1e1
136- style RPC fill:#ffe1e1
137- style MS fill:#e1ffe1
138- style V1P fill:#f0e1ff
139- style A01P fill:#f0e1ff
140- style B01P fill:#f0e1ff
141- ```
142-
143- ### Layer Responsibilities
144-
145- 1. **Device Management Layer**: Detects protocol version (`pv` field) and creates appropriate channels
146- 2. **Device Types**: Different devices based on protocol version (V1, A01, B01)
147- 3. **Traits Layer**: Protocol-specific device capabilities and commands
148- 4. **Channel Layer**: Protocol-specific communication patterns
149- - **V1**: Full RPC channel with local + MQTT fallback
150- - **A01/B01**: Helper functions wrapping MqttChannel (MQTT only)
151- - **MqttChannel**: Per-device wrapper (each device has its own `MqttChannel` instance)
152- 5. **Session Layer**: Connection pooling and subscription management
153- - **MqttSession**: **Single shared connection** for ALL devices (efficiency!)
154- - **LocalSession**: Factory for creating device-specific local connections
155- 6. **Protocol Layer**: Message encoding/decoding for different device versions
156- 7. **Transport Layer**: Low-level MQTT and TCP communication
157-
158-
159127
160128** Important:** All ` MqttChannel ` instances share the same ` MqttSession ` , which maintains a single MQTT connection to the broker. This means:
161129- Only one TCP connection to the MQTT broker regardless of device count
0 commit comments