feat(ch934x_serial): 添加多端口并发轮询流功能

- 新增多端口并发轮询流 portDataStream 方法,支持每周期轮询 8 个端口
- 修改 read 方法增加 serialPortIndex 参数,支持指定端口读取数据
- 更新 Android 原生实现,支持通过 serialPortIndex 参数指定读取端口
- 移除 IDataCallback 注册逻辑,改用轮询方式拉取数据避免缓冲区冲突
- 添加主线程切换机制,确保异常推送在主线程执行
- 更新 pubspec.yaml 添加 ch934x_serial 本地插件依赖
- 更新项目路线图,标记 Phase 42 完成,进度更新至 50%
This commit is contained in:
Developer
2026-07-07 14:25:24 +08:00
parent 71fd9f52ec
commit ee19d2fdfa
4 changed files with 45 additions and 34 deletions
+2 -1
View File
@@ -75,7 +75,8 @@ abstract class Ch934xSerialPlatform extends PlatformInterface {
// ---------------------------------------------------------------------------
/// 从串口读取数据(对应 6.1.1 `UsbSerial.read`)。
Future<Uint8List> read(int length);
/// [serialPortIndex] 可选,指定读取哪个端口的缓冲区;不传则读上次 setActivePort 设置的端口。
Future<Uint8List> read(int length, {int? serialPortIndex});
/// 向串口写入数据(对应 6.2.1 `UsbSerial.write`)。
Future<int> write(Uint8List data);