变更详情:删除 RDP 渲染管线,协议统一 Moonlight;退出三层设计与串流过场层落地 - 移除 rdp_session.*、FreeRDP 构建依赖与代码内协议概念,Moonlight 为唯一会话通道 - Ctrl+Alt+Shift+Q 退串流回列表(kiosk 兜底 + moonlight-qt 主路径);登录页去退出按钮 - 新增 TransitionOverlay:全屏过场层盖住串流启动闪烁,进程 CPU 首帧检测后淡出 - Sunshine 写入 sw_preset=ultrafast;实测推翻 x264 瓶颈结论(21.6FPS 帽子在虚拟显示/捕获节奏,CPU≈0%) - 文档:麒麟(101/.71)/Ubuntu(102/.72) 接入信息与四件事落地记录;MEMORY 根因修正
65 lines
1.9 KiB
C++
65 lines
1.9 KiB
C++
// kiosk-shell 状态机
|
||
//
|
||
// 对应《VDI 云桌面软件开发方案》3.2 节:
|
||
// 状态机:BOOT -> CONFIG/LOGIN -> CONNECTING -> SESSION(Moonlight 串流)
|
||
// -> RECONNECT -> ERROR
|
||
//
|
||
// 状态转换规则:
|
||
// BOOT 进程启动,读取本地配置
|
||
// CONFIG 无可用配置或用户停留在登录页,等待输入
|
||
// CONNECTING 正在建立 Moonlight 串流连接
|
||
// SESSION 远程会话进行中(moonlight-qt 独占全屏)
|
||
// RECONNECT 会话意外断开,等待重连
|
||
// ERROR 不可恢复错误,提示后回到 CONFIG
|
||
|
||
#ifndef KIOSK_SHELL_STATE_MACHINE_H
|
||
#define KIOSK_SHELL_STATE_MACHINE_H
|
||
|
||
#include <QString>
|
||
#include <functional>
|
||
#include <string>
|
||
|
||
namespace vdi {
|
||
|
||
enum class State {
|
||
kBoot, // 启动中
|
||
kConfig, // 首配 / 登录页
|
||
kAuthenticating, // 正在认证
|
||
kDesktopList, // 桌面列表(登录成功后)
|
||
kConnecting, // 连接中
|
||
kSession, // 会话中
|
||
kReconnect, // 断线等待重连
|
||
kError, // 错误
|
||
};
|
||
|
||
const char* stateToString(State s);
|
||
|
||
class StateMachine {
|
||
public:
|
||
// 状态说明使用 QString,便于直接显示在状态条上
|
||
using StateListener = std::function<void(State from, State to, const QString& detail)>;
|
||
|
||
explicit StateMachine(StateListener listener = nullptr);
|
||
|
||
State current() const { return current_; }
|
||
bool isIn(State s) const { return current_ == s; }
|
||
|
||
// 尝试切换到目标状态;非法转换会被拒绝并返回 false
|
||
bool transitionTo(State next, const QString& detail = QString());
|
||
|
||
// 当前状态下允许执行的动作
|
||
bool canConnect() const;
|
||
bool canDisconnect() const;
|
||
bool canRetry() const;
|
||
|
||
private:
|
||
static bool isLegalTransition(State from, State to);
|
||
|
||
State current_ = State::kBoot;
|
||
StateListener listener_;
|
||
};
|
||
|
||
} // namespace vdi
|
||
|
||
#endif // KIOSK_SHELL_STATE_MACHINE_H
|