54 lines
1.5 KiB
C++
54 lines
1.5 KiB
C++
// 终端本地配置
|
||
//
|
||
// 对应《VDI 云桌面软件开发方案》4.2 节 config_template 的终端侧镜像:
|
||
// 终端保存一份本地的配置版本,API 下发后覆盖。
|
||
// 当前阶段先做本地文件版本,后续由 vdt-agent 接管与 API 同步。
|
||
|
||
#ifndef KIOSK_SHELL_CONFIG_H
|
||
#define KIOSK_SHELL_CONFIG_H
|
||
|
||
#include <string>
|
||
|
||
namespace vdi {
|
||
|
||
struct TerminalConfig {
|
||
// 设备身份
|
||
std::string sn; // 序列号
|
||
std::string deviceKey; // 预置密钥(注册用)
|
||
|
||
// 首配
|
||
std::string server; // 服务器地址
|
||
std::string username; // 登录账号
|
||
std::string password; // 登录密码
|
||
std::string wifiSsid; // WiFi SSID
|
||
std::string wifiPassword;
|
||
|
||
// 显示档位:1920x1440 / 2560x1440 / 1920x1080 / 1280x720
|
||
std::string resolution = "1920x1440";
|
||
|
||
// 是否记住连接参数
|
||
bool remember = true;
|
||
|
||
int version = 0;
|
||
};
|
||
|
||
// 配置路径:~/.config/vdi-terminal/client.conf
|
||
std::string configDir();
|
||
std::string configPath();
|
||
|
||
// 读取配置;文件不存在时返回默认值
|
||
TerminalConfig loadConfig();
|
||
|
||
// 判断是否已经有 Agent/API 下发的可用桌面连接配置。
|
||
bool hasConnectionConfig(const TerminalConfig& cfg);
|
||
|
||
// 保存配置
|
||
bool saveConfig(const TerminalConfig& cfg);
|
||
|
||
// 读取设备序列号(优先取 /etc/machine-id,其次 /proc/device-tree/serial-number)
|
||
std::string readSerialNumber();
|
||
|
||
} // namespace vdi
|
||
|
||
#endif // KIOSK_SHELL_CONFIG_H
|