Repository navigation
feat: 手机电量回报与手机端链路质量面板 - #404
Open
OrientCOMPASS wants to merge 12 commits into
Open
OrientCOMPASS wants to merge 12 commits into
OrientCOMPASS wants to merge 12 commits into
Conversation
…use and native fixture
OrientCOMPASS
marked this pull request as ready for review
November 26, 2026 14:04
Contributor
Author
Member
|
必要性存疑 |
Contributor
Author
|
#403 提出了这个电量显示需求,具体UI可以再调整。我之前用Android端带降噪的时候低电量降频声音就会卡顿,不开监听自己也不知道。后来用回官方版确实这个需求更弱了,但是有相当多旧Android设备在运行MicYou,电池健康度较差,可能这个需求会更强烈。 |
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.


Closes #403
概述
手机与桌面之间补齐两条遥测,都是纯增量、旧客户端/旧宿主可直接共存:
手机 → 桌面:电量回报
新增
MessageWrapper.clientStatus = 9(ClientStatusMessage { batteryLevel, isCharging })。Android 在握手成功后立即上报一次,之后仅在电量或充电状态变化时推送;桌面落库到NetworkStats、通过ServerEvents::client_battery广播,并进入StreamingStatus与get_streaming_status。GUI 主界面状态卡显示电量胶囊(充电高亮 + 闪电、≤20% 红色、断开即消失),CLI 打印[mic] battery 78% (charging),TUI 设备区多一行「电量 78% ⚡」。桌面 → 手机:链路质量
桌面原本每秒推送
StatsMessage(field 8),但 Android 端从未解析。现在手机解析该消息,底部栏在连接后出现「链路质量 23 ms」按钮(与 soundpad 面板按钮同款位置与样式),点开展开面板显示 RTT / 抖动 / 丢包 / 端到端延迟,并按阈值给出 优秀 / 良好 / 一般 / 较差 评级。手机不主动 ping,RTT 仍由桌面从 ping/pong 计算后回传,与协议设计一致。分层改动
network.proto:新增ClientStatusMessage与MessageWrapper.clientStatus = 9;proto3 未知字段跳过,双向兼容stats.rs:BatteryStatus+NetworkStats电量原子量(连接/断开清零,越界值视为未知);tcp.rs:handle_message守卫写入(被顶掉的连接不能覆盖在场设备)、断连清理;events.rs:client_battery(Option<BatteryStatus>);settings.rs:StreamingStatus.batterysrc-tauri/events.rs:client-battery事件;micyou-cli/micyou-tui:sink + 展示;TUI 7 个语言表补「电量」文案AudioStateSnapshot.battery与DeviceSnapshot.battery({ level, charging },Option+skip_serializing_if),audio_state/connected_devices均可见;JSON 纯增量,宿主 ABI 版本不变,现有插件无需重编types.ts/events.ts:BatteryStatus、client-battery、StreamingStatus.battery;useServer:deviceBatteryref、断连清零、窗口重载恢复;App.vue:状态卡电量 chip;7 个 locale 补文案Protocol.kt:StatsMessage/ClientStatusMessage、wrapper field 8+9、hasControlMessage纳入clientStatus;BatteryStatusReporter(粘性广播 + API 33+RECEIVER_NOT_EXPORTED);AudioEngine:电量上报随会话生命周期、linkQualityStateFlow;LinkQualityPanel:底部栏按钮 + 面板;MainViewModel:面板开关、断流自动收起;7 个values*/strings.xml补文案AGENTS.md协议小节、docs/plugins/api-reference.md、docs/plugins/development-guide.md兼容性
clientStatus的旧手机时电量视为未知,不显示 chipMPL_ABI_VERSION)不变验证
本 PR 不改动任何 workflow:仓库里的
development.yml/release.yml与上游完全一致(git diff upstream/master...HEAD -- .github/workflows为空)。验证在个人 fork 上用一次性 workflow 跑过,不随 PR 提交:
bun run build(licenses +vue-tsc --noEmit+ vite)bun run test:webbun run prepare-sidecars:dev后cargo test --workspacecargo clippy --workspace --all-targets./gradlew :composeApp:assembleDebughead
5ce3d56的 Verify run 45841603776:verify与android均 success;同 commit 的 Development Build 在 fork 上五平台全绿(含 Windows/macOS×2/Linux/Android 产物)。备注