Serial Reader
controller.infrastructure.communication.serial_reader
串口读取器 - Infrastructure层 负责多线程读取串口数据
SerialReader
SerialReader(serial_port: Optional[Serial] = None)
Bases: QObject
串口读取处理类。
负责在独立线程中读取串口数据,支持多种编码格式。
属性:
| 名称 | 类型 | 描述 |
|---|---|---|
data_received |
pyqtSignal
|
接收到数据时发送信号,携带十六进制字符串。 |
初始化串口读取器。
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
serial_port
|
Serial
|
串口对象。 |
None
|
源代码位于: src/controller/controller/infrastructure/communication/serial_reader.py
23 24 25 26 27 28 29 30 31 | |
stop
stop() -> None
停止读取。
源代码位于: src/controller/controller/infrastructure/communication/serial_reader.py
35 36 37 | |
read_data
read_data() -> None
读取串口数据 - 在独立线程中运行。
源代码位于: src/controller/controller/infrastructure/communication/serial_reader.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | |