Equipment data processing
1. Device Data Flow (Device Reporting)
Hardware clients report data through a DTU or module. The data is forwarded from the MQTT broker via MQ to the gateway module. The gateway module matches the device data against the parsing protocol and decodes it. The decoded data goes through the agreed data calculation. After calculation, the latest piece of data is cached in Redis as real-time data for the frontend, while data that requires historical storage is persisted to TDengine.
The simplified flow is as follows:
- emq -> mq -> gateway -> data storage
- netty-mqtt -> mq -> gateway -> data storage

2. Command Issuing Flow
Commands issued via the frontend or mini program are sent through an HTTP interface to the backend for data encoding, and then sent to the device for execution.
Taking MQTT command issuing as an example:
The backend provides two interfaces: one issues a command and waits for the device's response data; the other issues the command directly without waiting for the device's response data.

The issued data enters a queue and waits for the queue consumer to process it. The messaging side first matches the device's encoding protocol to encode the data to be issued, and then delivers it to the corresponding server according to the device's communication protocol.


