From f0605196fec578d2be4002e007d781fd02b55b43 Mon Sep 17 00:00:00 2001 From: showen Date: Fri, 13 Mar 2026 07:14:44 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20Phase2=20Task1=20=E2=80=94=20DeviceComm?= =?UTF-8?q?and=E6=B7=BB=E5=8A=A0SetCursorVisible=20+=20DeviceCapability::C?= =?UTF-8?q?ursor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .showen/TEAM_CHAT.md | 26 ++++++++++++++++++++++++++ plugin-sdk/src/lib.rs | 6 ++++++ souls/zhang-mingyuan.md | 10 ++++++++++ src/core/message.rs | 6 ++++++ 4 files changed, 48 insertions(+) diff --git a/.showen/TEAM_CHAT.md b/.showen/TEAM_CHAT.md index 36a84a1..3ea528d 100644 --- a/.showen/TEAM_CHAT.md +++ b/.showen/TEAM_CHAT.md @@ -2331,3 +2331,29 @@ Task 4 已完成,DevicePlugin 阶段一基础框架全部就绪。等待 PM plugin-sdk 现在已与主库的 Device 消息系统完全同步,第三方插件可以使用这些类型与 DevicePlugin 进行通信。 + +--- + +**张明远** (2026-03-13 14:30) + +DevicePlugin 阶段二 Task 1 已完成。 + +**完成内容**: +1. 在 `src/core/message.rs` 中扩展 `DeviceCommand`,添加 `SetCursorVisible(bool)` 变体 +2. 在 `DeviceCapability` 中添加 `Cursor` 变体 +3. 同步更新 `plugin-sdk/src/lib.rs`,保持 SDK 与主程序 ABI 一致 +4. 添加中文文档注释,说明 Linux 平台通过 unclutter 实现 + +**验收结果**: +- ✅ `cargo check --workspace --all-targets` 零 warning +- ✅ `cargo test --workspace` 全部通过(73/73 测试) +- ✅ `SetCursorVisible` 正确派生 serde traits +- ✅ `DeviceCapability::Cursor` 已添加 + +**修改文件**: +- `src/core/message.rs` (line 138-160, line 162-193) +- `plugin-sdk/src/lib.rs` (line 189-212, line 212-245) + +Task 1 完成,可以开始 Task 2(LinuxArm64Backend 实现光标控制)。 + +@赵雨薇 现在可以开始 Task 2 了。 diff --git a/plugin-sdk/src/lib.rs b/plugin-sdk/src/lib.rs index 83fd9de..e573325 100644 --- a/plugin-sdk/src/lib.rs +++ b/plugin-sdk/src/lib.rs @@ -207,6 +207,8 @@ pub enum DeviceCapability { Framebuffer, /// GPIO GPIO, + /// 光标控制能力 + Cursor, } /// 设备命令(业务插件 → DevicePlugin) @@ -222,6 +224,10 @@ pub enum DeviceCommand { WriteFramebuffer { data: Vec, format: PixelFormat }, /// 设置防息屏 SetSleepInhibit(bool), + /// 设置光标可见性 + /// - true: 显示光标 + /// - false: 隐藏光标(通过 unclutter 或平台特定方式) + SetCursorVisible(bool), /// 获取电池电量 GetBatteryLevel, /// 设置音量(0-100) diff --git a/souls/zhang-mingyuan.md b/souls/zhang-mingyuan.md index 013ea50..6c4fd1e 100644 --- a/souls/zhang-mingyuan.md +++ b/souls/zhang-mingyuan.md @@ -59,3 +59,13 @@ - 所有类型正确派生 Debug, Clone, Serialize, Deserialize(跨 FFI 要求) - 修复了 tests.rs 中的 match 穷尽性检查(新增三个 message 变体) - cargo check 零 warning,cargo test 全部通过(66 个测试) + +## 个人经验 (2026-03-13 - DevicePlugin 阶段二 Task 1) +- 完成 DeviceCommand 扩展,添加光标控制命令 + - 在 DeviceCommand 中添加 SetCursorVisible(bool) 变体 + - 在 DeviceCapability 中添加 Cursor 变体 + - 同步更新 plugin-sdk/src/lib.rs 保持 ABI 一致性 + - 文档注释说明 Linux 平台通过 unclutter 实现光标隐藏 + - cargo check --workspace --all-targets 零 warning + - cargo test --workspace 全部通过(73 个测试) + - 为 Task 2(LinuxArm64Backend 实现)铺平道路 diff --git a/src/core/message.rs b/src/core/message.rs index 040f5be..64c3f3c 100644 --- a/src/core/message.rs +++ b/src/core/message.rs @@ -155,6 +155,8 @@ pub enum DeviceCapability { Framebuffer, /// GPIO GPIO, + /// 光标控制能力 + Cursor, } /// 设备命令(业务插件 → DevicePlugin) @@ -170,6 +172,10 @@ pub enum DeviceCommand { WriteFramebuffer { data: Vec, format: PixelFormat }, /// 设置防息屏 SetSleepInhibit(bool), + /// 设置光标可见性 + /// - true: 显示光标 + /// - false: 隐藏光标(通过 unclutter 或平台特定方式) + SetCursorVisible(bool), /// 获取电池电量 GetBatteryLevel, /// 设置音量(0-100)