//
// Created by zx on 2023/10/7.
//

#include "tof3d_manager.h"

Error_manager tof3dManager::init() {
    if (loadProtobufFile(ETC_PATH PROJECT_NAME "/tof3d_manager.json", m_tof_etc) == SUCCESS) {
        LOG(INFO) << m_tof_etc.DebugString();
    } else {
        return {FAILED, NEGLIGIBLE_ERROR, "tof3dManager read param form %s error.", ETC_PATH PROJECT_NAME "/tof3d_manager.json"};
    }

    auto list = m_tof_etc.vzense_tof3d_devices();
    std::map<std::string, tof3dVzenseEtc> device_mp;
    for (auto &device: m_tof_etc.vzense_tof3d_devices()) {
        device_mp.insert(std::pair<std::string, tof3dVzenseEtc>(device.ip(), device));
    }

    DeviceTof3D::iter()->Init(device_mp, true);

    return {};
}
