Repository navigation
refactor(device): 分离通用串口协议与蓝牙桥接入口 - #85
Merged
Merged
Conversation
ca1e
marked this pull request as ready for review
November 1, 2026 12:19
Contributor
|
整体是个高质量提交,已具有插件化改造能力。代码层面符合"基础通用功能"设计目标,后续可继续完善GUI配置面和插件级适配方案。 |
5 of 11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更说明
#84 将固件专用地址和固定服务列表项带入了设备选择、端点解析及来源占用。这个后续 PR 按照维护者的建议,把串口协议与桥接入口分别注册,宿主只处理传输地址和设备能力。
IConnectionProvider,由SerialConnectionProvider注册串口协议/波特率,BridgeConnectionProvider注册桥接协议。工厂按顺序延迟创建,失败后释放连接;宿主可注入自己的协议集合。NintendoSwitchConnections.cs。保留原生串口 115200 → 9600 → pokeldn 921600 的探测顺序、公开串口接口和原有测试接缝。tcp://主机:端口,不再固定服务地址。串口枚举只返回物理端口;GUI 通过现有controller_profile保存显式桥接地址并保留在设备列表中,CLI 同时支持--port和--profiles。ConnectionEndpoint统一串口路径、主机名大小写、结尾斜杠及 IPv6 等价写法,规范化后的地址共享来源占用锁。占用冲突在打开第二个连接前拒绝。默认桥接适配器仍实现官方
pokeldn.pad.serviceJSON 行协议,服务负责 BLE 扫描和连接。其他消息协议需要注册对应适配器;本次没有声称任意 TCP 服务均可兼容,也没有实现操作系统直连 BLE。地址迁移
pokeldn:COM3/pokeldn:/dev/ttyUSB0COM3//dev/ttyUSB0pokeldn://service/pokeldn (BLE 服务)tcp://127.0.0.1:47800,Transport = TcpBridge旧专用地址不再解析。GUI 当前通过配置文件设置桥接端点,自动连接只扫描物理串口。完整用法及协议扩展契约见通用设备连接文档。
关联 Issue
后续于已合并的 #84,回应其中维护者提出的通用串口协议与蓝牙桥接建议。没有单独的提案 Issue;本 PR 保持草稿,供维护者复核具体接口及迁移方式,不将该建议视为对本实现的批准。
基于当前
dev:26538600fce7fa3269744a17e23bb59ce3192ca7。变更类型
人工审核声明
代码和自动化验证由 Codex 辅助完成,未代替提交者确认逐行人工审核。
自查清单
dotnet test EasyCon2.slnx -c Release --no-restore通过dotnet format EasyCon2.slnx --verify-no-changes --no-restore无差异验证方式
Windows / .NET SDK 10.0.403,全量 1,904 通过、182 跳过、0 失败,另有 29 项显式测试未选择运行;构建保留现存警告。跳过项主要依赖本机未安装的 C99 编译器、OCR 模型或其他平台环境。
新增 21 项测试,覆盖自定义协议注册、延迟探测与失败释放、桥接不误探测串口、TCP 地址校验、GUI/CLI 配置读写及桥接选择刷新。原有占用锁测试改为通用地址等价形式,服务协议测试改为经默认注册和真实本机 TCP 入口连接模拟服务。设备项目共 65 项全部通过,既有输入映射和 GUI 回归通过。
实机边界:用户确认早期适配构建的 ESP32E 可控制 NS;此次通用化构建尚未实机复测,ESP32-S3 仍待实测。当前固件的休眠唤醒限制仍见 pokeldn 说明。