feat(ch934x_serial): 添加串口写入功能的端口索引参数
- write方法新增可选的serialPortIndex参数,支持直接写入指定端口 - 传入端口索引时不会改变当前活跃端口,保持原有活跃端口行为 - 添加对负数端口索引的验证处理,直接返回零避免异常 - 更新文档说明多端口并发客户端应使用显式端口写入方式 - 增加相关单元测试覆盖新参数的各种使用场景 - 同步更新Android原生层实现以支持端口索引传递
This commit is contained in:
@@ -79,7 +79,9 @@ abstract class Ch934xSerialPlatform extends PlatformInterface {
|
||||
Future<Uint8List> read(int length, {int? serialPortIndex});
|
||||
|
||||
/// 向串口写入数据(对应 6.2.1 `UsbSerial.write`)。
|
||||
Future<int> write(Uint8List data);
|
||||
///
|
||||
/// [serialPortIndex] 为空时使用当前活跃端口;传入时直接写入指定端口。
|
||||
Future<int> write(Uint8List data, {int? serialPortIndex});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// GPIO
|
||||
|
||||
Reference in New Issue
Block a user