feat(android): 添加 CH934X USB 转串口芯片支持
- 在 AndroidManifest.xml 中添加 USB Host 权限声明 - 集成 CH934X Android SDK 并通过反射调用原生功能 - 实现设备查找、串口读写、GPIO 和 Modem 控制功能 - 添加异常回调机制处理设备拔出等情况 - 提供 Stream 数据流支持实时串口数据监听 - 完善单元测试覆盖所有核心功能模块
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
/// 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;
|
||||
}
|
||||
Reference in New Issue
Block a user