- 在 AndroidManifest.xml 中添加 USB Host 权限声明 - 集成 CH934X Android SDK 并通过反射调用原生功能 - 实现设备查找、串口读写、GPIO 和 Modem 控制功能 - 添加异常回调机制处理设备拔出等情况 - 提供 Stream 数据流支持实时串口数据监听 - 完善单元测试覆盖所有核心功能模块
22 lines
601 B
Dart
22 lines
601 B
Dart
/// Modem 状态位掩码常量,对应文档 7.2.2 中 `getModemStatus` 的返回值。
|
|
///
|
|
/// 可与 `getModemStatus()` 返回值按位与来判定具体引脚电平。
|
|
class ModemStatus {
|
|
const ModemStatus._();
|
|
|
|
/// CTS 状态位,值为 0x01。
|
|
static const int cts = 0x01;
|
|
|
|
/// DSR 状态位,值为 0x02。
|
|
static const int dsr = 0x02;
|
|
|
|
/// RI 状态位,值为 0x04。
|
|
static const int ri = 0x04;
|
|
|
|
/// DCD 状态位,值为 0x08。
|
|
static const int dcd = 0x08;
|
|
|
|
/// 读取指定状态位是否为高电平。
|
|
static bool isSet(int status, int mask) => (status & mask) != 0;
|
|
}
|