ThingsPanel uses a five-layer architecture to handle device data flow, ensuring protocol independence and high performance through asynchronous processing.
Uplink Data Flow (Device to Database):
Device → Adapter Layer → Uplink Layer → Processor Layer → Storage Layer → Database (with an optional Forwarder for data dispatch).
Downlink Data Flow (Platform to Device):
API/Scenario → Downlink Layer → Adapter Layer → Device.
Core Principles:
- Protocol Isolation: The
Adapter layer masks protocol differences so upper layers handle unified data. - Message-Driven: Layers communicate via a
Bus (Message Bus) to decouple components. - Asynchronous Processing: Uses a producer-consumer pattern based on Go Channels.
- Interface Abstraction: Components depend on interfaces rather than concrete implementations, facilitating testing and extensibility.