53 lines
1.7 KiB
C++
53 lines
1.7 KiB
C++
#include "ConfigManager.h"
|
||
#include "VrLog.h"
|
||
#include "VrError.h"
|
||
|
||
// ParticleSize 应用的 ConfigManager 实现
|
||
// 所有通用功能都在 BaseConfigManager 中实现
|
||
// 这里只实现 ParticleSize 特定的功能
|
||
|
||
// 实现 LoadConfigFromFile 以适配 ParticleSize 的 IVrConfig API
|
||
// ParticleSize 使用引用参数方式:int LoadConfig(const std::string& filePath, ConfigResult& configResult)
|
||
bool ConfigManager::LoadConfigFromFile(const std::string& filePath)
|
||
{
|
||
if (!m_pVrConfig) {
|
||
LOG_ERROR("VrConfig instance not available\n");
|
||
return false;
|
||
}
|
||
|
||
try {
|
||
ConfigResult configResult;
|
||
|
||
// ParticleSize 使用引用参数方式
|
||
int ret = m_pVrConfig->LoadConfig(filePath, configResult);
|
||
if (ret != SUCCESS) {
|
||
LOG_ERROR("Failed to load config from file: %s, error: %d\n", filePath.c_str(), ret);
|
||
return false;
|
||
}
|
||
|
||
// 使用基类的公共逻辑应用配置
|
||
return _ApplyLoadedConfig(configResult, filePath);
|
||
|
||
} catch (const std::exception& e) {
|
||
LOG_ERROR("Failed to load configuration from file %s: %s\n", filePath.c_str(), e.what());
|
||
return false;
|
||
}
|
||
}
|
||
|
||
bool ConfigManager::OnSwitchPackageTypeCommand(const SwitchPackageTypeParam& param)
|
||
{
|
||
LOG_INFO("ParticleSize: Received switch package type command: packageTypeId=%s\n", param.packageTypeId);
|
||
|
||
// ParticleSize 应用特有的包裹类型切换逻辑
|
||
// 这里需要根据实际需求实现包裹类型切换
|
||
// 可能需要:
|
||
// 1. 重新加载不同的配置文件
|
||
// 2. 更新算法参数
|
||
// 3. 切换检测模式
|
||
// 4. 通知UI更新
|
||
|
||
// TODO: 实现具体的包裹类型切换逻辑
|
||
|
||
return true;
|
||
}
|